added the last remaining tests of the XML-RPC methods (Rpc...Test classes)
This commit is contained in:
parent
2d4c16a1d3
commit
f1701e9477
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.34 $
|
Version : $Revision: 1.35 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -1875,6 +1875,8 @@ WebStorageClient :: reset(void)
|
||||||
throw XmlRpcMethodResponseException(eMsg.str());
|
throw XmlRpcMethodResponseException(eMsg.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editedPlaylists.clear();
|
||||||
|
|
||||||
XmlRpcValue audioClipArray = result[resetStorageAudioClipResultParamName];
|
XmlRpcValue audioClipArray = result[resetStorageAudioClipResultParamName];
|
||||||
audioClipIds.reset(new std::vector<Ptr<UniqueId>::Ref>);
|
audioClipIds.reset(new std::vector<Ptr<UniqueId>::Ref>);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: fgerlits $
|
# Author : $Author: fgerlits $
|
||||||
# Version : $Revision: 1.49 $
|
# Version : $Revision: 1.50 $
|
||||||
# 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@
|
||||||
|
@ -225,21 +225,28 @@ TEST_RUNNER_OBJS = ${SCHEDULER_OBJS} \
|
||||||
${TMP_DIR}/DisplayPlaylistsMethodTest.o \
|
${TMP_DIR}/DisplayPlaylistsMethodTest.o \
|
||||||
${TMP_DIR}/RpcDisplayPlaylistsTest.o \
|
${TMP_DIR}/RpcDisplayPlaylistsTest.o \
|
||||||
${TMP_DIR}/OpenPlaylistForEditingMethodTest.o \
|
${TMP_DIR}/OpenPlaylistForEditingMethodTest.o \
|
||||||
|
${TMP_DIR}/RpcOpenPlaylistForEditingTest.o \
|
||||||
${TMP_DIR}/CreatePlaylistMethodTest.o \
|
${TMP_DIR}/CreatePlaylistMethodTest.o \
|
||||||
${TMP_DIR}/RpcCreatePlaylistTest.o \
|
${TMP_DIR}/RpcCreatePlaylistTest.o \
|
||||||
${TMP_DIR}/AddAudioClipToPlaylistMethodTest.o \
|
${TMP_DIR}/AddAudioClipToPlaylistMethodTest.o \
|
||||||
${TMP_DIR}/RpcAddAudioClipToPlaylistTest.o \
|
${TMP_DIR}/RpcAddAudioClipToPlaylistTest.o \
|
||||||
${TMP_DIR}/RemoveAudioClipFromPlaylistMethodTest.o \
|
${TMP_DIR}/RemoveAudioClipFromPlaylistMethodTest.o \
|
||||||
|
${TMP_DIR}/RpcRemoveAudioClipFromPlaylistTest.o \
|
||||||
${TMP_DIR}/ValidatePlaylistMethodTest.o \
|
${TMP_DIR}/ValidatePlaylistMethodTest.o \
|
||||||
|
${TMP_DIR}/RpcValidatePlaylistTest.o \
|
||||||
${TMP_DIR}/DisplayAudioClipMethodTest.o \
|
${TMP_DIR}/DisplayAudioClipMethodTest.o \
|
||||||
${TMP_DIR}/RpcDisplayAudioClipTest.o \
|
${TMP_DIR}/RpcDisplayAudioClipTest.o \
|
||||||
${TMP_DIR}/DisplayAudioClipsMethodTest.o \
|
${TMP_DIR}/DisplayAudioClipsMethodTest.o \
|
||||||
${TMP_DIR}/RpcDisplayAudioClipsTest.o \
|
${TMP_DIR}/RpcDisplayAudioClipsTest.o \
|
||||||
${TMP_DIR}/SavePlaylistMethodTest.o \
|
${TMP_DIR}/SavePlaylistMethodTest.o \
|
||||||
|
${TMP_DIR}/RpcSavePlaylistTest.o \
|
||||||
${TMP_DIR}/RevertEditedPlaylistMethodTest.o \
|
${TMP_DIR}/RevertEditedPlaylistMethodTest.o \
|
||||||
|
${TMP_DIR}/RpcRevertEditedPlaylistTest.o \
|
||||||
${TMP_DIR}/PostgresqlPlayLogTest.o \
|
${TMP_DIR}/PostgresqlPlayLogTest.o \
|
||||||
${TMP_DIR}/GeneratePlayReportMethodTest.o \
|
${TMP_DIR}/GeneratePlayReportMethodTest.o \
|
||||||
|
${TMP_DIR}/RpcGeneratePlayReportTest.o \
|
||||||
${TMP_DIR}/UpdateFadeInFadeOutMethodTest.o \
|
${TMP_DIR}/UpdateFadeInFadeOutMethodTest.o \
|
||||||
|
${TMP_DIR}/RpcUpdateFadeInFadeOutTest.o \
|
||||||
${TMP_DIR}/PlaylistEventContainerTest.o \
|
${TMP_DIR}/PlaylistEventContainerTest.o \
|
||||||
${TMP_DIR}/PlaylistEventTest.o
|
${TMP_DIR}/PlaylistEventTest.o
|
||||||
TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl
|
TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl
|
||||||
|
|
|
@ -4,15 +4,16 @@
|
||||||
<!ELEMENT authenticationClientFactory (testAuthentication|
|
<!ELEMENT authenticationClientFactory (testAuthentication|
|
||||||
webAuthentication)>
|
webAuthentication)>
|
||||||
|
|
||||||
<!ELEMENT testAuthentication (user) >
|
<!ELEMENT webAuthentication (location) >
|
||||||
|
|
||||||
<!ELEMENT user EMPTY >
|
|
||||||
<!ATTLIST user login CDATA #REQUIRED >
|
|
||||||
<!ATTLIST user password CDATA #REQUIRED >
|
|
||||||
|
|
||||||
|
<!ELEMENT location EMPTY >
|
||||||
|
<!ATTLIST location server CDATA #REQUIRED >
|
||||||
|
<!ATTLIST location port NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST location path CDATA #REQUIRED >
|
||||||
]>
|
]>
|
||||||
<authenticationClientFactory>
|
<authenticationClientFactory>
|
||||||
<testAuthentication>
|
<webAuthentication>
|
||||||
<user login="root" password="q" />
|
<location server="localhost" port="80"
|
||||||
</testAuthentication>
|
path="/livesupportStorageServer/xmlrpc/xrLocStor.php" />
|
||||||
|
</webAuthentication>
|
||||||
</authenticationClientFactory>
|
</authenticationClientFactory>
|
||||||
|
|
|
@ -3,48 +3,18 @@
|
||||||
|
|
||||||
<!ELEMENT storageClientFactory (webStorage|testStorage) >
|
<!ELEMENT storageClientFactory (webStorage|testStorage) >
|
||||||
|
|
||||||
<!ELEMENT testStorage (playlist*, audioClip*) >
|
<!ELEMENT webStorage (location) >
|
||||||
<!ATTLIST testStorage tempFiles CDATA #REQUIRED >
|
<!ATTLIST webStorage tempFiles CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT playlist (playlistElement*) >
|
<!ELEMENT location EMPTY >
|
||||||
<!ATTLIST playlist id NMTOKEN #REQUIRED >
|
<!ATTLIST location server CDATA #REQUIRED >
|
||||||
<!ATTLIST playlist playlength NMTOKEN #REQUIRED >
|
<!ATTLIST location port NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST location path CDATA #REQUIRED >
|
||||||
<!ELEMENT playlistElement ((audioClip|playlist), fadeInfo?) >
|
|
||||||
<!ATTLIST playlistElement id NMTOKEN #REQUIRED >
|
|
||||||
<!ATTLIST playlistElement relativeOffset NMTOKEN #REQUIRED >
|
|
||||||
|
|
||||||
<!ELEMENT audioClip EMPTY >
|
|
||||||
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
|
||||||
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
|
||||||
<!ATTLIST audioClip title CDATA #REQUIRED >
|
|
||||||
<!ATTLIST audioClip uri CDATA #REQUIRED >
|
|
||||||
|
|
||||||
<!ELEMENT fadeInfo EMPTY >
|
|
||||||
<!ATTLIST fadeInfo id NMTOKEN #REQUIRED >
|
|
||||||
<!ATTLIST fadeInfo fadeIn NMTOKEN #REQUIRED >
|
|
||||||
<!ATTLIST fadeInfo fadeOut NMTOKEN #REQUIRED >
|
|
||||||
]>
|
]>
|
||||||
<storageClientFactory>
|
<storageClientFactory>
|
||||||
<testStorage tempFiles="file:///tmp/tempPlaylist">
|
<webStorage tempFiles="file:///tmp/webStorageClient" >
|
||||||
<playlist id="0000000000000001" playlength="01:30:00.000">
|
<location server="localhost" port="80"
|
||||||
<playlistElement id="0000000000000101" relativeOffset="0" >
|
path="/livesupportStorageServer/xmlrpc/xrLocStor.php" />
|
||||||
<audioClip id="0000000000010001" playlength="01:00:00.000"
|
</webStorage>
|
||||||
title="one"
|
|
||||||
uri="file:var/test1.mp3" />
|
|
||||||
</playlistElement>
|
|
||||||
<playlistElement id="0000000000000102"
|
|
||||||
relativeOffset="01:00:00.000" >
|
|
||||||
<audioClip id="0000000000010002" playlength="00:30:00.000"
|
|
||||||
title="two"
|
|
||||||
uri="file:var/test2.mp3" />
|
|
||||||
</playlistElement>
|
|
||||||
</playlist>
|
|
||||||
<audioClip id="0000000000010001" playlength="01:00:00.000"
|
|
||||||
title="one"
|
|
||||||
uri="file:var/test1.mp3" />
|
|
||||||
<audioClip id="0000000000010002" playlength="00:30:00.000"
|
|
||||||
title="two"
|
|
||||||
uri="file:var/test2.mp3" />
|
|
||||||
</testStorage>
|
|
||||||
</storageClientFactory>
|
</storageClientFactory>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.11 $
|
Version : $Revision: 1.12 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -106,10 +106,11 @@ void
|
||||||
RpcAddAudioClipToPlaylistTest :: firstTest(void)
|
RpcAddAudioClipToPlaylistTest :: firstTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
parameters["sessionId"] = sessionId->getId();
|
parameters["sessionId"] = sessionId->getId();
|
||||||
parameters["playlistId"] = "0000000000000001";
|
parameters["playlistId"] = "0000000000000001";
|
||||||
parameters["audioClipId"] = "0000000000010001";
|
parameters["audioClipId"] = "0000000000010001";
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.10 $
|
Version : $Revision: 1.11 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -48,11 +48,6 @@ using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(RpcDisplayPlaylistTest);
|
CPPUNIT_TEST_SUITE_REGISTRATION(RpcDisplayPlaylistTest);
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the configuration file for the scheduler daemon.
|
|
||||||
*/
|
|
||||||
static const std::string configFileName = "etc/scheduler.xml";
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,379 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <XmlRpcClient.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/UniqueId.h"
|
||||||
|
#include "SchedulerDaemon.h"
|
||||||
|
#include "PlayLogFactory.h"
|
||||||
|
|
||||||
|
#include "RpcGeneratePlayReportTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(RpcGeneratePlayReportTest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration file for the scheduler daemon
|
||||||
|
*/
|
||||||
|
static const std::string configFileName = "etc/scheduler.xml";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcGeneratePlayReportTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
|
|
||||||
|
if (!daemon->isConfigured()) {
|
||||||
|
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();
|
||||||
|
daemon->configure(*root);
|
||||||
|
} 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();
|
||||||
|
insertEntries();
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
parameters["login"] = "root";
|
||||||
|
parameters["password"] = "q";
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("login", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("sessionId"));
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
|
||||||
|
sessionId.reset(new SessionId(std::string(result["sessionId"])));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcGeneratePlayReportTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
|
||||||
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
|
daemon->uninstall();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Insert some entries into the play log
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcGeneratePlayReportTest :: insertEntries(void)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
Ptr<PlayLogFactory>::Ref plf = PlayLogFactory::getInstance();
|
||||||
|
Ptr<PlayLogInterface>::Ref playLog = plf->getPlayLog();
|
||||||
|
|
||||||
|
Ptr<const UniqueId>::Ref audioClipId(new UniqueId(10001));
|
||||||
|
Ptr<const ptime>::Ref timestamp(new ptime(time_from_string(
|
||||||
|
"2004-10-26 14:00:00")));
|
||||||
|
playLog->addPlayLogEntry(audioClipId, timestamp);
|
||||||
|
|
||||||
|
audioClipId.reset(new UniqueId(10017));
|
||||||
|
timestamp.reset(new ptime(time_from_string("2004-10-26 15:30:00")));
|
||||||
|
playLog->addPlayLogEntry(audioClipId, timestamp);
|
||||||
|
|
||||||
|
audioClipId.reset(new UniqueId(10003));
|
||||||
|
timestamp.reset(new ptime(time_from_string("2004-10-27 10:01:00")));
|
||||||
|
playLog->addPlayLogEntry(audioClipId, timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Just a very simple smoke test
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcGeneratePlayReportTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
struct tm time;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
// set up a structure for the parameters
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
time.tm_year = 101; // 2001
|
||||||
|
time.tm_mon = 10; // November
|
||||||
|
time.tm_mday = 12;
|
||||||
|
time.tm_hour = 18;
|
||||||
|
time.tm_min = 31;
|
||||||
|
time.tm_sec = 1;
|
||||||
|
parameters["from"] = &time;
|
||||||
|
time.tm_year = 101; // 2001
|
||||||
|
time.tm_mon = 10; // November
|
||||||
|
time.tm_mday = 12;
|
||||||
|
time.tm_hour = 19;
|
||||||
|
time.tm_min = 31;
|
||||||
|
time.tm_sec = 1;
|
||||||
|
parameters["to"] = &time;
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.size() == 0);
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Look at some intervals and check against test data
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcGeneratePlayReportTest :: intervalTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
struct tm time;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
// check for the interval 2004-10-26 between 13 and 15 o'clock
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
time.tm_year = 104; // 2004
|
||||||
|
time.tm_mon = 9; // October
|
||||||
|
time.tm_mday = 26;
|
||||||
|
time.tm_hour = 13;
|
||||||
|
time.tm_min = 0;
|
||||||
|
time.tm_sec = 0;
|
||||||
|
parameters["from"] = &time;
|
||||||
|
time.tm_year = 104; // 2004
|
||||||
|
time.tm_mon = 9; // October
|
||||||
|
time.tm_mday = 26;
|
||||||
|
time.tm_hour = 15;
|
||||||
|
time.tm_min = 0;
|
||||||
|
time.tm_sec = 0;
|
||||||
|
parameters["to"] = &time;
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
// check the returned values
|
||||||
|
CPPUNIT_ASSERT(result.size() == 1);
|
||||||
|
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
||||||
|
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
||||||
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
|
UniqueId newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
||||||
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
||||||
|
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
||||||
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
|
time = result[0]["timestamp"];
|
||||||
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
CPPUNIT_ASSERT(time.tm_mon == 9); // October
|
||||||
|
CPPUNIT_ASSERT(time.tm_mday == 26);
|
||||||
|
CPPUNIT_ASSERT(time.tm_hour == 14);
|
||||||
|
CPPUNIT_ASSERT(time.tm_min == 0);
|
||||||
|
CPPUNIT_ASSERT(time.tm_sec == 0);
|
||||||
|
|
||||||
|
|
||||||
|
// check for the interval 2004-10-26 between 14 o'clock and 15:30
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
time.tm_year = 104; // 2004
|
||||||
|
time.tm_mon = 9; // October
|
||||||
|
time.tm_mday = 26;
|
||||||
|
time.tm_hour = 14;
|
||||||
|
time.tm_min = 0;
|
||||||
|
time.tm_sec = 0;
|
||||||
|
parameters["from"] = &time;
|
||||||
|
time.tm_year = 104; // 2004
|
||||||
|
time.tm_mon = 9; // October
|
||||||
|
time.tm_mday = 26;
|
||||||
|
time.tm_hour = 15;
|
||||||
|
time.tm_min = 30;
|
||||||
|
time.tm_sec = 0;
|
||||||
|
parameters["to"] = &time;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
// check the returned values
|
||||||
|
CPPUNIT_ASSERT(result.size() == 1);
|
||||||
|
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
||||||
|
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
||||||
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
|
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
||||||
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
||||||
|
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
||||||
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
|
time = result[0]["timestamp"];
|
||||||
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
CPPUNIT_ASSERT(time.tm_mon == 9); // October
|
||||||
|
CPPUNIT_ASSERT(time.tm_mday == 26);
|
||||||
|
CPPUNIT_ASSERT(time.tm_hour == 14);
|
||||||
|
CPPUNIT_ASSERT(time.tm_min == 0);
|
||||||
|
CPPUNIT_ASSERT(time.tm_sec == 0);
|
||||||
|
|
||||||
|
|
||||||
|
// check for the interval 2004-10-26 15:00 to 2012-08-01 midnight
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
time.tm_year = 104; // 2004
|
||||||
|
time.tm_mon = 9; // October
|
||||||
|
time.tm_mday = 26;
|
||||||
|
time.tm_hour = 15;
|
||||||
|
time.tm_min = 30;
|
||||||
|
time.tm_sec = 0;
|
||||||
|
parameters["from"] = &time;
|
||||||
|
time.tm_year = 112; // 2012
|
||||||
|
time.tm_mon = 7; // August
|
||||||
|
time.tm_mday = 1;
|
||||||
|
time.tm_hour = 0;
|
||||||
|
time.tm_min = 0;
|
||||||
|
time.tm_sec = 0;
|
||||||
|
parameters["to"] = &time;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
// check the returned values
|
||||||
|
CPPUNIT_ASSERT(result.size() == 2);
|
||||||
|
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
||||||
|
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
||||||
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
|
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
||||||
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10017);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
||||||
|
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
||||||
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
|
time = result[0]["timestamp"];
|
||||||
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
CPPUNIT_ASSERT(time.tm_mon == 9); // October
|
||||||
|
CPPUNIT_ASSERT(time.tm_mday == 26);
|
||||||
|
CPPUNIT_ASSERT(time.tm_hour == 15);
|
||||||
|
CPPUNIT_ASSERT(time.tm_min == 30);
|
||||||
|
CPPUNIT_ASSERT(time.tm_sec == 0);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(result[1].hasMember("audioClipId"));
|
||||||
|
CPPUNIT_ASSERT(result[1]["audioClipId"].getType()
|
||||||
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
|
newAudioClipId = UniqueId(std::string(result[1]["audioClipId"]));
|
||||||
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10003);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(result[1].hasMember("timestamp"));
|
||||||
|
CPPUNIT_ASSERT(result[1]["timestamp"].getType()
|
||||||
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
|
time = result[1]["timestamp"];
|
||||||
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
CPPUNIT_ASSERT(time.tm_mon == 9); // October
|
||||||
|
CPPUNIT_ASSERT(time.tm_mday == 27);
|
||||||
|
CPPUNIT_ASSERT(time.tm_hour == 10);
|
||||||
|
CPPUNIT_ASSERT(time.tm_min == 01);
|
||||||
|
CPPUNIT_ASSERT(time.tm_sec == 0);
|
||||||
|
|
||||||
|
|
||||||
|
// check for the interval 2004-10-26 16 o'clock to 2004-10-27 10 o'clock
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
time.tm_year = 104; // 2004
|
||||||
|
time.tm_mon = 9; // October
|
||||||
|
time.tm_mday = 26;
|
||||||
|
time.tm_hour = 16;
|
||||||
|
time.tm_min = 0;
|
||||||
|
time.tm_sec = 0;
|
||||||
|
parameters["from"] = &time;
|
||||||
|
time.tm_year = 104; // 2004
|
||||||
|
time.tm_mon = 9; // October
|
||||||
|
time.tm_mday = 27;
|
||||||
|
time.tm_hour = 10;
|
||||||
|
time.tm_min = 0;
|
||||||
|
time.tm_sec = 0;
|
||||||
|
parameters["to"] = &time;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
// check the returned values
|
||||||
|
CPPUNIT_ASSERT(result.size() == 0);
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,133 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGeneratePlayReportTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef RpcGeneratePlayReportTest_h
|
||||||
|
#define RpcGeneratePlayReportTest_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/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the GeneratePlayReportMethod class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see GeneratePlayReportMethod
|
||||||
|
*/
|
||||||
|
class RpcGeneratePlayReportTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(RpcGeneratePlayReportTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST(intervalTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A session ID from the authentication client login() method.
|
||||||
|
*/
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert some entries into the play log to provide test data.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
insertEntries(void) throw ();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple test.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
firstTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look at some intervals, and check them against the test data.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
intervalTest(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 // RpcGeneratePlayReportTest_h
|
||||||
|
|
|
@ -0,0 +1,155 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <XmlRpcClient.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "SchedulerDaemon.h"
|
||||||
|
|
||||||
|
#include "RpcOpenPlaylistForEditingTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(RpcOpenPlaylistForEditingTest);
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcOpenPlaylistForEditingTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
parameters["login"] = "root";
|
||||||
|
parameters["password"] = "q";
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("login", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("sessionId"));
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
|
||||||
|
sessionId.reset(new SessionId(std::string(result["sessionId"])));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcOpenPlaylistForEditingTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Just a very simple smoke test
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcOpenPlaylistForEditingTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
parameters["playlistId"] = "0000000000000001";
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("openPlaylistForEditing",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("id"));
|
||||||
|
CPPUNIT_ASSERT(result["id"].getType() == XmlRpc::XmlRpcValue::TypeString);
|
||||||
|
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000000001");
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("playlength"));
|
||||||
|
CPPUNIT_ASSERT(result["playlength"].getType()
|
||||||
|
== XmlRpc::XmlRpcValue::TypeInt);
|
||||||
|
CPPUNIT_ASSERT(int(result["playlength"]) == 90 * 60);
|
||||||
|
|
||||||
|
parameters.clear();
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
parameters["playlistId"] = "0000000000009999";
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("openPlaylistForEditing",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("allowed to open non-existent playlist",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 104); // could not open playlist
|
||||||
|
|
||||||
|
parameters.clear();
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
parameters["playlistId"] = "0000000000000001";
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("openPlaylistForEditing",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("allowed to open the same playlist twice",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 104); // could not open playlist
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef RpcOpenPlaylistForEditingTest_h
|
||||||
|
#define RpcOpenPlaylistForEditingTest_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/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the OpenPlaylistForEditingMethod class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see OpenPlaylistForEditingMethod
|
||||||
|
*/
|
||||||
|
class RpcOpenPlaylistForEditingTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(RpcOpenPlaylistForEditingTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A session ID from the authentication client login() method.
|
||||||
|
*/
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
|
||||||
|
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 // RpcOpenPlaylistForEditingTest_h
|
||||||
|
|
|
@ -0,0 +1,153 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <XmlRpcClient.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "SchedulerDaemon.h"
|
||||||
|
|
||||||
|
#include "RpcRemoveAudioClipFromPlaylistTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(RpcRemoveAudioClipFromPlaylistTest);
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcRemoveAudioClipFromPlaylistTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
parameters["login"] = "root";
|
||||||
|
parameters["password"] = "q";
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("login", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("sessionId"));
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
|
||||||
|
sessionId.reset(new SessionId(std::string(result["sessionId"])));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcRemoveAudioClipFromPlaylistTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Just a very simple smoke test
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcRemoveAudioClipFromPlaylistTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
parameters["playlistId"] = "0000000000000001";
|
||||||
|
parameters["audioClipId"] = "0000000000010001";
|
||||||
|
parameters["relativeOffset"] = 90*60;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("allowed to edit playlist without opening it first",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 405); // not open for editing
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("openPlaylistForEditing",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(
|
||||||
|
"allowed to remove non-existent audio clip from playlist",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 406);
|
||||||
|
// no audio clip at this rel offset
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("addAudioClipToPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef RpcRemoveAudioClipFromPlaylistTest_h
|
||||||
|
#define RpcRemoveAudioClipFromPlaylistTest_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/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the RemoveAudioClipFromPlaylistMethod class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see RemoveAudioClipFromPlaylistMethod
|
||||||
|
*/
|
||||||
|
class RpcRemoveAudioClipFromPlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(RpcRemoveAudioClipFromPlaylistTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A session ID from the authentication client login() method.
|
||||||
|
*/
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
|
||||||
|
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 // RpcRemoveAudioClipFromPlaylistTest_h
|
||||||
|
|
|
@ -0,0 +1,167 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <XmlRpcClient.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "SchedulerDaemon.h"
|
||||||
|
|
||||||
|
#include "RpcRevertEditedPlaylistTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(RpcRevertEditedPlaylistTest);
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcRevertEditedPlaylistTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
parameters["login"] = "root";
|
||||||
|
parameters["password"] = "q";
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("login", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("sessionId"));
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
|
||||||
|
sessionId.reset(new SessionId(std::string(result["sessionId"])));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcRevertEditedPlaylistTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Just a very simple smoke test
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcRevertEditedPlaylistTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
parameters["playlistId"] = "0000000000000001";
|
||||||
|
parameters["relativeOffset"] = 0;
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("revertEditedPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("allowed to revert playlist without saving it first",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 804); // no saved copy
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("openPlaylistForEditing",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear(); // can't remove it twice
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("allowed to remove the same playlist element twice",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("revertEditedPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear(); // but now we can again
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("savePlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("revertEditedPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(
|
||||||
|
"allowed to revert playlist after discarding saved copy",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 804); // no saved copy
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef RpcRevertEditedPlaylistTest_h
|
||||||
|
#define RpcRevertEditedPlaylistTest_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/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the RevertEditedPlaylistMethod class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see RevertEditedPlaylistMethod
|
||||||
|
*/
|
||||||
|
class RpcRevertEditedPlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(RpcRevertEditedPlaylistTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A session ID from the authentication client login() method.
|
||||||
|
*/
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
|
||||||
|
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 // RpcRevertEditedPlaylistTest_h
|
||||||
|
|
|
@ -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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcSavePlaylistTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <XmlRpcClient.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "SchedulerDaemon.h"
|
||||||
|
|
||||||
|
#include "RpcSavePlaylistTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(RpcSavePlaylistTest);
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcSavePlaylistTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
parameters["login"] = "root";
|
||||||
|
parameters["password"] = "q";
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("login", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("sessionId"));
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
|
||||||
|
sessionId.reset(new SessionId(std::string(result["sessionId"])));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcSavePlaylistTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Just a very simple smoke test
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcSavePlaylistTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
parameters["playlistId"] = "0000000000009999";
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("savePlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("allowed to save non-existent playlist",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 703); // playlist not found
|
||||||
|
|
||||||
|
parameters["playlistId"] = "0000000000000001";
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("openPlaylistForEditing",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("savePlaylist", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("savePlaylist", parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("allowed to save playlist twice",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 705); // could not save playlist
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcSavePlaylistTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef RpcSavePlaylistTest_h
|
||||||
|
#define RpcSavePlaylistTest_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/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the SavePlaylistMethod class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see SavePlaylistMethod
|
||||||
|
*/
|
||||||
|
class RpcSavePlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(RpcSavePlaylistTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A session ID from the authentication client login() method.
|
||||||
|
*/
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
|
||||||
|
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 // RpcSavePlaylistTest_h
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <XmlRpcClient.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "RpcUpdateFadeInFadeOutTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(RpcUpdateFadeInFadeOutTest);
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcUpdateFadeInFadeOutTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
parameters["login"] = "root";
|
||||||
|
parameters["password"] = "q";
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("login", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("sessionId"));
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
|
||||||
|
sessionId.reset(new SessionId(std::string(result["sessionId"])));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcUpdateFadeInFadeOutTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Just a very simple smoke test
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcUpdateFadeInFadeOutTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
parameters["playlistId"] = "0000000000000001";
|
||||||
|
parameters["relativeOffset"] = 90*60;
|
||||||
|
parameters["fadeIn"] = 0;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("updateFadeInFadeOut",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("did not notice missing fade out parameter",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 1605); // missing fade out
|
||||||
|
|
||||||
|
parameters["fadeOut"] = 2100;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("updateFadeInFadeOut",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(
|
||||||
|
"allowed update fade info without opening playlist first",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 1607); // not open for editing
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("openPlaylistForEditing",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("updateFadeInFadeOut",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(
|
||||||
|
"allowed update fade info for non-existent playlist element",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 1608);
|
||||||
|
// no audio clip at this rel offset
|
||||||
|
|
||||||
|
parameters["relativeOffset"] = 0;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("updateFadeInFadeOut",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef RpcUpdateFadeInFadeOutTest_h
|
||||||
|
#define RpcUpdateFadeInFadeOutTest_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/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the UpdateFadeInFadeOutMethod class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see UpdateFadeInFadeOutMethod
|
||||||
|
*/
|
||||||
|
class RpcUpdateFadeInFadeOutTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(RpcUpdateFadeInFadeOutTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A session ID from the authentication client login() method.
|
||||||
|
*/
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
|
||||||
|
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 // RpcUpdateFadeInFadeOutTest_h
|
||||||
|
|
|
@ -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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcValidatePlaylistTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <XmlRpcClient.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "SchedulerDaemon.h"
|
||||||
|
|
||||||
|
#include "RpcValidatePlaylistTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(RpcValidatePlaylistTest);
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcValidatePlaylistTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("resetStorage", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
parameters["login"] = "root";
|
||||||
|
parameters["password"] = "q";
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("login", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("sessionId"));
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
|
||||||
|
sessionId.reset(new SessionId(std::string(result["sessionId"])));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcValidatePlaylistTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("logout", parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Just a very simple smoke test
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
RpcValidatePlaylistTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||||
|
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
parameters["playlistId"] = "0000000000009999";
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("validatePlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("allowed to validate non-existent playlist",
|
||||||
|
xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||||
|
CPPUNIT_ASSERT(int(result["faultCode"]) == 503); // no such playlist
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
parameters.clear();
|
||||||
|
parameters["sessionId"] = sessionId->getId();
|
||||||
|
parameters["playlistId"] = "0000000000000001";
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("openPlaylistForEditing",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("validatePlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("valid"));
|
||||||
|
CPPUNIT_ASSERT(bool(result["valid"]));
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
parameters["relativeOffset"] = 0;
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
CPPUNIT_ASSERT(xmlRpcClient.execute("validatePlaylist",
|
||||||
|
parameters, result));
|
||||||
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("valid"));
|
||||||
|
CPPUNIT_ASSERT(result["valid"].getType()
|
||||||
|
== XmlRpc::XmlRpcValue::TypeBoolean);
|
||||||
|
CPPUNIT_ASSERT(!bool(result["valid"])); // has a gap at the beginning
|
||||||
|
|
||||||
|
xmlRpcClient.close();
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcValidatePlaylistTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef RpcValidatePlaylistTest_h
|
||||||
|
#define RpcValidatePlaylistTest_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/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the ValidatePlaylistMethod class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see ValidatePlaylistMethod
|
||||||
|
*/
|
||||||
|
class RpcValidatePlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(RpcValidatePlaylistTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A session ID from the authentication client login() method.
|
||||||
|
*/
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
|
||||||
|
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 // RpcValidatePlaylistTest_h
|
||||||
|
|
Loading…
Reference in New Issue