diff --git a/livesupport/bin/user_setup.sh b/livesupport/bin/user_setup.sh new file mode 100755 index 000000000..9911a1313 --- /dev/null +++ b/livesupport/bin/user_setup.sh @@ -0,0 +1,355 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/user_setup.sh,v $ +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# This script configures the environment for a developer. +# +# Invoke as: +# ./bin/user_setup.sh +# +# To get usage help, try the -h option +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +docdir=$basedir/doc +tmpdir=$basedir/tmp +toolsdir=$basedir/tools +modules_dir=$basedir/modules +products_dir=$basedir/products + +usrdir=`cd $basedir/usr; pwd;` + + +#------------------------------------------------------------------------------- +# Print the usage information for this script. +#------------------------------------------------------------------------------- +printUsage() +{ + echo "LiveSupport install script."; + echo "parameters"; + echo ""; + echo " -g, --apache-group The group the apache daemon runs as."; + echo " [default: apache]"; + echo " -h, --help Print this message and exit."; + echo ""; +} + + +#------------------------------------------------------------------------------- +# Process command line parameters +#------------------------------------------------------------------------------- +CMD=${0##*/} + +opts=$(getopt -o g:h -l apache-group:,help -n $CMD -- "$@") || exit 1 +eval set -- "$opts" +while true; do + case "$1" in + -g|--apache-group) + apache_group=$2; + shift; shift;; + -h|--help) + printUsage; + exit 0;; + --) + shift; + break;; + *) + echo "Unrecognized option $1."; + printUsage; + exit 1; + esac +done + +if [ "x$apache_group" == "x" ]; then + apache_group=apache; +fi + +scheduler_base_port=3344 + +user=`whoami` +hostname=`hostname -f` +http_port=80 +scheduler_port=`expr $scheduler_base_port + $UID` +dbserver=localhost +database=LiveSupport-$user +dbuser=test +dbpassword=test +homedir=$HOME +configdir=$homedir/.livesupport +htmldir=$homedir/public_html + + + +echo "Configuring LiveSupport development environment for user $user."; +echo ""; +echo "Using the following installation parameters:"; +echo ""; +echo " host name: $hostname"; +echo " web server port: $http_port"; +echo " scheduler port: $scheduler_port"; +echo " database server: $dbserver"; +echo " database: $database"; +echo " database user: $dbuser"; +echo " database user password: $dbpassword"; +echo " apache daemon group: $apache_group"; +echo " home directory: $homedir"; +echo " configuration directory: $configdir"; +echo " web base directory: $htmldir"; +echo "" + + +# check for the apache group to be a real group +group_tmp_file=/tmp/ls_group_check.$$ +touch $group_tmp_file +test_result=`chgrp $apache_group $group_tmp_file 2> /dev/null` +if [ $? != 0 ]; then + rm -f $group_tmp_file; + echo "Unable to use apache deamon group $apache_group."; + echo "Please check if $apache_group is a correct user group."; + exit 1; +fi +rm -f $group_tmp_file; + + +#------------------------------------------------------------------------------- +# The details of installation +#------------------------------------------------------------------------------- + +installdir=$usrdir + +ls_php_host=$hostname +ls_php_port=$http_port +ls_php_urlPrefix=~$user/livesupport + +ls_alib_xmlRpcPrefix="xmlrpc/xrLocStor.php" +ls_storage_xmlRpcPrefix="xmlrpc/xrLocStor.php" + +ls_dbserver=$dbserver +ls_dbuser=$dbuser +ls_dbpassword=$dbpassword +ls_database=$database + +ls_scheduler_host=$hostname +ls_scheduler_port=$scheduler_port +ls_scheduler_urlPrefix= +ls_scheduler_xmlRpcPrefix=RC2 + + + +# replace / characters with a \/ sequence, for sed below +# the sed statement is really "s/\//\\\\\//g", but needs escaping because of +# bash, hence the extra '\' characters +installdir_s=`echo $installdir | sed -e "s/\//\\\\\\\\\//g"` +ls_storage_xmlRpcPrefix_s=`echo $ls_storage_xmlRpcPrefix | \ + sed -e "s/\//\\\\\\\\\//g"` +ls_alib_xmlRpcPrefix_s=`echo $ls_alib_xmlRpcPrefix | sed -e "s/\//\\\\\\\\\//g"` +ls_php_urlPrefix_s=`echo $ls_php_urlPrefix | sed -e "s/\//\\\\\\\\\//g"` +ls_scheduler_urlPrefix_s=`echo $ls_scheduler_urlPrefix | \ + sed -e "s/\//\\\\\\\\\//g"` +ls_scheduler_xmlRpcPrefix_s=`echo $ls_scheduler_xmlRpcPrefix | \ + sed -e "s/\//\\\\\\\\\//g"` + +replace_sed_string="s/ls_install_dir/$installdir_s/; \ + s/ls_dbuser/$ls_dbuser/; \ + s/ls_dbpassword/$ls_dbpassword/; \ + s/ls_dbserver/$ls_dbserver/; \ + s/ls_database/$ls_database/; \ + s/ls_storageUrlPath/\/$ls_php_urlPrefix_s\/storageServer\/var/; \ + s/ls_php_urlPrefix/$ls_php_urlPrefix_s/; \ + s/ls_storage_xmlRpcPrefix/$ls_storage_xmlRpcPrefix_s/; \ + s/ls_alib_xmlRpcPrefix/$ls_alib_xmlRpcPrefix_s/; \ + s/ls_php_host/$ls_php_host/; \ + s/ls_php_port/$ls_php_port/; \ + s/ls_archiveUrlPath/\/$ls_php_urlPrefix_s\/archiveServer\/var/; \ + s/ls_scheduler_urlPrefix/$ls_scheduler_urlPrefix_s/; \ + s/ls_scheduler_xmlRpcPrefix/$ls_scheduler_xmlRpcPrefix_s/; \ + s/ls_scheduler_host/$ls_scheduler_host/; \ + s/ls_scheduler_port/$ls_scheduler_port/;" + + + +#------------------------------------------------------------------------------- +# Function to check for the existence of an executable on the PATH +# +# @param $1 the name of the exectuable +# @return 0 if the executable exists on the PATH, non-0 otherwise +#------------------------------------------------------------------------------- +check_exe() { + if [ -x "`which $1 2> /dev/null`" ]; then + echo "Exectuable $1 found..."; + return 0; + else + echo "Exectuable $1 not found..."; + return 1; + fi +} + + +#------------------------------------------------------------------------------- +# Function to check for a PEAR module +# +# @param $1 the name of the PEAR module +# @return 0 if the module is available, non-0 otherwise +#------------------------------------------------------------------------------- +check_pear_module() { + test_result=`pear info $1` + if [ $? = 0 ]; then + echo "PEAR module $1 found..."; + return 0; + else + echo "PEAR module $1 not found..."; + return 1; + fi +} + + +#------------------------------------------------------------------------------- +# Check for required tools +#------------------------------------------------------------------------------- +echo "Checking for required tools..." + +check_exe "sed" || exit 1; +check_exe "php" || exit 1; +check_exe "pear" || exit 1; + +check_pear_module "DB" || exit 1; +check_pear_module "Calendar" || exit 1; +check_pear_module "File" || exit 1; +check_pear_module "File_Find" || exit 1; +check_pear_module "HTML_Common" || exit 1; +check_pear_module "HTML_QuickForm" || exit 1; +check_pear_module "XML_Beautifier" || exit 1; +check_pear_module "XML_Parser" || exit 1; +check_pear_module "XML_RPC" || exit 1; +check_pear_module "XML_Serializer" || exit 1; +check_pear_module "XML_Util" || exit 1; + + +#------------------------------------------------------------------------------- +# Customize the configuration files with the appropriate values +#------------------------------------------------------------------------------- +echo "Customizing configuration files..." + +mkdir -p $configdir + +cat $modules_dir/storageServer/var/conf_only.php.template \ + | sed -e "$replace_sed_string" \ + > $configdir/storageServer.conf.php + +cat $modules_dir/archiveServer/var/conf_only.php.template \ + | sed -e "$replace_sed_string" \ + > $configdir/archiveServer.conf.php + +cat $modules_dir/db/etc/connectionManagerFactory.xml.template \ + | sed -e "$replace_sed_string" \ + > $configdir/connectionManagerFactory.xml + +cat $modules_dir/db/etc/simpleConnectionManager.xml.template \ + | sed -e "$replace_sed_string" \ + > $configdir/simpleConnectionManager.xml + +cat $modules_dir/schedulerClient/etc/schedulerClientFactory.xml.template \ + | sed -e "$replace_sed_string" \ + > $configdir/schedulerClientFactory.xml + +cat $modules_dir/schedulerClient/etc/schedulerDaemonXmlRpcClient.xml.template \ + | sed -e "$replace_sed_string" \ + > $configdir/schedulerDaemonXmlRpcClient.xml + +cat $modules_dir/storage/etc/webAuthenticationClient.xml.template \ + | sed -e "$replace_sed_string" \ + > $configdir/webAuthenticationClient.xml + +cat $modules_dir/storage/etc/webStorage.xml.template \ + | sed -e "$replace_sed_string" \ + > $configdir/webStorage.xml + +cat $products_dir/scheduler/etc/scheduler.xml.template \ + | sed -e "$replace_sed_string" \ + > $configdir/scheduler.xml + + +#------------------------------------------------------------------------------- +# Create the public html directory, and links to the PHP directories +#------------------------------------------------------------------------------- +echo "Creating public HTML directory and links to web interfaces..." + +mkdir -p $htmldir + +rm -f $htmldir/livesupport + +ln -s $modules_dir $htmldir/livesupport + + +#------------------------------------------------------------------------------- +# Setup directory permissions +#------------------------------------------------------------------------------- +echo "Setting up directory permissions..." + +chgrp $apache_group $modules_dir/archiveServer/var/stor +chgrp $apache_group $modules_dir/archiveServer/var/access +chgrp $apache_group $modules_dir/archiveServer/var/trans +chgrp $apache_group $modules_dir/archiveServer/var/stor/buffer + +chmod g+sw $modules_dir/archiveServer/var/stor +chmod g+sw $modules_dir/archiveServer/var/access +chmod g+sw $modules_dir/archiveServer/var/trans +chmod g+sw $modules_dir/archiveServer/var/stor/buffer + +chgrp $apache_group $modules_dir/storageServer/var/stor +chgrp $apache_group $modules_dir/storageServer/var/access +chgrp $apache_group $modules_dir/storageServer/var/trans +chgrp $apache_group $modules_dir/storageServer/var/stor/buffer + +chmod g+sw $modules_dir/storageServer/var/stor +chmod g+sw $modules_dir/storageServer/var/access +chmod g+sw $modules_dir/storageServer/var/trans +chmod g+sw $modules_dir/storageServer/var/stor/buffer + +chgrp $apache_group $modules_dir/htmlUI/var/templates_c +chgrp $apache_group $modules_dir/htmlUI/var/html/img + +chmod g+sw $modules_dir/htmlUI/var/templates_c +chmod g+sw $modules_dir/htmlUI/var/html/img + + +#------------------------------------------------------------------------------- +# Say goodbye +#------------------------------------------------------------------------------- +echo ""; +echo "The HTML user interface for the LiveSupport development environment"; +echo "for user $user is available at:"; +echo "http://$ls_php_host:$ls_php_port/$ls_php_urlPrefix/htmlUI/var"; +echo ""; +echo "Done." + diff --git a/livesupport/bin/user_setup_db.sh b/livesupport/bin/user_setup_db.sh new file mode 100755 index 000000000..e3bb553dc --- /dev/null +++ b/livesupport/bin/user_setup_db.sh @@ -0,0 +1,248 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/user_setup_db.sh,v $ +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# This script sets up the development environment for a user. +# +# Invoke as: +# ./bin/user_setup_root.sh +# +# To get usage help, try the -h option +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +docdir=$basedir/doc +tmpdir=$basedir/tmp +toolsdir=$basedir/tools +modules_dir=$basedir/modules +products_dir=$basedir/products + +usrdir=`cd $basedir/usr; pwd;` + + +#------------------------------------------------------------------------------- +# Print the usage information for this script. +#------------------------------------------------------------------------------- +printUsage() +{ + echo "LiveSupport development environment setup script."; + echo "parameters:"; + echo ""; + echo " -g, --apache-group The group the apache daemon runs as."; + echo " [default: apache]"; + echo " -u, --user The user to set up the environment for."; + echo " Required parameter."; + echo " -h, --help Print this message and exit."; + echo ""; +} + + +#------------------------------------------------------------------------------- +# Process command line parameters +#------------------------------------------------------------------------------- +CMD=${0##*/} + +opts=$(getopt -o g:hu: -l apache-group:,help,user: -n $CMD -- "$@") || exit 1 +eval set -- "$opts" +while true; do + case "$1" in + -g|--apache-group) + apache_group=$2; + shift; shift;; + -h|--help) + printUsage; + exit 0;; + -u|--user) + user=$2; + shift; shift;; + --) + shift; + break;; + *) + echo "Unrecognized option $1."; + printUsage; + exit 1; + esac +done + +if [ "x$user" == "x" ]; then + echo "Required parameter user missing."; + printUsage; + exit 1; +fi + +if [ "x$apache_group" == "x" ]; then + apache_group=apache; +fi + +dbserver=localhost; +database=LiveSupport-$user; +dbuser=test; +dbpassword=test; + + +echo "Configuring LiveSupport development environment."; +echo ""; +echo "Using the following parameters:"; +echo ""; +echo " configuring for user: $user"; +echo " database server: $dbserver"; +echo " database: $database"; +echo " database user: $dbuser"; +echo " database user password: $dbpassword"; +echo " apache daemon group: $apache_group"; +echo "" + +# check for the apache group to be a real group +group_tmp_file=/tmp/ls_group_check.$$ +touch $group_tmp_file +test_result=`chgrp $apache_group $group_tmp_file 2> /dev/null` +if [ $? != 0 ]; then + rm -f $group_tmp_file; + echo "Unable to use apache deamon group $apache_group."; + echo "Please check if $apache_group is a correct user group."; + exit 1; +fi +rm -f $group_tmp_file; + + +#------------------------------------------------------------------------------- +# The details of installation +#------------------------------------------------------------------------------- +ls_dbserver=$dbserver +ls_dbuser=$dbuser +ls_dbpassword=$dbpassword +ls_database=$database + + +postgres_user=postgres + + +replace_sed_string="s/ls_dbuser/$ls_dbuser/; \ + s/ls_dbpassword/$ls_dbpassword/; \ + s/ls_dbserver/$ls_dbserver/; \ + s/ls_database/$ls_database/;" + + + +#------------------------------------------------------------------------------- +# Function to check for the existence of an executable on the PATH +# +# @param $1 the name of the exectuable +# @return 0 if the executable exists on the PATH, non-0 otherwise +#------------------------------------------------------------------------------- +check_exe() { + if [ -x "`which $1 2> /dev/null`" ]; then + echo "Exectuable $1 found..."; + return 0; + else + echo "Exectuable $1 not found..."; + return 1; + fi +} + + +#------------------------------------------------------------------------------- +# Check to see if this script is being run as root +#------------------------------------------------------------------------------- +if [ `whoami` != "root" ]; then + echo "Please run this script as root."; + exit ; +fi + + +#------------------------------------------------------------------------------- +# Check for required tools +#------------------------------------------------------------------------------- +echo "Checking for required tools..." + +check_exe "sed" || exit 1; +check_exe "psql" || exit 1; +check_exe "odbcinst" || exit 1; + + +#------------------------------------------------------------------------------- +# Create the necessary database user and database itself +#------------------------------------------------------------------------------- +echo "Creating database and database user..."; + +# FIXME: the below might not work for remote databases + +su - $postgres_user -c "echo \"CREATE USER $ls_dbuser \ + ENCRYPTED PASSWORD '$ls_dbpassword' \ + CREATEDB NOCREATEUSER;\" \ + | psql -h $ls_dbserver template1" \ + || echo "Couldn't create database user $ls_dbuser."; + +su - $postgres_user -c "echo \"CREATE DATABASE \\\"$ls_database\\\" \ + OWNER $ls_dbuser ENCODING 'utf-8';\" \ + | psql -h $ls_dbserver template1" \ + || echo "Couldn't create database $ls_database."; + + +# TODO: check for the success of these operations somehow + + +#------------------------------------------------------------------------------- +# Create the ODBC data source and driver +#------------------------------------------------------------------------------- +echo "Creating ODBC data source and driver..."; + +odbcinst_template=$products_dir/scheduler/etc/odbcinst_template +odbc_template=$products_dir/scheduler/etc/odbc_template +odbc_template_tmp=/tmp/odbc_template.$$ + +# check for an existing PostgreSQL ODBC driver, and only install if necessary +odbcinst_res=`odbcinst -q -d | grep "\[PostgreSQL\]"` +if [ "x$odbcinst_res" == "x" ]; then + echo "Registering ODBC PostgreSQL driver..."; + odbcinst -i -d -v -f $odbcinst_template || exit 1; +fi + +echo "Registering LiveSupport ODBC data source..."; +cat $odbc_template | sed -e "$replace_sed_string" > $odbc_template_tmp +odbcinst -i -s -l -f $odbc_template_tmp || exit 1; +rm -f $odbc_template_tmp + + +#------------------------------------------------------------------------------- +# Call the script that will do the user-specific setup. +#------------------------------------------------------------------------------- +su - $user $bindir/user_setup.sh -g $apache_group + + +#------------------------------------------------------------------------------- +# Say goodbye +#------------------------------------------------------------------------------- +echo "Done." + diff --git a/livesupport/doc/gettingStarted.html b/livesupport/doc/gettingStarted.html index 8f98ba6ec..6f2f5492e 100644 --- a/livesupport/doc/gettingStarted.html +++ b/livesupport/doc/gettingStarted.html @@ -13,7 +13,7 @@ Development Loan Fund, under the GNU GPL.
@@ -36,6 +36,8 @@ development environment.
  • set up additional system resources
  • check out the sources
  • set up tools used by LiveSupport
  • +
  • personalize your development environment
    +
  • Install development tools

    Install all the tools needed for the development of LiveSupport. Please @@ -56,16 +58,6 @@ database, and an ODBC Data Source accessible to it through unixODBC. Please refer to the documentation of these tools to set them up.

    -LiveSupport expects an ODBC Data Source with the following parameters:
    - -This data source should point to a PostgreSQL instance. Only one -developer at the time should access this datasource, as the test suites -regularly create and destroy database tables.
    -
    The test environment assumes that it can connect to the PostgreSQL database as localhost via a TCP/IP connection, as the user test. To achieve this access, please make sure to edit postgresql.conf @@ -114,24 +106,6 @@ list and installed by e.g.: pear install DB): -Please, check settings in var/conf.php files in both -storageServer and archiveServer modules and create two -symlinks with name corresponding to 'URL configuration' part of -var/conf.php files - example for default values: - -Please make <livesupport-cvs>/modules/htmlUI/var/templates_c/ and -<livesupport-cvs>/modules/htmlUI/var/html/img/ writable for -apache.

    Check out the sources

    The LiveSupport development directory tree can be accessed via anonymous CVS, using the @@ -164,6 +138,82 @@ The execution of this command will take a while, as all the supporting libraries and tools are compiled and installed to the livesupport/usr directory. Please note that nothing is installed outside of the LiveSupport directory structure.
    +

    Personalize your LiveSupport development environment

    +The LiveSupport development environment can be run in two ways: either +only one developer actively doing LiveSupport development on the +system, or multiple developers sharing a system for LiveSupport +development. In the former case, only one database instance, scheduler +daemon and apache (XML-RPC and HTTP/HTML) entry point is needed. In the +latter case, each user will have their own database instance, scheduler +daemon and apache entry points.
    +

    Only one developer doing development on the system
    +

    +If only one developer is doing development on the system, there is no +need to personalize the resources used by the development environment. +The following resources are expected on the system.
    +
    +LiveSupport expects an ODBC Data Source with the following parameters:
    + +This data source should point to a PostgreSQL instance of the same +name. Only one +developer at the time should access this datasource, as the test suites +regularly create and destroy database tables.
    +
    +The scheduler daemon will use the port 3344.
    +
    +Please, check settings in var/conf.php files in both +storageServer and archiveServer modules and create two +symlinks with name corresponding to 'URL configuration' part of +var/conf.php files - example for default values: + +Please make <livesupport-cvs>/modules/htmlUI/var/templates_c/ +and +<livesupport-cvs>/modules/htmlUI/var/html/img/ +writable for +apache. +

    Multiple developers doing development on the system

    +In case multiple developers are sharing a system for LiveSupport +development, each resource has to be personalized. Please run the livesupport/bin/user_setup_db.sh +script as root to make the appropriate steps for +personalization. The script expects the name of the user as a mandatory +parameter, e.g. invoke as:
    +
    +
    cd livesupport
    ./bin/user_setup_db.sh --user ls_developer_user
    +
    +The script will set up the following resources:
    + +After running the above script, the livesupport development environment +for the specified user will be unique on the system, and will not +conflict with resources used by other developers. For example, the +LiveSupport HTML user interface for the user will be reachable at:
    +
    +
    http://localhost/~ls_developer_user/livesupport/htmlUI/var

    Ready to roll

    With the above steps completed, the LiveSupport modules and products are ready to be compiled and developed further. Have fun!
    diff --git a/livesupport/modules/archiveServer/var/conf.php b/livesupport/modules/archiveServer/var/conf.php index 5de0528ca..ef66e50ec 100644 --- a/livesupport/modules/archiveServer/var/conf.php +++ b/livesupport/modules/archiveServer/var/conf.php @@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: tomas $ - Version : $Revision: 1.9 $ + Author : $Author: maroy $ + Version : $Revision: 1.10 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/conf.php,v $ ------------------------------------------------------------------------------*/ @@ -54,6 +54,9 @@ *
    archiveUrlHost, archiveUrlPort
    host and port of archiveServer * */ + +// these are the default values for the config + $config = array( /* ================================================== basic configuration */ 'dsn' => array( @@ -113,4 +116,22 @@ $config = array( 'RootNode' => 'RootNode', 'tmpRootPass' => 'q', ); -?> \ No newline at end of file + +// see if a ~/.livesupport/archiveServer.conf.php exists, and +// overwrite the settings from there if any + +$this_file = $_SERVER["SCRIPT_FILENAME"]; +$fileowner_id = fileowner($this_file); +$fileowner_array = posix_getpwuid($fileowner_id); +$fileowner_homedir = $fileowner_array['dir']; +$home_conf = $fileowner_homedir . '/.livesupport/archiveServer.conf.php'; + +if (file_exists($home_conf)) { + $default_config = $config; + include $home_conf; + $user_config = $config; + $config = $user_config + $default_config; +} + +?> + diff --git a/livesupport/modules/archiveServer/var/conf_only.php.template b/livesupport/modules/archiveServer/var/conf_only.php.template new file mode 100644 index 000000000..fd97821a8 --- /dev/null +++ b/livesupport/modules/archiveServer/var/conf_only.php.template @@ -0,0 +1,80 @@ + + *
    dsn
    datasource setting + *
    tblNamePrefix
    prefix for table names in the database + *
    authCookieName
    secret token cookie name + *
    storageDir
    main directory for storing binary media files + *
    bufferDir
    directory for temporary files + *
    transDir
    directory for incomplete transferred files + *
    accessDir
    directory for symlinks to accessed files + *
    isArchive
    local/central flag + *
    storageUrlPath
    path-URL-part of storageServer base dir + * (on central archive side: storage=archive) + *
    storageXMLRPC
    XMLRPC server script address relative to storageUrlPath + *
    storageUrlHost, storageUrlPort
    host and port of storageServer + *
    archiveUrlPath
    path-URL-part of archiveServer base dir + *
    archiveXMLRPC
    XMLRPC server script address relative to archiveUrlPath + *
    archiveUrlHost, archiveUrlPort
    host and port of archiveServer + * + */ +$config = array( + /* ================================================== basic configuration */ + 'dsn' => array( + 'username' => 'ls_dbuser', + 'password' => 'ls_dbpassword', + 'hostspec' => 'ls_dbserver', + 'phptype' => 'pgsql', + 'database' => 'ls_database', + ), + + /* ==================================================== URL configuration */ + // on central archive side: archive is the storage ! + 'storageUrlPath' => 'ls_storageUrlPath', + 'storageXMLRPC' => 'xmlrpc/xrArchive.php', + 'storageUrlHost' => 'ls_php_host', + 'storageUrlPort' => ls_php_port, + // have to be another remote archive: + #'archiveUrlPath' => 'ls_archiveUrlPath', + #'archiveXMLRPC' => 'xmlrpc/xrArchive.php', + #'archiveUrlHost' => 'ls_php_host', + #'archiveUrlPort' => ls_php_port, + +); +?> diff --git a/livesupport/modules/core/etc/Makefile.in b/livesupport/modules/core/etc/Makefile.in index 2acb46dcc..c9e91235c 100644 --- a/livesupport/modules/core/etc/Makefile.in +++ b/livesupport/modules/core/etc/Makefile.in @@ -20,8 +20,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # -# Author : $Author: fgerlits $ -# Version : $Revision: 1.25 $ +# Author : $Author: maroy $ +# Version : $Revision: 1.26 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/etc/Makefile.in,v $ # # @configure_input@ @@ -125,7 +125,8 @@ CORE_LIB_OBJS = ${TMP_DIR}/UniqueId.o \ ${TMP_DIR}/Md5.o \ ${TMP_DIR}/XmlRpcTools.o \ ${TMP_DIR}/XmlRpcException.o \ - ${TMP_DIR}/TagConversion.o + ${TMP_DIR}/TagConversion.o \ + ${TMP_DIR}/BaseTestMethod.o TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \ ${TMP_DIR}/UniqueIdTest.o \ diff --git a/livesupport/modules/core/etc/configure.ac b/livesupport/modules/core/etc/configure.ac index 1b57b84e9..6e2e43756 100644 --- a/livesupport/modules/core/etc/configure.ac +++ b/livesupport/modules/core/etc/configure.ac @@ -20,8 +20,8 @@ dnl along with LiveSupport; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl dnl -dnl Author : $Author: fgerlits $ -dnl Version : $Revision: 1.8 $ +dnl Author : $Author: maroy $ +dnl Version : $Revision: 1.9 $ dnl Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/etc/configure.ac,v $ dnl----------------------------------------------------------------------------- @@ -35,14 +35,14 @@ dnl----------------------------------------------------------------------------- AC_INIT(Core, 1.0, bugs@campware.org) AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2004 Media Development Loan Fund under the GNU GPL]) -AC_REVISION($Revision: 1.8 $) +AC_REVISION($Revision: 1.9 $) AC_CONFIG_SRCDIR(../src/UniqueId.cxx) AC_CONFIG_HEADERS(configure.h) AC_PROG_CXX() -AC_CHECK_HEADERS(getopt.h sys/time.h time.h) +AC_CHECK_HEADERS(getopt.h sys/time.h time.h sys/types.h pwd.h) PKG_CHECK_MODULES(LIBXMLPP,[libxml++-2.6 >= 2.6.0]) AC_SUBST(LIBXMLPP_CFLAGS) diff --git a/livesupport/modules/core/include/LiveSupport/Core/BaseTestMethod.h b/livesupport/modules/core/include/LiveSupport/Core/BaseTestMethod.h new file mode 100644 index 000000000..a3a7c26a8 --- /dev/null +++ b/livesupport/modules/core/include/LiveSupport/Core/BaseTestMethod.h @@ -0,0 +1,125 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/BaseTestMethod.h,v $ + +------------------------------------------------------------------------------*/ +#ifndef LiveSupport_Core_BaseTestMethod_h +#define LiveSupport_Core_BaseTestMethod_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include + +#include +#include + + +namespace LiveSupport { +namespace Core { + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * A base class for the test methods. + * Subclass this class for the methods that use configuration files. + * This class gives helpers to access the configuration files + * from various locations (~/.livesupport, ./etc) + * + * @author $Author: maroy $ + * @version $Revision: 1.1 $ + */ +class BaseTestMethod : public CPPUNIT_NS::TestFixture +{ + private: + /** + * Get the current working directory. + * + * @return the current working directory. + */ + static std::string + getCwd(void) throw (); + + public: + /** + * Return the full path for a configuration file. + * + * @param configFileName the name of the configuration file. + * @return the full path of the configuration file, found in the + * appropriate directory. + * @exception std::invalid_argument if the specified config file + * does not exist. + */ + static std::string + getConfigFile(const std::string configFileName) + throw (std::invalid_argument); + + /** + * Helper function to return an XML Document object based on + * a config file name. + * First, the proper location of the config file is found. + * + * @param parser the XML DOM parser to use for parsing. + * @param configFileName the name of the configuration file. + * @return an XML document, containing the contents of the + * config file + * @exception std::invalid_argument if the configuration file + * could not be found + * @exception std::exception on parsing errors. + */ + static const xmlpp::Document * + getConfigDocument(xmlpp::DomParser & parser, + const std::string configFileName) + throw (std::invalid_argument, + std::exception); +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Core +} // namespace LiveSupport + +#endif // LiveSupport_Core_BaseTestMethod_h + diff --git a/livesupport/modules/core/src/BaseTestMethod.cxx b/livesupport/modules/core/src/BaseTestMethod.cxx new file mode 100644 index 000000000..fdda0564b --- /dev/null +++ b/livesupport/modules/core/src/BaseTestMethod.cxx @@ -0,0 +1,144 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/BaseTestMethod.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#else +#error need sys/types.h +#endif + +#ifdef HAVE_PWD_H +#include +#else +#error need pwd.h +#endif + +#include + +#include "LiveSupport/Core/BaseTestMethod.h" + + +using namespace LiveSupport::Core; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Return the current working directory + *----------------------------------------------------------------------------*/ +std::string +BaseTestMethod :: getCwd(void) throw () +{ + size_t size = 100; + char * buffer; + + while (true) { + buffer = new char[size]; + if (getcwd(buffer, size)) { + break; + } + delete[] buffer; + if (errno != ERANGE) { + return ""; + } + size *= 2; + } + + std::string cwd(buffer); + delete[] buffer; + return cwd; +} + + +/*------------------------------------------------------------------------------ + * Return the full path for a configuration file. + *----------------------------------------------------------------------------*/ +std::string +BaseTestMethod :: getConfigFile(const std::string configFileName) + throw (std::invalid_argument) +{ + std::string fileName; + std::ifstream file; + + // first, try with ~/.livesupport/configFileName + struct passwd * pwd = getpwnam(getlogin()); + if (pwd) { + fileName += pwd->pw_dir; + fileName += "/.livesupport/" + configFileName; + file.open(fileName.c_str()); + if (file.good()) { + file.close(); + return fileName; + } + file.close(); + file.clear(); + } + + // second, try with ./etc/configFileName + fileName = getCwd() + "/etc/" + configFileName; + file.open(fileName.c_str()); + if (file.good()) { + file.close(); + return fileName; + } + file.close(); + + throw std::invalid_argument("can't find config file " + configFileName); +} + + +/*------------------------------------------------------------------------------ + * Return a configuration document + *----------------------------------------------------------------------------*/ +const xmlpp::Document * +BaseTestMethod :: getConfigDocument(xmlpp::DomParser & parser, + const std::string configFileName) + throw (std::invalid_argument, + std::exception) +{ + std::string realFileName = getConfigFile(configFileName); + parser.set_validate(); + parser.parse_file(realFileName); + return parser.get_document(); +} + diff --git a/livesupport/modules/db/etc/Makefile.in b/livesupport/modules/db/etc/Makefile.in index d689f167c..8e53c8ae9 100644 --- a/livesupport/modules/db/etc/Makefile.in +++ b/livesupport/modules/db/etc/Makefile.in @@ -21,7 +21,7 @@ # # # Author : $Author: maroy $ -# Version : $Revision: 1.8 $ +# Version : $Revision: 1.9 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/etc/Makefile.in,v $ # # @configure_input@ @@ -43,6 +43,7 @@ BASE_DIR = @builddir@ DOC_DIR = ${BASE_DIR}/doc DOXYGEN_DIR = ${DOC_DIR}/doxygen COVERAGE_DIR = ${DOC_DIR}/coverage +BIN_DIR = ${BASE_DIR}/bin ETC_DIR = ${BASE_DIR}/etc INCLUDE_DIR = ${BASE_DIR}/include LIB_DIR = ${BASE_DIR}/lib @@ -73,9 +74,9 @@ TEST_RESULTS = ${DOC_DIR}/testResults.xml # the text result XSLT has to be relative to the test result file, e.g. TMP_DIR TEST_XSLT = ../etc/testResultToHtml.xsl -DB_LIB = livesupport_db -DB_LIB_FILE = ${LIB_DIR}/lib${DB_LIB}.a -TEST_RUNNER = ${TMP_DIR}/testRunner +DB_LIB = livesupport_db +DB_LIB_FILE = ${LIB_DIR}/lib${DB_LIB}.a +TEST_RUNNER = ${TMP_DIR}/testRunner DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config @@ -108,9 +109,9 @@ LDFLAGS = @LDFLAGS@ -pthread \ DB_LIB_OBJS = ${TMP_DIR}/SimpleConnectionManager.o \ ${TMP_DIR}/ConnectionManagerFactory.o \ ${TMP_DIR}/Conversion.o -TEST_RUNNER_OBJS = ${TMP_DIR}/SimpleConnectionManagerTest.o \ - ${TMP_DIR}/ConnectionManagerFactoryTest.o \ - ${TMP_DIR}/TestRunner.o +TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \ + ${TMP_DIR}/SimpleConnectionManagerTest.o \ + ${TMP_DIR}/ConnectionManagerFactoryTest.o TEST_RUNNER_LIBS = -l${DB_LIB} -l${CORE_LIB} -lcppunit -ldl diff --git a/livesupport/modules/db/etc/connectionManagerFactory.xml.template b/livesupport/modules/db/etc/connectionManagerFactory.xml.template new file mode 100644 index 000000000..5c0df33ff --- /dev/null +++ b/livesupport/modules/db/etc/connectionManagerFactory.xml.template @@ -0,0 +1,16 @@ + + + + + + + +]> + + + diff --git a/livesupport/modules/db/etc/simpleConnectionManager.xml.template b/livesupport/modules/db/etc/simpleConnectionManager.xml.template new file mode 100644 index 000000000..aaec38768 --- /dev/null +++ b/livesupport/modules/db/etc/simpleConnectionManager.xml.template @@ -0,0 +1,12 @@ + + + + + +]> + diff --git a/livesupport/modules/db/src/ConnectionManagerFactoryTest.cxx b/livesupport/modules/db/src/ConnectionManagerFactoryTest.cxx index 87e5cfda7..597f6bc33 100644 --- a/livesupport/modules/db/src/ConnectionManagerFactoryTest.cxx +++ b/livesupport/modules/db/src/ConnectionManagerFactoryTest.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/ConnectionManagerFactoryTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -61,7 +61,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ConnectionManagerFactoryTest); /** * The name of the configuration file for the connection manager factory. */ -static const std::string configFileName = "etc/connectionManagerFactory.xml"; +static const std::string configFileName = "connectionManagerFactory.xml"; /* =============================================== local function prototypes */ @@ -95,9 +95,9 @@ ConnectionManagerFactoryTest :: firstTest(void) throw (CPPUNIT_NS::Exception) { try { - Ptr::Ref parser( - new xmlpp::DomParser(configFileName, true)); - const xmlpp::Document * document = parser->get_document(); + xmlpp::DomParser parser; + const xmlpp::Document * document = getConfigDocument(parser, + configFileName); const xmlpp::Element * root = document->get_root_node(); Ptr::Ref cmf = ConnectionManagerFactory::getInstance(); @@ -118,7 +118,9 @@ ConnectionManagerFactoryTest :: firstTest(void) CPPUNIT_ASSERT(rs->getInt(1) == 1); } catch (std::invalid_argument &e) { - CPPUNIT_FAIL("semantic error in configuration file"); + CPPUNIT_FAIL(e.what()); + } catch (std::runtime_error &e) { + CPPUNIT_FAIL(e.what()); } catch (xmlpp::exception &e) { CPPUNIT_FAIL(e.what()); } diff --git a/livesupport/modules/db/src/ConnectionManagerFactoryTest.h b/livesupport/modules/db/src/ConnectionManagerFactoryTest.h index ffbdd0dbd..25801eb0f 100644 --- a/livesupport/modules/db/src/ConnectionManagerFactoryTest.h +++ b/livesupport/modules/db/src/ConnectionManagerFactoryTest.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/ConnectionManagerFactoryTest.h,v $ ------------------------------------------------------------------------------*/ @@ -42,10 +42,15 @@ #include +#include "LiveSupport/Core/BaseTestMethod.h" + namespace LiveSupport { namespace Db { +using namespace LiveSupport::Core; + + /* ================================================================ constants */ @@ -58,10 +63,10 @@ namespace Db { * Unit test for the ConnectionManagerFactory class. * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @see ConnectionManagerFactory */ -class ConnectionManagerFactoryTest : public CPPUNIT_NS::TestFixture +class ConnectionManagerFactoryTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(ConnectionManagerFactoryTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/modules/db/src/SimpleConnectionManager.cxx b/livesupport/modules/db/src/SimpleConnectionManager.cxx index e0f558923..c8bf3edad 100644 --- a/livesupport/modules/db/src/SimpleConnectionManager.cxx +++ b/livesupport/modules/db/src/SimpleConnectionManager.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/SimpleConnectionManager.cxx,v $ ------------------------------------------------------------------------------*/ @@ -120,7 +120,6 @@ SimpleConnectionManager :: getConnection(void) throw (std::runtime_error) { odbc::Connection * conn; - try { conn = odbc::DriverManager::getConnection(dsn, userName, password); } catch (std::exception &e) { @@ -128,7 +127,7 @@ SimpleConnectionManager :: getConnection(void) } if (!conn) { - std::string eMsg = "unable to option ODBC connection for DSN "; + std::string eMsg = "unable to open ODBC connection for DSN "; eMsg += dsn; throw std::runtime_error(eMsg); } diff --git a/livesupport/modules/db/src/SimpleConnectionManagerTest.cxx b/livesupport/modules/db/src/SimpleConnectionManagerTest.cxx index 131883c8f..cd73b6794 100644 --- a/livesupport/modules/db/src/SimpleConnectionManagerTest.cxx +++ b/livesupport/modules/db/src/SimpleConnectionManagerTest.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/SimpleConnectionManagerTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -61,7 +61,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(SimpleConnectionManagerTest); /** * The name of the configuration file for the connection manager. */ -static const std::string configFileName = "etc/simpleConnectionManager.xml"; +static const std::string configFileName = "simpleConnectionManager.xml"; /* =============================================== local function prototypes */ @@ -95,9 +95,9 @@ SimpleConnectionManagerTest :: firstTest(void) throw (CPPUNIT_NS::Exception) { try { - Ptr::Ref parser( - new xmlpp::DomParser(configFileName, true)); - const xmlpp::Document * document = parser->get_document(); + xmlpp::DomParser parser; + const xmlpp::Document * document = getConfigDocument(parser, + configFileName); const xmlpp::Element * root = document->get_root_node(); Ptr::Ref scm(new SimpleConnectionManager()); @@ -114,7 +114,9 @@ SimpleConnectionManagerTest :: firstTest(void) CPPUNIT_ASSERT(rs->getInt(1) == 1); } catch (std::invalid_argument &e) { - CPPUNIT_FAIL("semantic error in configuration file"); + CPPUNIT_FAIL(e.what()); + } catch (std::runtime_error &e) { + CPPUNIT_FAIL(e.what()); } catch (xmlpp::exception &e) { CPPUNIT_FAIL(e.what()); } diff --git a/livesupport/modules/db/src/SimpleConnectionManagerTest.h b/livesupport/modules/db/src/SimpleConnectionManagerTest.h index 64887a1bc..51b142422 100644 --- a/livesupport/modules/db/src/SimpleConnectionManagerTest.h +++ b/livesupport/modules/db/src/SimpleConnectionManagerTest.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/SimpleConnectionManagerTest.h,v $ ------------------------------------------------------------------------------*/ @@ -42,10 +42,15 @@ #include +#include "LiveSupport/Core/BaseTestMethod.h" + namespace LiveSupport { namespace Db { +using namespace LiveSupport::Core; + + /* ================================================================ constants */ @@ -58,10 +63,10 @@ namespace Db { * Unit test for the SimpleConnectionManager class. * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @see SimpleConnectionManager */ -class SimpleConnectionManagerTest : public CPPUNIT_NS::TestFixture +class SimpleConnectionManagerTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(SimpleConnectionManagerTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/modules/schedulerClient/etc/schedulerClientFactory.xml.template b/livesupport/modules/schedulerClient/etc/schedulerClientFactory.xml.template new file mode 100644 index 000000000..974cb7cb4 --- /dev/null +++ b/livesupport/modules/schedulerClient/etc/schedulerClientFactory.xml.template @@ -0,0 +1,18 @@ + + + + + + + + +]> + + + + diff --git a/livesupport/modules/schedulerClient/etc/schedulerDaemonXmlRpcClient.xml.template b/livesupport/modules/schedulerClient/etc/schedulerDaemonXmlRpcClient.xml.template new file mode 100644 index 000000000..6bb565a1d --- /dev/null +++ b/livesupport/modules/schedulerClient/etc/schedulerDaemonXmlRpcClient.xml.template @@ -0,0 +1,13 @@ + + + + + + +]> + diff --git a/livesupport/modules/schedulerClient/include/LiveSupport/SchedulerClient/SchedulerClientInterface.h b/livesupport/modules/schedulerClient/include/LiveSupport/SchedulerClient/SchedulerClientInterface.h index 4990ea5ad..71053129e 100644 --- a/livesupport/modules/schedulerClient/include/LiveSupport/SchedulerClient/SchedulerClientInterface.h +++ b/livesupport/modules/schedulerClient/include/LiveSupport/SchedulerClient/SchedulerClientInterface.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Author : $Author: maroy $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/schedulerClient/include/LiveSupport/SchedulerClient/SchedulerClientInterface.h,v $ ------------------------------------------------------------------------------*/ @@ -70,12 +70,36 @@ using namespace LiveSupport::Core; /** * An interface to access the scheduler daemon as a client. * - * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @author $Author: maroy $ + * @version $Revision: 1.6 $ */ class SchedulerClientInterface { public: + /** + * Return the XML-RPC host the client connects to. + * + * @return the XML-RPC host the client connects to. + */ + virtual Ptr::Ref + getXmlRpcHost(void) const throw () = 0; + + /** + * Return the XML-RPC port the client connects to. + * + * @return the XML-RPC port the client connects to. + */ + virtual unsigned int + getXmlRpcPort(void) const throw () = 0; + + /** + * Return the XML-RPC URI prefix used when connecting to the scheduler. + * + * @return the XML-RPC URI prefix. + */ + virtual Ptr::Ref + getXmlRpcUriPrefix(void) const throw () = 0; + /** * Return the version string for the scheduler this client * is connected to. diff --git a/livesupport/modules/schedulerClient/src/SchedulerClientFactoryTest.cxx b/livesupport/modules/schedulerClient/src/SchedulerClientFactoryTest.cxx index bdc64ca5b..b26237d67 100644 --- a/livesupport/modules/schedulerClient/src/SchedulerClientFactoryTest.cxx +++ b/livesupport/modules/schedulerClient/src/SchedulerClientFactoryTest.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/schedulerClient/src/SchedulerClientFactoryTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -60,7 +60,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(SchedulerClientFactoryTest); /** * The name of the configuration file for the scheduler client. */ -static const std::string configFileName = "etc/schedulerClientFactory.xml"; +static const std::string configFileName = "schedulerClientFactory.xml"; /* =============================================== local function prototypes */ @@ -78,9 +78,9 @@ SchedulerClientFactoryTest :: setUp(void) throw () // TODO: only configure, if not configured earlier try { - Ptr::Ref parser( - new xmlpp::DomParser(configFileName, true)); - const xmlpp::Document * document = parser->get_document(); + xmlpp::DomParser parser; + const xmlpp::Document * document = getConfigDocument(parser, + configFileName); const xmlpp::Element * root = document->get_root_node(); schedulerClientFactory->configure(*root); diff --git a/livesupport/modules/schedulerClient/src/SchedulerClientFactoryTest.h b/livesupport/modules/schedulerClient/src/SchedulerClientFactoryTest.h index b05604d82..689419942 100644 --- a/livesupport/modules/schedulerClient/src/SchedulerClientFactoryTest.h +++ b/livesupport/modules/schedulerClient/src/SchedulerClientFactoryTest.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/schedulerClient/src/SchedulerClientFactoryTest.h,v $ ------------------------------------------------------------------------------*/ @@ -42,6 +42,7 @@ #include +#include "LiveSupport/Core/BaseTestMethod.h" #include "LiveSupport/SchedulerClient/SchedulerClientFactory.h" namespace LiveSupport { @@ -61,10 +62,10 @@ using namespace LiveSupport::Core; * Unit test for the SchedulerClientFactoryTest class. * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @see SchedulerClientFactoryTest */ -class SchedulerClientFactoryTest : public CPPUNIT_NS::TestFixture +class SchedulerClientFactoryTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(SchedulerClientFactoryTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClient.h b/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClient.h index 9c09c31c7..67aeea28f 100644 --- a/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClient.h +++ b/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClient.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Author : $Author: maroy $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClient.h,v $ ------------------------------------------------------------------------------*/ @@ -93,8 +93,8 @@ using namespace LiveSupport::Core; * * * - * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @author $Author: maroy $ + * @version $Revision: 1.6 $ */ class SchedulerDaemonXmlRpcClient : virtual public Configurable, @@ -158,6 +158,39 @@ class SchedulerDaemonXmlRpcClient : throw (std::invalid_argument, std::logic_error); + /** + * Return the XML-RPC host the client connects to. + * + * @return the XML-RPC host the client connects to. + */ + virtual Ptr::Ref + getXmlRpcHost(void) const throw () + { + return xmlRpcHost; + } + + /** + * Return the XML-RPC port the client connects to. + * + * @return the XML-RPC port the client connects to. + */ + virtual unsigned int + getXmlRpcPort(void) const throw () + { + return xmlRpcPort; + } + + /** + * Return the XML-RPC URI prefix used when connecting to the scheduler. + * + * @return the XML-RPC URI prefix. + */ + virtual Ptr::Ref + getXmlRpcUriPrefix(void) const throw () + { + return xmlRpcUri; + } + /** * Return the version string for the scheduler this client * is connected to. diff --git a/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.cxx b/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.cxx index ec268efc2..5b458900d 100644 --- a/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.cxx +++ b/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Author : $Author: maroy $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -68,13 +68,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(SchedulerDaemonXmlRpcClientTest); /** * The name of the configuration file for the scheduler client. */ -static const std::string configFileName = "etc/schedulerDaemonXmlRpcClient.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -static const std::string authenticationClientConfigFileName = - "etc/authenticationClient.xml"; +static const std::string configFileName = "schedulerDaemonXmlRpcClient.xml"; /* =============================================== local function prototypes */ @@ -82,22 +76,6 @@ static const std::string authenticationClientConfigFileName = /* ============================================================= module code */ -/*------------------------------------------------------------------------------ * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/void -SchedulerDaemonXmlRpcClientTest :: configure( - Ptr::Ref configurable, - const std::string & fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ @@ -105,9 +83,9 @@ void SchedulerDaemonXmlRpcClientTest :: setUp(void) throw () { try { - Ptr::Ref parser( - new xmlpp::DomParser(configFileName, true)); - const xmlpp::Document * document = parser->get_document(); + xmlpp::DomParser parser; + const xmlpp::Document * document = getConfigDocument(parser, + configFileName); const xmlpp::Element * root = document->get_root_node(); schedulerClient.reset(new SchedulerDaemonXmlRpcClient()); @@ -121,7 +99,11 @@ SchedulerDaemonXmlRpcClientTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient( + schedulerClient->getXmlRpcHost()->c_str(), + schedulerClient->getXmlRpcPort(), + schedulerClient->getXmlRpcUriPrefix()->c_str(), + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -147,7 +129,11 @@ SchedulerDaemonXmlRpcClientTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient( + schedulerClient->getXmlRpcHost()->c_str(), + schedulerClient->getXmlRpcPort(), + schedulerClient->getXmlRpcUriPrefix()->c_str(), + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); diff --git a/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.h b/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.h index c37048564..e6f1b05ea 100644 --- a/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.h +++ b/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Author : $Author: maroy $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.h,v $ ------------------------------------------------------------------------------*/ @@ -42,6 +42,7 @@ #include +#include "LiveSupport/Core/BaseTestMethod.h" #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "SchedulerDaemonXmlRpcClient.h" @@ -62,11 +63,11 @@ using namespace LiveSupport::Authentication; /** * Unit test for the SchedulerDaemonXmlRpcClient class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @author $Author: maroy $ + * @version $Revision: 1.6 $ * @see SchedulerDaemonXmlRpcClient */ -class SchedulerDaemonXmlRpcClientTest : public CPPUNIT_NS::TestFixture +class SchedulerDaemonXmlRpcClientTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(SchedulerDaemonXmlRpcClientTest); CPPUNIT_TEST(getVersionTest); @@ -88,20 +89,6 @@ class SchedulerDaemonXmlRpcClientTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - const std::string & fileName) - throw (std::invalid_argument, - xmlpp::exception); - protected: diff --git a/livesupport/modules/storage/etc/webAuthenticationClient.xml.template b/livesupport/modules/storage/etc/webAuthenticationClient.xml.template new file mode 100644 index 000000000..1c453d095 --- /dev/null +++ b/livesupport/modules/storage/etc/webAuthenticationClient.xml.template @@ -0,0 +1,19 @@ + + + + + + + + + +]> + + + + + diff --git a/livesupport/modules/storage/etc/webStorage.xml.template b/livesupport/modules/storage/etc/webStorage.xml.template new file mode 100644 index 000000000..37973a099 --- /dev/null +++ b/livesupport/modules/storage/etc/webStorage.xml.template @@ -0,0 +1,16 @@ + + + + + + + + + +]> + + + diff --git a/livesupport/modules/storage/src/WebStorageClientTest.cxx b/livesupport/modules/storage/src/WebStorageClientTest.cxx index 17c93ad1b..78396bb64 100644 --- a/livesupport/modules/storage/src/WebStorageClientTest.cxx +++ b/livesupport/modules/storage/src/WebStorageClientTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.38 $ + Author : $Author: maroy $ + Version : $Revision: 1.39 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -71,13 +71,13 @@ CPPUNIT_TEST_SUITE_REGISTRATION(WebStorageClientTest); /** * The name of the configuration file for the web storage client. */ -static const std::string storageConfigFileName = "etc/webStorage.xml"; +static const std::string storageConfigFileName = "webStorage.xml"; /** * The name of the configuration file for the authentication factory. */ static const std::string authenticationFactoryConfigFileName - = "etc/webAuthenticationClient.xml"; + = "webAuthenticationClient.xml"; /* =============================================== local function prototypes */ @@ -94,9 +94,9 @@ WebStorageClientTest :: setUp(void) throw () Ptr::Ref acf; acf = AuthenticationClientFactory::getInstance(); try { - Ptr::Ref parser( - new xmlpp::DomParser(authenticationFactoryConfigFileName, true)); - const xmlpp::Document * document = parser->get_document(); + xmlpp::DomParser parser; + const xmlpp::Document * document = getConfigDocument(parser, + authenticationFactoryConfigFileName); const xmlpp::Element * root = document->get_root_node(); acf->configure(*root); @@ -109,9 +109,9 @@ WebStorageClientTest :: setUp(void) throw () authentication = acf->getAuthenticationClient(); try { - Ptr::Ref parser( - new xmlpp::DomParser(storageConfigFileName, true)); - const xmlpp::Document * document = parser->get_document(); + xmlpp::DomParser parser; + const xmlpp::Document * document = getConfigDocument(parser, + storageConfigFileName); const xmlpp::Element * root = document->get_root_node(); wsc.reset(new WebStorageClient()); diff --git a/livesupport/modules/storage/src/WebStorageClientTest.h b/livesupport/modules/storage/src/WebStorageClientTest.h index 5e24b6023..9f9ba5db7 100644 --- a/livesupport/modules/storage/src/WebStorageClientTest.h +++ b/livesupport/modules/storage/src/WebStorageClientTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.8 $ + Author : $Author: maroy $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.h,v $ ------------------------------------------------------------------------------*/ @@ -42,6 +42,7 @@ #include +#include "LiveSupport/Core/BaseTestMethod.h" #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" @@ -62,11 +63,11 @@ using namespace LiveSupport::Authentication; /** * Unit test for the UploadPlaylistMetohd class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.8 $ + * @author $Author: maroy $ + * @version $Revision: 1.9 $ * @see WebStorageClient */ -class WebStorageClientTest : public CPPUNIT_NS::TestFixture +class WebStorageClientTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(WebStorageClientTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/modules/storageServer/var/conf.php b/livesupport/modules/storageServer/var/conf.php index a838a8721..e23293b1a 100644 --- a/livesupport/modules/storageServer/var/conf.php +++ b/livesupport/modules/storageServer/var/conf.php @@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: tomas $ - Version : $Revision: 1.15 $ + Author : $Author: maroy $ + Version : $Revision: 1.16 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/conf.php,v $ ------------------------------------------------------------------------------*/ @@ -58,6 +58,9 @@ * for login to archive * */ + +// these are the default values for the config + $config = array( /* ================================================== basic configuration */ 'dsn' => array( @@ -125,4 +128,21 @@ $config = array( 'RootNode' => 'RootNode', 'tmpRootPass' => 'q', ); -?> \ No newline at end of file + +// see if a ~/.livesupport/archiveServer.conf.php exists, and +// overwrite the settings from there if any + +$this_file = $_SERVER["SCRIPT_FILENAME"]; +$fileowner_id = fileowner($this_file); +$fileowner_array = posix_getpwuid($fileowner_id); +$fileowner_homedir = $fileowner_array['dir']; +$home_conf = $fileowner_homedir . '/.livesupport/storageServer.conf.php'; + +if (file_exists($home_conf)) { + $default_config = $config; + include $home_conf; + $user_config = $config; + $config = $user_config + $default_config; +} + +?> diff --git a/livesupport/modules/storageServer/var/conf_only.php.template b/livesupport/modules/storageServer/var/conf_only.php.template new file mode 100644 index 000000000..12278b148 --- /dev/null +++ b/livesupport/modules/storageServer/var/conf_only.php.template @@ -0,0 +1,92 @@ + + *
    dsn
    datasource setting + *
    tblNamePrefix
    prefix for table names in the database + *
    authCookieName
    secret token cookie name + *
    StationPrefsGr
    name of station preferences group + *
    AllGr
    name of 'all users' group + *
    storageDir
    main directory for storing binary media files + *
    bufferDir
    directory for temporary files + *
    transDir
    directory for incomplete transferred files + *
    accessDir
    directory for symlinks to accessed files + *
    isArchive
    local/central flag + *
    validate
    enable/disable validator + *
    storageUrlPath
    path-URL-part of storageServer base dir + *
    storageXMLRPC
    XMLRPC server script address relative to storageUrlPath + *
    storageUrlHost, storageUrlPort
    host and port of storageServer + *
    archiveUrlPath
    path-URL-part of archiveServer base dir + *
    archiveXMLRPC
    XMLRPC server script address relative to archiveUrlPath + *
    archiveUrlHost, archiveUrlPort
    host and port of archiveServer + *
    archiveAccountLogin, archiveAccountPass
    account info + * for login to archive + * + */ +$config = array( + /* ================================================== basic configuration */ + 'dsn' => array( + 'username' => 'ls_dbuser', + 'password' => 'ls_dbpassword', + 'hostspec' => 'ls_dbserver', + 'phptype' => 'pgsql', + 'database' => 'ls_database', + ), + + /* ==================================================== URL configuration */ + 'storageUrlPath' => 'ls_storageUrlPath', + 'storageXMLRPC' => 'xmlrpc/xrLocStor.php', + 'storageUrlHost' => 'ls_php_host', + 'storageUrlPort' => ls_php_port, + + /* ================================================ archive configuration */ + 'archiveUrlPath' => 'ls_archiveUrlPath', + 'archiveXMLRPC' => 'xmlrpc/xrArchive.php', + 'archiveUrlHost' => 'ls_php_host', + 'archiveUrlPort' => ls_php_port, + 'archiveAccountLogin' => 'root', + 'archiveAccountPass' => 'q', + + /* ============================================== scheduler configuration */ + 'schedulerUrlPath' => 'ls_scheduler_urlPrefix', + 'schedulerXMLRPC' => 'ls_scheduler_xmlRpcPrefix', + 'schedulerUrlHost' => 'ls_scheduler_host', + 'schedulerUrlPort' => ls_scheduler_port, + +); +?> diff --git a/livesupport/products/scheduler/bin/run_tests.sh b/livesupport/products/scheduler/bin/run_tests.sh new file mode 100755 index 000000000..6c8c262a8 --- /dev/null +++ b/livesupport/products/scheduler/bin/run_tests.sh @@ -0,0 +1,70 @@ +#!/bin/sh +#-------------------------------------------------------------------------------# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/bin/run_tests.sh,v $ +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Run the test suite for the scheduler. +#------------------------------------------------------------------------------- + + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +libdir=$basedir/lib +tmpdir=$basedir/tmp + +usrdir=`cd $basedir/../../usr; pwd;` + + +#------------------------------------------------------------------------------- +# Set up the environment +#------------------------------------------------------------------------------- +export LD_LIBRARY_PATH=$usrdir/lib:$LD_LIBRARY_PATH + +if [ -x $tmpdir/testRunner ]; then + testRunner=$tmpdir/testRunner +else + echo "Can't find testRunner executable."; +fi + +if [ -f ~/.livesupport/scheduler.xml ]; then + config_file=~/.livesupport/scheduler.xml +elif [ -f $etcdir/scheduler.xml ]; then + config_file=$etcdir/scheduler.xml +else + echo "Can't find configuration file."; +fi + + +#------------------------------------------------------------------------------- +# Run the tests +#------------------------------------------------------------------------------- +$testRunner -c $config_file "$*" + diff --git a/livesupport/products/scheduler/bin/scheduler_devenv.sh b/livesupport/products/scheduler/bin/scheduler_devenv.sh new file mode 100755 index 000000000..c75270467 --- /dev/null +++ b/livesupport/products/scheduler/bin/scheduler_devenv.sh @@ -0,0 +1,120 @@ +#!/bin/sh +#-------------------------------------------------------------------------------# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/bin/scheduler_devenv.sh,v $ +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# System V runlevel style invoke script for the LiveSupport Scheduler +# This script is only used in the LiveSupport development environment +#------------------------------------------------------------------------------- + + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +libdir=$basedir/lib +tmpdir=$basedir/tmp + +usrdir=`cd $basedir/../../usr; pwd;` + + +#------------------------------------------------------------------------------- +# Set up the environment +#------------------------------------------------------------------------------- +export LD_LIBRARY_PATH=$usrdir/lib:$LD_LIBRARY_PATH + +if [ -x $bindir/scheduler ]; then + scheduler_exe=$bindir/scheduler +elif [ -x $tmpdir/scheduler ]; then + scheduler_exe=$tmpdir/scheduler +else + echo "Can't find scheduler executable."; +fi + +if [ -f ~/.livesupport/scheduler.xml ]; then + config_file=~/.livesupport/scheduler.xml +elif [ -f $etcdir/scheduler.xml ]; then + config_file=$etcdir/scheduler.xml +else + echo "Can't find configuration file."; +fi + +mode=$1 + +#echo "Using scheduler: $scheduler_exe"; +#echo " configuration file: $config_file"; + + +#------------------------------------------------------------------------------- +# Do what the user asks us to do +#------------------------------------------------------------------------------- +case "$mode" in + 'start') + echo "Starting the LiveSupport scheduler..." + $scheduler_exe -c $config_file start + sleep 2 + ;; + + 'stop') + echo "Stopping the LiveSupport scheduler..." + $scheduler_exe -c $config_file stop + sleep 2 + ;; + + 'status') + echo "Checking LiveSupport scheduler status..." + $scheduler_exe -c $config_file status + ;; + + 'install') + echo "Installing LiveSupport scheduler database tables..." + $scheduler_exe -c $config_file install + ;; + + 'uninstall') + echo "Uninstalling LiveSupport scheduler database tables..." + $scheduler_exe -c $config_file uninstall + ;; + + 'kill') + echo "Killing all LiveSupport scheduler processes..." + killall scheduler + sleep 2 + killall -9 scheduler + ;; + + *) + echo "LiveSupport scheduler System V runlevel init script." + echo "" + echo "Usage:" + echo " $0 start|stop|status|install|uninstall|kill" + echo "" + +esac + diff --git a/livesupport/products/scheduler/etc/Makefile.in b/livesupport/products/scheduler/etc/Makefile.in index ac395dd53..153b75b24 100644 --- a/livesupport/products/scheduler/etc/Makefile.in +++ b/livesupport/products/scheduler/etc/Makefile.in @@ -21,7 +21,7 @@ # # # Author : $Author: maroy $ -# Version : $Revision: 1.51 $ +# Version : $Revision: 1.52 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $ # # @configure_input@ @@ -43,6 +43,7 @@ BASE_DIR = @builddir@ DOC_DIR = ${BASE_DIR}/doc DOXYGEN_DIR = ${DOC_DIR}/doxygen COVERAGE_DIR = ${DOC_DIR}/coverage +BIN_DIR = ${BASE_DIR}/bin ETC_DIR = ${BASE_DIR}/etc SRC_DIR = ${BASE_DIR}/src TMP_DIR = ${BASE_DIR}/tmp @@ -117,6 +118,7 @@ TEST_RESULTS = ${DOC_DIR}/testResults.xml TEST_XSLT = ../etc/testResultToHtml.xsl SCHEDULER_EXE = ${TMP_DIR}/scheduler +SCHEDULER_SH = ${BIN_DIR}/scheduler_devenv.sh SCHEDULER_CFG = ${ETC_DIR}/scheduler.xml SCHEDULER_WEB_CFG = ${ETC_DIR}/scheduler-web.xml TEST_RUNNER = ${TMP_DIR}/testRunner @@ -207,8 +209,9 @@ SCHEDULER_EXE_LIBS = -l${EVENT_SCHEDULER_LIB} -l${PLAYLIST_EXECUTOR_LIB} \ TEST_RUNNER_OBJS = ${SCHEDULER_OBJS} \ ${TMP_DIR}/TestRunner.o \ - ${TMP_DIR}/SchedulerDaemonTest.o \ + ${TMP_DIR}/BaseTestMethod.o \ ${TMP_DIR}/ResetStorageMethodTest.o \ + ${TMP_DIR}/SchedulerDaemonTest.o \ ${TMP_DIR}/GetSchedulerTimeMethodTest.o \ ${TMP_DIR}/RpcGetSchedulerTimeTest.o \ ${TMP_DIR}/GetVersionMethodTest.o \ @@ -261,8 +264,8 @@ TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl #------------------------------------------------------------------------------- .PHONY: all dir_setup doc clean docclean depclean distclean .PHONY: install start status run_tests stop uninstall -.PHONY: install_web start_web status_web run_web stop_web uninstall_web -.PHONY: check check_web +.PHONY: install_local start_local status_local run_local stop_local +.PHONY: uninstall_local check check_local all: dir_setup ${SCHEDULER_EXE} @@ -292,54 +295,51 @@ depclean: clean distclean: clean docclean ${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te* -check: all ${TEST_RUNNER} start run_tests stop +check: all ${TEST_RUNNER} storage_server_init start run_tests stop -check_web: all ${TEST_RUNNER} storage_server_init start_web run_tests stop_web +check_local: all ${TEST_RUNNER} start_local run_tests stop_local run_tests: ${TEST_RUNNER} - ${TEST_RUNNER} -o ${TEST_RESULTS} -s ${TEST_XSLT} + ./bin/run_tests.sh -o ${TEST_RESULTS} -s ${TEST_XSLT} +# ${TEST_RUNNER} -o ${TEST_RESULTS} -s ${TEST_XSLT} install: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} install + ${SCHEDULER_SH} install start: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} start + ${SCHEDULER_SH} start sleep 2 stop: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} stop + ${SCHEDULER_SH} stop sleep 2 status: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} status + ${SCHEDULER_SH} status uninstall: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} uninstall + ${SCHEDULER_SH} uninstall -run: ${SCHEDULER_EXE} +install_local: ${SCHEDULER_EXE} + ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} install + +start_local: ${SCHEDULER_EXE} + ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} start + sleep 2 + +stop_local: ${SCHEDULER_EXE} + ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} stop + sleep 2 + +status_local: ${SCHEDULER_EXE} + ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} status + +run_local: ${SCHEDULER_EXE} ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} --debug start sleep 2 -install_web: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_WEB_CFG} install - -start_web: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_WEB_CFG} start - sleep 2 - -stop_web: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_WEB_CFG} stop - sleep 2 - -status_web: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_WEB_CFG} status - -run_web: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_WEB_CFG} --debug start - sleep 2 - -uninstall_web: ${SCHEDULER_EXE} - ${SCHEDULER_EXE} -c ${SCHEDULER_WEB_CFG} uninstall +uninstall_local: ${SCHEDULER_EXE} + ${SCHEDULER_EXE} -c ${SCHEDULER_CFG} uninstall storage_server_init: ${MAKE} -C ${STORAGE_SERVER_DIR} diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx index c73ff1796..77b484c14 100644 --- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.15 $ + Author : $Author: maroy $ + Version : $Revision: 1.16 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -52,6 +52,7 @@ #include "OpenPlaylistForEditingMethod.h" #include "AddAudioClipToPlaylistMethod.h" #include "AddAudioClipToPlaylistMethodTest.h" +#include "SchedulerDaemon.h" using namespace std; using namespace LiveSupport::Db; @@ -67,69 +68,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(AddAudioClipToPlaylistMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string AddAudioClipToPlaylistMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string AddAudioClipToPlaylistMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string AddAudioClipToPlaylistMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -AddAudioClipToPlaylistMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void AddAudioClipToPlaylistMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -138,7 +93,7 @@ AddAudioClipToPlaylistMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.h b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.h index 9b23acc65..d24e25ae5 100644 --- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.h +++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,11 +64,11 @@ using namespace LiveSupport::Authentication; /** * Unit test for the AddAudioClipToPlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see AddAudioClipToPlaylistMethod */ -class AddAudioClipToPlaylistMethodTest : public CPPUNIT_NS::TestFixture +class AddAudioClipToPlaylistMethodTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(AddAudioClipToPlaylistMethodTest); CPPUNIT_TEST(firstTest); @@ -75,23 +76,6 @@ class AddAudioClipToPlaylistMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,19 +86,6 @@ class AddAudioClipToPlaylistMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); protected: diff --git a/livesupport/products/scheduler/src/BaseTestMethod.cxx b/livesupport/products/scheduler/src/BaseTestMethod.cxx new file mode 100644 index 000000000..22d24ba81 --- /dev/null +++ b/livesupport/products/scheduler/src/BaseTestMethod.cxx @@ -0,0 +1,92 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/BaseTestMethod.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#include "SchedulerDaemon.h" +#include "BaseTestMethod.h" + + +using namespace LiveSupport::Scheduler; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + +/*------------------------------------------------------------------------------ + * The XML-RPC host to connect to. + *----------------------------------------------------------------------------*/ +std::string LiveSupport::Scheduler::BaseTestMethod::xmlRpcHost; + +/*------------------------------------------------------------------------------ + * The XML-RPC port number to connect to. + *----------------------------------------------------------------------------*/ +unsigned int LiveSupport::Scheduler::BaseTestMethod::xmlRpcPort; + +/*------------------------------------------------------------------------------ + * A flag to indicate if configuration has already been done. + *----------------------------------------------------------------------------*/ +bool LiveSupport::Scheduler::BaseTestMethod::configured = false; + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Read configuration information. + *----------------------------------------------------------------------------*/ +void +LiveSupport::Scheduler:: +BaseTestMethod :: configure(std::string configFileName) + throw (std::exception) +{ + if (!configured) { + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); + + try { + std::auto_ptr + parser(new xmlpp::DomParser(configFileName, true)); + const xmlpp::Document * document = parser->get_document(); + scheduler->configure(*(document->get_root_node())); + } catch (std::invalid_argument &e) { + std::cerr << "semantic error in configuration file" << std::endl + << e.what() << std::endl; + } catch (xmlpp::exception &e) { + std::cerr << "error parsing configuration file" << std::endl + << e.what() << std::endl; + } + + xmlRpcHost = scheduler->getXmlRpcHost(); + xmlRpcPort = scheduler->getXmlRpcPort(); + } +} + diff --git a/livesupport/products/scheduler/src/BaseTestMethod.h b/livesupport/products/scheduler/src/BaseTestMethod.h new file mode 100644 index 000000000..579d25c76 --- /dev/null +++ b/livesupport/products/scheduler/src/BaseTestMethod.h @@ -0,0 +1,135 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/BaseTestMethod.h,v $ + +------------------------------------------------------------------------------*/ +#ifndef BaseTestMethod_h +#define BaseTestMethod_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include + +#include "LiveSupport/Core/BaseTestMethod.h" + + +namespace LiveSupport { +namespace Scheduler { + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * A base class for the test methods. + * Subclass this class for the methods that connect to an XML-RPC source. + * Make sure to call BaseTestMethod::configure() before running the + * test cases. + * + * @author $Author: maroy $ + * @version $Revision: 1.1 $ + */ +class BaseTestMethod : public LiveSupport::Core::BaseTestMethod +{ + private: + /** + * The XML-RPC host name to connect to. + */ + static std::string xmlRpcHost; + + /** + * The XML-RPC port to connect to. + */ + static unsigned int xmlRpcPort; + + /** + * A flag to indicate if configuration has already been done. + */ + static bool configured; + + + public: + + /** + * Function to read configuration information, and fill out + * relevant attributes, such as the XML-RPC port and host. + * + * @param configFileName the name of the configuration file to read. + * @exception std::exception in case of errors reading the + * configuration file + */ + static void + configure(std::string configFileName) + throw (std::exception); + + /** + * Return the XML-RPC port to connect to. + * + * @return the XML-RPC port to connect to. + */ + static unsigned int + getXmlRpcPort(void) throw () + { + return xmlRpcPort; + } + + /** + * Return the XML-RPC host to connect to. + * + * @return the XML-RPC host to connect to. + */ + static std::string + getXmlRpcHost(void) throw () + { + return xmlRpcHost; + } +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Scheduler +} // namespace LiveSupport + +#endif // BaseTestMethod_h + diff --git a/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx b/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx index 5954c984b..9d3842aa2 100644 --- a/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.15 $ + Author : $Author: maroy $ + Version : $Revision: 1.16 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -48,6 +48,7 @@ #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "SchedulerDaemon.h" #include "CreatePlaylistMethod.h" #include "OpenPlaylistForEditingMethod.h" #include "CreatePlaylistMethodTest.h" @@ -67,69 +68,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(CreatePlaylistMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string CreatePlaylistMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string CreatePlaylistMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string CreatePlaylistMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -CreatePlaylistMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void CreatePlaylistMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -138,7 +93,7 @@ CreatePlaylistMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/CreatePlaylistMethodTest.h b/livesupport/products/scheduler/src/CreatePlaylistMethodTest.h index 71bbd6932..68638a035 100644 --- a/livesupport/products/scheduler/src/CreatePlaylistMethodTest.h +++ b/livesupport/products/scheduler/src/CreatePlaylistMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.6 $ + Author : $Author: maroy $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,11 +64,11 @@ using namespace LiveSupport::Authentication; /** * Unit test for the CreatePlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.6 $ + * @author $Author: maroy $ + * @version $Revision: 1.7 $ * @see CreatePlaylistMethod */ -class CreatePlaylistMethodTest : public CPPUNIT_NS::TestFixture +class CreatePlaylistMethodTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(CreatePlaylistMethodTest); CPPUNIT_TEST(firstTest); @@ -75,23 +76,6 @@ class CreatePlaylistMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,20 +86,6 @@ class CreatePlaylistMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - protected: diff --git a/livesupport/products/scheduler/src/DeletePlaylistMethodTest.cxx b/livesupport/products/scheduler/src/DeletePlaylistMethodTest.cxx index 61040d91e..774cc1179 100644 --- a/livesupport/products/scheduler/src/DeletePlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/DeletePlaylistMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.9 $ + Author : $Author: maroy $ + Version : $Revision: 1.10 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -48,6 +48,7 @@ #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "SchedulerDaemon.h" #include "OpenPlaylistForEditingMethod.h" #include "SavePlaylistMethod.h" @@ -68,69 +69,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(DeletePlaylistMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string DeletePlaylistMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string DeletePlaylistMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string DeletePlaylistMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -DeletePlaylistMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void DeletePlaylistMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -139,7 +94,7 @@ DeletePlaylistMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/DeletePlaylistMethodTest.h b/livesupport/products/scheduler/src/DeletePlaylistMethodTest.h index ea69a57f9..6e7359ce6 100644 --- a/livesupport/products/scheduler/src/DeletePlaylistMethodTest.h +++ b/livesupport/products/scheduler/src/DeletePlaylistMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -65,10 +66,10 @@ using namespace LiveSupport::Authentication; * * @author $Author: maroy, fgerlits $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * @see DeletePlaylistMethod */ -class DeletePlaylistMethodTest : public CPPUNIT_NS::TestFixture +class DeletePlaylistMethodTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(DeletePlaylistMethodTest); CPPUNIT_TEST(firstTest); @@ -77,23 +78,6 @@ class DeletePlaylistMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -104,20 +88,6 @@ class DeletePlaylistMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - protected: diff --git a/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx b/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx index e5e596741..4235b5c61 100644 --- a/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx +++ b/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.11 $ + Author : $Author: maroy $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -48,6 +48,7 @@ #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "SchedulerDaemon.h" #include "DisplayAudioClipMethod.h" #include "DisplayAudioClipMethodTest.h" @@ -65,69 +66,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(DisplayAudioClipMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string DisplayAudioClipMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string DisplayAudioClipMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string DisplayAudioClipMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -DisplayAudioClipMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void DisplayAudioClipMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -136,7 +91,7 @@ DisplayAudioClipMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { @@ -192,7 +147,7 @@ DisplayAudioClipMethodTest :: firstTest(void) Ptr::Ref audioClip; CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result))); CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10001); - CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 60 * 60); + CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 11); } diff --git a/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.h b/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.h index 29e586dc9..f8db9888f 100644 --- a/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.h +++ b/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,11 +64,11 @@ using namespace LiveSupport::Authentication; /** * Unit test for the DisplayAudioClipMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see DisplayAudioClipMethod */ -class DisplayAudioClipMethodTest : public CPPUNIT_NS::TestFixture +class DisplayAudioClipMethodTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(DisplayAudioClipMethodTest); CPPUNIT_TEST(firstTest); @@ -76,23 +77,6 @@ class DisplayAudioClipMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -103,20 +87,6 @@ class DisplayAudioClipMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - protected: diff --git a/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx b/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx index 596cf62fc..fab8926a8 100644 --- a/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx +++ b/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.11 $ + Author : $Author: maroy $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -49,6 +49,7 @@ #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "SchedulerDaemon.h" #include "DisplayAudioClipsMethod.h" #include "DisplayAudioClipsMethodTest.h" @@ -66,69 +67,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(DisplayAudioClipsMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string DisplayAudioClipsMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string DisplayAudioClipsMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string DisplayAudioClipsMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -DisplayAudioClipsMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void DisplayAudioClipsMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -137,7 +92,7 @@ DisplayAudioClipsMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { @@ -193,7 +148,7 @@ DisplayAudioClipsMethodTest :: firstTest(void) Ptr::Ref audioClip; CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result0))); CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10001); - CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 60 * 60); + CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 11); XmlRpc::XmlRpcValue result1 = result[1]; CPPUNIT_ASSERT(result1.hasMember("audioClip")); @@ -201,6 +156,6 @@ DisplayAudioClipsMethodTest :: firstTest(void) == XmlRpc::XmlRpcValue::TypeString); CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result1))); CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10002); - CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 30 * 60); + CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 12); } diff --git a/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.h b/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.h index d555f5d59..5f5576208 100644 --- a/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.h +++ b/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,11 +64,11 @@ using namespace LiveSupport::Authentication; /** * Unit test for the DisplayAudioClipsMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see DisplayAudioClipsMethod */ -class DisplayAudioClipsMethodTest : public CPPUNIT_NS::TestFixture +class DisplayAudioClipsMethodTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(DisplayAudioClipsMethodTest); CPPUNIT_TEST(firstTest); @@ -75,23 +76,6 @@ class DisplayAudioClipsMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,20 +86,6 @@ class DisplayAudioClipsMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - protected: diff --git a/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx index 078269a73..4144922ed 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.11 $ + Author : $Author: maroy $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -48,6 +48,7 @@ #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "SchedulerDaemon.h" #include "DisplayPlaylistMethod.h" #include "DisplayPlaylistMethodTest.h" @@ -65,69 +66,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(DisplayPlaylistMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string DisplayPlaylistMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string DisplayPlaylistMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string DisplayPlaylistMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -DisplayPlaylistMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void DisplayPlaylistMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -136,7 +91,7 @@ DisplayPlaylistMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.h b/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.h index 970362d7d..d07caacb9 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.h +++ b/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the DisplayPlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see DisplayPlaylistMethod */ class DisplayPlaylistMethodTest : public CPPUNIT_NS::TestFixture @@ -76,23 +77,6 @@ class DisplayPlaylistMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -103,20 +87,6 @@ class DisplayPlaylistMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - protected: diff --git a/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx b/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx index 71c809b01..ade01076d 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx +++ b/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.11 $ + Author : $Author: maroy $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -49,6 +49,7 @@ #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "SchedulerDaemon.h" #include "DisplayPlaylistsMethod.h" #include "DisplayPlaylistsMethodTest.h" @@ -66,69 +67,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(DisplayPlaylistsMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string DisplayPlaylistsMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string DisplayPlaylistsMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string DisplayPlaylistsMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -DisplayPlaylistsMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void DisplayPlaylistsMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -137,7 +92,7 @@ DisplayPlaylistsMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { @@ -184,14 +139,25 @@ DisplayPlaylistsMethodTest :: firstTest(void) << " - " << e.getMessage(); CPPUNIT_FAIL(eMsg.str()); } - CPPUNIT_ASSERT(result.size() == 1); - XmlRpc::XmlRpcValue result0 = result[0]; + CPPUNIT_ASSERT(result.size() == 2); + XmlRpc::XmlRpcValue result0; + Ptr::Ref playlist; + // check the first returned playlist + result0 = result[0]; CPPUNIT_ASSERT(result0.hasMember("playlist")); CPPUNIT_ASSERT(result0["playlist"].getType() == XmlRpc::XmlRpcValue::TypeString); - Ptr::Ref playlist; CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result0))); CPPUNIT_ASSERT(playlist->getId()->getId() == 1); CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60); + + // check the second returned playlist + result0 = result[1]; + CPPUNIT_ASSERT(result0.hasMember("playlist")); + CPPUNIT_ASSERT(result0["playlist"].getType() + == XmlRpc::XmlRpcValue::TypeString); + CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result0))); + CPPUNIT_ASSERT(playlist->getId()->getId() == 2); + CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 29); } diff --git a/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.h b/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.h index 1552d2da3..ef066f8e7 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.h +++ b/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the DisplayPlaylistsMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see DisplayPlaylistsMethod */ class DisplayPlaylistsMethodTest : public CPPUNIT_NS::TestFixture @@ -75,23 +76,6 @@ class DisplayPlaylistsMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,20 +86,6 @@ class DisplayPlaylistsMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - protected: diff --git a/livesupport/products/scheduler/src/DisplayScheduleMethodTest.cxx b/livesupport/products/scheduler/src/DisplayScheduleMethodTest.cxx index 56887e37f..4ca96a00a 100644 --- a/livesupport/products/scheduler/src/DisplayScheduleMethodTest.cxx +++ b/livesupport/products/scheduler/src/DisplayScheduleMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.10 $ + Author : $Author: maroy $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayScheduleMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -48,6 +48,7 @@ #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "SchedulerDaemon.h" #include "ScheduleFactory.h" #include "UploadPlaylistMethod.h" #include "DisplayScheduleMethod.h" @@ -69,81 +70,26 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(DisplayScheduleMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string DisplayScheduleMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string DisplayScheduleMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the schedule factory. - */ -const std::string DisplayScheduleMethodTest::scheduleConfig = - "etc/scheduleFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string DisplayScheduleMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -DisplayScheduleMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void DisplayScheduleMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - Ptr::Ref - sf = ScheduleFactory::getInstance(); - configure(sf, scheduleConfig); - schedule = sf->getSchedule(); + schedule = scheduler->getSchedule(); schedule->install(); - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -152,7 +98,7 @@ DisplayScheduleMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/DisplayScheduleMethodTest.h b/livesupport/products/scheduler/src/DisplayScheduleMethodTest.h index 1bd311e4e..19956c14a 100644 --- a/livesupport/products/scheduler/src/DisplayScheduleMethodTest.h +++ b/livesupport/products/scheduler/src/DisplayScheduleMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayScheduleMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the DisplayScheduleMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see DisplayScheduleMethod */ class DisplayScheduleMethodTest : public CPPUNIT_NS::TestFixture @@ -76,33 +77,11 @@ class DisplayScheduleMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the schedule factory. - */ - static const std::string scheduleConfig; - /** * The schedule used during the test. */ Ptr::Ref schedule; - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -113,21 +92,6 @@ class DisplayScheduleMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - - /** * Insert some entries into the schedule to provide test data. */ diff --git a/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.cxx b/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.cxx index a823fe770..6a897f114 100644 --- a/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.cxx +++ b/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.8 $ + Author : $Author: maroy $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -48,6 +48,7 @@ #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "SchedulerDaemon.h" #include "PlayLogFactory.h" #include "UploadPlaylistMethod.h" #include "GeneratePlayReportMethod.h" @@ -68,83 +69,28 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(GeneratePlayReportMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string GeneratePlayReportMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string GeneratePlayReportMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the play log factory. - */ -const std::string GeneratePlayReportMethodTest::playLogConfig = - "etc/playLogFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string GeneratePlayReportMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -GeneratePlayReportMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void GeneratePlayReportMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - Ptr::Ref plf = PlayLogFactory::getInstance(); - configure(plf, playLogConfig); - - playLog = plf->getPlayLog(); + playLog = scheduler->getPlayLog(); playLog->install(); insertEntries(); - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -153,7 +99,7 @@ GeneratePlayReportMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.h b/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.h index dfe4fa027..0e3474508 100644 --- a/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.h +++ b/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the GeneratePlayReportMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see GeneratePlayReportMethod */ class GeneratePlayReportMethodTest : public CPPUNIT_NS::TestFixture @@ -76,33 +77,11 @@ class GeneratePlayReportMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the play log factory. - */ - static const std::string playLogConfig; - /** * The play log used during the test. */ Ptr::Ref playLog; - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -113,21 +92,6 @@ class GeneratePlayReportMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - - /** * Insert some entries into the play log to provide test data. */ diff --git a/livesupport/products/scheduler/src/GetSchedulerTimeMethodTest.h b/livesupport/products/scheduler/src/GetSchedulerTimeMethodTest.h index 44e377987..e8cd4d5ad 100644 --- a/livesupport/products/scheduler/src/GetSchedulerTimeMethodTest.h +++ b/livesupport/products/scheduler/src/GetSchedulerTimeMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GetSchedulerTimeMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -41,6 +41,7 @@ #endif #include +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -59,8 +60,8 @@ using namespace LiveSupport::Core; /** * Unit test to test the getSchedulerTime XML-RPC call. * - * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @author $Author: maroy $ + * @version $Revision: 1.4 $ * @see SchedulerDaemon */ class GetSchedulerTimeMethodTest : public CPPUNIT_NS::TestFixture diff --git a/livesupport/products/scheduler/src/GetVersionMethodTest.h b/livesupport/products/scheduler/src/GetVersionMethodTest.h index 43f9c5984..2330e1202 100644 --- a/livesupport/products/scheduler/src/GetVersionMethodTest.h +++ b/livesupport/products/scheduler/src/GetVersionMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Author : $Author: maroy $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GetVersionMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the GetVersionMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.2 $ + * @author $Author: maroy $ + * @version $Revision: 1.3 $ * @see GetVersionMethod */ class GetVersionMethodTest : public CPPUNIT_NS::TestFixture diff --git a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx index c1ca7e310..27f818d95 100644 --- a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx +++ b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.16 $ + Author : $Author: maroy $ + Version : $Revision: 1.17 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -49,6 +49,7 @@ #include "LiveSupport/Authentication/AuthenticationClientFactory.h" #include "LiveSupport/Core/XmlRpcTools.h" +#include "SchedulerDaemon.h" #include "OpenPlaylistForEditingMethod.h" #include "OpenPlaylistForEditingMethodTest.h" @@ -66,69 +67,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(OpenPlaylistForEditingMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string OpenPlaylistForEditingMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string OpenPlaylistForEditingMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string OpenPlaylistForEditingMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -OpenPlaylistForEditingMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void OpenPlaylistForEditingMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -137,7 +92,7 @@ OpenPlaylistForEditingMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.h b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.h index c4aa3329a..8063f90d7 100644 --- a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.h +++ b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.6 $ + Author : $Author: maroy $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the OpenPlaylistForEditingMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.6 $ + * @author $Author: maroy $ + * @version $Revision: 1.7 $ * @see OpenPlaylistForEditingMethod */ class OpenPlaylistForEditingMethodTest : public CPPUNIT_NS::TestFixture @@ -75,23 +76,6 @@ class OpenPlaylistForEditingMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,19 +86,6 @@ class OpenPlaylistForEditingMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); protected: diff --git a/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx b/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx index 99a67add3..0ef0805df 100644 --- a/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx +++ b/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -49,6 +49,7 @@ #include "LiveSupport/Authentication/AuthenticationClientFactory.h" #include "PlayLogFactory.h" +#include "SchedulerDaemon.h" #include "PlaylistEventContainer.h" #include "PlaylistEventContainerTest.h" @@ -70,38 +71,6 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(PlaylistEventContainerTest); -/** - * The name of the configuration file for the audio player - */ -static const std::string audioPlayerConfigFileName = "etc/audioPlayer.xml"; - -/** - * The name of the configuration file for the connection manager - */ -static const std::string connectionManagerConfigFileName = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the storage client - */ -static const std::string storageClientConfigFileName = "etc/storageClient.xml"; - -/** - * The name of the configuration file for the schedule factory - */ -static const std::string scheduleConfigFileName = "etc/scheduleFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -static const std::string authenticationClientConfigFileName = - "etc/authenticationClient.xml"; - -/** - * The name of the configuration file for the play log factory. - */ -static const std::string playLogConfigFileName = "etc/playLogFactory.xml"; - /* =============================================== local function prototypes */ @@ -114,52 +83,14 @@ static const std::string playLogConfigFileName = "etc/playLogFactory.xml"; void PlaylistEventContainerTest :: setUp(void) throw () { + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - Ptr::Ref parser; - - // configure the audio player factory - Ptr::Ref apf = AudioPlayerFactory::getInstance(); - parser.reset(new xmlpp::DomParser(audioPlayerConfigFileName, true)); - apf->configure(*(parser->get_document()->get_root_node())); - - audioPlayer = apf->getAudioPlayer(); - - // configure the connection manager factory - Ptr::Ref cmf = - ConnectionManagerFactory::getInstance(); - parser.reset(new xmlpp::DomParser(connectionManagerConfigFileName, - true)); - cmf->configure(*(parser->get_document()->get_root_node())); - - // configure the storage client factory - Ptr::Ref scf = - StorageClientFactory::getInstance(); - parser.reset(new xmlpp::DomParser(storageClientConfigFileName, true)); - scf->configure(*(parser->get_document()->get_root_node())); - - storage = scf->getStorageClient(); + audioPlayer = scheduler->getAudioPlayer(); + storage = scheduler->getStorage(); storage->reset(); - - // configure the schedule factory - scheduleFactory = ScheduleFactory::getInstance(); - parser.reset(new xmlpp::DomParser(scheduleConfigFileName, true)); - scheduleFactory->configure(*(parser->get_document()->get_root_node())); - - schedule = scheduleFactory->getSchedule(); - - // get an authentication client - Ptr::Ref acf; - acf = AuthenticationClientFactory::getInstance(); - parser.reset(new xmlpp::DomParser(authenticationClientConfigFileName, - true)); - acf->configure(*(parser->get_document()->get_root_node())); - authentication = acf->getAuthenticationClient(); - - // get an playlog factory - Ptr::Ref plf = PlayLogFactory::getInstance(); - parser.reset(new xmlpp::DomParser(playLogConfigFileName, true)); - plf->configure(*(parser->get_document()->get_root_node())); - playLog = plf->getPlayLog(); + schedule = scheduler->getSchedule(); + authentication = scheduler->getAuthentication(); + playLog = scheduler->getPlayLog(); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; @@ -168,9 +99,8 @@ PlaylistEventContainerTest :: setUp(void) throw () std::cerr << e.what() << std::endl; CPPUNIT_FAIL("error parsing configuration file"); } - try { - scheduleFactory->install(); + schedule->install(); playLog->install(); } catch (std::exception &e) { std::cerr << e.what() << std::endl; @@ -191,12 +121,11 @@ void PlaylistEventContainerTest :: tearDown(void) throw () { audioPlayer->deInitialize(); - scheduleFactory->uninstall(); + schedule->uninstall(); playLog->uninstall(); playLog.reset(); schedule.reset(); - scheduleFactory.reset(); storage.reset(); audioPlayer.reset(); diff --git a/livesupport/products/scheduler/src/PlaylistEventContainerTest.h b/livesupport/products/scheduler/src/PlaylistEventContainerTest.h index 18a3fad8d..e8dd1edb4 100644 --- a/livesupport/products/scheduler/src/PlaylistEventContainerTest.h +++ b/livesupport/products/scheduler/src/PlaylistEventContainerTest.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventContainerTest.h,v $ ------------------------------------------------------------------------------*/ @@ -50,6 +50,7 @@ #include "ScheduleInterface.h" #include "PlayLogInterface.h" #include "ScheduleFactory.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -76,7 +77,7 @@ using namespace LiveSupport::Storage; * Unit test for the PlaylistEventContainer class * * @author $Author: maroy $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * @see PlaylistEventContainer */ class PlaylistEventContainerTest : public CPPUNIT_NS::TestFixture @@ -97,11 +98,6 @@ class PlaylistEventContainerTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref storage; - /** - * The schedule factory used in the test. - */ - Ptr::Ref scheduleFactory; - /** * The schedule used by the container. */ diff --git a/livesupport/products/scheduler/src/PlaylistEventTest.cxx b/livesupport/products/scheduler/src/PlaylistEventTest.cxx index 91939c708..8369c1af4 100644 --- a/livesupport/products/scheduler/src/PlaylistEventTest.cxx +++ b/livesupport/products/scheduler/src/PlaylistEventTest.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -46,8 +46,9 @@ #include "LiveSupport/Authentication/AuthenticationClientFactory.h" #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/PlaylistExecutor/AudioPlayerFactory.h" -#include "PlayLogFactory.h" +#include "SchedulerDaemon.h" +#include "PlayLogFactory.h" #include "PlaylistEvent.h" #include "PlaylistEventTest.h" @@ -67,27 +68,6 @@ using namespace LiveSupport::Scheduler; CPPUNIT_TEST_SUITE_REGISTRATION(PlaylistEventTest); -/** - * The name of the configuration file for the audio player - */ -static const std::string audioPlayerConfigFileName = "etc/audioPlayer.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -static const std::string authenticationClientConfigFileName = - "etc/authenticationClient.xml"; - -/** - * The name of the configuration file for the storage client - */ -static const std::string storageClientConfigFileName = "etc/storageClient.xml"; - -/** - * The name of the configuration file for the play log factory. - */ -static const std::string playLogConfigFileName = "etc/playLogFactory.xml"; - /* =============================================== local function prototypes */ @@ -100,38 +80,13 @@ static const std::string playLogConfigFileName = "etc/playLogFactory.xml"; void PlaylistEventTest :: setUp(void) throw () { + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - Ptr::Ref parser; - - // configure the audio player factory - Ptr::Ref apf = AudioPlayerFactory::getInstance(); - parser.reset(new xmlpp::DomParser(audioPlayerConfigFileName, true)); - apf->configure(*(parser->get_document()->get_root_node())); - - audioPlayer = apf->getAudioPlayer(); - - // configure the storage client factory - Ptr::Ref scf = - StorageClientFactory::getInstance(); - parser.reset(new xmlpp::DomParser(storageClientConfigFileName, true)); - scf->configure(*(parser->get_document()->get_root_node())); - - storage = scf->getStorageClient(); + audioPlayer = scheduler->getAudioPlayer(); + storage = scheduler->getStorage(); storage->reset(); - - // get an authentication client - Ptr::Ref acf; - acf = AuthenticationClientFactory::getInstance(); - parser.reset(new xmlpp::DomParser(authenticationClientConfigFileName, - true)); - acf->configure(*(parser->get_document()->get_root_node())); - authentication = acf->getAuthenticationClient(); - - // get an playlog factory - Ptr::Ref plf = PlayLogFactory::getInstance(); - parser.reset(new xmlpp::DomParser(playLogConfigFileName, true)); - plf->configure(*(parser->get_document()->get_root_node())); - playLog = plf->getPlayLog(); + authentication = scheduler->getAuthentication(); + playLog = scheduler->getPlayLog(); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; diff --git a/livesupport/products/scheduler/src/PlaylistEventTest.h b/livesupport/products/scheduler/src/PlaylistEventTest.h index 9e1718c13..248639bd1 100644 --- a/livesupport/products/scheduler/src/PlaylistEventTest.h +++ b/livesupport/products/scheduler/src/PlaylistEventTest.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventTest.h,v $ ------------------------------------------------------------------------------*/ @@ -47,6 +47,7 @@ #include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h" #include "PlayLogInterface.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -70,7 +71,7 @@ using namespace LiveSupport::PlaylistExecutor; * Unit test for the PlaylistEvent class * * @author $Author: maroy $ - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * @see PlaylistEvent */ class PlaylistEventTest : public CPPUNIT_NS::TestFixture diff --git a/livesupport/products/scheduler/src/PostgresqlPlayLogTest.cxx b/livesupport/products/scheduler/src/PostgresqlPlayLogTest.cxx index cb6313033..184404b11 100644 --- a/livesupport/products/scheduler/src/PostgresqlPlayLogTest.cxx +++ b/livesupport/products/scheduler/src/PostgresqlPlayLogTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PostgresqlPlayLogTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include #include "LiveSupport/Db/ConnectionManagerFactory.h" +#include "SchedulerDaemon.h" #include "PostgresqlPlayLog.h" #include "PostgresqlPlayLogTest.h" @@ -59,11 +60,6 @@ using namespace LiveSupport::Scheduler; CPPUNIT_TEST_SUITE_REGISTRATION(PostgresqlPlayLogTest); -/** - * The name of the configuration file for the connection manager factory. - */ -static const std::string configFileName = "etc/connectionManagerFactory.xml"; - /* =============================================== local function prototypes */ @@ -76,16 +72,9 @@ static const std::string configFileName = "etc/connectionManagerFactory.xml"; void PostgresqlPlayLogTest :: setUp(void) throw () { + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - Ptr::Ref parser( - new xmlpp::DomParser(configFileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - Ptr::Ref cmf = - ConnectionManagerFactory::getInstance(); - cmf->configure(*root); - cm = cmf->getConnectionManager(); + cm = scheduler->getConnectionManager(); playLog.reset(new PostgresqlPlayLog(cm)); playLog->install(); diff --git a/livesupport/products/scheduler/src/PostgresqlPlayLogTest.h b/livesupport/products/scheduler/src/PostgresqlPlayLogTest.h index 5c73e5a9a..b4d46901c 100644 --- a/livesupport/products/scheduler/src/PostgresqlPlayLogTest.h +++ b/livesupport/products/scheduler/src/PostgresqlPlayLogTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PostgresqlPlayLogTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Db/ConnectionManagerInterface.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Core; /** * Unit test for the PostgresqlPlayLog class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @author $Author: maroy $ + * @version $Revision: 1.2 $ * @see PostgresqlPlayLog */ class PostgresqlPlayLogTest : public CPPUNIT_NS::TestFixture diff --git a/livesupport/products/scheduler/src/PostgresqlScheduleTest.cxx b/livesupport/products/scheduler/src/PostgresqlScheduleTest.cxx index ff1cc654d..4ab6a76d3 100644 --- a/livesupport/products/scheduler/src/PostgresqlScheduleTest.cxx +++ b/livesupport/products/scheduler/src/PostgresqlScheduleTest.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PostgresqlScheduleTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include #include "LiveSupport/Db/ConnectionManagerFactory.h" +#include "SchedulerDaemon.h" #include "PostgresqlSchedule.h" #include "PostgresqlScheduleTest.h" @@ -59,11 +60,6 @@ using namespace LiveSupport::Scheduler; CPPUNIT_TEST_SUITE_REGISTRATION(PostgresqlScheduleTest); -/** - * The name of the configuration file for the connection manager factory. - */ -static const std::string configFileName = "etc/connectionManagerFactory.xml"; - /* =============================================== local function prototypes */ @@ -76,16 +72,9 @@ static const std::string configFileName = "etc/connectionManagerFactory.xml"; void PostgresqlScheduleTest :: setUp(void) throw () { + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - Ptr::Ref parser( - new xmlpp::DomParser(configFileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - Ptr::Ref cmf = - ConnectionManagerFactory::getInstance(); - cmf->configure(*root); - cm = cmf->getConnectionManager(); + cm = scheduler->getConnectionManager(); schedule.reset(new PostgresqlSchedule(cm)); schedule->install(); diff --git a/livesupport/products/scheduler/src/PostgresqlScheduleTest.h b/livesupport/products/scheduler/src/PostgresqlScheduleTest.h index 6ac281cc5..2948ce086 100644 --- a/livesupport/products/scheduler/src/PostgresqlScheduleTest.h +++ b/livesupport/products/scheduler/src/PostgresqlScheduleTest.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PostgresqlScheduleTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Db/ConnectionManagerInterface.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -64,7 +65,7 @@ using namespace LiveSupport::Core; * Unit test for the PostgresqlSchedule class. * * @author $Author: maroy $ - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * @see PostgresqlSchedule */ class PostgresqlScheduleTest : public CPPUNIT_NS::TestFixture diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx index 5e904ba7c..e804fa3be 100644 --- a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.13 $ + Author : $Author: maroy $ + Version : $Revision: 1.14 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -49,6 +49,7 @@ #include "LiveSupport/Authentication/AuthenticationClientFactory.h" #include "LiveSupport/Core/XmlRpcTools.h" +#include "SchedulerDaemon.h" #include "OpenPlaylistForEditingMethod.h" #include "AddAudioClipToPlaylistMethod.h" #include "RemoveAudioClipFromPlaylistMethod.h" @@ -69,71 +70,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(RemoveAudioClipFromPlaylistMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string RemoveAudioClipFromPlaylistMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string - RemoveAudioClipFromPlaylistMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string - RemoveAudioClipFromPlaylistMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -RemoveAudioClipFromPlaylistMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void -RemoveAudioClipFromPlaylistMethodTest :: setUp(void) throw () +RemoveAudioClipFromPlaylistMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -142,7 +95,7 @@ RemoveAudioClipFromPlaylistMethodTest :: setUp(void) thr CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.h b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.h index af26fba19..6f98e78f7 100644 --- a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.h +++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the RemoveAudioClipFromPlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see RemoveAudioClipFromPlaylistMethod */ class RemoveAudioClipFromPlaylistMethodTest : public CPPUNIT_NS::TestFixture @@ -75,23 +76,6 @@ class RemoveAudioClipFromPlaylistMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,19 +86,6 @@ class RemoveAudioClipFromPlaylistMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); protected: diff --git a/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.cxx b/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.cxx index ed994af7d..818ab1cc9 100644 --- a/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.cxx +++ b/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.8 $ + Author : $Author: maroy $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -46,14 +46,17 @@ #include "ScheduleFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "LiveSupport/Storage/StorageClientFactory.h" +#include "SchedulerDaemon.h" #include "UploadPlaylistMethod.h" #include "RemoveFromScheduleMethod.h" #include "RemoveFromScheduleMethodTest.h" -using namespace LiveSupport::Scheduler; using namespace LiveSupport::Authentication; +using namespace LiveSupport::Storage; +using namespace LiveSupport::Scheduler; /* =================================================== local data structures */ @@ -63,59 +66,26 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(RemoveFromScheduleMethodTest); -/** - * The name of the configuration file for the schedule factory. - */ -const std::string RemoveFromScheduleMethodTest::scheduleConfig = - "etc/scheduleFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string RemoveFromScheduleMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -RemoveFromScheduleMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void RemoveFromScheduleMethodTest :: setUp(void) throw () { - Ptr::Ref acf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - Ptr::Ref sf = ScheduleFactory::getInstance(); - configure(sf, scheduleConfig); + Ptr::Ref storage = scheduler->getStorage(); + storage->reset(); - schedule = sf->getSchedule(); + schedule = scheduler->getSchedule(); schedule->install(); - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -124,7 +94,7 @@ RemoveFromScheduleMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.h b/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.h index d9635505b..a8cf63ba6 100644 --- a/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.h +++ b/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the RemoveFromScheduleMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see RemoveFromScheduleMethod */ class RemoveFromScheduleMethodTest : public CPPUNIT_NS::TestFixture @@ -76,22 +77,11 @@ class RemoveFromScheduleMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the schedule factory. - */ - static const std::string scheduleConfig; - /** * The schedule used during the test. */ Ptr::Ref schedule; - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,20 +92,6 @@ class RemoveFromScheduleMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - protected: diff --git a/livesupport/products/scheduler/src/RescheduleMethodTest.cxx b/livesupport/products/scheduler/src/RescheduleMethodTest.cxx index 123ce61de..b22ecd9cf 100644 --- a/livesupport/products/scheduler/src/RescheduleMethodTest.cxx +++ b/livesupport/products/scheduler/src/RescheduleMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.8 $ + Author : $Author: maroy $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RescheduleMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -48,6 +48,7 @@ #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "SchedulerDaemon.h" #include "ScheduleFactory.h" #include "UploadPlaylistMethod.h" #include "RescheduleMethod.h" @@ -65,59 +66,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(RescheduleMethodTest); -/** - * The name of the configuration file for the schedule factory. - */ -const std::string RescheduleMethodTest::scheduleConfig = - "etc/scheduleFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string RescheduleMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -RescheduleMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void RescheduleMethodTest :: setUp(void) throw () { - Ptr::Ref acf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - Ptr::Ref sf = ScheduleFactory::getInstance(); - configure(sf, scheduleConfig); - - schedule = sf->getSchedule(); + schedule = scheduler->getSchedule(); schedule->install(); - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -126,7 +91,7 @@ RescheduleMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/RescheduleMethodTest.h b/livesupport/products/scheduler/src/RescheduleMethodTest.h index 8ddea5a79..6bbd19de1 100644 --- a/livesupport/products/scheduler/src/RescheduleMethodTest.h +++ b/livesupport/products/scheduler/src/RescheduleMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RescheduleMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the RescheduleMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see RescheduleMethod */ class RescheduleMethodTest : public CPPUNIT_NS::TestFixture @@ -75,22 +76,11 @@ class RescheduleMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the schedule factory. - */ - static const std::string scheduleConfig; - /** * The schedule used during the test. */ Ptr::Ref schedule; - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -101,20 +91,6 @@ class RescheduleMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - protected: diff --git a/livesupport/products/scheduler/src/ResetStorageMethodTest.cxx b/livesupport/products/scheduler/src/ResetStorageMethodTest.cxx index 7005cb889..dc591f79a 100644 --- a/livesupport/products/scheduler/src/ResetStorageMethodTest.cxx +++ b/livesupport/products/scheduler/src/ResetStorageMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Author : $Author: maroy $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ResetStorageMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -77,7 +77,10 @@ ResetStorageMethodTest :: firstTest(void) XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); diff --git a/livesupport/products/scheduler/src/ResetStorageMethodTest.h b/livesupport/products/scheduler/src/ResetStorageMethodTest.h index 469d378a5..d395fd21e 100644 --- a/livesupport/products/scheduler/src/ResetStorageMethodTest.h +++ b/livesupport/products/scheduler/src/ResetStorageMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ResetStorageMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -42,6 +42,8 @@ #include +#include "BaseTestMethod.h" + namespace LiveSupport { namespace Scheduler { @@ -57,17 +59,17 @@ namespace Scheduler { /** * Unit test for the ResetStorageMethod class. * - * @author $Author: maroy, fgerlits - $ - * @version $Revision: 1.1 $ + * @author $Author: maroy $ + * @version $Revision: 1.2 $ * @see ResetStorageMethod */ -class ResetStorageMethodTest : public CPPUNIT_NS::TestFixture +class ResetStorageMethodTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(ResetStorageMethodTest); CPPUNIT_TEST(firstTest); CPPUNIT_TEST_SUITE_END(); + protected: /** diff --git a/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx index b91614541..e209afeb4 100644 --- a/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.10 $ + Author : $Author: maroy $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -48,6 +48,7 @@ #include "LiveSupport/Storage/StorageClientFactory.h" #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "SchedulerDaemon.h" #include "OpenPlaylistForEditingMethod.h" #include "RemoveAudioClipFromPlaylistMethod.h" #include "SavePlaylistMethod.h" @@ -69,69 +70,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(RevertEditedPlaylistMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string RevertEditedPlaylistMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string RevertEditedPlaylistMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string RevertEditedPlaylistMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -RevertEditedPlaylistMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void RevertEditedPlaylistMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -140,7 +95,7 @@ RevertEditedPlaylistMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.h b/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.h index 04d4d57cd..ce04b698e 100644 --- a/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.h +++ b/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the RevertEditedPlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see RevertEditedPlaylistMethod */ class RevertEditedPlaylistMethodTest : public CPPUNIT_NS::TestFixture @@ -75,23 +76,6 @@ class RevertEditedPlaylistMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,19 +86,6 @@ class RevertEditedPlaylistMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); protected: diff --git a/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx b/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx index 82ee5f1cc..5e5dd483d 100644 --- a/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.13 $ + Author : $Author: maroy $ + Version : $Revision: 1.14 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcAddAudioClipToPlaylistTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcAddAudioClipToPlaylistTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -109,7 +115,10 @@ RpcAddAudioClipToPlaylistTest :: firstTest(void) XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000000001"; diff --git a/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.h b/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.h index a04e2ef75..6e5b95af9 100644 --- a/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.h +++ b/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the AddAudioClipToPlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @author $Author: maroy $ + * @version $Revision: 1.4 $ * @see AddAudioClipToPlaylistMethod */ -class RpcAddAudioClipToPlaylistTest : public CPPUNIT_NS::TestFixture +class RpcAddAudioClipToPlaylistTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcAddAudioClipToPlaylistTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx b/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx index fa9299298..753893034 100644 --- a/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.6 $ + Author : $Author: maroy $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcCreatePlaylistTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcCreatePlaylistTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -109,7 +115,10 @@ RpcCreatePlaylistTest :: firstTest(void) XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); result.clear(); diff --git a/livesupport/products/scheduler/src/RpcCreatePlaylistTest.h b/livesupport/products/scheduler/src/RpcCreatePlaylistTest.h index 084158123..30cbbf248 100644 --- a/livesupport/products/scheduler/src/RpcCreatePlaylistTest.h +++ b/livesupport/products/scheduler/src/RpcCreatePlaylistTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcCreatePlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the CreatePlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @author $Author: maroy $ + * @version $Revision: 1.4 $ * @see CreatePlaylistMethod */ -class RpcCreatePlaylistTest : public CPPUNIT_NS::TestFixture +class RpcCreatePlaylistTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcCreatePlaylistTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcDeletePlaylistTest.cxx b/livesupport/products/scheduler/src/RpcDeletePlaylistTest.cxx index abd6b4cd5..93e6952e9 100644 --- a/livesupport/products/scheduler/src/RpcDeletePlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcDeletePlaylistTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Author : $Author: maroy $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/RpcDeletePlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcDeletePlaylistTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcDeletePlaylistTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -106,7 +112,10 @@ void RpcDeletePlaylistTest :: firstTest(void) throw (CPPUNIT_NS::Exception) { - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -142,7 +151,10 @@ void RpcDeletePlaylistTest :: negativeTest(void) throw (CPPUNIT_NS::Exception) { - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; diff --git a/livesupport/products/scheduler/src/RpcDeletePlaylistTest.h b/livesupport/products/scheduler/src/RpcDeletePlaylistTest.h index 5b574deda..97e3024e3 100644 --- a/livesupport/products/scheduler/src/RpcDeletePlaylistTest.h +++ b/livesupport/products/scheduler/src/RpcDeletePlaylistTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/RpcDeletePlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -64,10 +65,10 @@ using namespace LiveSupport::Core; * * @author $Author: maroy, fgerlits $ - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * @see DeletePlaylistMethod */ -class RpcDeletePlaylistTest : public CPPUNIT_NS::TestFixture +class RpcDeletePlaylistTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcDeletePlaylistTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx b/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx index 0b4b76527..6d6d3a355 100644 --- a/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx +++ b/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.10 $ + Author : $Author: maroy $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcDisplayAudioClipTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcDisplayAudioClipTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -106,7 +112,10 @@ void RpcDisplayAudioClipTest :: firstTest(void) throw (CPPUNIT_NS::Exception) { - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -136,7 +145,10 @@ void RpcDisplayAudioClipTest :: negativeTest(void) throw (CPPUNIT_NS::Exception) { - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; diff --git a/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.h b/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.h index 69868c1fc..aaad48d72 100644 --- a/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.h +++ b/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the DisplayAudioClipMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @author $Author: maroy $ + * @version $Revision: 1.4 $ * @see DisplayAudioClipMethod */ -class RpcDisplayAudioClipTest : public CPPUNIT_NS::TestFixture +class RpcDisplayAudioClipTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcDisplayAudioClipTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx b/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx index 82999f1fd..94827914a 100644 --- a/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx +++ b/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.7 $ + Author : $Author: maroy $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcDisplayAudioClipsTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcDisplayAudioClipsTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -106,7 +112,10 @@ void RpcDisplayAudioClipsTest :: firstTest(void) throw (CPPUNIT_NS::Exception) { - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; diff --git a/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.h b/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.h index f950cc7cd..9c51088fc 100644 --- a/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.h +++ b/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the DisplayAudioClipsMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @author $Author: maroy $ + * @version $Revision: 1.4 $ * @see RpcDisplayAudioClips */ -class RpcDisplayAudioClipsTest : public CPPUNIT_NS::TestFixture +class RpcDisplayAudioClipsTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcDisplayAudioClipsTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx b/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx index 397274065..bb3d09d7f 100644 --- a/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.12 $ + Author : $Author: maroy $ + Version : $Revision: 1.13 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcDisplayPlaylistTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcDisplayPlaylistTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -109,7 +115,10 @@ RpcDisplayPlaylistTest :: simpleTest(void) XmlRpcValue parameters; XmlRpcValue result; - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000000001"; @@ -140,7 +149,10 @@ RpcDisplayPlaylistTest :: negativeTest(void) XmlRpcValue parameters; XmlRpcValue result; - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000009999"; diff --git a/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.h b/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.h index bcb9257a2..d99ad1a97 100644 --- a/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.h +++ b/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test to test the displayPlaylist XML-RPC call. * - * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @author $Author: maroy $ + * @version $Revision: 1.4 $ * @see SchedulerDaemon */ -class RpcDisplayPlaylistTest : public CPPUNIT_NS::TestFixture +class RpcDisplayPlaylistTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcDisplayPlaylistTest); CPPUNIT_TEST(simpleTest); diff --git a/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx b/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx index 802a1f695..9ada562fa 100644 --- a/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx +++ b/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.10 $ + Author : $Author: maroy $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcDisplayPlaylistsTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcDisplayPlaylistsTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -106,7 +112,10 @@ void RpcDisplayPlaylistsTest :: firstTest(void) throw (CPPUNIT_NS::Exception) { - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; diff --git a/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.h b/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.h index b6faf6f34..090a258ed 100644 --- a/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.h +++ b/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the DisplayPlaylistsMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @author $Author: maroy $ + * @version $Revision: 1.4 $ * @see DisplayPlaylistsMethod */ -class RpcDisplayPlaylistsTest : public CPPUNIT_NS::TestFixture +class RpcDisplayPlaylistsTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcDisplayPlaylistsTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcDisplayScheduleTest.cxx b/livesupport/products/scheduler/src/RpcDisplayScheduleTest.cxx index 8a7d27656..94b3fbbf0 100644 --- a/livesupport/products/scheduler/src/RpcDisplayScheduleTest.cxx +++ b/livesupport/products/scheduler/src/RpcDisplayScheduleTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.7 $ + Author : $Author: maroy $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayScheduleTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -92,7 +92,10 @@ RpcDisplayScheduleTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -118,7 +121,10 @@ RpcDisplayScheduleTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -142,7 +148,10 @@ RpcDisplayScheduleTest :: simpleTest(void) XmlRpcValue result; struct tm time; - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); // list the schedules for an interval (as the database is empty, // it's going to return an empty result set) @@ -181,7 +190,10 @@ RpcDisplayScheduleTest :: faultTest(void) XmlRpcValue parameters; XmlRpcValue result; - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); result.clear(); xmlRpcClient.execute("displaySchedule", parameters, result); diff --git a/livesupport/products/scheduler/src/RpcDisplayScheduleTest.h b/livesupport/products/scheduler/src/RpcDisplayScheduleTest.h index 722203fff..7464977dc 100644 --- a/livesupport/products/scheduler/src/RpcDisplayScheduleTest.h +++ b/livesupport/products/scheduler/src/RpcDisplayScheduleTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayScheduleTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test to test the displaySchedule XML-RPC call. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see SchedulerDaemon */ -class RpcDisplayScheduleTest : public CPPUNIT_NS::TestFixture +class RpcDisplayScheduleTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcDisplayScheduleTest); CPPUNIT_TEST(simpleTest); diff --git a/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.cxx b/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.cxx index 6d06c78f9..502682ea6 100644 --- a/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.cxx +++ b/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -91,7 +91,10 @@ RpcGeneratePlayReportTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -117,7 +120,10 @@ RpcGeneratePlayReportTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -166,7 +172,10 @@ RpcGeneratePlayReportTest :: firstTest(void) XmlRpc::XmlRpcValue result; struct tm time; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); // set up a structure for the parameters parameters["sessionId"] = sessionId->getId(); @@ -205,7 +214,10 @@ RpcGeneratePlayReportTest :: intervalTest(void) XmlRpc::XmlRpcValue result; struct tm time; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); // check for the interval 2004-10-26 between 13 and 15 o'clock parameters["sessionId"] = sessionId->getId(); diff --git a/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.h b/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.h index b217bbcec..75264b43b 100644 --- a/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.h +++ b/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the GeneratePlayReportMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @author $Author: maroy $ + * @version $Revision: 1.2 $ * @see GeneratePlayReportMethod */ -class RpcGeneratePlayReportTest : public CPPUNIT_NS::TestFixture +class RpcGeneratePlayReportTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcGeneratePlayReportTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.cxx b/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.cxx index 48b825ff8..4bc9b96df 100644 --- a/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.cxx +++ b/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -110,7 +110,10 @@ RpcGetSchedulerTimeTest :: simpleTest(void) struct tm time1, time2; - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); result.clear(); xmlRpcClient.execute("getSchedulerTime", parameters, result); diff --git a/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.h b/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.h index f570b7109..411bc23fa 100644 --- a/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.h +++ b/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.h,v $ ------------------------------------------------------------------------------*/ @@ -42,6 +42,7 @@ #include +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -59,11 +60,11 @@ using namespace LiveSupport::Core; /** * Unit test to test the getSchedulerTime XML-RPC call. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see SchedulerDaemon */ -class RpcGetSchedulerTimeTest : public CPPUNIT_NS::TestFixture +class RpcGetSchedulerTimeTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcGetSchedulerTimeTest); CPPUNIT_TEST(simpleTest); diff --git a/livesupport/products/scheduler/src/RpcGetVersionTest.cxx b/livesupport/products/scheduler/src/RpcGetVersionTest.cxx index 951cc1a15..f0c9a0502 100644 --- a/livesupport/products/scheduler/src/RpcGetVersionTest.cxx +++ b/livesupport/products/scheduler/src/RpcGetVersionTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGetVersionTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -91,7 +91,10 @@ RpcGetVersionTest :: simpleTest(void) XmlRpcValue parameters; XmlRpcValue result; - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); result.clear(); xmlRpcClient.execute("getVersion", parameters, result); diff --git a/livesupport/products/scheduler/src/RpcGetVersionTest.h b/livesupport/products/scheduler/src/RpcGetVersionTest.h index 2542699bf..1589cf5ac 100644 --- a/livesupport/products/scheduler/src/RpcGetVersionTest.h +++ b/livesupport/products/scheduler/src/RpcGetVersionTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Author : $Author: maroy $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGetVersionTest.h,v $ ------------------------------------------------------------------------------*/ @@ -42,6 +42,7 @@ #include +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -57,11 +58,11 @@ namespace Scheduler { /** * Unit test to test the getVersion XML-RPC call. * - * @author $Author: fgerlits $ - * @version $Revision: 1.2 $ + * @author $Author: maroy $ + * @version $Revision: 1.3 $ * @see SchedulerDaemon */ -class RpcGetVersionTest : public CPPUNIT_NS::TestFixture +class RpcGetVersionTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcGetVersionTest); CPPUNIT_TEST(simpleTest); diff --git a/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.cxx b/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.cxx index beed5d99a..7fc64c588 100644 --- a/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.cxx +++ b/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Author : $Author: maroy $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcOpenPlaylistForEditingTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcOpenPlaylistForEditingTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -109,7 +115,10 @@ RpcOpenPlaylistForEditingTest :: firstTest(void) XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000000001"; diff --git a/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.h b/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.h index a448d89fa..3fe351baa 100644 --- a/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.h +++ b/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the OpenPlaylistForEditingMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @author $Author: maroy $ + * @version $Revision: 1.2 $ * @see OpenPlaylistForEditingMethod */ -class RpcOpenPlaylistForEditingTest : public CPPUNIT_NS::TestFixture +class RpcOpenPlaylistForEditingTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcOpenPlaylistForEditingTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.cxx b/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.cxx index 21cab3c9b..43ffcddef 100644 --- a/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Author : $Author: maroy $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcRemoveAudioClipFromPlaylistTest :: setUp(void) throw XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcRemoveAudioClipFromPlaylistTest :: tearDown(void) throw XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -109,7 +115,10 @@ RpcRemoveAudioClipFromPlaylistTest :: firstTest(void) XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000000001"; diff --git a/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.h b/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.h index 7deccea4d..a06a21b71 100644 --- a/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.h +++ b/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the RemoveAudioClipFromPlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @author $Author: maroy $ + * @version $Revision: 1.2 $ * @see RemoveAudioClipFromPlaylistMethod */ -class RpcRemoveAudioClipFromPlaylistTest : public CPPUNIT_NS::TestFixture +class RpcRemoveAudioClipFromPlaylistTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcRemoveAudioClipFromPlaylistTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.cxx b/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.cxx index fcc5607a8..3f5284e86 100644 --- a/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.cxx +++ b/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.7 $ + Author : $Author: maroy $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -67,7 +67,10 @@ RpcRemoveFromScheduleTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -93,7 +96,10 @@ RpcRemoveFromScheduleTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -118,7 +124,10 @@ RpcRemoveFromScheduleTest :: simpleTest(void) XmlRpcValue result; struct tm time; - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); // first schedule a playlist, so that there is something to remove parameters["sessionId"] = sessionId->getId(); @@ -159,7 +168,10 @@ RpcRemoveFromScheduleTest :: negativeTest(void) XmlRpcValue parameters; XmlRpcValue result; - XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["scheduleEntryId"] = "0000000000009999"; diff --git a/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.h b/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.h index a8eea5de8..7fda7df15 100644 --- a/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.h +++ b/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test to test the removeFromSchedule XML-RPC call. * - * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @author $Author: maroy $ + * @version $Revision: 1.4 $ * @see SchedulerDaemon */ -class RpcRemoveFromScheduleTest : public CPPUNIT_NS::TestFixture +class RpcRemoveFromScheduleTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcRemoveFromScheduleTest); CPPUNIT_TEST(simpleTest); diff --git a/livesupport/products/scheduler/src/RpcRescheduleTest.cxx b/livesupport/products/scheduler/src/RpcRescheduleTest.cxx index ce3dc7e75..48022af1b 100644 --- a/livesupport/products/scheduler/src/RpcRescheduleTest.cxx +++ b/livesupport/products/scheduler/src/RpcRescheduleTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.7 $ + Author : $Author: maroy $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRescheduleTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -88,7 +88,10 @@ RpcRescheduleTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -114,7 +117,10 @@ RpcRescheduleTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -138,7 +144,10 @@ RpcRescheduleTest :: simpleTest(void) XmlRpc::XmlRpcValue result; struct tm time; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); // first schedule a playlist, so that there is something to reschedule parameters["sessionId"] = sessionId->getId(); @@ -204,7 +213,10 @@ RpcRescheduleTest :: negativeTest(void) XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["scheduleEntryId"] = "0000000000009999"; diff --git a/livesupport/products/scheduler/src/RpcRescheduleTest.h b/livesupport/products/scheduler/src/RpcRescheduleTest.h index 74b11e7b1..eb4c7ec17 100644 --- a/livesupport/products/scheduler/src/RpcRescheduleTest.h +++ b/livesupport/products/scheduler/src/RpcRescheduleTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRescheduleTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test to test the removeFromSchedule XML-RPC call. * - * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @author $Author: maroy $ + * @version $Revision: 1.4 $ * @see SchedulerDaemon */ -class RpcRescheduleTest : public CPPUNIT_NS::TestFixture +class RpcRescheduleTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcRescheduleTest); CPPUNIT_TEST(simpleTest); diff --git a/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.cxx b/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.cxx index f598b5822..c5d0a21a8 100644 --- a/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Author : $Author: maroy $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcRevertEditedPlaylistTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcRevertEditedPlaylistTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -109,7 +115,10 @@ RpcRevertEditedPlaylistTest :: firstTest(void) XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000000001"; diff --git a/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.h b/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.h index 05b9306ee..5d20197f3 100644 --- a/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.h +++ b/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the RevertEditedPlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @author $Author: maroy $ + * @version $Revision: 1.2 $ * @see RevertEditedPlaylistMethod */ -class RpcRevertEditedPlaylistTest : public CPPUNIT_NS::TestFixture +class RpcRevertEditedPlaylistTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcRevertEditedPlaylistTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcSavePlaylistTest.cxx b/livesupport/products/scheduler/src/RpcSavePlaylistTest.cxx index 272569177..f952c6ac1 100644 --- a/livesupport/products/scheduler/src/RpcSavePlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcSavePlaylistTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcSavePlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcSavePlaylistTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcSavePlaylistTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -109,7 +115,10 @@ RpcSavePlaylistTest :: firstTest(void) XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000009999"; diff --git a/livesupport/products/scheduler/src/RpcSavePlaylistTest.h b/livesupport/products/scheduler/src/RpcSavePlaylistTest.h index 7e49f85bd..218d01425 100644 --- a/livesupport/products/scheduler/src/RpcSavePlaylistTest.h +++ b/livesupport/products/scheduler/src/RpcSavePlaylistTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcSavePlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,11 +64,11 @@ using namespace LiveSupport::Core; /** * Unit test for the SavePlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @author $Author: maroy $ + * @version $Revision: 1.2 $ * @see SavePlaylistMethod */ -class RpcSavePlaylistTest : public CPPUNIT_NS::TestFixture +class RpcSavePlaylistTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcSavePlaylistTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.cxx b/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.cxx index 2eaf93f52..2c78395cb 100644 --- a/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.cxx +++ b/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Author : $Author: maroy $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -61,7 +61,10 @@ RpcUpdateFadeInFadeOutTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -87,7 +90,10 @@ RpcUpdateFadeInFadeOutTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -107,7 +113,10 @@ RpcUpdateFadeInFadeOutTest :: firstTest(void) XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000000001"; diff --git a/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.h b/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.h index 75a350710..b01088dda 100644 --- a/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.h +++ b/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the UpdateFadeInFadeOutMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @author $Author: maroy $ + * @version $Revision: 1.2 $ * @see UpdateFadeInFadeOutMethod */ -class RpcUpdateFadeInFadeOutTest : public CPPUNIT_NS::TestFixture +class RpcUpdateFadeInFadeOutTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcUpdateFadeInFadeOutTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/RpcUploadPlaylistTest.cxx b/livesupport/products/scheduler/src/RpcUploadPlaylistTest.cxx index 0ccc4e990..4ae8f5972 100644 --- a/livesupport/products/scheduler/src/RpcUploadPlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcUploadPlaylistTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.9 $ + Author : $Author: maroy $ + Version : $Revision: 1.10 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUploadPlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -88,7 +88,10 @@ RpcUploadPlaylistTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -114,7 +117,10 @@ RpcUploadPlaylistTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -138,7 +144,10 @@ RpcUploadPlaylistTest :: simpleTest(void) XmlRpc::XmlRpcValue result; struct tm time; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); // try to schedule playlist #1 for the time below parameters.clear(); diff --git a/livesupport/products/scheduler/src/RpcUploadPlaylistTest.h b/livesupport/products/scheduler/src/RpcUploadPlaylistTest.h index 47b169d72..5fba4c1f0 100644 --- a/livesupport/products/scheduler/src/RpcUploadPlaylistTest.h +++ b/livesupport/products/scheduler/src/RpcUploadPlaylistTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUploadPlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test to test the uploadPlaylist XML-RPC call. * - * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @author $Author: maroy $ + * @version $Revision: 1.4 $ * @see SchedulerDaemon */ -class RpcUploadPlaylistTest : public CPPUNIT_NS::TestFixture +class RpcUploadPlaylistTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcUploadPlaylistTest); CPPUNIT_TEST(simpleTest); diff --git a/livesupport/products/scheduler/src/RpcValidatePlaylistTest.cxx b/livesupport/products/scheduler/src/RpcValidatePlaylistTest.cxx index fb087a59f..50243d134 100644 --- a/livesupport/products/scheduler/src/RpcValidatePlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcValidatePlaylistTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Author : $Author: maroy $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcValidatePlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -63,7 +63,10 @@ RpcValidatePlaylistTest :: setUp(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -89,7 +92,10 @@ RpcValidatePlaylistTest :: tearDown(void) throw () XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result)); @@ -109,7 +115,10 @@ RpcValidatePlaylistTest :: firstTest(void) XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); + XmlRpc::XmlRpcClient xmlRpcClient(getXmlRpcHost().c_str(), + getXmlRpcPort(), + "/RPC2", + false); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000009999"; diff --git a/livesupport/products/scheduler/src/RpcValidatePlaylistTest.h b/livesupport/products/scheduler/src/RpcValidatePlaylistTest.h index 9530bf2c9..8fcd2f542 100644 --- a/livesupport/products/scheduler/src/RpcValidatePlaylistTest.h +++ b/livesupport/products/scheduler/src/RpcValidatePlaylistTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Author : $Author: maroy $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcValidatePlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -62,11 +63,11 @@ using namespace LiveSupport::Core; /** * Unit test for the ValidatePlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @author $Author: maroy $ + * @version $Revision: 1.2 $ * @see ValidatePlaylistMethod */ -class RpcValidatePlaylistTest : public CPPUNIT_NS::TestFixture +class RpcValidatePlaylistTest : public BaseTestMethod { CPPUNIT_TEST_SUITE(RpcValidatePlaylistTest); CPPUNIT_TEST(firstTest); diff --git a/livesupport/products/scheduler/src/SavePlaylistMethodTest.cxx b/livesupport/products/scheduler/src/SavePlaylistMethodTest.cxx index 17f2cce07..da32deebe 100644 --- a/livesupport/products/scheduler/src/SavePlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/SavePlaylistMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.9 $ + Author : $Author: maroy $ + Version : $Revision: 1.10 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -50,6 +50,7 @@ #include "LiveSupport/Authentication/AuthenticationClientFactory.h" #include "OpenPlaylistForEditingMethod.h" +#include "SchedulerDaemon.h" #include "SavePlaylistMethod.h" #include "SavePlaylistMethodTest.h" @@ -67,69 +68,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(SavePlaylistMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string SavePlaylistMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string SavePlaylistMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string SavePlaylistMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -SavePlaylistMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void SavePlaylistMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -138,7 +93,7 @@ SavePlaylistMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/SavePlaylistMethodTest.h b/livesupport/products/scheduler/src/SavePlaylistMethodTest.h index 3d2911cef..da67716b7 100644 --- a/livesupport/products/scheduler/src/SavePlaylistMethodTest.h +++ b/livesupport/products/scheduler/src/SavePlaylistMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the SavePlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see SavePlaylistMethod */ class SavePlaylistMethodTest : public CPPUNIT_NS::TestFixture @@ -75,23 +76,6 @@ class SavePlaylistMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,19 +86,6 @@ class SavePlaylistMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); protected: diff --git a/livesupport/products/scheduler/src/SchedulerDaemon.cxx b/livesupport/products/scheduler/src/SchedulerDaemon.cxx index 7100cd3bb..36eb405db 100644 --- a/livesupport/products/scheduler/src/SchedulerDaemon.cxx +++ b/livesupport/products/scheduler/src/SchedulerDaemon.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.25 $ + Version : $Revision: 1.26 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.cxx,v $ ------------------------------------------------------------------------------*/ @@ -260,15 +260,18 @@ SchedulerDaemon :: configure(const xmlpp::Element & element) TagConversion::configure( *((const xmlpp::Element*) *(nodes.begin())) ); // do some initialization, using the configured objects - authentication = acf->getAuthenticationClient(); - audioPlayer = apf->getAudioPlayer(); - playLog = plf->getPlayLog(); + authentication = acf->getAuthenticationClient(); + connectionManager = cmf->getConnectionManager(); + storage = scf->getStorageClient(); + audioPlayer = apf->getAudioPlayer(); + playLog = plf->getPlayLog(); + schedule = sf->getSchedule(); Ptr::Ref eventContainer; Ptr::Ref granularity; eventContainer.reset(new PlaylistEventContainer(sessionId, - scf->getStorageClient(), - sf->getSchedule(), + storage, + schedule, audioPlayer, playLog)); // TODO: read granularity from config file diff --git a/livesupport/products/scheduler/src/SchedulerDaemon.h b/livesupport/products/scheduler/src/SchedulerDaemon.h index c8f4ee37a..188dd44a3 100644 --- a/livesupport/products/scheduler/src/SchedulerDaemon.h +++ b/livesupport/products/scheduler/src/SchedulerDaemon.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.19 $ + Version : $Revision: 1.20 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.h,v $ ------------------------------------------------------------------------------*/ @@ -61,6 +61,8 @@ #include "LiveSupport/Core/Installable.h" #include "LiveSupport/Core/Configurable.h" #include "LiveSupport/Core/SessionId.h" +#include "LiveSupport/Db/ConnectionManagerInterface.h" +#include "LiveSupport/Storage/StorageClientInterface.h" #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h" #include "LiveSupport/EventScheduler/EventScheduler.h" @@ -80,6 +82,7 @@ #include "RemoveFromScheduleMethod.h" #include "RescheduleMethod.h" #include "RevertEditedPlaylistMethod.h" +#include "ScheduleInterface.h" #include "SavePlaylistMethod.h" #include "UpdateFadeInFadeOutMethod.h" #include "UploadPlaylistMethod.h" @@ -97,6 +100,9 @@ namespace Scheduler { using namespace LiveSupport; using namespace LiveSupport::Core; using namespace LiveSupport::Authentication; +using namespace LiveSupport::Db; +using namespace LiveSupport::Storage; +using namespace LiveSupport::Scheduler; using namespace LiveSupport::PlaylistExecutor; /* ================================================================ constants */ @@ -162,7 +168,7 @@ using namespace LiveSupport::PlaylistExecutor; * * * @author $Author: maroy $ - * @version $Revision: 1.19 $ + * @version $Revision: 1.20 $ * @see ConnectionManagerFactory * @see AuthenticationClientFactory * @see StorageClientFactory @@ -178,33 +184,48 @@ class SchedulerDaemon : public Installable, /** * The singleton instance of the scheduler daemon. */ - static Ptr::Ref schedulerDaemon; + static Ptr::Ref schedulerDaemon; /** * The authentication client. */ Ptr::Ref authentication; + /** + * The connection manager used by the scheduler. + */ + Ptr::Ref connectionManager; + + /** + * The storage client. + */ + Ptr::Ref storage; + + /** + * The schedule used by the scheduler daemon. + */ + Ptr::Ref schedule; + /** * The session id for the scheduler user. */ - Ptr::Ref sessionId; + Ptr::Ref sessionId; /** * The event scheduler. */ Ptr::Ref - eventScheduler; + eventScheduler; /** * The audio player. */ - Ptr::Ref audioPlayer; + Ptr::Ref audioPlayer; /** * The play logging facility. */ - Ptr::Ref playLog; + Ptr::Ref playLog; /** * The addAudioClipToPlaylistMethod the daemon is providing. @@ -214,52 +235,52 @@ class SchedulerDaemon : public Installable, /** * The createPlaylistMethod the daemon is providing. */ - Ptr::Ref createPlaylistMethod; + Ptr::Ref createPlaylistMethod; /** * The deletePlaylistMethod the daemon is providing. */ - Ptr::Ref deletePlaylistMethod; + Ptr::Ref deletePlaylistMethod; /** * The displayAudioClipMethod the daemon is providing. */ - Ptr::Ref displayAudioClipMethod; + Ptr::Ref displayAudioClipMethod; /** * The displayAudioClipsMethod the daemon is providing. */ - Ptr::Ref displayAudioClipsMethod; + Ptr::Ref displayAudioClipsMethod; /** * The displayPlaylistMethod the daemon is providing. */ - Ptr::Ref displayPlaylistMethod; + Ptr::Ref displayPlaylistMethod; /** * The displayPlaylistsMethod the daemon is providing. */ - Ptr::Ref displayPlaylistsMethod; + Ptr::Ref displayPlaylistsMethod; /** * The displayScheduleMethod the daemon is providing. */ - Ptr::Ref displayScheduleMethod; + Ptr::Ref displayScheduleMethod; /** * The generatePlayReportMethod the daemon is providing. */ - Ptr::Ref generatePlayReportMethod; + Ptr::Ref generatePlayReportMethod; /** * The getSchedulerTimeMethod the daemon is providing. */ - Ptr::Ref getSchedulerTimeMethod; + Ptr::Ref getSchedulerTimeMethod; /** * The getVersion the daemon is providing. */ - Ptr::Ref getVersionMethod; + Ptr::Ref getVersionMethod; /** * The openPlaylistForEditingMethod the daemon is providing. @@ -275,62 +296,62 @@ class SchedulerDaemon : public Installable, /** * The removeFromScheduleMethod the daemon is providing. */ - Ptr::Ref removeFromScheduleMethod; + Ptr::Ref removeFromScheduleMethod; /** * The rescheduleMethod the daemon is providing. */ - Ptr::Ref rescheduleMethod; + Ptr::Ref rescheduleMethod; /** * The revertEditedPlaylistMethod the daemon is providing. */ - Ptr::Ref revertEditedPlaylistMethod; + Ptr::Ref revertEditedPlaylistMethod; /** * The savePlaylistMethod the daemon is providing. */ - Ptr::Ref savePlaylistMethod; + Ptr::Ref savePlaylistMethod; /** * The updateFadeInFadeOutMethod the daemon is providing. */ - Ptr::Ref updateFadeInFadeOutMethod; + Ptr::Ref updateFadeInFadeOutMethod; /** * The uploadPlaylistMethod the daemon is providing. */ - Ptr::Ref uploadPlaylistMethod; + Ptr::Ref uploadPlaylistMethod; /** * The validatePlaylistMethod the daemon is providing. */ - Ptr::Ref validatePlaylistMethod; + Ptr::Ref validatePlaylistMethod; /** * The loginMethod the daemon is providing. */ - Ptr::Ref loginMethod; + Ptr::Ref loginMethod; /** * The logoutMethod the daemon is providing. */ - Ptr::Ref logoutMethod; + Ptr::Ref logoutMethod; /** * The resetStorageMethod the daemon is providing. */ - Ptr::Ref resetStorageMethod; + Ptr::Ref resetStorageMethod; /** * The login to the authentication system. */ - std::string login; + std::string login; /** * The password to the authentication system. */ - std::string password; + std::string password; /** * Default constructor. @@ -389,6 +410,72 @@ class SchedulerDaemon : public Installable, throw (std::invalid_argument, std::logic_error); + /** + * Return the connection manager used by the scheduler. + * + * @return the connection manager used by the scheduler. + */ + Ptr::Ref + getConnectionManager(void) throw () + { + return connectionManager; + } + + /** + * Return the storage client used by the scheduler. + * + * @return the storage client used by the scheduler. + */ + Ptr::Ref + getStorage(void) throw () + { + return storage; + } + + /** + * Return the authentication client used by the scheduler. + * + * @return the authentication client used by the scheduler. + */ + Ptr::Ref + getAuthentication(void) throw () + { + return authentication; + } + + /** + * Return the schedule used by the scheduler. + * + * @return the schedule used by the scheduler. + */ + Ptr::Ref + getSchedule(void) throw () + { + return schedule; + } + + /** + * Return the play log used by the scheduler. + * + * @return the play log used by the scheduler. + */ + Ptr::Ref + getPlayLog(void) throw () + { + return playLog; + } + + /** + * Return the audio player used by the scheduler. + * + * @return the audio player used by the scheduler. + */ + Ptr::Ref + getAudioPlayer(void) throw () + { + return audioPlayer; + } + /** * Install the component. * This step involves creating the environment in which the component diff --git a/livesupport/products/scheduler/src/SchedulerDaemonTest.cxx b/livesupport/products/scheduler/src/SchedulerDaemonTest.cxx index 220b3055c..9b13e7490 100644 --- a/livesupport/products/scheduler/src/SchedulerDaemonTest.cxx +++ b/livesupport/products/scheduler/src/SchedulerDaemonTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Author : $Author: maroy $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemonTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -55,11 +55,6 @@ using namespace LiveSupport::Scheduler; // CPPUNIT_TEST_SUITE_REGISTRATION(SchedulerDaemonTest); -/** - * The name of the configuration file for the scheduler daemon. - */ -static const std::string configFileName = "etc/scheduler.xml"; - /* =============================================== local function prototypes */ @@ -73,19 +68,6 @@ void SchedulerDaemonTest :: setUp(void) throw () { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - - if (!daemon->isConfigured()) { - try { - std::auto_ptr - parser(new xmlpp::DomParser(configFileName, true)); - const xmlpp::Document * document = parser->get_document(); - daemon->configure(*(document->get_root_node())); - } catch (std::invalid_argument &e) { - CPPUNIT_FAIL("semantic error in configuration file"); - } catch (xmlpp::exception &e) { - CPPUNIT_FAIL("error parsing configuration file"); - } - } } diff --git a/livesupport/products/scheduler/src/SchedulerDaemonTest.h b/livesupport/products/scheduler/src/SchedulerDaemonTest.h index 216c22a9c..1c080a43c 100644 --- a/livesupport/products/scheduler/src/SchedulerDaemonTest.h +++ b/livesupport/products/scheduler/src/SchedulerDaemonTest.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemonTest.h,v $ ------------------------------------------------------------------------------*/ @@ -42,6 +42,7 @@ #include +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -60,7 +61,7 @@ using namespace LiveSupport; * Unit test for the SchedulerDaemon class. * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @see SchedulerDaemon */ class SchedulerDaemonTest : public CPPUNIT_NS::TestFixture diff --git a/livesupport/products/scheduler/src/TestRunner.cxx b/livesupport/products/scheduler/src/TestRunner.cxx index e9833491f..4b48b754b 100644 --- a/livesupport/products/scheduler/src/TestRunner.cxx +++ b/livesupport/products/scheduler/src/TestRunner.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/TestRunner.cxx,v $ ------------------------------------------------------------------------------*/ @@ -56,9 +56,12 @@ #include #include "LiveSupport/Core/Ptr.h" +#include "BaseTestMethod.h" using namespace LiveSupport::Core; +using namespace LiveSupport::Scheduler; + /* =================================================== local data structures */ @@ -74,12 +77,13 @@ static const char copyrightNotice[] = /** * String describing the short options. */ -static const char options[] = "ho:s:v"; +static const char options[] = "c:ho:s:v"; /** * Structure describing the long options */ static const struct option longOptions[] = { + { "config", required_argument, 0, 'c' }, { "help", no_argument, 0, 'h' }, { "output", required_argument, 0, 'o' }, { "stylesheet", required_argument, 0, 's' }, @@ -92,6 +96,11 @@ static const struct option longOptions[] = { */ static const std::string encoding = "utf-8"; +/** + * The name of the scheduler config file to use. + */ +static Ptr::Ref configFileName; + /** * The output XML file name. */ @@ -148,6 +157,14 @@ main( int argc, return 0; } + // Configure the test methods via their shared base class + try { + LiveSupport::Scheduler::BaseTestMethod::configure(*configFileName); + } catch (std::exception &e) { + std::cerr << "configuration error: " << e.what() << std::endl; + return 1; + } + // Create the event manager and test controller CPPUNIT_NS::TestResult controller; @@ -194,6 +211,10 @@ processArguments(int argc, char *argv[]) while ((i = getopt_long(argc, argv, options, longOptions, 0)) != -1) { switch (i) { + case 'c': + configFileName.reset(new std::string(optarg)); + break; + case 'h': printUsage(argv[0], std::cout); return false; @@ -222,6 +243,13 @@ processArguments(int argc, char *argv[]) return false; } + if (!configFileName) { + std::cerr << "mandatory option configuration file name not specified" + << std::endl; + printUsage(argv[0], std::cout); + return false; + } + if (!xmlOutFileName) { std::cerr << "mandatory option output file name not specified" << std::endl; @@ -229,6 +257,7 @@ processArguments(int argc, char *argv[]) return false; } + std::cerr << "using config file '" << *configFileName << '\'' << std::endl; std::cerr << "writing output to '" << *xmlOutFileName << '\'' << std::endl; if (xsltFileName) { std::cerr << "using XSLT file '" << *xsltFileName << '\'' << std::endl; diff --git a/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx b/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx index dbc3d485b..900145aac 100644 --- a/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx +++ b/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.10 $ + Author : $Author: maroy $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -49,6 +49,7 @@ #include "LiveSupport/Authentication/AuthenticationClientFactory.h" #include "LiveSupport/Core/XmlRpcTools.h" +#include "SchedulerDaemon.h" #include "OpenPlaylistForEditingMethod.h" #include "AddAudioClipToPlaylistMethod.h" #include "UpdateFadeInFadeOutMethod.h" @@ -69,69 +70,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(UpdateFadeInFadeOutMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string UpdateFadeInFadeOutMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string UpdateFadeInFadeOutMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string UpdateFadeInFadeOutMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -UpdateFadeInFadeOutMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void UpdateFadeInFadeOutMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -140,7 +95,7 @@ UpdateFadeInFadeOutMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.h b/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.h index ee310320b..b84be25fc 100644 --- a/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.h +++ b/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the UpdateFadeInFadeOutMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see UpdateFadeInFadeOutMethod */ class UpdateFadeInFadeOutMethodTest : public CPPUNIT_NS::TestFixture @@ -75,23 +76,6 @@ class UpdateFadeInFadeOutMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,19 +86,6 @@ class UpdateFadeInFadeOutMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); protected: diff --git a/livesupport/products/scheduler/src/UploadPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/UploadPlaylistMethodTest.cxx index 4d5980359..96caf9b02 100644 --- a/livesupport/products/scheduler/src/UploadPlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/UploadPlaylistMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.12 $ + Author : $Author: maroy $ + Version : $Revision: 1.13 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UploadPlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -66,81 +66,26 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(UploadPlaylistMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string UploadPlaylistMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string UploadPlaylistMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the schedule factory. - */ -const std::string UploadPlaylistMethodTest::scheduleConfig = - "etc/scheduleFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string UploadPlaylistMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -UploadPlaylistMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void UploadPlaylistMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - Ptr::Ref sf = ScheduleFactory::getInstance(); - configure(sf, scheduleConfig); - - schedule = sf->getSchedule(); + schedule = scheduler->getSchedule(); schedule->install(); - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -149,7 +94,7 @@ UploadPlaylistMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/UploadPlaylistMethodTest.h b/livesupport/products/scheduler/src/UploadPlaylistMethodTest.h index b2c16724b..a306ed902 100644 --- a/livesupport/products/scheduler/src/UploadPlaylistMethodTest.h +++ b/livesupport/products/scheduler/src/UploadPlaylistMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Author : $Author: maroy $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UploadPlaylistMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,8 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "SchedulerDaemon.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +65,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the UploadPlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @author $Author: maroy $ + * @version $Revision: 1.6 $ * @see UploadPlaylistMethod */ class UploadPlaylistMethodTest : public CPPUNIT_NS::TestFixture @@ -76,33 +78,11 @@ class UploadPlaylistMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the schedule factory. - */ - static const std::string scheduleConfig; - /** * The schedule used during the test. */ Ptr::Ref schedule; - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -113,20 +93,6 @@ class UploadPlaylistMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); - protected: diff --git a/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx b/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx index a13f1e067..6b3dcdffb 100644 --- a/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.11 $ + Author : $Author: maroy $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -49,6 +49,7 @@ #include "LiveSupport/Authentication/AuthenticationClientFactory.h" #include "LiveSupport/Core/XmlRpcTools.h" +#include "SchedulerDaemon.h" #include "OpenPlaylistForEditingMethod.h" #include "RemoveAudioClipFromPlaylistMethod.h" #include "ValidatePlaylistMethod.h" @@ -69,69 +70,23 @@ using namespace LiveSupport::Authentication; CPPUNIT_TEST_SUITE_REGISTRATION(ValidatePlaylistMethodTest); -/** - * The name of the configuration file for the storage client factory. - */ -const std::string ValidatePlaylistMethodTest::storageClientConfig = - "etc/storageClient.xml"; - -/** - * The name of the configuration file for the connection manager factory. - */ -const std::string ValidatePlaylistMethodTest::connectionManagerConfig = - "etc/connectionManagerFactory.xml"; - -/** - * The name of the configuration file for the authentication client factory. - */ -const std::string ValidatePlaylistMethodTest::authenticationClientConfig = - "etc/authenticationClient.xml"; - /* =============================================== local function prototypes */ /* ============================================================= module code */ -/*------------------------------------------------------------------------------ - * Configure a Configurable with an XML file. - *----------------------------------------------------------------------------*/ -void -ValidatePlaylistMethodTest :: configure( - Ptr::Ref configurable, - const std::string fileName) - throw (std::invalid_argument, - xmlpp::exception) -{ - Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - configurable->configure(*root); -} - - /*------------------------------------------------------------------------------ * Set up the test environment *----------------------------------------------------------------------------*/ void ValidatePlaylistMethodTest :: setUp(void) throw () { - Ptr::Ref acf; - Ptr::Ref scf; + Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { - scf = StorageClientFactory::getInstance(); - configure(scf, storageClientConfig); - Ptr::Ref storage = scf->getStorageClient(); + Ptr::Ref storage = scheduler->getStorage(); storage->reset(); - Ptr::Ref cmf - = ConnectionManagerFactory::getInstance(); - configure(cmf, connectionManagerConfig); - - acf = AuthenticationClientFactory::getInstance(); - configure(acf, authenticationClientConfig); - } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -140,7 +95,7 @@ ValidatePlaylistMethodTest :: setUp(void) throw () CPPUNIT_FAIL(e.what()); } - authentication = acf->getAuthenticationClient(); + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); } catch (XmlRpcException &e) { diff --git a/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.h b/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.h index 3a9bae0d3..0817f975f 100644 --- a/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.h +++ b/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Author : $Author: maroy $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Core/SessionId.h" +#include "BaseTestMethod.h" namespace LiveSupport { namespace Scheduler { @@ -63,8 +64,8 @@ using namespace LiveSupport::Authentication; /** * Unit test for the ValidatePlaylistMethod class. * - * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @author $Author: maroy $ + * @version $Revision: 1.5 $ * @see ValidatePlaylistMethod */ class ValidatePlaylistMethodTest : public CPPUNIT_NS::TestFixture @@ -75,23 +76,6 @@ class ValidatePlaylistMethodTest : public CPPUNIT_NS::TestFixture private: - /** - * The name of the configuration file for the storage client factory. - */ - static const std::string storageClientConfig; - - /** - * The name of the configuration file for the connection manager - * factory. - */ - static const std::string connectionManagerConfig; - - /** - * The name of the configuration file for the authentication client - * factory. - */ - static const std::string authenticationClientConfig; - /** * The authentication client produced by the factory. */ @@ -102,19 +86,6 @@ class ValidatePlaylistMethodTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref sessionId; - /** - * Configure a configurable with an XML file. - * - * @param configurable configure this - * @param fileName the name of the XML file to configure with. - * @exception std::invalid_argument on configuration errors. - * @exception xmlpp::exception on XML parsing errors. - */ - void - configure(Ptr::Ref configurable, - std::string fileName) - throw (std::invalid_argument, - xmlpp::exception); protected: diff --git a/livesupport/usr/tmp/.keepme b/livesupport/usr/tmp/.keepme new file mode 100644 index 000000000..e0808fa16 --- /dev/null +++ b/livesupport/usr/tmp/.keepme @@ -0,0 +1 @@ +keep me