changed all(*) XML-RPC references to unique IDs to string, and all(*)

PostgreSQL references to BIGINT.

* that I could think of
This commit is contained in:
fgerlits 2005-01-05 19:50:01 +00:00
parent 130cc75cb8
commit 7259599ce1
35 changed files with 467 additions and 431 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/SessionId.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/SessionId.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -55,7 +55,7 @@ namespace Core {
* A class representing session identifiers. * A class representing session identifiers.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
*/ */
class SessionId class SessionId
{ {
@ -75,13 +75,12 @@ class SessionId
public: public:
/** /**
* The type for the numeric value the session id is represented in. * The type for the value the session id is represented in.
*/ */
typedef std::string IdType; typedef std::string IdType;
/** /**
* Constructor to create a SessionId with a specific value. * Constructor to create a SessionId with a specific value.
* TODO: remove this later, as this is for testing purposes only.
* *
* @param id the value of the created id object. * @param id the value of the created id object.
*/ */
@ -119,9 +118,9 @@ class SessionId
} }
/** /**
* Return the string value of this session ID. * Return the (string) value of this session ID.
* *
* @return the string value of this id. * @return the value of this id.
*/ */
const IdType const IdType
getId(void) const throw () getId(void) const throw ()

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -178,8 +178,8 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void)
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
parameters["audioClipId"] = 0x10001; parameters["audioClipId"] = "0000000000010001";
parameters["relativeOffset"] = 60*60; parameters["relativeOffset"] = 60*60;
rootParameter[0] = parameters; rootParameter[0] = parameters;
@ -205,8 +205,8 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void)
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
parameters["audioClipId"] = 0x10001; parameters["audioClipId"] = "0000000000010001";
parameters["relativeOffset"] = 90*60; parameters["relativeOffset"] = 90*60;
rootParameter[0] = parameters; rootParameter[0] = parameters;

View file

