added getVersion XML-RPC method
This commit is contained in:
parent
c5107f715b
commit
2b60d95a9c
|
@ -20,8 +20,8 @@
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: fgerlits $
|
# Author : $Author: maroy $
|
||||||
# Version : $Revision: 1.29 $
|
# Version : $Revision: 1.30 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -34,6 +34,7 @@ MKDIR = mkdir -p
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
RMDIR = rm -rf
|
RMDIR = rm -rf
|
||||||
DOXYGEN = doxygen
|
DOXYGEN = doxygen
|
||||||
|
KILLALL = killall
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Basic directory and file definitions
|
# Basic directory and file definitions
|
||||||
|
@ -148,6 +149,7 @@ SCHEDULER_OBJS = ${TMP_DIR}/SignalDispatcher.o \
|
||||||
${TMP_DIR}/XmlRpcDaemon.o \
|
${TMP_DIR}/XmlRpcDaemon.o \
|
||||||
${TMP_DIR}/SchedulerDaemon.o \
|
${TMP_DIR}/SchedulerDaemon.o \
|
||||||
${TMP_DIR}/XmlRpcTools.o \
|
${TMP_DIR}/XmlRpcTools.o \
|
||||||
|
${TMP_DIR}/GetVersionMethod.o \
|
||||||
${TMP_DIR}/UploadPlaylistMethod.o \
|
${TMP_DIR}/UploadPlaylistMethod.o \
|
||||||
${TMP_DIR}/DisplayScheduleMethod.o \
|
${TMP_DIR}/DisplayScheduleMethod.o \
|
||||||
${TMP_DIR}/DisplayPlaylistMethod.o \
|
${TMP_DIR}/DisplayPlaylistMethod.o \
|
||||||
|
@ -192,6 +194,8 @@ TEST_RUNNER_OBJS = ${SCHEDULER_OBJS} \
|
||||||
${TMP_DIR}/RpcRemoveFromScheduleTest.o \
|
${TMP_DIR}/RpcRemoveFromScheduleTest.o \
|
||||||
${TMP_DIR}/RpcRescheduleTest.o \
|
${TMP_DIR}/RpcRescheduleTest.o \
|
||||||
${TMP_DIR}/XmlRpcToolsTest.o \
|
${TMP_DIR}/XmlRpcToolsTest.o \
|
||||||
|
${TMP_DIR}/GetVersionMethodTest.o \
|
||||||
|
${TMP_DIR}/SchedulerDaemonGetVersionTest.o \
|
||||||
${TMP_DIR}/UploadPlaylistMethodTest.o \
|
${TMP_DIR}/UploadPlaylistMethodTest.o \
|
||||||
${TMP_DIR}/DisplayScheduleMethodTest.o \
|
${TMP_DIR}/DisplayScheduleMethodTest.o \
|
||||||
${TMP_DIR}/DisplayPlaylistMethodTest.o \
|
${TMP_DIR}/DisplayPlaylistMethodTest.o \
|
||||||
|
@ -280,6 +284,11 @@ run: ${SCHEDULER_EXE}
|
||||||
storage_server_init:
|
storage_server_init:
|
||||||
# ${MAKE} -C ${STORAGE_SERVER_DIR}
|
# ${MAKE} -C ${STORAGE_SERVER_DIR}
|
||||||
|
|
||||||
|
kill:
|
||||||
|
${KILLALL} scheduler
|
||||||
|
sleep 2
|
||||||
|
${KILLALL} -9 scheduler
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Specific targets
|
# Specific targets
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/GetVersionMethod.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_TIME_H
|
||||||
|
#include <time.h>
|
||||||
|
#else
|
||||||
|
#error need time.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "XmlRpcTools.h"
|
||||||
|
|
||||||
|
#include "GetVersionMethod.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of this XML-RPC method.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string GetVersionMethod::methodName = "getVersion";
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The version string.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string GetVersionMethod::versionStr =
|
||||||
|
"Scheduler Daemon (" PACKAGE_VERSION ")";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Construct the method and register it right away.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
GetVersionMethod :: GetVersionMethod (
|
||||||
|
Ptr<XmlRpc::XmlRpcServer>::Ref xmlRpcServer) throw ()
|
||||||
|
: XmlRpc::XmlRpcServerMethod(methodName, xmlRpcServer.get())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Execute the stop XML-RPC function call.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
GetVersionMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
|
||||||
|
XmlRpc::XmlRpcValue & returnValue)
|
||||||
|
throw (XmlRpc::XmlRpcException)
|
||||||
|
{
|
||||||
|
returnValue["version"] = versionStr;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/GetVersionMethod.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef GetVersionMethod_h
|
||||||
|
#define GetVersionMethod_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 <XmlRpcServerMethod.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
#include <XmlRpcException.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An XML-RPC method object to return the version string for the
|
||||||
|
* scheduler daemon.
|
||||||
|
*
|
||||||
|
* The name of the method when called through XML-RPC is "getVersion".
|
||||||
|
*
|
||||||
|
* There are no expected parameters for this method.
|
||||||
|
*
|
||||||
|
* The XML-RPC function returns an XML-RPC structure, containing the following
|
||||||
|
* fields:
|
||||||
|
* <ul>
|
||||||
|
* <li>version - string - the version string of the Scheduler Daemon
|
||||||
|
* </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* There are no possible internal error condititons for this function.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class GetVersionMethod : public XmlRpc::XmlRpcServerMethod
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The name of this method, as it will be registered into the
|
||||||
|
* XML-RPC server.
|
||||||
|
*/
|
||||||
|
static const std::string methodName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version string, returned by this method.
|
||||||
|
*/
|
||||||
|
static const std::string versionStr;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* A default constructor, for testing purposes.
|
||||||
|
*/
|
||||||
|
GetVersionMethod(void) throw ()
|
||||||
|
: XmlRpc::XmlRpcServerMethod(methodName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constuctor that registers the method with the server right away.
|
||||||
|
*
|
||||||
|
* @param xmlRpcServer the XML-RPC server to register with.
|
||||||
|
*/
|
||||||
|
GetVersionMethod(
|
||||||
|
Ptr<XmlRpc::XmlRpcServer>::Ref xmlRpcServer)
|
||||||
|
throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the create playlist command on the Scheduler daemon.
|
||||||
|
*
|
||||||
|
* @param parameters XML-RPC function call parameters
|
||||||
|
* @param returnValue the return value of the call (out parameter)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
execute( XmlRpc::XmlRpcValue & parameters,
|
||||||
|
XmlRpc::XmlRpcValue & returnValue)
|
||||||
|
throw (XmlRpc::XmlRpcException);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Scheduler
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // GetVersionMethod_h
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/GetVersionMethodTest.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 <iostream>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "GetVersionMethod.h"
|
||||||
|
#include "GetVersionMethodTest.h"
|
||||||
|
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(GetVersionMethodTest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The persumed version string.
|
||||||
|
*/
|
||||||
|
static const std::string versionStr = "Scheduler Daemon (" PACKAGE_VERSION ")";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
GetVersionMethodTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
GetVersionMethodTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Just a very simple smoke test
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
GetVersionMethodTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
Ptr<GetVersionMethod>::Ref method(new GetVersionMethod());
|
||||||
|
XmlRpc::XmlRpcValue rootParameter;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
try {
|
||||||
|
method->execute(rootParameter, result);
|
||||||
|
} catch (XmlRpc::XmlRpcException &e) {
|
||||||
|
std::stringstream eMsg;
|
||||||
|
eMsg << "XML-RPC method returned error: " << e.getCode()
|
||||||
|
<< " - " << e.getMessage();
|
||||||
|
CPPUNIT_FAIL(eMsg.str());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("version"));
|
||||||
|
CPPUNIT_ASSERT(result["version"] == versionStr);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/GetVersionMethodTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef GetVersionMethodTest_h
|
||||||
|
#define GetVersionMethodTest_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/Core/AuthenticationClientInterface.h"
|
||||||
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the GetVersionMethod class.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see GetVersionMethod
|
||||||
|
*/
|
||||||
|
class GetVersionMethodTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(GetVersionMethodTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
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 Scheduler
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // GetVersionMethodTest_h
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.10 $
|
Version : $Revision: 1.11 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -101,6 +101,7 @@ static const std::string xmlRpcDaemonConfElement = "xmlRpcDaemon";
|
||||||
SchedulerDaemon :: SchedulerDaemon (void) throw ()
|
SchedulerDaemon :: SchedulerDaemon (void) throw ()
|
||||||
: XmlRpcDaemon()
|
: XmlRpcDaemon()
|
||||||
{
|
{
|
||||||
|
getVersionMethod.reset(new GetVersionMethod());
|
||||||
uploadPlaylistMethod.reset(new UploadPlaylistMethod());
|
uploadPlaylistMethod.reset(new UploadPlaylistMethod());
|
||||||
displayScheduleMethod.reset(new DisplayScheduleMethod());
|
displayScheduleMethod.reset(new DisplayScheduleMethod());
|
||||||
displayPlaylistMethod.reset(new DisplayPlaylistMethod());
|
displayPlaylistMethod.reset(new DisplayPlaylistMethod());
|
||||||
|
@ -208,6 +209,7 @@ SchedulerDaemon :: registerXmlRpcFunctions(
|
||||||
Ptr<XmlRpc::XmlRpcServer>::Ref xmlRpcServer)
|
Ptr<XmlRpc::XmlRpcServer>::Ref xmlRpcServer)
|
||||||
throw (std::logic_error)
|
throw (std::logic_error)
|
||||||
{
|
{
|
||||||
|
xmlRpcServer->addMethod(getVersionMethod.get());
|
||||||
xmlRpcServer->addMethod(uploadPlaylistMethod.get());
|
xmlRpcServer->addMethod(uploadPlaylistMethod.get());
|
||||||
xmlRpcServer->addMethod(displayScheduleMethod.get());
|
xmlRpcServer->addMethod(displayScheduleMethod.get());
|
||||||
xmlRpcServer->addMethod(displayPlaylistMethod.get());
|
xmlRpcServer->addMethod(displayPlaylistMethod.get());
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.9 $
|
Version : $Revision: 1.10 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -62,6 +62,7 @@
|
||||||
#include "LiveSupport/Core/Configurable.h"
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
#include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h"
|
#include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h"
|
||||||
#include "LiveSupport/EventScheduler/EventScheduler.h"
|
#include "LiveSupport/EventScheduler/EventScheduler.h"
|
||||||
|
#include "GetVersionMethod.h"
|
||||||
#include "UploadPlaylistMethod.h"
|
#include "UploadPlaylistMethod.h"
|
||||||
#include "DisplayScheduleMethod.h"
|
#include "DisplayScheduleMethod.h"
|
||||||
#include "DisplayPlaylistMethod.h"
|
#include "DisplayPlaylistMethod.h"
|
||||||
|
@ -125,8 +126,8 @@ using namespace LiveSupport::PlaylistExecutor;
|
||||||
* scheduleFactory,xmlRpcDaemon) >
|
* scheduleFactory,xmlRpcDaemon) >
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.9 $
|
* @version $Revision: 1.10 $
|
||||||
* @see ConnectionManagerFactory
|
* @see ConnectionManagerFactory
|
||||||
* @see StorageClientFactory
|
* @see StorageClientFactory
|
||||||
* @see ScheduleFactory
|
* @see ScheduleFactory
|
||||||
|
@ -153,6 +154,11 @@ class SchedulerDaemon : public Installable,
|
||||||
*/
|
*/
|
||||||
Ptr<AudioPlayerInterface>::Ref audioPlayer;
|
Ptr<AudioPlayerInterface>::Ref audioPlayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The getVersion the daemon is providing.
|
||||||
|
*/
|
||||||
|
Ptr<GetVersionMethod>::Ref getVersionMethod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The uploadPlaylistMethod the daemon is providing.
|
* The uploadPlaylistMethod the daemon is providing.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/Attic/SchedulerDaemonGetVersionTest.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 <XmlRpcClient.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "SchedulerDaemon.h"
|
||||||
|
#include "SchedulerDaemonGetVersionTest.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace XmlRpc;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(SchedulerDaemonGetVersionTest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration file for the scheduler daemon.
|
||||||
|
*/
|
||||||
|
static const std::string configFileName = "etc/scheduler.xml";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The persumed version string.
|
||||||
|
*/
|
||||||
|
static const std::string versionStr = "Scheduler Daemon (" PACKAGE_VERSION ")";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Configure a Configurable with an XML file.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SchedulerDaemonGetVersionTest :: configure(
|
||||||
|
Ptr<Configurable>::Ref configurable,
|
||||||
|
const std::string & fileName)
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
xmlpp::exception)
|
||||||
|
{
|
||||||
|
Ptr<xmlpp::DomParser>::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
|
||||||
|
SchedulerDaemonGetVersionTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
|
|
||||||
|
if (!daemon->isConfigured()) {
|
||||||
|
try {
|
||||||
|
configure(daemon, configFileName);
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
|
} catch (xmlpp::exception &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
CPPUNIT_FAIL("error parsing configuration file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
daemon->install();
|
||||||
|
// daemon->start();
|
||||||
|
// sleep(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SchedulerDaemonGetVersionTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
|
|
||||||
|
// daemon->stop();
|
||||||
|
daemon->uninstall();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Test a simple upload.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SchedulerDaemonGetVersionTest :: simpleTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
XmlRpcValue parameters;
|
||||||
|
XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
xmlRpcClient.execute("getVersion", parameters, result);
|
||||||
|
CPPUNIT_ASSERT(!result.hasMember("errorCode"));
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("version"));
|
||||||
|
CPPUNIT_ASSERT(result["version"] == versionStr);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,124 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/Attic/SchedulerDaemonGetVersionTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef SchedulerDaemonGetVersionTest_h
|
||||||
|
#define SchedulerDaemonGetVersionTest_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>
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test to test the getVersion XML-RPC call.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see SchedulerDaemon
|
||||||
|
*/
|
||||||
|
class SchedulerDaemonGetVersionTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(SchedulerDaemonGetVersionTest);
|
||||||
|
CPPUNIT_TEST(simpleTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* 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<Configurable>::Ref configurable,
|
||||||
|
const std::string & fileName)
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
xmlpp::exception);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple test for playlist uploading.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
simpleTest(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 Scheduler
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // SchedulerDaemonGetVersionTest_h
|
||||||
|
|
Loading…
Reference in New Issue