added scheduler client module
This commit is contained in:
parent
97a0c86134
commit
885b2cc212
|
@ -21,7 +21,7 @@
|
|||
#
|
||||
#
|
||||
# Author : $Author: maroy $
|
||||
# Version : $Revision: 1.17 $
|
||||
# Version : $Revision: 1.18 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/Attic/Makefile,v $
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
@ -92,6 +92,7 @@ DB_DIR = ${MODULES_DIR}/db
|
|||
STORAGE_DIR = ${MODULES_DIR}/storage
|
||||
PLAYLIST_EXECUTOR_DIR = ${MODULES_DIR}/playlistExecutor
|
||||
EVENT_SCHEDULER_DIR = ${MODULES_DIR}/eventScheduler
|
||||
SCHEDULER_CLIENT_DIR = ${MODULES_DIR}/schedulerClient
|
||||
|
||||
PRODUCTS_DIR = ${BASE_DIR}/products
|
||||
SCHEDULER_DIR = ${PRODUCTS_DIR}/scheduler
|
||||
|
@ -140,6 +141,7 @@ flawfinder:
|
|||
${PLAYLIST_EXECUTOR_DIR}/include \
|
||||
${PLAYLIST_EXECUTOR_DIR}/src \
|
||||
${EVENT_SCHEDULER_DIR}/include ${EVENT_SCHEDULER_DIR}/src \
|
||||
${SCHEDULER_CLIENT_DIR}/include ${SCHEDULER_CLIENT_DIR}/src \
|
||||
${SCHEDULER_DIR}/src > ${FLAWFINDER_FILE} \
|
||||
${GLIVESUPPORT_DIR}/src > ${FLAWFINDER_FILE} \
|
||||
|
||||
|
@ -173,6 +175,7 @@ modules_setup:
|
|||
${STORAGE_DIR}/bin/autogen.sh
|
||||
${PLAYLIST_EXECUTOR_DIR}/bin/autogen.sh
|
||||
${EVENT_SCHEDULER_DIR}/bin/autogen.sh
|
||||
${SCHEDULER_CLIENT_DIR}/bin/autogen.sh
|
||||
|
||||
products_setup:
|
||||
${SCHEDULER_DIR}/bin/autogen.sh
|
||||
|
@ -185,6 +188,7 @@ distclean:
|
|||
${MAKE} -C ${STORAGE_DIR} distclean
|
||||
${MAKE} -C ${PLAYLIST_EXECUTOR_DIR} distclean
|
||||
${MAKE} -C ${EVENT_SCHEDULER_DIR} distclean
|
||||
${MAKE} -C ${SCHDULER_CLIENT_DIR} distclean
|
||||
${MAKE} -C ${SCHEDULER_DIR} distclean
|
||||
${MAKE} -C ${GLIVESUPPORT_DIR} distclean
|
||||
|
||||
|
@ -195,6 +199,7 @@ depclean:
|
|||
${MAKE} -C ${STORAGE_DIR} depclean
|
||||
${MAKE} -C ${PLAYLIST_EXECUTOR_DIR} depclean
|
||||
${MAKE} -C ${EVENT_SCHEDULER_DIR} depclean
|
||||
${MAKE} -C ${SCHEDULER_CLIENT_DIR} depclean
|
||||
${MAKE} -C ${SCHEDULER_DIR} depclean
|
||||
${MAKE} -C ${GLIVESUPPORT_DIR} depclean
|
||||
|
||||
|
@ -205,6 +210,7 @@ compile:
|
|||
${MAKE} -C ${STORAGE_DIR} all
|
||||
${MAKE} -C ${PLAYLIST_EXECUTOR_DIR} all
|
||||
${MAKE} -C ${EVENT_SCHEDULER_DIR} all
|
||||
${MAKE} -C ${SCHEDULER_CLIENT_DIR} all
|
||||
${MAKE} -C ${SCHEDULER_DIR} all
|
||||
${MAKE} -C ${GLIVESUPPORT_DIR} all
|
||||
|
||||
|
@ -215,6 +221,7 @@ check:
|
|||
-${MAKE} -C ${STORAGE_DIR} check
|
||||
-${MAKE} -C ${PLAYLIST_EXECUTOR_DIR} check
|
||||
-${MAKE} -C ${EVENT_SCHEDULER_DIR} check
|
||||
-${MAKE} -C ${SCHEDULER_CLIENT_DIR} check
|
||||
-${MAKE} -C ${SCHEDULER_DIR} check
|
||||
-${MAKE} -C ${GLIVESUPPORT_DIR} check
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#
|
||||
#
|
||||
# Author : $Author: maroy $
|
||||
# Version : $Revision: 1.4 $
|
||||
# Version : $Revision: 1.5 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/gen_coverage_data.sh,v $
|
||||
#-------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -47,6 +47,7 @@ authentication_coverage_file=$modules_dir/authentication/tmp/coverage.info
|
|||
db_coverage_file=$modules_dir/db/tmp/coverage.info
|
||||
storage_coverage_file=$modules_dir/storage/tmp/coverage.info
|
||||
eventScheduler_coverage_file=$modules_dir/eventScheduler/tmp/coverage.info
|
||||
schedulerClient_coverage_file=$modules_dir/schedulerClient/tmp/coverage.info
|
||||
playlistExecutor_coverage_file=$modules_dir/playlistExecutor/tmp/coverage.info
|
||||
scheduler_coverage_file=$products_dir/scheduler/tmp/coverage.info
|
||||
|
||||
|
@ -64,6 +65,7 @@ $modules_dir/authentication/bin/gen_coverage_data.sh
|
|||
$modules_dir/db/bin/gen_coverage_data.sh
|
||||
$modules_dir/storage/bin/gen_coverage_data.sh
|
||||
$modules_dir/eventScheduler/bin/gen_coverage_data.sh
|
||||
$modules_dir/schedulerClient/bin/gen_coverage_data.sh
|
||||
$modules_dir/playlistExecutor/bin/gen_coverage_data.sh
|
||||
$products_dir/scheduler/bin/gen_coverage_data.sh
|
||||
|
||||
|
@ -79,6 +81,7 @@ cat $authentication_coverage_file | sed -e "s/authentication\/tmp\//authenticati
|
|||
cat $db_coverage_file | sed -e "s/db\/tmp\//db\//g" >> $coverage_file
|
||||
cat $storage_coverage_file | sed -e "s/storage\/tmp\//storage\//g" >> $coverage_file
|
||||
cat $eventScheduler_coverage_file | sed -e "s/eventScheduler\/tmp\//eventScheduler\//g" >> $coverage_file
|
||||
cat $schedulerClient_coverage_file | sed -e "s/schedulerClient\/tmp\//schedulerClient\//g" >> $coverage_file
|
||||
cat $playlistExecutor_coverage_file | sed -e "s/playlistExecutor\/tmp\//playlistExecutor\//g" >> $coverage_file
|
||||
cat $scheduler_coverage_file | sed -e "s/scheduler\/tmp\//scheduler\//g" >> $coverage_file
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#
|
||||
#
|
||||
# Author : $Author: maroy $
|
||||
# Version : $Revision: 1.7 $
|
||||
# Version : $Revision: 1.8 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/etc/doxygen.config,v $
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
@ -427,7 +427,10 @@ INPUT = modules/core/include modules/core/src \
|
|||
modules/playlistExecutor/src \
|
||||
modules/eventScheduler/include \
|
||||
modules/eventScheduler/src \
|
||||
products/scheduler/src
|
||||
modules/schedulerClient/include \
|
||||
modules/schedulerClient/src \
|
||||
products/scheduler/src \
|
||||
products/gLiveSupport/src
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
#!/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/modules/schedulerClient/bin/autogen.sh,v $
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Run this to set up the build system: configure, makefiles, etc.
|
||||
# (based on the version in enlightenment's cvs)
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
package="SchedulerClient"
|
||||
|
||||
# assume we're in $basedir/bin
|
||||
basedir=`dirname $0`/..
|
||||
test -z "$basedir" && basedir=.
|
||||
|
||||
tmpdir=$basedir/tmp
|
||||
|
||||
cd "$tmpdir"
|
||||
DIE=0
|
||||
|
||||
# look at all other directories as seen from ${basedir}/tmp
|
||||
tmpdir=.
|
||||
bindir=../bin
|
||||
etcdir=../etc
|
||||
|
||||
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile $package."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile $package."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$*"; then
|
||||
echo "I am going to run ./configure with no arguments - if you wish "
|
||||
echo "to pass any to it, please specify them on the $0 command line."
|
||||
fi
|
||||
|
||||
echo "Generating configuration files for $package, please wait...."
|
||||
|
||||
configure_ac=${etcdir}/configure.ac
|
||||
configure=${tmpdir}/configure
|
||||
|
||||
#echo " aclocal $ACLOCAL_FLAGS"
|
||||
#aclocal $ACLOCAL_FLAGS
|
||||
echo " autoheader ${configure_ac}"
|
||||
autoheader ${configure_ac}
|
||||
echo " autoconf -o ${configure} ${configure_ac}"
|
||||
autoconf -o ${configure} ${configure_ac}
|
||||
|
||||
${configure} "$@" && echo
|
|
@ -0,0 +1,80 @@
|
|||
#!/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/modules/schedulerClient/bin/gen_coverage_data.sh,v $
|
||||
#-------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# This script generates code coverage data for the module
|
||||
#-------------------------------------------------------------------------------
|
||||
module="LiveSupport Scheduler Client"
|
||||
|
||||
reldir=`dirname $0`/..
|
||||
basedir=`cd $reldir; pwd; cd -`
|
||||
bindir=$basedir/bin
|
||||
docdir=$basedir/doc
|
||||
tmpdir=$basedir/tmp
|
||||
|
||||
usrdir=`cd $basedir/../../usr; pwd; cd -`
|
||||
|
||||
coverage_report_dir=$docdir/coverage
|
||||
|
||||
raw_coverage_file=$tmpdir/raw_coverage.info
|
||||
coverage_file=$tmpdir/coverage.info
|
||||
|
||||
lcov=$usrdir/bin/lcov
|
||||
genhtml=$usrdir/bin/genhtml
|
||||
|
||||
|
||||
cd $basedir
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Re-configure with covarege collection enabled, compile and run the tests
|
||||
#-------------------------------------------------------------------------------
|
||||
$bindir/autogen.sh --enable-coverage
|
||||
make clean
|
||||
make check
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Generate some symlinks so that the sources are visible from tmpdir
|
||||
#-------------------------------------------------------------------------------
|
||||
ln -s $basedir/include $tmpdir/include
|
||||
ln -s $basedir/src $tmpdir/src
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Use lcov to generate an HTML report on the coverage data
|
||||
#-------------------------------------------------------------------------------
|
||||
$lcov -d $tmpdir -c > $raw_coverage_file
|
||||
$lcov -e $raw_coverage_file "$tmpdir/*" > $coverage_file
|
||||
rm -rf $coverage_report_dir
|
||||
mkdir -p $coverage_report_dir
|
||||
$genhtml -t "$module" -o $coverage_report_dir $coverage_file
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Clean up
|
||||
#-------------------------------------------------------------------------------
|
||||
rm -f $tmpdir/include
|
||||
rm -f $tmpdir/src
|
|
@ -0,0 +1 @@
|
|||
keep me
|
|
@ -0,0 +1,188 @@
|
|||
#-------------------------------------------------------------------------------
|
||||
# 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/schedulerClient/etc/Makefile.in,v $
|
||||
#
|
||||
# @configure_input@
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# General command definitions
|
||||
#-------------------------------------------------------------------------------
|
||||
MKDIR = mkdir -p
|
||||
RM = rm -f
|
||||
RMDIR = rm -rf
|
||||
DOXYGEN = doxygen
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Basic directory and file definitions
|
||||
#-------------------------------------------------------------------------------
|
||||
BASE_DIR = @builddir@
|
||||
DOC_DIR = ${BASE_DIR}/doc
|
||||
DOXYGEN_DIR = ${DOC_DIR}/doxygen
|
||||
COVERAGE_DIR = ${DOC_DIR}/coverage
|
||||
ETC_DIR = ${BASE_DIR}/etc
|
||||
INCLUDE_DIR = ${BASE_DIR}/include
|
||||
LIB_DIR = ${BASE_DIR}/lib
|
||||
SRC_DIR = ${BASE_DIR}/src
|
||||
TMP_DIR = ${BASE_DIR}/tmp
|
||||
|
||||
USR_DIR = ${BASE_DIR}/../../usr
|
||||
USR_INCLUDE_DIR = ${USR_DIR}/include
|
||||
USR_LIB_DIR = ${USR_DIR}/lib
|
||||
BOOST_INCLUDE_DIR = ${USR_INCLUDE_DIR}/boost-1_31
|
||||
LIBXMLPP_INCLUDE_DIR = ${USR_INCLUDE_DIR}/libxml++-1.0
|
||||
|
||||
MODULES_DIR = ${BASE_DIR}/..
|
||||
|
||||
CORE_DIR = ${MODULES_DIR}/core
|
||||
CORE_INCLUDE_DIR = ${CORE_DIR}/include
|
||||
CORE_LIB_DIR = ${CORE_DIR}/lib
|
||||
CORE_LIB = livesupport_core
|
||||
CORE_LIB_FILE = ${CORE_LIB_DIR}/lib${CORE_LIB}.a
|
||||
|
||||
PRODUCTS_DIR = ${BASE_DIR}/../../products
|
||||
|
||||
SCHEDULER_DIR = ${PRODUCTS_DIR}/scheduler
|
||||
SCHEDULER_EXE = ${SCHEDULER_DIR}/tmp/scheduler
|
||||
|
||||
|
||||
VPATH = ${SRC_DIR}
|
||||
|
||||
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
|
||||
|
||||
SCHEDULER_CLIENT_LIB = livesupport_scheduler_client
|
||||
SCHEDULER_CLIENT_LIB_FILE = ${LIB_DIR}/lib${SCHEDULER_CLIENT_LIB}.a
|
||||
TEST_RUNNER = ${TMP_DIR}/testRunner
|
||||
|
||||
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
|
||||
|
||||
export LD_LIBRARY_PATH=${USR_LIB_DIR}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Configuration parameters
|
||||
#-------------------------------------------------------------------------------
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \
|
||||
-pedantic -Wall -Wno-long-long \
|
||||
-I${USR_INCLUDE_DIR} \
|
||||
-I${BOOST_INCLUDE_DIR} \
|
||||
-I${LIBXMLPP_INCLUDE_DIR} \
|
||||
-I${CORE_INCLUDE_DIR} \
|
||||
-I${INCLUDE_DIR} -I${TMP_DIR}
|
||||
LDFLAGS = @LDFLAGS@ -pthread -L${USR_LIB_DIR} -L${CORE_LIB_DIR} -L${LIB_DIR}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Dependencies
|
||||
#-------------------------------------------------------------------------------
|
||||
SCHEDULER_CLIENT_LIB_OBJS = ${TMP_DIR}/SchedulerDaemonXmlRpcClient.o \
|
||||
${TMP_DIR}/SchedulerClientFactory.o
|
||||
|
||||
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
|
||||
${TMP_DIR}/SchedulerDaemonXmlRpcClientTest.o \
|
||||
${TMP_DIR}/SchedulerClientFactoryTest.o
|
||||
|
||||
TEST_RUNNER_LIBS = -l${SCHEDULER_CLIENT_LIB} -l${CORE_LIB} -lxml++-1.0 \
|
||||
-lcppunit -ldl -lxmlrpc++ -lssl
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Targets
|
||||
#-------------------------------------------------------------------------------
|
||||
.PHONY: all dir_setup doc clean docclean depclean distclean
|
||||
.PHONY: install start run_tests stop uninstall
|
||||
|
||||
all: dir_setup ${SCHEDULER_CLIENT_LIB_FILE}
|
||||
|
||||
dir_setup: ${TMP_DIR} ${DOXYGEN_DIR}
|
||||
|
||||
doc:
|
||||
${DOXYGEN} ${DOXYGEN_CONFIG}
|
||||
|
||||
clean:
|
||||
${RM} ${SCHEDULER_CLIENT_LIB_OBJS} ${SCHEDULER_CLIENT_LIB_FILE}
|
||||
${RM} ${TEST_RUNNER_OBJS} ${TEST_RUNNER}
|
||||
${RM} ${TMP_DIR}/*.bb ${TMP_DIR}/*.bbg ${TMP_DIR}/*.da ${TMP_DIR}/*.info
|
||||
|
||||
docclean:
|
||||
${RMDIR} ${DOXYGEN_DIR}/html
|
||||
${RMDIR} ${COVERAGE_DIR}/*
|
||||
${RM} ${TEST_RESULTS}
|
||||
|
||||
depclean: clean
|
||||
|
||||
distclean: clean docclean
|
||||
${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te*
|
||||
|
||||
check: all ${TEST_RUNNER} start run_tests stop
|
||||
|
||||
run_tests: ${TEST_RUNNER}
|
||||
${TEST_RUNNER} -o ${TEST_RESULTS} -s ${TEST_XSLT}
|
||||
|
||||
install: ${SCHEDULER_EXE}
|
||||
${MAKE} -C ${SCHEDULER_DIR} install
|
||||
|
||||
start: ${SCHEDULER_EXE}
|
||||
${MAKE} -C ${SCHEDULER_DIR} start
|
||||
|
||||
stop: ${SCHEDULER_EXE}
|
||||
${MAKE} -C ${SCHEDULER_DIR} stop
|
||||
|
||||
uninstall: ${SCHEDULER_EXE}
|
||||
${MAKE} -C ${SCHEDULER_DIR} uninstall
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Specific targets
|
||||
#-------------------------------------------------------------------------------
|
||||
${SCHEDULER_CLIENT_LIB_FILE}: ${SCHEDULER_CLIENT_LIB_OBJS}
|
||||
${AR} crus $@ $^
|
||||
|
||||
${TMP_DIR}:
|
||||
${MKDIR} ${TMP_DIR}
|
||||
|
||||
${DOXYGEN_DIR}:
|
||||
${MKDIR} ${DOXYGEN_DIR}
|
||||
|
||||
${TEST_RUNNER}: ${CORE_LIB_FILE} ${TEST_RUNNER_OBJS} ${SCHEDULER_CLIENT_LIB_FILE}
|
||||
${CXX} ${LDFLAGS} -o $@ ${TEST_RUNNER_OBJS} ${TEST_RUNNER_LIBS}
|
||||
|
||||
${CORE_LIB_FILE}:
|
||||
${MAKE} -C ${CORE_DIR}
|
||||
|
||||
${SCHEDULER_EXE}:
|
||||
${MAKE} -C ${SCHEDULER_DIR}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Pattern rules
|
||||
#-------------------------------------------------------------------------------
|
||||
${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx
|
||||
${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
dnl-----------------------------------------------------------------------------
|
||||
dnl Copyright (c) 2004 Media Development Loan Fund
|
||||
dnl
|
||||
dnl This file is part of the LiveSupport project.
|
||||
dnl http://livesupport.campware.org/
|
||||
dnl To report bugs, send an e-mail to bugs@campware.org
|
||||
dnl
|
||||
dnl LiveSupport is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl LiveSupport is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
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: maroy $
|
||||
dnl Version : $Revision: 1.1 $
|
||||
dnl Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/schedulerClient/etc/configure.ac,v $
|
||||
dnl-----------------------------------------------------------------------------
|
||||
|
||||
dnl-----------------------------------------------------------------------------
|
||||
dnl NOTE: Run all configure related scripts from the tmp directory of the
|
||||
dnl project.
|
||||
dnl This is due to the fact that configure spreads a lot of trash around,
|
||||
dnl like atom4te cache directories, config.* files, etc. into the directory
|
||||
dnl it is being run from. We clearly don't want these in our base directory.
|
||||
dnl-----------------------------------------------------------------------------
|
||||
AC_INIT(StorageClient, 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.1 $)
|
||||
|
||||
AC_CONFIG_SRCDIR(../include/LiveSupport/SchedulerClient/SchedulerClientFactory.h)
|
||||
|
||||
AC_CONFIG_HEADERS(configure.h)
|
||||
AC_PROG_CXX()
|
||||
|
||||
AC_CHECK_HEADERS(getopt.h)
|
||||
|
||||
dnl-----------------------------------------------------------------------------
|
||||
dnl enable compilaton for code coverage data
|
||||
dnl-----------------------------------------------------------------------------
|
||||
AC_SUBST(COVERAGE_CXXFLAGS)
|
||||
|
||||
AC_ARG_ENABLE( coverage,
|
||||
[ --enable-coverage enable code coverage data generaton (no) ],
|
||||
ENABLE_COVERAGE=${enableval}, ENABLE_COVERAGE="no" )
|
||||
|
||||
if test "x${ENABLE_COVERAGE}" == "xyes" ; then
|
||||
COVERAGE_CXXFLAGS="-fprofile-arcs -ftest-coverage"
|
||||
AC_MSG_RESULT([compiling in code coverage mode])
|
||||
else
|
||||
AC_MSG_RESULT([not compiling in code coverage mode])
|
||||
fi
|
||||
|
||||
|
||||
AC_CONFIG_FILES(../Makefile:../etc/Makefile.in)
|
||||
|
||||
AC_OUTPUT()
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE schedulerClientFactory [
|
||||
|
||||
<!ELEMENT schedulerClientFactory (schedulerDaemonXmlRpcClient) >
|
||||
|
||||
<!ELEMENT schedulerDaemonXmlRpcClient EMPTY >
|
||||
<!ATTLIST schedulerDaemonXmlRpcClient xmlRpcHost CDATA #REQUIRED >
|
||||
<!ATTLIST schedulerDaemonXmlRpcClient xmlRpcPort NMTOKEN #REQUIRED >
|
||||
<!ATTLIST schedulerDaemonXmlRpcClient xmlRpcUri CDATA #REQUIRED >
|
||||
|
||||
]>
|
||||
<schedulerClientFactory>
|
||||
<schedulerDaemonXmlRpcClient xmlRpcHost = "localhost"
|
||||
xmlRpcPort = "3344"
|
||||
xmlRpcUri = "/RC2"
|
||||
/>
|
||||
</schedulerClientFactory>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE schedulerDaemonXmlRpcClient [
|
||||
|
||||
<!ELEMENT schedulerDaemonXmlRpcClient EMPTY >
|
||||
<!ATTLIST schedulerDaemonXmlRpcClient xmlRpcHost CDATA #REQUIRED >
|
||||
<!ATTLIST schedulerDaemonXmlRpcClient xmlRpcPort NMTOKEN #REQUIRED >
|
||||
<!ATTLIST schedulerDaemonXmlRpcClient xmlRpcUri CDATA #REQUIRED >
|
||||
|
||||
]>
|
||||
<schedulerDaemonXmlRpcClient xmlRpcHost = "localhost"
|
||||
xmlRpcPort = "3344"
|
||||
xmlRpcUri = "/RC2"
|
||||
/>
|
|
@ -0,0 +1,193 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
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/schedulerClient/include/LiveSupport/SchedulerClient/SchedulerClientFactory.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef LiveSupport_SchedulerClient_SchedulerClientFactory_h
|
||||
#define LiveSupport_SchedulerClient_SchedulerClientFactory_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "LiveSupport/Core/Configurable.h"
|
||||
#include "LiveSupport/SchedulerClient/SchedulerClientInterface.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace SchedulerClient {
|
||||
|
||||
using namespace LiveSupport;
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* The factory to create SchedulerClientInterface objects.
|
||||
*
|
||||
* This object has to be configured with an XML configuration element
|
||||
* called authenticationClientFactory. This element contains a child element
|
||||
* specifying and configuring the kind of AuthenticationClient that the
|
||||
* factory builds. This client is either a TestAuthenticationClient or
|
||||
* a WebAuthenticationClient, and the child element name is either
|
||||
* testAuthentication or webAuthentication, correspondingly.
|
||||
*
|
||||
* An authenticationClientFactory configuration element may look like
|
||||
* the following:
|
||||
*
|
||||
* <pre><code>
|
||||
* <authenticationClientFactory>
|
||||
* <webAuthentication>
|
||||
* ...
|
||||
* </webAuthentication>
|
||||
* </authenticationClientFactory>
|
||||
* </code></pre>
|
||||
*
|
||||
* For detais of the testAuthentication and webAuthentication elements, see the
|
||||
* documentation for the TestAuthenticationClient and WebAuthenticationClient
|
||||
* classes.
|
||||
*
|
||||
* The DTD for the above element is:
|
||||
*
|
||||
* <pre><code>
|
||||
* <!ELEMENT authenticationClientFactory (testAuthentication|
|
||||
* webAuthentication) >
|
||||
* </code></pre>
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.1 $
|
||||
* @see TestAuthenticationClient
|
||||
* @see WebAuthenticationClient
|
||||
*/
|
||||
class SchedulerClientFactory : virtual public Configurable
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The name of the configuration XML elmenent used by this object.
|
||||
*/
|
||||
static const std::string configElementNameStr;
|
||||
|
||||
/**
|
||||
* The singleton instance of this object.
|
||||
*/
|
||||
static Ptr<SchedulerClientFactory>::Ref singleton;
|
||||
|
||||
/**
|
||||
* The authentication client created by this factory.
|
||||
*/
|
||||
Ptr<SchedulerClientInterface>::Ref schedulerClient;
|
||||
|
||||
/**
|
||||
* The default constructor.
|
||||
*/
|
||||
SchedulerClientFactory(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* A virtual destructor, as this class has virtual functions.
|
||||
*/
|
||||
virtual
|
||||
~SchedulerClientFactory(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the XML element this object expects
|
||||
* to be sent to a call to configure().
|
||||
*
|
||||
* @return the name of the expected XML configuration element.
|
||||
*/
|
||||
static const std::string
|
||||
getConfigElementName(void) throw ()
|
||||
{
|
||||
return configElementNameStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the singleton instance of this object.
|
||||
*
|
||||
* @return the singleton instance of this object.
|
||||
*/
|
||||
static Ptr<SchedulerClientFactory>::Ref
|
||||
getInstance() throw ();
|
||||
|
||||
/**
|
||||
* Configure the object based on the XML element supplied.
|
||||
*
|
||||
* @param element the XML element to configure the object from.
|
||||
* @exception std::invalid_argument if the supplied XML element
|
||||
* contains bad configuraiton information
|
||||
* @exception std::logic_error if the object has already
|
||||
* been configured, and can not be reconfigured.
|
||||
*/
|
||||
virtual void
|
||||
configure(const xmlpp::Element & element)
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error);
|
||||
|
||||
/**
|
||||
* Return a scheduler client.
|
||||
*
|
||||
* @return the appropriate scheduler client, according to the
|
||||
* configuration of this factory.
|
||||
*/
|
||||
Ptr<SchedulerClientInterface>::Ref
|
||||
getSchedulerClient(void) throw ()
|
||||
{
|
||||
return schedulerClient;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace SchedulerClient
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_SchedulerClient_SchedulerClientFactory_h
|
||||
|
|
@ -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/modules/schedulerClient/include/LiveSupport/SchedulerClient/SchedulerClientInterface.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef LiveSupport_SchedulerClient_SchedulerClientInterface_h
|
||||
#define LiveSupport_SchedulerClient_SchedulerClientInterface_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace SchedulerClient {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* An interface to access the scheduler daemon as a client.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
class SchedulerClientInterface
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Return the version string for the scheduler this client
|
||||
* is connected to.
|
||||
*
|
||||
* @return the version string of the scheduler daemon.
|
||||
*/
|
||||
virtual Ptr<const std::string>::Ref
|
||||
getVersion(void) throw ()
|
||||
= 0;
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace SchedulerClient
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_SchedulerClient_SchedulerClientInterface_h
|
||||
|
|
@ -0,0 +1 @@
|
|||
keep me
|
|
@ -0,0 +1,113 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
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/schedulerClient/src/SchedulerClientFactory.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/SchedulerClient/SchedulerClientFactory.h"
|
||||
#include "SchedulerDaemonXmlRpcClient.h"
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::SchedulerClient;
|
||||
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the config element for this class
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string SchedulerClientFactory::configElementNameStr =
|
||||
"schedulerClientFactory";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The singleton instance of SchedulerClientFactory
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<SchedulerClientFactory>::Ref SchedulerClientFactory::singleton;
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return the singleton instance to SchedulerClientFactory
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<SchedulerClientFactory>::Ref
|
||||
SchedulerClientFactory :: getInstance(void) throw ()
|
||||
{
|
||||
if (!singleton.get()) {
|
||||
singleton.reset(new SchedulerClientFactory());
|
||||
}
|
||||
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Configure the test authentication client.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SchedulerClientFactory :: configure(const xmlpp::Element & element)
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error)
|
||||
{
|
||||
if (element.get_name() != configElementNameStr) {
|
||||
std::string eMsg = "Bad configuration element ";
|
||||
eMsg += element.get_name();
|
||||
throw std::invalid_argument(eMsg);
|
||||
}
|
||||
|
||||
schedulerClient.reset();
|
||||
|
||||
// try to look for a SchedulerDaemonXmlRpcClient configuration element
|
||||
xmlpp::Node::NodeList nodes =
|
||||
element.get_children(
|
||||
SchedulerDaemonXmlRpcClient::getConfigElementName());
|
||||
if (nodes.size() >= 1) {
|
||||
const xmlpp::Element * configElement =
|
||||
dynamic_cast<const xmlpp::Element*> (*(nodes.begin()));
|
||||
|
||||
Ptr<SchedulerDaemonXmlRpcClient>::Ref client;
|
||||
client.reset(new SchedulerDaemonXmlRpcClient());
|
||||
client->configure(*configElement);
|
||||
|
||||
schedulerClient = client;
|
||||
return;
|
||||
}
|
||||
|
||||
throw std::invalid_argument("no authentication client configuration found");
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
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/schedulerClient/src/SchedulerClientFactoryTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#error "Need unistd.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "SchedulerClientFactoryTest.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::SchedulerClient;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(SchedulerClientFactoryTest);
|
||||
|
||||
/**
|
||||
* The name of the configuration file for the scheduler client.
|
||||
*/
|
||||
static const std::string configFileName = "etc/schedulerClientFactory.xml";
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Set up the test environment
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SchedulerClientFactoryTest :: setUp(void) throw ()
|
||||
{
|
||||
schedulerClientFactory = SchedulerClientFactory::getInstance();
|
||||
|
||||
// TODO: only configure, if not configured earlier
|
||||
try {
|
||||
Ptr<xmlpp::DomParser>::Ref parser(
|
||||
new xmlpp::DomParser(configFileName, true));
|
||||
const xmlpp::Document * document = parser->get_document();
|
||||
const xmlpp::Element * root = document->get_root_node();
|
||||
|
||||
schedulerClientFactory->configure(*root);
|
||||
|
||||
} catch (std::invalid_argument &e) {
|
||||
CPPUNIT_FAIL("semantic error in configuration file");
|
||||
} catch (xmlpp::exception &e) {
|
||||
CPPUNIT_FAIL("error parsing configuration file");
|
||||
}
|
||||
|
||||
schedulerClient = schedulerClientFactory->getSchedulerClient();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Clean up the test environment
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SchedulerClientFactoryTest :: tearDown(void) throw ()
|
||||
{
|
||||
schedulerClientFactory.reset();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Test to see if we can log on and off
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SchedulerClientFactoryTest :: firstTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
CPPUNIT_ASSERT(schedulerClient.get());
|
||||
|
||||
Ptr<const std::string>::Ref version = schedulerClient->getVersion();
|
||||
CPPUNIT_ASSERT(version.get());
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
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/schedulerClient/src/SchedulerClientFactoryTest.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef SchedulerClientFactoryTest_h
|
||||
#define SchedulerClientFactoryTest_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
#include "LiveSupport/SchedulerClient/SchedulerClientFactory.h"
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace SchedulerClient {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* Unit test for the SchedulerClientFactoryTest class.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.1 $
|
||||
* @see SchedulerClientFactoryTest
|
||||
*/
|
||||
class SchedulerClientFactoryTest : public CPPUNIT_NS::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(SchedulerClientFactoryTest);
|
||||
CPPUNIT_TEST(firstTest);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
/**
|
||||
* The SchedulerClientFactory instance to test.
|
||||
*/
|
||||
Ptr<SchedulerClientFactory>::Ref schedulerClientFactory;
|
||||
|
||||
/**
|
||||
* The SchedulerClientInterface returned by the factory.
|
||||
*/
|
||||
Ptr<SchedulerClientInterface>::Ref schedulerClient;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* A simple test.
|
||||
*
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
void
|
||||
firstTest(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Set up the environment for the test case.
|
||||
*/
|
||||
void
|
||||
setUp(void) throw ();
|
||||
|
||||
/**
|
||||
* Clean up the environment after the test case.
|
||||
*/
|
||||
void
|
||||
tearDown(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace SchedulerClient
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // SchedulerClientFactoryTest_h
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
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/schedulerClient/src/SchedulerDaemonXmlRpcClient.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <XmlRpcClient.h>
|
||||
#include <XmlRpcValue.h>
|
||||
|
||||
#include "SchedulerDaemonXmlRpcClient.h"
|
||||
|
||||
using namespace boost::posix_time;
|
||||
using namespace XmlRpc;
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::SchedulerClient;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ configuration file constants */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the config element for this class
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string SchedulerDaemonXmlRpcClient::configElementNameStr
|
||||
= "schedulerDaemonXmlRpcClient";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the config element attribute for the XML-RPC host
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string xmlRpcHostAttrName = "xmlRpcHost";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the config element attribute for the XML-RPC port
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string xmlRpcPortAttrName = "xmlRpcPort";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the config element attribute for the XML-RPC URI
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string xmlRpcUriAttrName = "xmlRpcUri";
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Configure the test storage client.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SchedulerDaemonXmlRpcClient :: configure(const xmlpp::Element & element)
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error)
|
||||
{
|
||||
if (element.get_name() != configElementNameStr) {
|
||||
std::string eMsg = "Bad configuration element ";
|
||||
eMsg += element.get_name();
|
||||
throw std::invalid_argument(eMsg);
|
||||
}
|
||||
|
||||
const xmlpp::Attribute * attribute;
|
||||
std::stringstream strStr;
|
||||
|
||||
// get the XML-RPC host name
|
||||
if (!(attribute = element.get_attribute(xmlRpcHostAttrName))) {
|
||||
std::string eMsg = "Missing attribute ";
|
||||
eMsg += xmlRpcHostAttrName;
|
||||
throw std::invalid_argument(eMsg);
|
||||
}
|
||||
xmlRpcHost.reset(new std::string(attribute->get_value()));
|
||||
|
||||
// get the XML-RPC port
|
||||
if (!(attribute = element.get_attribute(xmlRpcPortAttrName))) {
|
||||
std::string eMsg = "Missing attribute ";
|
||||
eMsg += xmlRpcPortAttrName;
|
||||
throw std::invalid_argument(eMsg);
|
||||
}
|
||||
strStr.str(attribute->get_value());
|
||||
strStr >> xmlRpcPort;
|
||||
|
||||
// get the XML-RPC URI
|
||||
if (!(attribute = element.get_attribute(xmlRpcUriAttrName))) {
|
||||
std::string eMsg = "Missing attribute ";
|
||||
eMsg += xmlRpcUriAttrName;
|
||||
throw std::invalid_argument(eMsg);
|
||||
}
|
||||
xmlRpcUri.reset(new std::string(attribute->get_value()));
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Get the version string from the scheduler daemon
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<const std::string>::Ref
|
||||
SchedulerDaemonXmlRpcClient :: getVersion(void) throw ()
|
||||
{
|
||||
XmlRpcValue xmlRpcParams;
|
||||
XmlRpcValue xmlRpcResult;
|
||||
Ptr<std::string>::Ref result;
|
||||
|
||||
XmlRpcClient xmlRpcClient(xmlRpcHost->c_str(),
|
||||
xmlRpcPort,
|
||||
xmlRpcUri->c_str(),
|
||||
false);
|
||||
|
||||
xmlRpcResult.clear();
|
||||
xmlRpcClient.execute("getVersion", xmlRpcParams, xmlRpcResult);
|
||||
|
||||
if (xmlRpcResult.hasMember("version")) {
|
||||
result.reset(new std::string(xmlRpcResult["version"]));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -0,0 +1,178 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
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/schedulerClient/src/SchedulerDaemonXmlRpcClient.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef SchedulerDaemonXmlRpcClient_h
|
||||
#define SchedulerDaemonXmlRpcClient_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#include <XmlRpcClient.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Core/Configurable.h"
|
||||
#include "LiveSupport/SchedulerClient/SchedulerClientInterface.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace SchedulerClient {
|
||||
|
||||
using namespace LiveSupport;
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* An XML-RPC client to the Scheduler Daemon.
|
||||
*
|
||||
* This object has to be configured with an XML configuration element
|
||||
* called schedulerDaemonXmlRpcClient.
|
||||
*
|
||||
* A schedulerDaemonXmlRpcClient configuration element may look like the
|
||||
* following:
|
||||
*
|
||||
* <pre><code>
|
||||
* <schedulerDaemonXmlRpcClient xmlRpcHost = "localhost"
|
||||
* xmlRpcPort = "3344"
|
||||
* xmlRpcUri = "/RC2"
|
||||
* />
|
||||
* </code></pre>
|
||||
*
|
||||
* The DTD for the above element is:
|
||||
*
|
||||
* <pre><code>
|
||||
* <!ELEMENT schedulerDaemonXmlRpcClient EMPTY >
|
||||
* <!ATTLIST schedulerDaemonXmlRpcClient xmlRpcHost CDATA #REQUIRED >
|
||||
* <!ATTLIST schedulerDaemonXmlRpcClient xmlRpcPort NMTOKEN #REQUIRED >
|
||||
* <!ATTLIST schedulerDaemonXmlRpcClient xmlRpcUri CDATA #REQUIRED >
|
||||
* </code></pre>
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
class SchedulerDaemonXmlRpcClient :
|
||||
virtual public Configurable,
|
||||
virtual public SchedulerClientInterface
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The name of the configuration XML elmenent used by
|
||||
* SchedulerDaemonXmlRpcClient
|
||||
*/
|
||||
static const std::string configElementNameStr;
|
||||
|
||||
/**
|
||||
* The host name of the schedulers XML-RPC interface.
|
||||
*/
|
||||
Ptr<std::string>::Ref xmlRpcHost;
|
||||
|
||||
/**
|
||||
* The port of the schedulers XML-RPC interface.
|
||||
*/
|
||||
unsigned int xmlRpcPort;
|
||||
|
||||
/**
|
||||
* The URI to send to the schedulers XML-RPC interface.
|
||||
*/
|
||||
Ptr<std::string>::Ref xmlRpcUri;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* A virtual destructor, as this class has virtual functions.
|
||||
*/
|
||||
virtual
|
||||
~SchedulerDaemonXmlRpcClient(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the XML element this object expects
|
||||
* to be sent to a call to configure().
|
||||
*
|
||||
* @return the name of the expected XML configuration element.
|
||||
*/
|
||||
static const std::string
|
||||
getConfigElementName(void) throw ()
|
||||
{
|
||||
return configElementNameStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the object based on the XML element supplied.
|
||||
*
|
||||
* @param element the XML element to configure the object from.
|
||||
* @exception std::invalid_argument if the supplied XML element
|
||||
* contains bad configuraiton information
|
||||
* @exception std::logic_error if the scheduler daemon has already
|
||||
* been configured, and can not be reconfigured.
|
||||
*/
|
||||
virtual void
|
||||
configure(const xmlpp::Element & element)
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error);
|
||||
|
||||
/**
|
||||
* Return the version string for the scheduler this client
|
||||
* is connected to.
|
||||
*
|
||||
* @return the version string of the scheduler daemon.
|
||||
*/
|
||||
virtual Ptr<const std::string>::Ref
|
||||
getVersion(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace SchedulerClient
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // SchedulerDaemonXmlRpcClient_h
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
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/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#error "Need unistd.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "SchedulerDaemonXmlRpcClientTest.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::SchedulerClient;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(SchedulerDaemonXmlRpcClientTest);
|
||||
|
||||
/**
|
||||
* The name of the configuration file for the scheduler client.
|
||||
*/
|
||||
static const std::string configFileName = "etc/schedulerDaemonXmlRpcClient.xml";
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Set up the test environment
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SchedulerDaemonXmlRpcClientTest :: setUp(void) throw ()
|
||||
{
|
||||
try {
|
||||
Ptr<xmlpp::DomParser>::Ref parser(
|
||||
new xmlpp::DomParser(configFileName, true));
|
||||
const xmlpp::Document * document = parser->get_document();
|
||||
const xmlpp::Element * root = document->get_root_node();
|
||||
|
||||
schedulerClient.reset(new SchedulerDaemonXmlRpcClient());
|
||||
schedulerClient->configure(*root);
|
||||
} catch (std::invalid_argument &e) {
|
||||
CPPUNIT_FAIL("semantic error in configuration file");
|
||||
} catch (xmlpp::exception &e) {
|
||||
CPPUNIT_FAIL("error parsing configuration file");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Clean up the test environment
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SchedulerDaemonXmlRpcClientTest :: tearDown(void) throw ()
|
||||
{
|
||||
schedulerClient.reset();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Test to see if we can log on and off
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SchedulerDaemonXmlRpcClientTest :: firstTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<const std::string>::Ref version = schedulerClient->getVersion();
|
||||
|
||||
CPPUNIT_ASSERT(version.get());
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
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/schedulerClient/src/SchedulerDaemonXmlRpcClientTest.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef SchedulerDaemonXmlRpcClientTest_h
|
||||
#define SchedulerDaemonXmlRpcClientTest_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
#include "SchedulerDaemonXmlRpcClient.h"
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace SchedulerClient {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* Unit test for the SchedulerDaemonXmlRpcClient class.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.1 $
|
||||
* @see SchedulerDaemonXmlRpcClient
|
||||
*/
|
||||
class SchedulerDaemonXmlRpcClientTest : public CPPUNIT_NS::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(SchedulerDaemonXmlRpcClientTest);
|
||||
CPPUNIT_TEST(firstTest);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
/**
|
||||
* The SchedulerDaemonXmlRpcClient instance to test.
|
||||
*/
|
||||
Ptr<SchedulerDaemonXmlRpcClient>::Ref schedulerClient;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* A simple test.
|
||||
*
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
void
|
||||
firstTest(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Set up the environment for the test case.
|
||||
*/
|
||||
void
|
||||
setUp(void) throw ();
|
||||
|
||||
/**
|
||||
* Clean up the environment after the test case.
|
||||
*/
|
||||
void
|
||||
tearDown(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace SchedulerClient
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // SchedulerDaemonXmlRpcClientTest_h
|
||||
|
|
@ -0,0 +1,281 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
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/schedulerClient/src/TestRunner.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#error "Need unistd.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#else
|
||||
#error "Need getopt.h"
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <cppunit/BriefTestProgressListener.h>
|
||||
#include <cppunit/CompilerOutputter.h>
|
||||
#include <cppunit/XmlOutputter.h>
|
||||
#include <cppunit/extensions/TestFactoryRegistry.h>
|
||||
#include <cppunit/TestResult.h>
|
||||
#include <cppunit/TestResultCollector.h>
|
||||
#include <cppunit/TestRunner.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
/**
|
||||
* Our copyright notice, should be at most 80 columns
|
||||
*/
|
||||
static const char copyrightNotice[] =
|
||||
"Copyright (c) 2004 Media Development Loan Fund under the GNU GPL";
|
||||
|
||||
/**
|
||||
* String describing the short options.
|
||||
*/
|
||||
static const char options[] = "ho:s:v";
|
||||
|
||||
/**
|
||||
* Structure describing the long options
|
||||
*/
|
||||
static const struct option longOptions[] = {
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ "output", required_argument, 0, 'o' },
|
||||
{ "stylesheet", required_argument, 0, 's' },
|
||||
{ "version", no_argument, 0, 'v' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
/**
|
||||
* The encoding to use for the output file.
|
||||
*/
|
||||
static const std::string encoding = "utf-8";
|
||||
|
||||
/**
|
||||
* The output XML file name.
|
||||
*/
|
||||
static Ptr<std::string>::Ref xmlOutFileName;
|
||||
|
||||
/**
|
||||
* The XSLT attached to the output file.
|
||||
*/
|
||||
static Ptr<std::string>::Ref xsltFileName;
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
/**
|
||||
* Print program version.
|
||||
*
|
||||
* @param os the std::ostream to print to.
|
||||
*/
|
||||
static void
|
||||
printVersion ( std::ostream & os );
|
||||
|
||||
/**
|
||||
* Print program usage information.
|
||||
*
|
||||
* @param invocation the command line command used to invoke this program.
|
||||
* @param os the std::ostream to print to.
|
||||
*/
|
||||
static void
|
||||
printUsage ( const char invocation[],
|
||||
std::ostream & os );
|
||||
|
||||
/**
|
||||
* Process command line arguments.
|
||||
*
|
||||
* @param argc the number of arguments.
|
||||
* @param argv the arguments themselves.
|
||||
* @return true of all went well, false in case the program should exit
|
||||
* after this call.
|
||||
*/
|
||||
static bool
|
||||
processArguments(int argc, char *argv[]);
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Run all tests
|
||||
*----------------------------------------------------------------------------*/
|
||||
int
|
||||
main( int argc,
|
||||
char * argv[] ) throw ()
|
||||
{
|
||||
if (!processArguments(argc, argv)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Create the event manager and test controller
|
||||
CPPUNIT_NS::TestResult controller;
|
||||
|
||||
// Add a listener that colllects test result
|
||||
CPPUNIT_NS::TestResultCollector result;
|
||||
controller.addListener( &result );
|
||||
|
||||
// Add a listener that print dots as test run.
|
||||
CPPUNIT_NS::BriefTestProgressListener progress;
|
||||
controller.addListener( &progress );
|
||||
|
||||
// Add the top suite to the test runner
|
||||
CPPUNIT_NS::TestRunner runner;
|
||||
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
|
||||
runner.run( controller );
|
||||
|
||||
// Print test in a compiler compatible format.
|
||||
CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
|
||||
outputter.setLocationFormat("%p:%l:");
|
||||
outputter.write();
|
||||
|
||||
// also generate an XML document as an output
|
||||
std::ofstream xmlOutFile(xmlOutFileName->c_str());
|
||||
CPPUNIT_NS::XmlOutputter xmlOutputter(&result, xmlOutFile, encoding);
|
||||
xmlOutputter.setStandalone(false);
|
||||
if (xsltFileName) {
|
||||
xmlOutputter.setStyleSheet(*xsltFileName);
|
||||
}
|
||||
xmlOutputter.write();
|
||||
xmlOutFile.flush();
|
||||
xmlOutFile.close();
|
||||
|
||||
return result.wasSuccessful() ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Process command line arguments.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static bool
|
||||
processArguments(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
while ((i = getopt_long(argc, argv, options, longOptions, 0)) != -1) {
|
||||
switch (i) {
|
||||
case 'h':
|
||||
printUsage(argv[0], std::cout);
|
||||
return false;
|
||||
|
||||
case 'o':
|
||||
xmlOutFileName.reset(new std::string(optarg));
|
||||
break;
|
||||
|
||||
case 's':
|
||||
xsltFileName.reset(new std::string(optarg));
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
printVersion(std::cout);
|
||||
return false;
|
||||
|
||||
default:
|
||||
printUsage(argv[0], std::cout);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc) {
|
||||
std::cerr << "error processing command line arguments" << std::endl;
|
||||
printUsage(argv[0], std::cout);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!xmlOutFileName) {
|
||||
std::cerr << "mandatory option output file name not specified"
|
||||
<< std::endl;
|
||||
printUsage(argv[0], std::cout);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cerr << "writing output to '" << *xmlOutFileName << '\'' << std::endl;
|
||||
if (xsltFileName) {
|
||||
std::cerr << "using XSLT file '" << *xsltFileName << '\'' << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Print program version.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static void
|
||||
printVersion ( std::ostream & os )
|
||||
{
|
||||
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
|
||||
<< "Unit test runner" << std::endl
|
||||
<< copyrightNotice << std::endl;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Print program usage.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static void
|
||||
printUsage ( const char invocation[],
|
||||
std::ostream & os )
|
||||
{
|
||||
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
|
||||
<< "Unit test runner" << std::endl
|
||||
<< std::endl
|
||||
<< "Usage: " << invocation << " [OPTION]"
|
||||
<< std::endl
|
||||
<< " mandatory options:" << std::endl
|
||||
<< " -o, --output=file.name write test results into this XML file"
|
||||
<< std::endl
|
||||
<< " optional options:" << std::endl
|
||||
<< " -s, --stylesheet specify this XSLT for the output file"
|
||||
<< std::endl
|
||||
<< " this is either an absolute URI, or a"
|
||||
<< std::endl
|
||||
<< " relative path for the output document"
|
||||
<< std::endl
|
||||
<< " -h, --help display this help and exit" << std::endl
|
||||
<< " -v, --version display version information and exit"
|
||||
<< std::endl
|
||||
<< std::endl
|
||||
<< "Report bugs to " << PACKAGE_BUGREPORT << std::endl;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
keep me
|
Loading…
Reference in New Issue