@ -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/CreatePlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -186,13 +186,16 @@ CreatePlaylistMethodTest :: firstTest(void)
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("id"));
CPPUNIT_ASSERT(((int) result["playlength"]) == 0); CPPUNIT_ASSERT(result["id"].getType() == XmlRpc::XmlRpcValue::TypeString);
CPPUNIT_ASSERT(result.hasMember("playlength"));
CPPUNIT_ASSERT(result["playlength"].getType()
== XmlRpc::XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(result["playlength"]) == 0);
int playlistId = (int) result["id"];
method.reset(new OpenPlaylistForEditingMethod()); method.reset(new OpenPlaylistForEditingMethod());
parameter.clear(); parameter.clear();
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = playlistId; parameter["playlistId"] = std::string(result["id"]);
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -181,7 +181,7 @@ DeletePlaylistMethodTest :: firstTest(void)
// set up a structure for the parameters // set up a structure for the parameters
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = 1; parameter["playlistId"] = "0000000000000001";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();
@ -243,7 +243,7 @@ DeletePlaylistMethodTest :: negativeTest(void)
// set up a structure for the parameters // set up a structure for the parameters
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = 9999; parameter["playlistId"] = "0000000000009999";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -173,7 +173,7 @@ DisplayAudioClipMethodTest :: firstTest(void)
// set up a structure for the parameter // set up a structure for the parameter
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["audioClipId"] = 0x10001; parameter["audioClipId"] = "0000000000010001";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();
@ -186,8 +186,14 @@ DisplayAudioClipMethodTest :: firstTest(void)
<< " - " << e.getMessage(); << " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(int(result["id"]) == 0x10001); CPPUNIT_ASSERT(result.hasMember("id"));
CPPUNIT_ASSERT(int(result["playlength"]) == (60 * 60)); CPPUNIT_ASSERT(result["id"].getType() == XmlRpc::XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000010001");
CPPUNIT_ASSERT(result.hasMember("playlength"));
CPPUNIT_ASSERT(result["playlength"].getType()
== XmlRpc::XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(result["playlength"]) == 60 * 60);
} }
@ -206,7 +212,7 @@ DisplayAudioClipMethodTest :: negativeTest(void)
// set up a structure for the parameter // set up a structure for the parameter
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["audioClipId"] = 0x9999; parameter["audioClipId"] = "0000000000009999";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -188,11 +188,25 @@ DisplayAudioClipsMethodTest :: firstTest(void)
CPPUNIT_ASSERT(result.size() == 2); CPPUNIT_ASSERT(result.size() == 2);
audioClip = result[0]; audioClip = result[0];
CPPUNIT_ASSERT(int(audioClip["id"]) == 0x10001); CPPUNIT_ASSERT(audioClip.hasMember("id"));
CPPUNIT_ASSERT(audioClip["id"].getType()
== XmlRpc::XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(audioClip["id"]) == "0000000000010001");
CPPUNIT_ASSERT(audioClip.hasMember("playlength"));
CPPUNIT_ASSERT(audioClip["playlength"].getType()
== XmlRpc::XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(audioClip["playlength"]) == 60 * 60); CPPUNIT_ASSERT(int(audioClip["playlength"]) == 60 * 60);
audioClip = result[1]; audioClip = result[1];
CPPUNIT_ASSERT(int(audioClip["id"]) == 0x10002); CPPUNIT_ASSERT(audioClip.hasMember("id"));
CPPUNIT_ASSERT(audioClip["id"].getType()
== XmlRpc::XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(audioClip["id"]) == "0000000000010002");
CPPUNIT_ASSERT(audioClip.hasMember("playlength"));
CPPUNIT_ASSERT(audioClip["playlength"].getType()
== XmlRpc::XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(audioClip["playlength"]) == 30 * 60); CPPUNIT_ASSERT(int(audioClip["playlength"]) == 30 * 60);
} }

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -173,7 +173,7 @@ DisplayPlaylistMethodTest :: firstTest(void)
// set up a structure for the parameter // set up a structure for the parameter
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = 1; parameter["playlistId"] = "0000000000000001";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();
@ -186,7 +186,12 @@ DisplayPlaylistMethodTest :: firstTest(void)
<< " - " << e.getMessage(); << " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(int(result["id"]) == 1); 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); CPPUNIT_ASSERT(int(result["playlength"]) == 90 * 60);
} }
@ -206,7 +211,7 @@ DisplayPlaylistMethodTest :: negativeTest(void)
// set up a structure for the parameter // set up a structure for the parameter
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = 9999; parameter["playlistId"] = "0000000000009999";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -171,7 +171,6 @@ DisplayPlaylistsMethodTest :: firstTest(void)
XmlRpc::XmlRpcValue rootParameter; XmlRpc::XmlRpcValue rootParameter;
rootParameter.setSize(1); rootParameter.setSize(1);
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
XmlRpc::XmlRpcValue playlist;
result.clear(); result.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
@ -186,8 +185,14 @@ DisplayPlaylistsMethodTest :: firstTest(void)
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result.size() == 1);
XmlRpc::XmlRpcValue playlist = result[0];
playlist = result[0]; CPPUNIT_ASSERT(playlist.hasMember("id"));
CPPUNIT_ASSERT(((int) playlist["id"]) == 1); CPPUNIT_ASSERT(playlist["id"].getType() == XmlRpc::XmlRpcValue::TypeString);
CPPUNIT_ASSERT(((int) playlist["playlength"]) == (90 * 60)); CPPUNIT_ASSERT(std::string(playlist["id"]) == "0000000000000001");
CPPUNIT_ASSERT(playlist.hasMember("playlength"));
CPPUNIT_ASSERT(playlist["playlength"].getType()
== XmlRpc::XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(playlist["playlength"]) == 90 * 60);
} }

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayScheduleMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayScheduleMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -54,6 +54,7 @@
#include "DisplayScheduleMethodTest.h" #include "DisplayScheduleMethodTest.h"
using namespace std; using namespace std;
using namespace XmlRpc;
using namespace LiveSupport::Db; using namespace LiveSupport::Db;
using namespace LiveSupport::Storage; using namespace LiveSupport::Storage;
@ -185,11 +186,11 @@ DisplayScheduleMethodTest :: firstTest(void)
throw (CPPUNIT_NS::Exception) throw (CPPUNIT_NS::Exception)
{ {
Ptr<DisplayScheduleMethod>::Ref method(new DisplayScheduleMethod()); Ptr<DisplayScheduleMethod>::Ref method(new DisplayScheduleMethod());
XmlRpc::XmlRpcValue parameters; XmlRpcValue parameters;
XmlRpc::XmlRpcValue rootParameter; XmlRpcValue rootParameter;
rootParameter.setSize(1); rootParameter.setSize(1);
XmlRpc::XmlRpcValue result; XmlRpcValue result;
struct tm time; struct tm time;
// set up a structure for the parameters // set up a structure for the parameters
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
@ -231,15 +232,15 @@ DisplayScheduleMethodTest :: insertEntries(void)
throw () throw ()
{ {
Ptr<UploadPlaylistMethod>::Ref method(new UploadPlaylistMethod()); Ptr<UploadPlaylistMethod>::Ref method(new UploadPlaylistMethod());
XmlRpc::XmlRpcValue parameters; XmlRpcValue parameters;
XmlRpc::XmlRpcValue rootParameter; XmlRpcValue rootParameter;
rootParameter.setSize(1); rootParameter.setSize(1);
XmlRpc::XmlRpcValue result; XmlRpcValue result;
struct tm time; struct tm time;
// insert a playlist for 2004-07-31, at 10 o'clock // insert a playlist for 2004-07-31, at 10 o'clock
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2004; time.tm_year = 2004;
time.tm_mon = 7; time.tm_mon = 7;
time.tm_mday = 31; time.tm_mday = 31;
@ -262,7 +263,7 @@ DisplayScheduleMethodTest :: insertEntries(void)
// insert a playlist for 2004-07-31, at 12 o'clock // insert a playlist for 2004-07-31, at 12 o'clock
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2004; time.tm_year = 2004;
time.tm_mon = 7; time.tm_mon = 7;
time.tm_mday = 31; time.tm_mday = 31;
@ -285,7 +286,7 @@ DisplayScheduleMethodTest :: insertEntries(void)
// insert a playlist for 2004-07-31, at 14 o'clock // insert a playlist for 2004-07-31, at 14 o'clock
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2004; time.tm_year = 2004;
time.tm_mon = 7; time.tm_mon = 7;
time.tm_mday = 31; time.tm_mday = 31;
@ -316,11 +317,11 @@ DisplayScheduleMethodTest :: intervalTest(void)
throw (CPPUNIT_NS::Exception) throw (CPPUNIT_NS::Exception)
{ {
Ptr<DisplayScheduleMethod>::Ref method(new DisplayScheduleMethod()); Ptr<DisplayScheduleMethod>::Ref method(new DisplayScheduleMethod());
XmlRpc::XmlRpcValue parameters; XmlRpcValue parameters;
XmlRpc::XmlRpcValue rootParameter; XmlRpcValue rootParameter;
rootParameter.setSize(1); rootParameter.setSize(1);
XmlRpc::XmlRpcValue result; XmlRpcValue result;
struct tm time; struct tm time;
// check for the interval 2004-07-31 between 9 and 11 o'clock // check for the interval 2004-07-31 between 9 and 11 o'clock
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
@ -353,7 +354,10 @@ DisplayScheduleMethodTest :: intervalTest(void)
// check the returned values // check the returned values
CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result.size() == 1);
CPPUNIT_ASSERT((int)(result[0]["playlistId"]) == 1); CPPUNIT_ASSERT(result[0].hasMember("playlistId"));
CPPUNIT_ASSERT(result[0]["playlistId"].getType()
== XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(result[0]["playlistId"]) == "0000000000000001");
time = result[0]["start"]; time = result[0]["start"];
CPPUNIT_ASSERT(time.tm_year == 2004); CPPUNIT_ASSERT(time.tm_year == 2004);
CPPUNIT_ASSERT(time.tm_mon == 7); CPPUNIT_ASSERT(time.tm_mon == 7);
@ -400,7 +404,10 @@ DisplayScheduleMethodTest :: intervalTest(void)
// check the returned values // check the returned values
CPPUNIT_ASSERT(result.size() == 2); CPPUNIT_ASSERT(result.size() == 2);
CPPUNIT_ASSERT((int)(result[0]["playlistId"]) == 1); CPPUNIT_ASSERT(result[0].hasMember("playlistId"));
CPPUNIT_ASSERT(result[0]["playlistId"].getType()
== XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(result[0]["playlistId"]) == "0000000000000001");
time = result[0]["start"]; time = result[0]["start"];
CPPUNIT_ASSERT(time.tm_year == 2004); CPPUNIT_ASSERT(time.tm_year == 2004);
CPPUNIT_ASSERT(time.tm_mon == 7); CPPUNIT_ASSERT(time.tm_mon == 7);
@ -416,7 +423,10 @@ DisplayScheduleMethodTest :: intervalTest(void)
CPPUNIT_ASSERT(time.tm_min == 30); CPPUNIT_ASSERT(time.tm_min == 30);
CPPUNIT_ASSERT(time.tm_sec == 0); CPPUNIT_ASSERT(time.tm_sec == 0);
CPPUNIT_ASSERT((int)(result[1]["playlistId"]) == 1); CPPUNIT_ASSERT(result[1].hasMember("playlistId"));
CPPUNIT_ASSERT(result[1]["playlistId"].getType()
== XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(result[1]["playlistId"]) == "0000000000000001");
time = result[1]["start"]; time = result[1]["start"];
CPPUNIT_ASSERT(time.tm_year == 2004); CPPUNIT_ASSERT(time.tm_year == 2004);
CPPUNIT_ASSERT(time.tm_mon == 7); CPPUNIT_ASSERT(time.tm_mon == 7);

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -193,15 +193,15 @@ GeneratePlayReportMethodTest :: firstTest(void)
// set up a structure for the parameters // set up a structure for the parameters
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
time.tm_year = 2001; time.tm_year = 101; // 2001
time.tm_mon = 11; time.tm_mon = 10; // November
time.tm_mday = 12; time.tm_mday = 12;
time.tm_hour = 18; time.tm_hour = 18;
time.tm_min = 31; time.tm_min = 31;
time.tm_sec = 1; time.tm_sec = 1;
parameters["from"] = &time; parameters["from"] = &time;
time.tm_year = 2001; time.tm_year = 101; // 2001
time.tm_mon = 11; time.tm_mon = 10; // November
time.tm_mday = 12; time.tm_mday = 12;
time.tm_hour = 19; time.tm_hour = 19;
time.tm_min = 31; time.tm_min = 31;
@ -261,15 +261,15 @@ GeneratePlayReportMethodTest :: intervalTest(void)
// check for the interval 2004-10-26 between 13 and 15 o'clock // check for the interval 2004-10-26 between 13 and 15 o'clock
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
time.tm_year = 2004; time.tm_year = 104; // 2004
time.tm_mon = 10; time.tm_mon = 9; // October
time.tm_mday = 26; time.tm_mday = 26;
time.tm_hour = 13; time.tm_hour = 13;
time.tm_min = 0; time.tm_min = 0;
time.tm_sec = 0; time.tm_sec = 0;
parameters["from"] = &time; parameters["from"] = &time;
time.tm_year = 2004; time.tm_year = 104; // 2004
time.tm_mon = 10; time.tm_mon = 9; // October
time.tm_mday = 26; time.tm_mday = 26;
time.tm_hour = 15; time.tm_hour = 15;
time.tm_min = 0; time.tm_min = 0;
@ -290,10 +290,18 @@ GeneratePlayReportMethodTest :: intervalTest(void)
// check the returned values // check the returned values
CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result.size() == 1);
CPPUNIT_ASSERT((int)(result[0]["audioClipId"]) == 10001); 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"]; time = result[0]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 2004); CPPUNIT_ASSERT(time.tm_year == 104); // 2004
CPPUNIT_ASSERT(time.tm_mon == 10); CPPUNIT_ASSERT(time.tm_mon == 9); // October
CPPUNIT_ASSERT(time.tm_mday == 26); CPPUNIT_ASSERT(time.tm_mday == 26);
CPPUNIT_ASSERT(time.tm_hour == 14); CPPUNIT_ASSERT(time.tm_hour == 14);
CPPUNIT_ASSERT(time.tm_min == 0); CPPUNIT_ASSERT(time.tm_min == 0);
@ -302,15 +310,15 @@ GeneratePlayReportMethodTest :: intervalTest(void)
// check for the interval 2004-10-26 between 14 o'clock and 15:30 // check for the interval 2004-10-26 between 14 o'clock and 15:30
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
time.tm_year = 2004; time.tm_year = 104; // 2004
time.tm_mon = 10; time.tm_mon = 9; // October
time.tm_mday = 26; time.tm_mday = 26;
time.tm_hour = 14; time.tm_hour = 14;
time.tm_min = 0; time.tm_min = 0;
time.tm_sec = 0; time.tm_sec = 0;
parameters["from"] = &time; parameters["from"] = &time;
time.tm_year = 2004; time.tm_year = 104; // 2004
time.tm_mon = 10; time.tm_mon = 9; // October
time.tm_mday = 26; time.tm_mday = 26;
time.tm_hour = 15; time.tm_hour = 15;
time.tm_min = 30; time.tm_min = 30;
@ -331,10 +339,18 @@ GeneratePlayReportMethodTest :: intervalTest(void)
// check the returned values // check the returned values
CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result.size() == 1);
CPPUNIT_ASSERT((int)(result[0]["audioClipId"]) == 10001); 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"]; time = result[0]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 2004); CPPUNIT_ASSERT(time.tm_year == 104); // 2004
CPPUNIT_ASSERT(time.tm_mon == 10); CPPUNIT_ASSERT(time.tm_mon == 9); // October
CPPUNIT_ASSERT(time.tm_mday == 26); CPPUNIT_ASSERT(time.tm_mday == 26);
CPPUNIT_ASSERT(time.tm_hour == 14); CPPUNIT_ASSERT(time.tm_hour == 14);
CPPUNIT_ASSERT(time.tm_min == 0); CPPUNIT_ASSERT(time.tm_min == 0);
@ -343,15 +359,15 @@ GeneratePlayReportMethodTest :: intervalTest(void)
// check for the interval 2004-10-26 15:00 to 2012-08-01 midnight // check for the interval 2004-10-26 15:00 to 2012-08-01 midnight
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
time.tm_year = 2004; time.tm_year = 104; // 2004
time.tm_mon = 10; time.tm_mon = 9; // October
time.tm_mday = 26; time.tm_mday = 26;
time.tm_hour = 15; time.tm_hour = 15;
time.tm_min = 30; time.tm_min = 30;
time.tm_sec = 0; time.tm_sec = 0;
parameters["from"] = &time; parameters["from"] = &time;
time.tm_year = 2012; time.tm_year = 112; // 2012
time.tm_mon = 8; time.tm_mon = 7; // August
time.tm_mday = 1; time.tm_mday = 1;
time.tm_hour = 0; time.tm_hour = 0;
time.tm_min = 0; time.tm_min = 0;
@ -372,19 +388,35 @@ GeneratePlayReportMethodTest :: intervalTest(void)
// check the returned values // check the returned values
CPPUNIT_ASSERT(result.size() == 2); CPPUNIT_ASSERT(result.size() == 2);
CPPUNIT_ASSERT((int)(result[0]["audioClipId"]) == 10017); 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"]; time = result[0]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 2004); CPPUNIT_ASSERT(time.tm_year == 104); // 2004
CPPUNIT_ASSERT(time.tm_mon == 10); CPPUNIT_ASSERT(time.tm_mon == 9); // October
CPPUNIT_ASSERT(time.tm_mday == 26); CPPUNIT_ASSERT(time.tm_mday == 26);
CPPUNIT_ASSERT(time.tm_hour == 15); CPPUNIT_ASSERT(time.tm_hour == 15);
CPPUNIT_ASSERT(time.tm_min == 30); CPPUNIT_ASSERT(time.tm_min == 30);
CPPUNIT_ASSERT(time.tm_sec == 0); CPPUNIT_ASSERT(time.tm_sec == 0);
CPPUNIT_ASSERT((int)(result[1]["audioClipId"]) == 10003); 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"]; time = result[1]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 2004); CPPUNIT_ASSERT(time.tm_year == 104); // 2004
CPPUNIT_ASSERT(time.tm_mon == 10); CPPUNIT_ASSERT(time.tm_mon == 9); // October
CPPUNIT_ASSERT(time.tm_mday == 27); CPPUNIT_ASSERT(time.tm_mday == 27);
CPPUNIT_ASSERT(time.tm_hour == 10); CPPUNIT_ASSERT(time.tm_hour == 10);
CPPUNIT_ASSERT(time.tm_min == 01); CPPUNIT_ASSERT(time.tm_min == 01);
@ -393,15 +425,15 @@ GeneratePlayReportMethodTest :: intervalTest(void)
// check for the interval 2004-10-26 16 o'clock to 2004-10-27 10 o'clock // check for the interval 2004-10-26 16 o'clock to 2004-10-27 10 o'clock
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
time.tm_year = 2004; time.tm_year = 104; // 2004
time.tm_mon = 10; time.tm_mon = 9; // October
time.tm_mday = 26; time.tm_mday = 26;
time.tm_hour = 16; time.tm_hour = 16;
time.tm_min = 0; time.tm_min = 0;
time.tm_sec = 0; time.tm_sec = 0;
parameters["from"] = &time; parameters["from"] = &time;
time.tm_year = 2004; time.tm_year = 104; // 2004
time.tm_mon = 10; time.tm_mon = 9; // October
time.tm_mday = 27; time.tm_mday = 27;
time.tm_hour = 10; time.tm_hour = 10;
time.tm_min = 0; time.tm_min = 0;

View file

@ -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/OpenPlaylistForEditingMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -174,7 +174,7 @@ OpenPlaylistForEditingMethodTest :: firstTest(void)
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = 1; parameter["playlistId"] = "0000000000000001";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();
@ -187,12 +187,18 @@ OpenPlaylistForEditingMethodTest :: firstTest(void)
<< " - " << e.getMessage(); << " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT((int) result["id"] == 1); CPPUNIT_ASSERT(result.hasMember("id"));
CPPUNIT_ASSERT((int) result["playlength"] == (90 * 60)); 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);
parameter.clear(); parameter.clear();
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = 6376; parameter["playlistId"] = "0000000000009999";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();
@ -206,7 +212,7 @@ OpenPlaylistForEditingMethodTest :: firstTest(void)
parameter.clear(); parameter.clear();
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = 1; parameter["playlistId"] = "0000000000000001";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.3 $ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PostgresqlPlayLog.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PostgresqlPlayLog.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -63,8 +63,8 @@ const std::string PostgresqlPlayLog::configElementNameStr =
const std::string PostgresqlPlayLog::createStmt = const std::string PostgresqlPlayLog::createStmt =
"CREATE TABLE playLog\n" "CREATE TABLE playLog\n"
"(\n" "(\n"
" id INT NOT NULL,\n" " id BIGINT NOT NULL,\n"
" audioClipId INT NOT NULL,\n" " audioClipId BIGINT NOT NULL,\n"
" timestamp TIMESTAMP NOT NULL,\n" " timestamp TIMESTAMP NOT NULL,\n"
"\n" "\n"
" PRIMARY KEY(id)\n" " PRIMARY KEY(id)\n"
@ -181,9 +181,9 @@ PostgresqlPlayLog :: addPlayLogEntry(
Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement( Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement(
addPlayLogEntryStmt)); addPlayLogEntryStmt));
id = UniqueId::generateId(); id = UniqueId::generateId();
pstmt->setInt(1, id->getId()); pstmt->setLong(1, id->getId());
pstmt->setInt(2, audioClipId->getId()); pstmt->setLong(2, audioClipId->getId());
timestamp = Conversion::ptimeToTimestamp(clipTimestamp); timestamp = Conversion::ptimeToTimestamp(clipTimestamp);
pstmt->setTimestamp(3, *timestamp); pstmt->setTimestamp(3, *timestamp);
@ -231,8 +231,8 @@ PostgresqlPlayLog :: getPlayLogEntries(
Ptr<ResultSet>::Ref rs(pstmt->executeQuery()); Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
while (rs->next()) { while (rs->next()) {
Ptr<UniqueId>::Ref id(new UniqueId(rs->getInt(1))); Ptr<UniqueId>::Ref id(new UniqueId(rs->getLong(1)));
Ptr<UniqueId>::Ref audioClipId(new UniqueId(rs->getInt(2))); Ptr<UniqueId>::Ref audioClipId(new UniqueId(rs->getLong(2)));
*timestamp = rs->getTimestamp(3); *timestamp = rs->getTimestamp(3);
Ptr<ptime>::Ref clipTimestamp Ptr<ptime>::Ref clipTimestamp

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PostgresqlSchedule.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PostgresqlSchedule.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -63,8 +63,8 @@ const std::string PostgresqlSchedule::configElementNameStr =
const std::string PostgresqlSchedule::createStmt = const std::string PostgresqlSchedule::createStmt =
"CREATE TABLE schedule\n" "CREATE TABLE schedule\n"
"(\n" "(\n"
" id INT NOT NULL,\n" " id BIGINT NOT NULL,\n"
" playlist INT NOT NULL,\n" " playlist BIGINT NOT NULL,\n"
" starts TIMESTAMP NOT NULL,\n" " starts TIMESTAMP NOT NULL,\n"
" ends TIMESTAMP NOT NULL,\n" " ends TIMESTAMP NOT NULL,\n"
"\n" "\n"
@ -243,7 +243,7 @@ PostgresqlSchedule :: isTimeframeAvailable(
pstmt->setTimestamp(6, *timestamp); pstmt->setTimestamp(6, *timestamp);
Ptr<ResultSet>::Ref rs(pstmt->executeQuery()); Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
result = (rs->next()) ? (rs->getInt(1) == 0) : false; result = (rs->next()) ? (rs->getLong(1) == 0) : false;
cm->returnConnection(conn); cm->returnConnection(conn);
} catch (std::exception &e) { } catch (std::exception &e) {
@ -277,9 +277,9 @@ PostgresqlSchedule :: schedulePlaylist(
Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement( Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement(
schedulePlaylistStmt)); schedulePlaylistStmt));
id = UniqueId::generateId(); id = UniqueId::generateId();
pstmt->setInt(1, id->getId()); pstmt->setLong(1, id->getId());
pstmt->setInt(2, playlist->getId()->getId()); pstmt->setLong(2, playlist->getId()->getId());
timestamp = Conversion::ptimeToTimestamp(playtime); timestamp = Conversion::ptimeToTimestamp(playtime);
pstmt->setTimestamp(3, *timestamp); pstmt->setTimestamp(3, *timestamp);
@ -331,8 +331,8 @@ PostgresqlSchedule :: getScheduleEntries(
Ptr<ResultSet>::Ref rs(pstmt->executeQuery()); Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
while (rs->next()) { while (rs->next()) {
Ptr<UniqueId>::Ref id(new UniqueId(rs->getInt(1))); Ptr<UniqueId>::Ref id(new UniqueId(rs->getLong(1)));
Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getInt(2))); Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getLong(2)));
*timestamp = rs->getTimestamp(3); *timestamp = rs->getTimestamp(3);
Ptr<ptime>::Ref startTime = Conversion::timestampToPtime(timestamp); Ptr<ptime>::Ref startTime = Conversion::timestampToPtime(timestamp);
@ -380,8 +380,8 @@ PostgresqlSchedule :: getNextEntry(Ptr<ptime>::Ref fromTime)
Ptr<ResultSet>::Ref rs(pstmt->executeQuery()); Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
if (rs->next()) { if (rs->next()) {
Ptr<UniqueId>::Ref id(new UniqueId(rs->getInt(1))); Ptr<UniqueId>::Ref id(new UniqueId(rs->getLong(1)));
Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getInt(2))); Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getLong(2)));
*timestamp = rs->getTimestamp(3); *timestamp = rs->getTimestamp(3);
Ptr<ptime>::Ref startTime = Conversion::timestampToPtime(timestamp); Ptr<ptime>::Ref startTime = Conversion::timestampToPtime(timestamp);
@ -420,10 +420,10 @@ PostgresqlSchedule :: scheduleEntryExists(
conn = cm->getConnection(); conn = cm->getConnection();
Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement( Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement(
scheduleEntryExistsStmt)); scheduleEntryExistsStmt));
pstmt->setInt(1, entryId->getId()); pstmt->setLong(1, entryId->getId());
Ptr<ResultSet>::Ref rs(pstmt->executeQuery()); Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
result = (rs->next()) ? (rs->getInt(1) == 1) : false; result = (rs->next()) ? (rs->getLong(1) == 1) : false;
cm->returnConnection(conn); cm->returnConnection(conn);
} catch (std::exception &e) { } catch (std::exception &e) {
@ -452,7 +452,7 @@ PostgresqlSchedule :: removeFromSchedule(
conn = cm->getConnection(); conn = cm->getConnection();
Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement( Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement(
removeFromScheduleStmt)); removeFromScheduleStmt));
pstmt->setInt(1, entryId->getId()); pstmt->setLong(1, entryId->getId());
result = pstmt->executeUpdate() == 1; result = pstmt->executeUpdate() == 1;
@ -484,14 +484,14 @@ PostgresqlSchedule :: getScheduleEntry(Ptr<UniqueId>::Ref entryId)
conn = cm->getConnection(); conn = cm->getConnection();
Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement( Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement(
getScheduleEntryStmt)); getScheduleEntryStmt));
pstmt->setInt(1, entryId->getId()); pstmt->setLong(1, entryId->getId());
Ptr<ResultSet>::Ref rs(pstmt->executeQuery()); Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
if (rs->next()) { if (rs->next()) {
Ptr<Timestamp>::Ref timestamp(new Timestamp()); Ptr<Timestamp>::Ref timestamp(new Timestamp());
Ptr<UniqueId>::Ref id(new UniqueId(rs->getInt(1))); Ptr<UniqueId>::Ref id(new UniqueId(rs->getLong(1)));
Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getInt(2))); Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getLong(2)));
*timestamp = rs->getTimestamp(3); *timestamp = rs->getTimestamp(3);
Ptr<ptime>::Ref startTime = Conversion::timestampToPtime(timestamp); Ptr<ptime>::Ref startTime = Conversion::timestampToPtime(timestamp);
@ -551,7 +551,7 @@ PostgresqlSchedule :: reschedule(Ptr<UniqueId>::Ref entryId,
timestamp = Conversion::ptimeToTimestamp(ends); timestamp = Conversion::ptimeToTimestamp(ends);
pstmt->setTimestamp(2, *timestamp); pstmt->setTimestamp(2, *timestamp);
pstmt->setInt(3, entryId->getId()); pstmt->setLong(3, entryId->getId());
result = pstmt->executeUpdate() == 1; result = pstmt->executeUpdate() == 1;

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.7 $ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -183,8 +183,8 @@ RemoveAudioClipFromPlaylistMethodTest :: firstTest(void)
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
parameters["audioClipId"] = 0x10001; parameters["audioClipId"] = "0000000000010001";
parameters["relativeOffset"] = 90*60; parameters["relativeOffset"] = 90*60;
rootParameter[0] = parameters; rootParameter[0] = parameters;

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -170,7 +170,7 @@ RemoveFromScheduleMethodTest :: firstTest(void)
// first schedule (upload) a playlist // first schedule (upload) a playlist
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -191,11 +191,13 @@ RemoveFromScheduleMethodTest :: firstTest(void)
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
entryId.reset(new UniqueId(int(result["scheduleEntryId"]))); CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["scheduleEntryId"] = int(entryId->getId()); parameters["scheduleEntryId"] = std::string(*entryId);
rootParameter[0] = parameters; rootParameter[0] = parameters;
result.clear(); result.clear();
@ -227,7 +229,7 @@ RemoveFromScheduleMethodTest :: negativeTest(void)
Ptr<UniqueId>::Ref entryId(new UniqueId(9999)); Ptr<UniqueId>::Ref entryId(new UniqueId(9999));
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["scheduleEntryId"] = int(entryId->getId()); parameters["scheduleEntryId"] = std::string(*entryId);
rootParameter[0] = parameters; rootParameter[0] = parameters;
result.clear(); result.clear();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RescheduleMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RescheduleMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -170,7 +170,7 @@ RescheduleMethodTest :: firstTest(void)
// let's upload something so we can reschedule it // let's upload something so we can reschedule it
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -191,12 +191,14 @@ RescheduleMethodTest :: firstTest(void)
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
entryId.reset(new UniqueId(int(result["scheduleEntryId"]))); CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
// now let's reschedule it // now let's reschedule it
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["scheduleEntryId"] = (int) entryId->getId(); parameters["scheduleEntryId"] = std::string(*entryId);
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -220,7 +222,7 @@ RescheduleMethodTest :: firstTest(void)
// now let's reschedule unto itself, should fail // now let's reschedule unto itself, should fail
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["scheduleEntryId"] = (int) entryId->getId(); parameters["scheduleEntryId"] = std::string(*entryId);
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -183,7 +183,7 @@ RevertEditedPlaylistMethodTest :: firstTest(void)
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
parameters["relativeOffset"] = 0; parameters["relativeOffset"] = 0;
rootParameter[0] = parameters; rootParameter[0] = parameters;

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -194,15 +194,16 @@ RpcAddAudioClipToPlaylistTest :: firstTest(void)
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
parameters["audioClipId"] = 0x10001; parameters["audioClipId"] = "0000000000010001";
parameters["relativeOffset"] = 0; parameters["relativeOffset"] = 0;
result.clear(); result.clear();
xmlRpcClient.execute("openPlaylistForEditing", parameters, result); xmlRpcClient.execute("openPlaylistForEditing", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("id"));
CPPUNIT_ASSERT(int(result["id"]) == 1); CPPUNIT_ASSERT(result["id"].getType() == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000000001");
result.clear(); result.clear();
xmlRpcClient.execute("addAudioClipToPlaylist", parameters, result); xmlRpcClient.execute("addAudioClipToPlaylist", parameters, result);
@ -210,8 +211,8 @@ RpcAddAudioClipToPlaylistTest :: firstTest(void)
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
parameters["audioClipId"] = 0x10001; parameters["audioClipId"] = "0000000000010001";
parameters["relativeOffset"] = 90*60; parameters["relativeOffset"] = 90*60;
result.clear(); result.clear();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -196,12 +196,14 @@ RpcCreatePlaylistTest :: firstTest(void)
xmlRpcClient.execute("createPlaylist", parameters, result); xmlRpcClient.execute("createPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("id"));
CPPUNIT_ASSERT(((int) result["playlength"]) == 0); CPPUNIT_ASSERT(result["id"].getType == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(result.hasMember("playlength"));
CPPUNIT_ASSERT(result["playlength"].getType == XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(result["playlength"]) == 0);
int playlistId = (int) result["id"];
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = playlistId; parameters["playlistId"] = std::string(result["id"]);
result.clear(); result.clear();
xmlRpcClient.execute("openPlaylistForEditing", parameters, result); xmlRpcClient.execute("openPlaylistForEditing", parameters, result);

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/RpcDeletePlaylistTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/RpcDeletePlaylistTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -193,7 +193,7 @@ RpcDeletePlaylistTest :: firstTest(void)
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
result.clear(); result.clear();
xmlRpcClient.execute("openPlaylistForEditing", parameters, result); xmlRpcClient.execute("openPlaylistForEditing", parameters, result);
@ -227,7 +227,7 @@ RpcDeletePlaylistTest :: negativeTest(void)
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 9999; parameters["playlistId"] = "9999";
result.clear(); result.clear();
xmlRpcClient.execute("deletePlaylist", parameters, result); xmlRpcClient.execute("deletePlaylist", parameters, result);

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -165,29 +165,24 @@ void
DisplayAudioClipMethodTest :: firstTest(void) DisplayAudioClipMethodTest :: firstTest(void)
throw (CPPUNIT_NS::Exception) throw (CPPUNIT_NS::Exception)
{ {
Ptr<DisplayAudioClipMethod>::Ref method(new DisplayAudioClipMethod()); XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
XmlRpc::XmlRpcValue parameter; XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue rootParameter;
rootParameter.setSize(1);
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
// set up a structure for the parameter parameters["sessionId"] = sessionId->getId();
parameter["sessionId"] = sessionId->getId(); parameters["audioClipId"] = "0000000000010001";
parameter["audioClipId"] = 10001;
rootParameter[0] = parameter;
result.clear(); result.clear();
try { xmlRpcClient.execute("displayAudioClip", parameters, result);
method->execute(rootParameter, result); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
}
catch (XmlRpc::XmlRpcException &e) { CPPUNIT_ASSERT(result.hasMember("id"));
std::stringstream eMsg; CPPUNIT_ASSERT(result["id"].getType() == XmlRpcValue::TypeString);
eMsg << "XML-RPC method returned error: " << e.getCode() CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000010001");
<< " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_ASSERT(result.hasMember("playlength"));
} CPPUNIT_ASSERT(result["playlength"].getType() == XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(result["id"]) == 10001); CPPUNIT_ASSERT(int(result["playlength"]) == 60 * 60);
CPPUNIT_ASSERT(int(result["playlength"]) == (60 * 60));
} }
@ -198,23 +193,16 @@ void
DisplayAudioClipMethodTest :: negativeTest(void) DisplayAudioClipMethodTest :: negativeTest(void)
throw (CPPUNIT_NS::Exception) throw (CPPUNIT_NS::Exception)
{ {
Ptr<DisplayAudioClipMethod>::Ref method(new DisplayAudioClipMethod()); XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
XmlRpc::XmlRpcValue parameter; XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue rootParameter;
rootParameter.setSize(1);
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
// set up a structure for the parameter parameters["sessionId"] = sessionId->getId();
parameter["sessionId"] = sessionId->getId(); parameters["audioClipId"] = "0000000000009999";
parameter["audioClipId"] = 9999;
rootParameter[0] = parameter;
result.clear(); result.clear();
try { xmlRpcClient.execute("displayAudioClip", parameters, result);
method->execute(rootParameter, result); CPPUNIT_ASSERT(xmlRpcClient.isFault());
CPPUNIT_FAIL("allowed to display non-existent audio clip"); CPPUNIT_ASSERT(result.hasMember("faultCode"));
} CPPUNIT_ASSERT(int(result["faultCode"]) == 603); // audio clip not found
catch (XmlRpc::XmlRpcException &e) {
CPPUNIT_ASSERT(e.getCode() == 603); // audio clip not found
}
} }

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -161,33 +161,32 @@ void
DisplayAudioClipsMethodTest :: firstTest(void) DisplayAudioClipsMethodTest :: firstTest(void)
throw (CPPUNIT_NS::Exception) throw (CPPUNIT_NS::Exception)
{ {
Ptr<DisplayAudioClipsMethod>::Ref method(new DisplayAudioClipsMethod()); XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
XmlRpc::XmlRpcValue parameter; XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue rootParameter; XmlRpc::XmlRpcValue result;
rootParameter.setSize(1);
XmlRpc::XmlRpcValue result;
XmlRpc::XmlRpcValue audioClip;
result.clear(); result.clear();
parameter["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
rootParameter[0] = parameter; xmlRpcClient.execute("displayAudioClips", parameters, result);
try { CPPUNIT_ASSERT(!xmlRpcClient.isFault());
method->execute(rootParameter, result);
}
catch (XmlRpc::XmlRpcException &e) {
std::stringstream eMsg;
eMsg << "XML-RPC method returned error: " << e.getCode()
<< " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str());
}
CPPUNIT_ASSERT(result.size() == 2); CPPUNIT_ASSERT(result.size() == 2);
audioClip = result[0]; XmlRpc::XmlRpcValue audioClip = result[0];
CPPUNIT_ASSERT(int(audioClip["id"]) == 10001); CPPUNIT_ASSERT(audioClip.hasMember("id"));
CPPUNIT_ASSERT(audioClip["id"].getType() == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(audioClip["id"]) == "0000000000010001");
CPPUNIT_ASSERT(audioClip.hasMember("playlength"));
CPPUNIT_ASSERT(audioClip["playlength"].getType() == XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(audioClip["playlength"]) == 60 * 60); CPPUNIT_ASSERT(int(audioClip["playlength"]) == 60 * 60);
audioClip = result[1]; audioClip = result[1];
CPPUNIT_ASSERT(int(audioClip["id"]) == 10002); CPPUNIT_ASSERT(audioClip.hasMember("id"));
CPPUNIT_ASSERT(audioClip["id"].getType() == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(audioClip["id"]) == "0000000000010002");
CPPUNIT_ASSERT(audioClip.hasMember("playlength"));
CPPUNIT_ASSERT(audioClip["playlength"].getType() == XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(audioClip["playlength"]) == 30 * 60); CPPUNIT_ASSERT(int(audioClip["playlength"]) == 30 * 60);
} }

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -187,13 +187,18 @@ RpcDisplayPlaylistTest :: simpleTest(void)
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
result.clear(); result.clear();
xmlRpcClient.execute("displayPlaylist", parameters, result); xmlRpcClient.execute("displayPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(((int) result["id"]) == 1); CPPUNIT_ASSERT(result.hasMember("id"));
CPPUNIT_ASSERT(((int) result["playlength"]) == (90 * 60)); CPPUNIT_ASSERT(result["id"].getType() == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(result.hasMember("playlength"));
CPPUNIT_ASSERT(result["playlength"].getType() == XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000000001");
CPPUNIT_ASSERT(int(result["playlength"]) == 90 * 60);
} }
@ -210,7 +215,7 @@ RpcDisplayPlaylistTest :: negativeTest(void)
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 9999; parameters["playlistId"] = "0000000000009999";
result.clear(); result.clear();
xmlRpcClient.execute("displayPlaylist", parameters, result); xmlRpcClient.execute("displayPlaylist", parameters, result);

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -166,28 +166,22 @@ void
DisplayPlaylistsMethodTest :: firstTest(void) DisplayPlaylistsMethodTest :: firstTest(void)
throw (CPPUNIT_NS::Exception) throw (CPPUNIT_NS::Exception)
{ {
Ptr<DisplayPlaylistsMethod>::Ref method(new DisplayPlaylistsMethod()); XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue rootParameter; XmlRpc::XmlRpcValue result;
rootParameter.setSize(1);
XmlRpc::XmlRpcValue result;
XmlRpc::XmlRpcValue playlist;
result.clear(); result.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
rootParameter[0] = parameters; xmlRpcClient.execute("displayPlaylists", parameters, result);
try { CPPUNIT_ASSERT(!xmlRpcClient.isFault());
method->execute(rootParameter, result);
}
catch (XmlRpc::XmlRpcException &e) {
std::stringstream eMsg;
eMsg << "XML-RPC method returned error: " << e.getCode()
<< " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str());
}
CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result.size() == 1);
playlist = result[0]; XmlRpc::XmlRpcValue playlist = result[0];
CPPUNIT_ASSERT(((int) playlist["id"]) == 1); CPPUNIT_ASSERT(playlist.hasMember("id"));
CPPUNIT_ASSERT(((int) playlist["playlength"]) == (90 * 60)); CPPUNIT_ASSERT(playlist["id"].getType() == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(playlist["id"]) == "0000000000000001");
CPPUNIT_ASSERT(playlist.hasMember("playlength"));
CPPUNIT_ASSERT(playlist["playlength"].getType() == XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(playlist["playlength"]) == 90 * 60);
} }

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGetVersionTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGetVersionTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -147,7 +147,8 @@ RpcGetVersionTest :: simpleTest(void)
result.clear(); result.clear();
xmlRpcClient.execute("getVersion", parameters, result); xmlRpcClient.execute("getVersion", parameters, result);
CPPUNIT_ASSERT(!result.hasMember("errorCode")); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("version")); CPPUNIT_ASSERT(result.hasMember("version"));
std::string versionStr = result["version"]; std::string versionStr = result["version"];
CPPUNIT_ASSERT(versionStr.find(versionPrefix) == 0); CPPUNIT_ASSERT(versionStr.find(versionPrefix) == 0);

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -178,7 +178,7 @@ RpcRemoveFromScheduleTest :: simpleTest(void)
// first schedule a playlist, so that there is something to remove // first schedule a playlist, so that there is something to remove
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -191,9 +191,11 @@ RpcRemoveFromScheduleTest :: simpleTest(void)
xmlRpcClient.execute("uploadPlaylist", parameters, result); xmlRpcClient.execute("uploadPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
Ptr<UniqueId>::Ref entryId(new UniqueId(int(result["scheduleEntryId"]))); == XmlRpcValue::TypeString);
parameters["scheduleEntryId"] = (int) entryId->getId(); Ptr<UniqueId>::Ref entryId(new UniqueId(std::string(
result["scheduleEntryId"] )));
parameters["scheduleEntryId"] = std::string(*entryId);
result.clear(); result.clear();
xmlRpcClient.execute("removeFromSchedule", parameters, result); xmlRpcClient.execute("removeFromSchedule", parameters, result);
@ -214,7 +216,7 @@ RpcRemoveFromScheduleTest :: negativeTest(void)
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["scheduleEntryId"] = 9999; parameters["scheduleEntryId"] = "0000000000009999";
result.clear(); result.clear();
xmlRpcClient.execute("removeFromSchedule", parameters, result); xmlRpcClient.execute("removeFromSchedule", parameters, result);

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRescheduleTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRescheduleTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -177,7 +177,7 @@ RpcRescheduleTest :: simpleTest(void)
// first schedule a playlist, so that there is something to reschedule // first schedule a playlist, so that there is something to reschedule
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -190,11 +190,14 @@ RpcRescheduleTest :: simpleTest(void)
xmlRpcClient.execute("uploadPlaylist", parameters, result); xmlRpcClient.execute("uploadPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
Ptr<UniqueId>::Ref entryId(new UniqueId(int(result["scheduleEntryId"]))); CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpcValue::TypeString);
Ptr<UniqueId>::Ref entryId(new UniqueId(std::string(
result["scheduleEntryId"] )));
// now reschedule it // now reschedule it
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["scheduleEntryId"] = (int) entryId->getId(); parameters["scheduleEntryId"] = std::string(*entryId);
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -209,7 +212,7 @@ RpcRescheduleTest :: simpleTest(void)
// now reschedule it unto itself, should fail // now reschedule it unto itself, should fail
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["scheduleEntryId"] = (int) entryId->getId(); parameters["scheduleEntryId"] = std::string(*entryId);
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -237,7 +240,7 @@ RpcRescheduleTest :: negativeTest(void)
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["scheduleEntryId"] = 9999; parameters["scheduleEntryId"] = "0000000000009999";
result.clear(); result.clear();
xmlRpcClient.execute("removeFromSchedule", parameters, result); xmlRpcClient.execute("removeFromSchedule", parameters, result);

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUploadPlaylistTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUploadPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -180,7 +180,7 @@ RpcUploadPlaylistTest :: simpleTest(void)
// try to schedule playlist #1 for the time below // try to schedule playlist #1 for the time below
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -175,7 +175,7 @@ SavePlaylistMethodTest :: firstTest(void)
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = 9999; parameter["playlistId"] = "0000000000009999";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();
@ -187,7 +187,7 @@ SavePlaylistMethodTest :: firstTest(void)
CPPUNIT_ASSERT(e.getCode() == 703); // playlist not found CPPUNIT_ASSERT(e.getCode() == 703); // playlist not found
} }
parameter["playlistId"] = 1; parameter["playlistId"] = "0000000000000001";
rootParameter[0] = parameter; rootParameter[0] = parameter;
result.clear(); result.clear();
try { try {

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -179,7 +179,7 @@ UpdateFadeInFadeOutMethodTest :: firstTest(void)
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
parameters["relativeOffset"] = 90*60; parameters["relativeOffset"] = 90*60;
parameters["fadeIn"] = 0; parameters["fadeIn"] = 0;
rootParameter[0] = parameters; rootParameter[0] = parameters;
@ -219,7 +219,8 @@ UpdateFadeInFadeOutMethodTest :: firstTest(void)
result.clear(); result.clear();
try { try {
updateFadeMethod->execute(rootParameter, result); updateFadeMethod->execute(rootParameter, result);
CPPUNIT_FAIL("allowed update fade info for non-existent p.l. element"); CPPUNIT_FAIL("allowed update fade info for non-existent "
"playlist element");
} }
catch (XmlRpc::XmlRpcException &e) { catch (XmlRpc::XmlRpcException &e) {
CPPUNIT_ASSERT(e.getCode() == 1608);// no audio clip at this rel offset CPPUNIT_ASSERT(e.getCode() == 1608);// no audio clip at this rel offset

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.8 $ Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UploadPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UploadPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -188,7 +188,7 @@ UploadPlaylistMethodTest :: firstTest(void)
// set up a structure for the parameters // set up a structure for the parameters
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -228,7 +228,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
// load the first playlist, this will succeed // load the first playlist, this will succeed
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -253,7 +253,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
// try to load the same one, but in an overlapping time region // try to load the same one, but in an overlapping time region
// (we know that playlist with id 1 is 1 hour long) // (we know that playlist with id 1 is 1 hour long)
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -274,7 +274,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
// try to load the same one, but now in good timing // try to load the same one, but now in good timing
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;
@ -298,7 +298,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
// try to load the same one, this time overlapping both previos instances // try to load the same one, this time overlapping both previos instances
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = "0000000000000001";
time.tm_year = 2001; time.tm_year = 2001;
time.tm_mon = 11; time.tm_mon = 11;
time.tm_mday = 12; time.tm_mday = 12;

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -182,7 +182,7 @@ ValidatePlaylistMethodTest :: firstTest(void)
result.clear(); result.clear();
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = 275; parameter["playlistId"] = "0000000000009999";
rootParameter[0] = parameter; rootParameter[0] = parameter;
try { try {
validatePlaylistMethod->execute(rootParameter, result); validatePlaylistMethod->execute(rootParameter, result);
@ -195,7 +195,7 @@ ValidatePlaylistMethodTest :: firstTest(void)
result.clear(); result.clear();
parameter.clear(); parameter.clear();
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
parameter["playlistId"] = 1; parameter["playlistId"] = "0000000000000001";
rootParameter[0] = parameter; rootParameter[0] = parameter;
try { try {
openPlaylistMethod->execute(rootParameter, result); openPlaylistMethod->execute(rootParameter, result);
@ -244,5 +244,7 @@ ValidatePlaylistMethodTest :: firstTest(void)
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.hasMember("valid")); CPPUNIT_ASSERT(result.hasMember("valid"));
CPPUNIT_ASSERT(result["valid"].getType()
== XmlRpc::XmlRpcValue::TypeBoolean);
CPPUNIT_ASSERT(!bool(result["valid"])); // has a gap at the beginning CPPUNIT_ASSERT(!bool(result["valid"])); // has a gap at the beginning
} }

View file

@ -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/Attic/XmlRpcTools.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcTools.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -41,6 +41,7 @@
#include <string> #include <string>
#include "LiveSupport/Core/TimeConversion.h"
#include "XmlRpcTools.h" #include "XmlRpcTools.h"
@ -58,59 +59,52 @@ using namespace LiveSupport::Scheduler;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the playlist ID member in the XML-RPC parameter structure * The name of the playlist ID member in the XML-RPC parameter structure
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string XmlRpcTools::playlistIdName = "playlistId"; static const std::string playlistIdName = "playlistId";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the audio clip ID member in the XML-RPC parameter structure * The name of the audio clip ID member in the XML-RPC parameter structure
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string XmlRpcTools::audioClipIdName = "audioClipId"; static const std::string audioClipIdName = "audioClipId";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the relative offset member in the XML-RPC parameter structure * The name of the relative offset member in the XML-RPC parameter structure
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string XmlRpcTools::relativeOffsetName = "relativeOffset"; static const std::string relativeOffsetName = "relativeOffset";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the from member in the XML-RPC parameter * The name of the from member in the XML-RPC parameter structure.
* structure.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string XmlRpcTools::fromTimeName = "from"; static const std::string fromTimeName = "from";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the to member in the XML-RPC parameter * The name of the to member in the XML-RPC parameter structure.
* structure.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string XmlRpcTools::toTimeName = "to"; static const std::string toTimeName = "to";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the playlist id member in the XML-RPC parameter * The name of the playlist id member in the XML-RPC parameter structure.
* structure.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string XmlRpcTools::scheduleEntryIdName = static const std::string scheduleEntryIdName = "scheduleEntryId";
"scheduleEntryId";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the playtime member in the XML-RPC parameter * The name of the playtime member in the XML-RPC parameter structure.
* structure.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string XmlRpcTools::playtimeName = "playtime"; static const std::string playtimeName = "playtime";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the fade in member in the XML-RPC parameter * The name of the fade in member in the XML-RPC parameter structure.
* structure.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string XmlRpcTools::fadeInName = "fadeIn"; static const std::string fadeInName = "fadeIn";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the fade out member in the XML-RPC parameter * The name of the fade out member in the XML-RPC parameter structure.
* structure.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string XmlRpcTools::fadeOutName = "fadeOut"; static const std::string fadeOutName = "fadeOut";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the session ID member in the XML-RPC parameter structure * The name of the session ID member in the XML-RPC parameter structure
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string XmlRpcTools::sessionIdName = "sessionId"; static const std::string sessionIdName = "sessionId";
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
@ -129,11 +123,15 @@ XmlRpcTools :: extractScheduleEntryId(
XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (!xmlRpcValue.hasMember(scheduleEntryIdName)) { if (!xmlRpcValue.hasMember(scheduleEntryIdName)
throw std::invalid_argument("missing schedule entry ID argument"); || xmlRpcValue[scheduleEntryIdName].getType()
!= XmlRpc::XmlRpcValue::TypeString) {
throw std::invalid_argument("missing or bad schedule entry ID "
"argument");
} }
Ptr<UniqueId>::Ref id(new UniqueId((int) xmlRpcValue[scheduleEntryIdName])); Ptr<UniqueId>::Ref id(new UniqueId(std::string(
xmlRpcValue[scheduleEntryIdName] )));
return id; return id;
} }
@ -145,11 +143,14 @@ Ptr<UniqueId>::Ref
XmlRpcTools :: extractPlaylistId(XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpcTools :: extractPlaylistId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (!xmlRpcValue.hasMember(playlistIdName)) { if (!xmlRpcValue.hasMember(playlistIdName)
throw std::invalid_argument("missing playlist ID argument"); || xmlRpcValue[playlistIdName].getType()
!= XmlRpc::XmlRpcValue::TypeString) {
throw std::invalid_argument("missing or bad playlist ID argument");
} }
Ptr<UniqueId>::Ref id(new UniqueId((int) xmlRpcValue[playlistIdName])); Ptr<UniqueId>::Ref id(new UniqueId(std::string(
xmlRpcValue[playlistIdName] )));
return id; return id;
} }
@ -161,11 +162,14 @@ Ptr<UniqueId>::Ref
XmlRpcTools :: extractAudioClipId(XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpcTools :: extractAudioClipId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (!xmlRpcValue.hasMember(audioClipIdName)) { if (!xmlRpcValue.hasMember(audioClipIdName)
throw std::invalid_argument("missing audio clip ID argument"); || xmlRpcValue[audioClipIdName].getType()
!= XmlRpc::XmlRpcValue::TypeString) {
throw std::invalid_argument("missing or bad audio clip ID argument");
} }
Ptr<UniqueId>::Ref id(new UniqueId((int) xmlRpcValue[audioClipIdName])); Ptr<UniqueId>::Ref id(new UniqueId(std::string(
xmlRpcValue[audioClipIdName] )));
return id; return id;
} }
@ -177,12 +181,14 @@ Ptr<time_duration>::Ref
XmlRpcTools :: extractRelativeOffset(XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpcTools :: extractRelativeOffset(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (!xmlRpcValue.hasMember(relativeOffsetName)) { if (!xmlRpcValue.hasMember(relativeOffsetName)
|| xmlRpcValue[relativeOffsetName].getType()
!= XmlRpc::XmlRpcValue::TypeInt) {
throw std::invalid_argument("missing relative offset argument"); throw std::invalid_argument("missing relative offset argument");
} }
Ptr<time_duration>::Ref relativeOffset(new time_duration(0,0, Ptr<time_duration>::Ref relativeOffset(new time_duration(0,0,
(int) xmlRpcValue[relativeOffsetName], 0)); int(xmlRpcValue[relativeOffsetName]), 0));
return relativeOffset; return relativeOffset;
} }
@ -196,8 +202,8 @@ XmlRpcTools :: playlistToXmlRpcValue(
XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpc::XmlRpcValue & xmlRpcValue)
throw () throw ()
{ {
xmlRpcValue["id"] = (int) (playlist->getId()->getId()); xmlRpcValue["id"] = std::string(*playlist->getId());
xmlRpcValue["playlength"] = playlist->getPlaylength()->total_seconds(); xmlRpcValue["playlength"] = int(playlist->getPlaylength()->total_seconds());
} }
@ -237,8 +243,9 @@ XmlRpcTools :: audioClipToXmlRpcValue(
XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpc::XmlRpcValue & xmlRpcValue)
throw () throw ()
{ {
xmlRpcValue["id"] = (int) (audioClip->getId()->getId()); xmlRpcValue["id"] = std::string(*audioClip->getId());
xmlRpcValue["playlength"] = audioClip->getPlaylength()->total_seconds(); xmlRpcValue["playlength"] = int(audioClip->getPlaylength()
->total_seconds());
} }
@ -302,16 +309,15 @@ XmlRpcTools :: extractFromTime(
XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (!xmlRpcValue.hasMember(fromTimeName)) { if (!xmlRpcValue.hasMember(fromTimeName)
throw std::invalid_argument("no from part in parameter structure"); || xmlRpcValue[fromTimeName].getType()
!= XmlRpc::XmlRpcValue::TypeDateTime) {
throw std::invalid_argument("missing or bad 'from' time in "
"parameter structure");
} }
struct tm tm = (struct tm) xmlRpcValue[fromTimeName]; struct tm time = (struct tm) xmlRpcValue[fromTimeName];
gregorian::date date(tm.tm_year, tm.tm_mon, tm.tm_mday); return TimeConversion::tmToPtime(&time);
time_duration hours(tm.tm_hour, tm.tm_min, tm.tm_sec);
Ptr<ptime>::Ref ptime(new ptime(date, hours));
return ptime;
} }
@ -323,16 +329,15 @@ XmlRpcTools :: extractToTime(
XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (!xmlRpcValue.hasMember(toTimeName)) { if (!xmlRpcValue.hasMember(toTimeName)
throw std::invalid_argument("no to part in parameter structure"); || xmlRpcValue[toTimeName].getType()
!= XmlRpc::XmlRpcValue::TypeDateTime) {
throw std::invalid_argument("missing or bad 'to' time in "
"parameter structure");
} }
struct tm tm = (struct tm) xmlRpcValue[toTimeName]; struct tm time = (struct tm) xmlRpcValue[toTimeName];
gregorian::date date(tm.tm_year, tm.tm_mon, tm.tm_mday); return TimeConversion::tmToPtime(&time);
time_duration hours(tm.tm_hour, tm.tm_min, tm.tm_sec);
Ptr<ptime>::Ref ptime(new ptime(date, hours));
return ptime;
} }
@ -341,22 +346,14 @@ XmlRpcTools :: extractToTime(
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
XmlRpcTools :: ptimeToXmlRpcValue( XmlRpcTools :: ptimeToXmlRpcValue(
Ptr<const ptime>::Ref ptime, Ptr<const ptime>::Ref ptimeParam,
XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpc::XmlRpcValue& xmlRpcValue)
throw () throw ()
{ {
gregorian::date date = ptime->date(); struct tm time;
posix_time::time_duration hours = ptime->time_of_day(); Ptr<ptime>::Ref myPtime(new ptime(*ptimeParam)); // get rid of const
struct tm time;
time.tm_year = date.year();
time.tm_mon = date.month();
time.tm_mday = date.day();
time.tm_hour = hours.hours();
time.tm_min = hours.minutes();
time.tm_sec = hours.seconds();
// TODO: set tm_wday, tm_yday and tm_isdst fields as well
TimeConversion::ptimeToTm(myPtime, time);
xmlRpcValue = XmlRpc::XmlRpcValue(&time); xmlRpcValue = XmlRpc::XmlRpcValue(&time);
} }
@ -381,8 +378,8 @@ XmlRpcTools :: scheduleEntriesToXmlRpcValue(
while (it != scheduleEntries->end()) { while (it != scheduleEntries->end()) {
Ptr<ScheduleEntry>::Ref entry = *it; Ptr<ScheduleEntry>::Ref entry = *it;
XmlRpc::XmlRpcValue returnStruct; XmlRpc::XmlRpcValue returnStruct;
returnStruct["id"] = (int) (entry->getId()->getId()); returnStruct["id"] = std::string(*entry->getId());
returnStruct["playlistId"] = (int) (entry->getPlaylistId()->getId()); returnStruct["playlistId"] = std::string(*entry->getPlaylistId());
XmlRpc::XmlRpcValue time; XmlRpc::XmlRpcValue time;
ptimeToXmlRpcValue(entry->getStartTime(), time); ptimeToXmlRpcValue(entry->getStartTime(), time);
@ -405,16 +402,15 @@ XmlRpcTools :: extractPlayschedule(
XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (!xmlRpcValue.hasMember(playtimeName)) { if (!xmlRpcValue.hasMember(playtimeName)
throw std::invalid_argument("no playtime in parameter structure"); || xmlRpcValue[playtimeName].getType()
!= XmlRpc::XmlRpcValue::TypeDateTime) {
throw std::invalid_argument("missing or bad playtime in "
"parameter structure");
} }
struct tm tm = (struct tm) xmlRpcValue[playtimeName]; struct tm time = (struct tm) xmlRpcValue[playtimeName];
gregorian::date date(tm.tm_year, tm.tm_mon, tm.tm_mday); return TimeConversion::tmToPtime(&time);
time_duration hours(tm.tm_hour, tm.tm_min, tm.tm_sec);
Ptr<ptime>::Ref ptime(new ptime(date, hours));
return ptime;
} }
@ -425,12 +421,14 @@ Ptr<time_duration>::Ref
XmlRpcTools :: extractFadeIn(XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpcTools :: extractFadeIn(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (!xmlRpcValue.hasMember(fadeInName)) { if (!xmlRpcValue.hasMember(fadeInName)
throw std::invalid_argument("missing fade in argument"); || xmlRpcValue[fadeInName].getType()
!= XmlRpc::XmlRpcValue::TypeInt) {
throw std::invalid_argument("missing or bad 'fade in' argument");
} }
Ptr<time_duration>::Ref fadeIn(new time_duration(0,0, Ptr<time_duration>::Ref fadeIn(new time_duration(0,0,
(int) xmlRpcValue[fadeInName], 0)); int(xmlRpcValue[fadeInName]), 0));
return fadeIn; return fadeIn;
} }
@ -442,12 +440,14 @@ Ptr<time_duration>::Ref
XmlRpcTools :: extractFadeOut(XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpcTools :: extractFadeOut(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (!xmlRpcValue.hasMember(fadeOutName)) { if (!xmlRpcValue.hasMember(fadeOutName)
throw std::invalid_argument("missing fade out argument"); || xmlRpcValue[fadeOutName].getType()
!= XmlRpc::XmlRpcValue::TypeInt) {
throw std::invalid_argument("missing or bad 'fade out' argument");
} }
Ptr<time_duration>::Ref fadeOut(new time_duration(0,0, Ptr<time_duration>::Ref fadeOut(new time_duration(0,0,
(int) xmlRpcValue[fadeOutName], 0)); int(xmlRpcValue[fadeOutName]), 0));
return fadeOut; return fadeOut;
} }
@ -461,7 +461,7 @@ XmlRpcTools :: scheduleEntryIdToXmlRpcValue(
XmlRpc::XmlRpcValue & returnValue) XmlRpc::XmlRpcValue & returnValue)
throw () throw ()
{ {
returnValue[scheduleEntryIdName] = int(scheduleEntryId->getId()); returnValue[scheduleEntryIdName] = std::string(*scheduleEntryId);
} }
@ -474,11 +474,11 @@ XmlRpcTools :: playLogEntryToXmlRpcValue(
XmlRpc::XmlRpcValue & returnValue) XmlRpc::XmlRpcValue & returnValue)
throw () throw ()
{ {
returnValue["audioClipId"] = int(playLogEntry->getAudioClipId()->getId()); returnValue["audioClipId"] = std::string(*playLogEntry->getAudioClipId());
XmlRpc::XmlRpcValue timestamp; XmlRpc::XmlRpcValue timestamp;
ptimeToXmlRpcValue(playLogEntry->getTimestamp(), timestamp); ptimeToXmlRpcValue(playLogEntry->getTimestamp(), timestamp);
returnValue["timestamp"] = timestamp; returnValue["timestamp"] = timestamp;
} }
@ -518,11 +518,14 @@ XmlRpcTools :: extractSessionId(
XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (!xmlRpcValue.hasMember(sessionIdName)) { if (!xmlRpcValue.hasMember(sessionIdName)
throw std::invalid_argument("missing session ID argument"); || xmlRpcValue[sessionIdName].getType()
!= XmlRpc::XmlRpcValue::TypeString) {
throw std::invalid_argument("missing or bad session ID argument");
} }
Ptr<SessionId>::Ref id(new SessionId(xmlRpcValue[sessionIdName])); Ptr<SessionId>::Ref id(new SessionId(std::string(
xmlRpcValue[sessionIdName] )));
return id; return id;
} }

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.12 $ Version : $Revision: 1.13 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcTools.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcTools.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -74,70 +74,11 @@ using namespace LiveSupport::Core;
* in the Scheduler. * in the Scheduler.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.12 $ * @version $Revision: 1.13 $
*/ */
class XmlRpcTools class XmlRpcTools
{ {
private: private:
/**
* The name of the playlistId member in the XML-RPC parameter
* structure given as the input to an XmlRpcServerMethod.
*/
static const std::string playlistIdName;
/**
* The name of the playlistId member in the XML-RPC parameter
* structure given as the input to an XmlRpcServerMethod.
*/
static const std::string audioClipIdName;
/**
* The name of the playlistId member in the XML-RPC parameter
* structure given as the input to an XmlRpcServerMethod.
*/
static const std::string relativeOffsetName;
/**
* The name of the from member in the XML-RPC parameter
* structure.
*/
static const std::string fromTimeName;
/**
* The name of the to member in the XML-RPC parameter
* structure.
*/
static const std::string toTimeName;
/**
* The name of the entry id member in the XML-RPC parameter
* structure.
*/
static const std::string scheduleEntryIdName;
/**
* The name of the playtime member in the XML-RPC parameter
* structure.
*/
static const std::string playtimeName;
/**
* The name of the fade in member in the XML-RPC parameter
* structure.
*/
static const std::string fadeInName;
/**
* The name of the fade out member in the XML-RPC parameter
* structure.
*/
static const std::string fadeOutName;
/**
* The name of the sessionId member in the XML-RPC parameter
* structure given as the input to an XmlRpcServerMethod.
*/
static const std::string sessionIdName;
/** /**
* Convert a boost::posix_time::ptime to an XmlRpcValue * Convert a boost::posix_time::ptime to an XmlRpcValue

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcToolsTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcToolsTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -137,39 +137,49 @@ XmlRpcToolsTest :: firstTest(void)
XmlRpcTools :: playlistToXmlRpcValue(playlist, xmlRpcPlaylist); XmlRpcTools :: playlistToXmlRpcValue(playlist, xmlRpcPlaylist);
XmlRpcTools :: audioClipToXmlRpcValue(audioClip, xmlRpcAudioClip); XmlRpcTools :: audioClipToXmlRpcValue(audioClip, xmlRpcAudioClip);
CPPUNIT_ASSERT(int(xmlRpcPlaylist["id"]) == 1); CPPUNIT_ASSERT(xmlRpcPlaylist.hasMember("id"));
CPPUNIT_ASSERT(xmlRpcPlaylist["id"].getType() == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(xmlRpcPlaylist["id"]) == "0000000000000001");
CPPUNIT_ASSERT(xmlRpcPlaylist.hasMember("playlength"));
CPPUNIT_ASSERT(xmlRpcPlaylist["playlength"].getType()
== XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(xmlRpcPlaylist["playlength"]) == 90 * 60); CPPUNIT_ASSERT(int(xmlRpcPlaylist["playlength"]) == 90 * 60);
CPPUNIT_ASSERT(int(xmlRpcAudioClip["id"]) == 0x10001); CPPUNIT_ASSERT(xmlRpcAudioClip.hasMember("id"));
CPPUNIT_ASSERT(xmlRpcAudioClip["id"].getType() == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(xmlRpcAudioClip["id"]) == "0000000000010001");
CPPUNIT_ASSERT(xmlRpcAudioClip.hasMember("playlength"));
CPPUNIT_ASSERT(xmlRpcAudioClip["playlength"].getType()
== XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(xmlRpcAudioClip["playlength"]) == 60 * 60); CPPUNIT_ASSERT(int(xmlRpcAudioClip["playlength"]) == 60 * 60);
XmlRpcValue xmlRpcPlaylistId; XmlRpcValue xmlRpcPlaylistId;
Ptr<UniqueId>::Ref playlistId; Ptr<UniqueId>::Ref playlistId(new UniqueId(rand()));
Ptr<UniqueId>::Ref audioClipId; Ptr<UniqueId>::Ref audioClipId(new UniqueId(rand()));
Ptr<time_duration>::Ref relativeOffset; Ptr<time_duration>::Ref relativeOffset(new time_duration(0,0,rand(),0));
int playlistIdNum = rand(); xmlRpcPlaylistId["playlistId"] = std::string(*playlistId);
int audioClipIdNum = rand(); xmlRpcPlaylistId["audioClipId"] = std::string(*audioClipId);
int relativeOffsetNum = rand(); xmlRpcPlaylistId["relativeOffset"] = relativeOffset->total_seconds();
xmlRpcPlaylistId["playlistId"] = playlistIdNum;
xmlRpcPlaylistId["audioClipId"] = audioClipIdNum;
xmlRpcPlaylistId["relativeOffset"] = relativeOffsetNum;
// run the unpacking methods // run the unpacking methods
Ptr<UniqueId>::Ref newPlaylistId;
Ptr<UniqueId>::Ref newAudioClipId;
Ptr<time_duration>::Ref newRelativeOffset;
try { try {
playlistId = XmlRpcTools::extractPlaylistId(xmlRpcPlaylistId); newPlaylistId = XmlRpcTools::extractPlaylistId(xmlRpcPlaylistId);
audioClipId = XmlRpcTools::extractAudioClipId(xmlRpcPlaylistId); newAudioClipId = XmlRpcTools::extractAudioClipId(xmlRpcPlaylistId);
relativeOffset = XmlRpcTools::extractRelativeOffset(xmlRpcPlaylistId); newRelativeOffset = XmlRpcTools::extractRelativeOffset(xmlRpcPlaylistId);
} }
catch (std::invalid_argument &e) { catch (std::invalid_argument &e) {
CPPUNIT_FAIL(e.what()); CPPUNIT_FAIL(e.what());
} }
CPPUNIT_ASSERT((int)(playlistId->getId()) == playlistIdNum); CPPUNIT_ASSERT(*playlistId == *newPlaylistId);
CPPUNIT_ASSERT((int)(audioClipId->getId()) == audioClipIdNum); CPPUNIT_ASSERT(*audioClipId == *newAudioClipId);
CPPUNIT_ASSERT((int)(relativeOffset->total_seconds()) CPPUNIT_ASSERT(*relativeOffset == *newRelativeOffset);
== relativeOffsetNum);
} }