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:
parent
130cc75cb8
commit
7259599ce1
35 changed files with 467 additions and 431 deletions
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -55,7 +55,7 @@ namespace Core {
|
|||
* A class representing session identifiers.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.1 $
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
class SessionId
|
||||
{
|
||||
|
@ -75,13 +75,12 @@ class SessionId
|
|||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
@ -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
|
||||
getId(void) const throw ()
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -178,8 +178,8 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void)
|
|||
|
||||
parameters.clear();
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["audioClipId"] = 0x10001;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
parameters["audioClipId"] = "0000000000010001";
|
||||
parameters["relativeOffset"] = 60*60;
|
||||
rootParameter[0] = parameters;
|
||||
|
||||
|
@ -205,8 +205,8 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void)
|
|||
|
||||
parameters.clear();
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["audioClipId"] = 0x10001;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
parameters["audioClipId"] = "0000000000010001";
|
||||
parameters["relativeOffset"] = 90*60;
|
||||
rootParameter[0] = parameters;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -186,13 +186,16 @@ CreatePlaylistMethodTest :: firstTest(void)
|
|||
CPPUNIT_FAIL(eMsg.str());
|
||||
}
|
||||
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());
|
||||
parameter.clear();
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = playlistId;
|
||||
parameter["playlistId"] = std::string(result["id"]);
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -181,7 +181,7 @@ DeletePlaylistMethodTest :: firstTest(void)
|
|||
|
||||
// set up a structure for the parameters
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = 1;
|
||||
parameter["playlistId"] = "0000000000000001";
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
@ -243,7 +243,7 @@ DeletePlaylistMethodTest :: negativeTest(void)
|
|||
|
||||
// set up a structure for the parameters
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = 9999;
|
||||
parameter["playlistId"] = "0000000000009999";
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -173,7 +173,7 @@ DisplayAudioClipMethodTest :: firstTest(void)
|
|||
|
||||
// set up a structure for the parameter
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["audioClipId"] = 0x10001;
|
||||
parameter["audioClipId"] = "0000000000010001";
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
@ -186,8 +186,14 @@ DisplayAudioClipMethodTest :: firstTest(void)
|
|||
<< " - " << e.getMessage();
|
||||
CPPUNIT_FAIL(eMsg.str());
|
||||
}
|
||||
CPPUNIT_ASSERT(int(result["id"]) == 0x10001);
|
||||
CPPUNIT_ASSERT(int(result["playlength"]) == (60 * 60));
|
||||
CPPUNIT_ASSERT(result.hasMember("id"));
|
||||
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
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["audioClipId"] = 0x9999;
|
||||
parameter["audioClipId"] = "0000000000009999";
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -188,11 +188,25 @@ DisplayAudioClipsMethodTest :: firstTest(void)
|
|||
CPPUNIT_ASSERT(result.size() == 2);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -173,7 +173,7 @@ DisplayPlaylistMethodTest :: firstTest(void)
|
|||
|
||||
// set up a structure for the parameter
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = 1;
|
||||
parameter["playlistId"] = "0000000000000001";
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
@ -186,7 +186,12 @@ DisplayPlaylistMethodTest :: firstTest(void)
|
|||
<< " - " << e.getMessage();
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -206,7 +211,7 @@ DisplayPlaylistMethodTest :: negativeTest(void)
|
|||
|
||||
// set up a structure for the parameter
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = 9999;
|
||||
parameter["playlistId"] = "0000000000009999";
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -171,7 +171,6 @@ DisplayPlaylistsMethodTest :: firstTest(void)
|
|||
XmlRpc::XmlRpcValue rootParameter;
|
||||
rootParameter.setSize(1);
|
||||
XmlRpc::XmlRpcValue result;
|
||||
XmlRpc::XmlRpcValue playlist;
|
||||
|
||||
result.clear();
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
|
@ -186,8 +185,14 @@ DisplayPlaylistsMethodTest :: firstTest(void)
|
|||
CPPUNIT_FAIL(eMsg.str());
|
||||
}
|
||||
CPPUNIT_ASSERT(result.size() == 1);
|
||||
XmlRpc::XmlRpcValue playlist = result[0];
|
||||
|
||||
playlist = result[0];
|
||||
CPPUNIT_ASSERT(((int) playlist["id"]) == 1);
|
||||
CPPUNIT_ASSERT(((int) playlist["playlength"]) == (90 * 60));
|
||||
CPPUNIT_ASSERT(playlist.hasMember("id"));
|
||||
CPPUNIT_ASSERT(playlist["id"].getType() == XmlRpc::XmlRpcValue::TypeString);
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -54,6 +54,7 @@
|
|||
#include "DisplayScheduleMethodTest.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace XmlRpc;
|
||||
|
||||
using namespace LiveSupport::Db;
|
||||
using namespace LiveSupport::Storage;
|
||||
|
@ -185,11 +186,11 @@ DisplayScheduleMethodTest :: firstTest(void)
|
|||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<DisplayScheduleMethod>::Ref method(new DisplayScheduleMethod());
|
||||
XmlRpc::XmlRpcValue parameters;
|
||||
XmlRpc::XmlRpcValue rootParameter;
|
||||
XmlRpcValue parameters;
|
||||
XmlRpcValue rootParameter;
|
||||
rootParameter.setSize(1);
|
||||
XmlRpc::XmlRpcValue result;
|
||||
struct tm time;
|
||||
XmlRpcValue result;
|
||||
struct tm time;
|
||||
|
||||
// set up a structure for the parameters
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
|
@ -231,15 +232,15 @@ DisplayScheduleMethodTest :: insertEntries(void)
|
|||
throw ()
|
||||
{
|
||||
Ptr<UploadPlaylistMethod>::Ref method(new UploadPlaylistMethod());
|
||||
XmlRpc::XmlRpcValue parameters;
|
||||
XmlRpc::XmlRpcValue rootParameter;
|
||||
XmlRpcValue parameters;
|
||||
XmlRpcValue rootParameter;
|
||||
rootParameter.setSize(1);
|
||||
XmlRpc::XmlRpcValue result;
|
||||
struct tm time;
|
||||
XmlRpcValue result;
|
||||
struct tm time;
|
||||
|
||||
// insert a playlist for 2004-07-31, at 10 o'clock
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2004;
|
||||
time.tm_mon = 7;
|
||||
time.tm_mday = 31;
|
||||
|
@ -262,7 +263,7 @@ DisplayScheduleMethodTest :: insertEntries(void)
|
|||
|
||||
// insert a playlist for 2004-07-31, at 12 o'clock
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2004;
|
||||
time.tm_mon = 7;
|
||||
time.tm_mday = 31;
|
||||
|
@ -285,7 +286,7 @@ DisplayScheduleMethodTest :: insertEntries(void)
|
|||
|
||||
// insert a playlist for 2004-07-31, at 14 o'clock
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2004;
|
||||
time.tm_mon = 7;
|
||||
time.tm_mday = 31;
|
||||
|
@ -316,11 +317,11 @@ DisplayScheduleMethodTest :: intervalTest(void)
|
|||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<DisplayScheduleMethod>::Ref method(new DisplayScheduleMethod());
|
||||
XmlRpc::XmlRpcValue parameters;
|
||||
XmlRpc::XmlRpcValue rootParameter;
|
||||
XmlRpcValue parameters;
|
||||
XmlRpcValue rootParameter;
|
||||
rootParameter.setSize(1);
|
||||
XmlRpc::XmlRpcValue result;
|
||||
struct tm time;
|
||||
XmlRpcValue result;
|
||||
struct tm time;
|
||||
|
||||
// check for the interval 2004-07-31 between 9 and 11 o'clock
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
|
@ -353,7 +354,10 @@ DisplayScheduleMethodTest :: intervalTest(void)
|
|||
|
||||
// check the returned values
|
||||
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"];
|
||||
CPPUNIT_ASSERT(time.tm_year == 2004);
|
||||
CPPUNIT_ASSERT(time.tm_mon == 7);
|
||||
|
@ -400,7 +404,10 @@ DisplayScheduleMethodTest :: intervalTest(void)
|
|||
|
||||
// check the returned values
|
||||
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"];
|
||||
CPPUNIT_ASSERT(time.tm_year == 2004);
|
||||
CPPUNIT_ASSERT(time.tm_mon == 7);
|
||||
|
@ -416,7 +423,10 @@ DisplayScheduleMethodTest :: intervalTest(void)
|
|||
CPPUNIT_ASSERT(time.tm_min == 30);
|
||||
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"];
|
||||
CPPUNIT_ASSERT(time.tm_year == 2004);
|
||||
CPPUNIT_ASSERT(time.tm_mon == 7);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -193,15 +193,15 @@ GeneratePlayReportMethodTest :: firstTest(void)
|
|||
|
||||
// set up a structure for the parameters
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_year = 101; // 2001
|
||||
time.tm_mon = 10; // November
|
||||
time.tm_mday = 12;
|
||||
time.tm_hour = 18;
|
||||
time.tm_min = 31;
|
||||
time.tm_sec = 1;
|
||||
parameters["from"] = &time;
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_year = 101; // 2001
|
||||
time.tm_mon = 10; // November
|
||||
time.tm_mday = 12;
|
||||
time.tm_hour = 19;
|
||||
time.tm_min = 31;
|
||||
|
@ -261,15 +261,15 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
|||
|
||||
// check for the interval 2004-10-26 between 13 and 15 o'clock
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
time.tm_year = 2004;
|
||||
time.tm_mon = 10;
|
||||
time.tm_year = 104; // 2004
|
||||
time.tm_mon = 9; // October
|
||||
time.tm_mday = 26;
|
||||
time.tm_hour = 13;
|
||||
time.tm_min = 0;
|
||||
time.tm_sec = 0;
|
||||
parameters["from"] = &time;
|
||||
time.tm_year = 2004;
|
||||
time.tm_mon = 10;
|
||||
time.tm_year = 104; // 2004
|
||||
time.tm_mon = 9; // October
|
||||
time.tm_mday = 26;
|
||||
time.tm_hour = 15;
|
||||
time.tm_min = 0;
|
||||
|
@ -290,10 +290,18 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
|||
|
||||
// check the returned values
|
||||
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"];
|
||||
CPPUNIT_ASSERT(time.tm_year == 2004);
|
||||
CPPUNIT_ASSERT(time.tm_mon == 10);
|
||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||
CPPUNIT_ASSERT(time.tm_mon == 9); // October
|
||||
CPPUNIT_ASSERT(time.tm_mday == 26);
|
||||
CPPUNIT_ASSERT(time.tm_hour == 14);
|
||||
CPPUNIT_ASSERT(time.tm_min == 0);
|
||||
|
@ -302,15 +310,15 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
|||
|
||||
// check for the interval 2004-10-26 between 14 o'clock and 15:30
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
time.tm_year = 2004;
|
||||
time.tm_mon = 10;
|
||||
time.tm_year = 104; // 2004
|
||||
time.tm_mon = 9; // October
|
||||
time.tm_mday = 26;
|
||||
time.tm_hour = 14;
|
||||
time.tm_min = 0;
|
||||
time.tm_sec = 0;
|
||||
parameters["from"] = &time;
|
||||
time.tm_year = 2004;
|
||||
time.tm_mon = 10;
|
||||
time.tm_year = 104; // 2004
|
||||
time.tm_mon = 9; // October
|
||||
time.tm_mday = 26;
|
||||
time.tm_hour = 15;
|
||||
time.tm_min = 30;
|
||||
|
@ -331,10 +339,18 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
|||
|
||||
// check the returned values
|
||||
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"];
|
||||
CPPUNIT_ASSERT(time.tm_year == 2004);
|
||||
CPPUNIT_ASSERT(time.tm_mon == 10);
|
||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||
CPPUNIT_ASSERT(time.tm_mon == 9); // October
|
||||
CPPUNIT_ASSERT(time.tm_mday == 26);
|
||||
CPPUNIT_ASSERT(time.tm_hour == 14);
|
||||
CPPUNIT_ASSERT(time.tm_min == 0);
|
||||
|
@ -343,15 +359,15 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
|||
|
||||
// check for the interval 2004-10-26 15:00 to 2012-08-01 midnight
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
time.tm_year = 2004;
|
||||
time.tm_mon = 10;
|
||||
time.tm_year = 104; // 2004
|
||||
time.tm_mon = 9; // October
|
||||
time.tm_mday = 26;
|
||||
time.tm_hour = 15;
|
||||
time.tm_min = 30;
|
||||
time.tm_sec = 0;
|
||||
parameters["from"] = &time;
|
||||
time.tm_year = 2012;
|
||||
time.tm_mon = 8;
|
||||
time.tm_year = 112; // 2012
|
||||
time.tm_mon = 7; // August
|
||||
time.tm_mday = 1;
|
||||
time.tm_hour = 0;
|
||||
time.tm_min = 0;
|
||||
|
@ -372,19 +388,35 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
|||
|
||||
// check the returned values
|
||||
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"];
|
||||
CPPUNIT_ASSERT(time.tm_year == 2004);
|
||||
CPPUNIT_ASSERT(time.tm_mon == 10);
|
||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||
CPPUNIT_ASSERT(time.tm_mon == 9); // October
|
||||
CPPUNIT_ASSERT(time.tm_mday == 26);
|
||||
CPPUNIT_ASSERT(time.tm_hour == 15);
|
||||
CPPUNIT_ASSERT(time.tm_min == 30);
|
||||
CPPUNIT_ASSERT(time.tm_sec == 0);
|
||||
|
||||
CPPUNIT_ASSERT((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"];
|
||||
CPPUNIT_ASSERT(time.tm_year == 2004);
|
||||
CPPUNIT_ASSERT(time.tm_mon == 10);
|
||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||
CPPUNIT_ASSERT(time.tm_mon == 9); // October
|
||||
CPPUNIT_ASSERT(time.tm_mday == 27);
|
||||
CPPUNIT_ASSERT(time.tm_hour == 10);
|
||||
CPPUNIT_ASSERT(time.tm_min == 01);
|
||||
|
@ -393,15 +425,15 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
|||
|
||||
// check for the interval 2004-10-26 16 o'clock to 2004-10-27 10 o'clock
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
time.tm_year = 2004;
|
||||
time.tm_mon = 10;
|
||||
time.tm_year = 104; // 2004
|
||||
time.tm_mon = 9; // October
|
||||
time.tm_mday = 26;
|
||||
time.tm_hour = 16;
|
||||
time.tm_min = 0;
|
||||
time.tm_sec = 0;
|
||||
parameters["from"] = &time;
|
||||
time.tm_year = 2004;
|
||||
time.tm_mon = 10;
|
||||
time.tm_year = 104; // 2004
|
||||
time.tm_mon = 9; // October
|
||||
time.tm_mday = 27;
|
||||
time.tm_hour = 10;
|
||||
time.tm_min = 0;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -174,7 +174,7 @@ OpenPlaylistForEditingMethodTest :: firstTest(void)
|
|||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = 1;
|
||||
parameter["playlistId"] = "0000000000000001";
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
@ -187,12 +187,18 @@ OpenPlaylistForEditingMethodTest :: firstTest(void)
|
|||
<< " - " << e.getMessage();
|
||||
CPPUNIT_FAIL(eMsg.str());
|
||||
}
|
||||
CPPUNIT_ASSERT((int) result["id"] == 1);
|
||||
CPPUNIT_ASSERT((int) result["playlength"] == (90 * 60));
|
||||
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);
|
||||
|
||||
parameter.clear();
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = 6376;
|
||||
parameter["playlistId"] = "0000000000009999";
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
@ -206,7 +212,7 @@ OpenPlaylistForEditingMethodTest :: firstTest(void)
|
|||
|
||||
parameter.clear();
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = 1;
|
||||
parameter["playlistId"] = "0000000000000001";
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -63,8 +63,8 @@ const std::string PostgresqlPlayLog::configElementNameStr =
|
|||
const std::string PostgresqlPlayLog::createStmt =
|
||||
"CREATE TABLE playLog\n"
|
||||
"(\n"
|
||||
" id INT NOT NULL,\n"
|
||||
" audioClipId INT NOT NULL,\n"
|
||||
" id BIGINT NOT NULL,\n"
|
||||
" audioClipId BIGINT NOT NULL,\n"
|
||||
" timestamp TIMESTAMP NOT NULL,\n"
|
||||
"\n"
|
||||
" PRIMARY KEY(id)\n"
|
||||
|
@ -181,9 +181,9 @@ PostgresqlPlayLog :: addPlayLogEntry(
|
|||
Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement(
|
||||
addPlayLogEntryStmt));
|
||||
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);
|
||||
pstmt->setTimestamp(3, *timestamp);
|
||||
|
@ -231,8 +231,8 @@ PostgresqlPlayLog :: getPlayLogEntries(
|
|||
|
||||
Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
|
||||
while (rs->next()) {
|
||||
Ptr<UniqueId>::Ref id(new UniqueId(rs->getInt(1)));
|
||||
Ptr<UniqueId>::Ref audioClipId(new UniqueId(rs->getInt(2)));
|
||||
Ptr<UniqueId>::Ref id(new UniqueId(rs->getLong(1)));
|
||||
Ptr<UniqueId>::Ref audioClipId(new UniqueId(rs->getLong(2)));
|
||||
|
||||
*timestamp = rs->getTimestamp(3);
|
||||
Ptr<ptime>::Ref clipTimestamp
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.5 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.6 $
|
||||
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 =
|
||||
"CREATE TABLE schedule\n"
|
||||
"(\n"
|
||||
" id INT NOT NULL,\n"
|
||||
" playlist INT NOT NULL,\n"
|
||||
" id BIGINT NOT NULL,\n"
|
||||
" playlist BIGINT NOT NULL,\n"
|
||||
" starts TIMESTAMP NOT NULL,\n"
|
||||
" ends TIMESTAMP NOT NULL,\n"
|
||||
"\n"
|
||||
|
@ -243,7 +243,7 @@ PostgresqlSchedule :: isTimeframeAvailable(
|
|||
pstmt->setTimestamp(6, *timestamp);
|
||||
|
||||
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);
|
||||
} catch (std::exception &e) {
|
||||
|
@ -277,9 +277,9 @@ PostgresqlSchedule :: schedulePlaylist(
|
|||
Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement(
|
||||
schedulePlaylistStmt));
|
||||
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);
|
||||
pstmt->setTimestamp(3, *timestamp);
|
||||
|
@ -331,8 +331,8 @@ PostgresqlSchedule :: getScheduleEntries(
|
|||
|
||||
Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
|
||||
while (rs->next()) {
|
||||
Ptr<UniqueId>::Ref id(new UniqueId(rs->getInt(1)));
|
||||
Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getInt(2)));
|
||||
Ptr<UniqueId>::Ref id(new UniqueId(rs->getLong(1)));
|
||||
Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getLong(2)));
|
||||
|
||||
*timestamp = rs->getTimestamp(3);
|
||||
Ptr<ptime>::Ref startTime = Conversion::timestampToPtime(timestamp);
|
||||
|
@ -380,8 +380,8 @@ PostgresqlSchedule :: getNextEntry(Ptr<ptime>::Ref fromTime)
|
|||
|
||||
Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
|
||||
if (rs->next()) {
|
||||
Ptr<UniqueId>::Ref id(new UniqueId(rs->getInt(1)));
|
||||
Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getInt(2)));
|
||||
Ptr<UniqueId>::Ref id(new UniqueId(rs->getLong(1)));
|
||||
Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getLong(2)));
|
||||
|
||||
*timestamp = rs->getTimestamp(3);
|
||||
Ptr<ptime>::Ref startTime = Conversion::timestampToPtime(timestamp);
|
||||
|
@ -420,10 +420,10 @@ PostgresqlSchedule :: scheduleEntryExists(
|
|||
conn = cm->getConnection();
|
||||
Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement(
|
||||
scheduleEntryExistsStmt));
|
||||
pstmt->setInt(1, entryId->getId());
|
||||
pstmt->setLong(1, entryId->getId());
|
||||
|
||||
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);
|
||||
} catch (std::exception &e) {
|
||||
|
@ -452,7 +452,7 @@ PostgresqlSchedule :: removeFromSchedule(
|
|||
conn = cm->getConnection();
|
||||
Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement(
|
||||
removeFromScheduleStmt));
|
||||
pstmt->setInt(1, entryId->getId());
|
||||
pstmt->setLong(1, entryId->getId());
|
||||
|
||||
result = pstmt->executeUpdate() == 1;
|
||||
|
||||
|
@ -484,14 +484,14 @@ PostgresqlSchedule :: getScheduleEntry(Ptr<UniqueId>::Ref entryId)
|
|||
conn = cm->getConnection();
|
||||
Ptr<PreparedStatement>::Ref pstmt(conn->prepareStatement(
|
||||
getScheduleEntryStmt));
|
||||
pstmt->setInt(1, entryId->getId());
|
||||
pstmt->setLong(1, entryId->getId());
|
||||
|
||||
Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
|
||||
if (rs->next()) {
|
||||
Ptr<Timestamp>::Ref timestamp(new Timestamp());
|
||||
|
||||
Ptr<UniqueId>::Ref id(new UniqueId(rs->getInt(1)));
|
||||
Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getInt(2)));
|
||||
Ptr<UniqueId>::Ref id(new UniqueId(rs->getLong(1)));
|
||||
Ptr<UniqueId>::Ref playlistId(new UniqueId(rs->getLong(2)));
|
||||
|
||||
*timestamp = rs->getTimestamp(3);
|
||||
Ptr<ptime>::Ref startTime = Conversion::timestampToPtime(timestamp);
|
||||
|
@ -551,7 +551,7 @@ PostgresqlSchedule :: reschedule(Ptr<UniqueId>::Ref entryId,
|
|||
timestamp = Conversion::ptimeToTimestamp(ends);
|
||||
pstmt->setTimestamp(2, *timestamp);
|
||||
|
||||
pstmt->setInt(3, entryId->getId());
|
||||
pstmt->setLong(3, entryId->getId());
|
||||
|
||||
result = pstmt->executeUpdate() == 1;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -183,8 +183,8 @@ RemoveAudioClipFromPlaylistMethodTest :: firstTest(void)
|
|||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["audioClipId"] = 0x10001;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
parameters["audioClipId"] = "0000000000010001";
|
||||
parameters["relativeOffset"] = 90*60;
|
||||
rootParameter[0] = parameters;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -170,7 +170,7 @@ RemoveFromScheduleMethodTest :: firstTest(void)
|
|||
|
||||
// first schedule (upload) a playlist
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -191,11 +191,13 @@ RemoveFromScheduleMethodTest :: firstTest(void)
|
|||
CPPUNIT_FAIL(eMsg.str());
|
||||
}
|
||||
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["sessionId"] = sessionId->getId();
|
||||
parameters["scheduleEntryId"] = int(entryId->getId());
|
||||
parameters["scheduleEntryId"] = std::string(*entryId);
|
||||
rootParameter[0] = parameters;
|
||||
|
||||
result.clear();
|
||||
|
@ -227,7 +229,7 @@ RemoveFromScheduleMethodTest :: negativeTest(void)
|
|||
Ptr<UniqueId>::Ref entryId(new UniqueId(9999));
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["scheduleEntryId"] = int(entryId->getId());
|
||||
parameters["scheduleEntryId"] = std::string(*entryId);
|
||||
rootParameter[0] = parameters;
|
||||
|
||||
result.clear();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -170,7 +170,7 @@ RescheduleMethodTest :: firstTest(void)
|
|||
|
||||
// let's upload something so we can reschedule it
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -191,12 +191,14 @@ RescheduleMethodTest :: firstTest(void)
|
|||
CPPUNIT_FAIL(eMsg.str());
|
||||
}
|
||||
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
|
||||
parameters.clear();
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["scheduleEntryId"] = (int) entryId->getId();
|
||||
parameters["scheduleEntryId"] = std::string(*entryId);
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -220,7 +222,7 @@ RescheduleMethodTest :: firstTest(void)
|
|||
// now let's reschedule unto itself, should fail
|
||||
parameters.clear();
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["scheduleEntryId"] = (int) entryId->getId();
|
||||
parameters["scheduleEntryId"] = std::string(*entryId);
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -183,7 +183,7 @@ RevertEditedPlaylistMethodTest :: firstTest(void)
|
|||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
parameters["relativeOffset"] = 0;
|
||||
rootParameter[0] = parameters;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -194,15 +194,16 @@ RpcAddAudioClipToPlaylistTest :: firstTest(void)
|
|||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["audioClipId"] = 0x10001;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
parameters["audioClipId"] = "0000000000010001";
|
||||
parameters["relativeOffset"] = 0;
|
||||
|
||||
result.clear();
|
||||
xmlRpcClient.execute("openPlaylistForEditing", parameters, result);
|
||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||
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();
|
||||
xmlRpcClient.execute("addAudioClipToPlaylist", parameters, result);
|
||||
|
@ -210,8 +211,8 @@ RpcAddAudioClipToPlaylistTest :: firstTest(void)
|
|||
|
||||
parameters.clear();
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["audioClipId"] = 0x10001;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
parameters["audioClipId"] = "0000000000010001";
|
||||
parameters["relativeOffset"] = 90*60;
|
||||
|
||||
result.clear();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -196,12 +196,14 @@ RpcCreatePlaylistTest :: firstTest(void)
|
|||
xmlRpcClient.execute("createPlaylist", parameters, result);
|
||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||
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["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = playlistId;
|
||||
parameters["playlistId"] = std::string(result["id"]);
|
||||
|
||||
result.clear();
|
||||
xmlRpcClient.execute("openPlaylistForEditing", parameters, result);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -193,7 +193,7 @@ RpcDeletePlaylistTest :: firstTest(void)
|
|||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
|
||||
result.clear();
|
||||
xmlRpcClient.execute("openPlaylistForEditing", parameters, result);
|
||||
|
@ -227,7 +227,7 @@ RpcDeletePlaylistTest :: negativeTest(void)
|
|||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 9999;
|
||||
parameters["playlistId"] = "9999";
|
||||
|
||||
result.clear();
|
||||
xmlRpcClient.execute("deletePlaylist", parameters, result);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -165,29 +165,24 @@ void
|
|||
DisplayAudioClipMethodTest :: firstTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<DisplayAudioClipMethod>::Ref method(new DisplayAudioClipMethod());
|
||||
XmlRpc::XmlRpcValue parameter;
|
||||
XmlRpc::XmlRpcValue rootParameter;
|
||||
rootParameter.setSize(1);
|
||||
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||
XmlRpc::XmlRpcValue parameters;
|
||||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
// set up a structure for the parameter
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["audioClipId"] = 10001;
|
||||
rootParameter[0] = parameter;
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["audioClipId"] = "0000000000010001";
|
||||
|
||||
result.clear();
|
||||
try {
|
||||
method->execute(rootParameter, result);
|
||||
}
|
||||
catch (XmlRpc::XmlRpcException &e) {
|
||||
std::stringstream eMsg;
|
||||
eMsg << "XML-RPC method returned error: " << e.getCode()
|
||||
<< " - " << e.getMessage();
|
||||
CPPUNIT_FAIL(eMsg.str());
|
||||
}
|
||||
CPPUNIT_ASSERT(int(result["id"]) == 10001);
|
||||
CPPUNIT_ASSERT(int(result["playlength"]) == (60 * 60));
|
||||
xmlRpcClient.execute("displayAudioClip", parameters, result);
|
||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||
|
||||
CPPUNIT_ASSERT(result.hasMember("id"));
|
||||
CPPUNIT_ASSERT(result["id"].getType() == XmlRpcValue::TypeString);
|
||||
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000010001");
|
||||
|
||||
CPPUNIT_ASSERT(result.hasMember("playlength"));
|
||||
CPPUNIT_ASSERT(result["playlength"].getType() == XmlRpcValue::TypeInt);
|
||||
CPPUNIT_ASSERT(int(result["playlength"]) == 60 * 60);
|
||||
}
|
||||
|
||||
|
||||
|
@ -198,23 +193,16 @@ void
|
|||
DisplayAudioClipMethodTest :: negativeTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<DisplayAudioClipMethod>::Ref method(new DisplayAudioClipMethod());
|
||||
XmlRpc::XmlRpcValue parameter;
|
||||
XmlRpc::XmlRpcValue rootParameter;
|
||||
rootParameter.setSize(1);
|
||||
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||
XmlRpc::XmlRpcValue parameters;
|
||||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
// set up a structure for the parameter
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["audioClipId"] = 9999;
|
||||
rootParameter[0] = parameter;
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["audioClipId"] = "0000000000009999";
|
||||
|
||||
result.clear();
|
||||
try {
|
||||
method->execute(rootParameter, result);
|
||||
CPPUNIT_FAIL("allowed to display non-existent audio clip");
|
||||
}
|
||||
catch (XmlRpc::XmlRpcException &e) {
|
||||
CPPUNIT_ASSERT(e.getCode() == 603); // audio clip not found
|
||||
}
|
||||
xmlRpcClient.execute("displayAudioClip", parameters, result);
|
||||
CPPUNIT_ASSERT(xmlRpcClient.isFault());
|
||||
CPPUNIT_ASSERT(result.hasMember("faultCode"));
|
||||
CPPUNIT_ASSERT(int(result["faultCode"]) == 603); // audio clip not found
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -161,33 +161,32 @@ void
|
|||
DisplayAudioClipsMethodTest :: firstTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<DisplayAudioClipsMethod>::Ref method(new DisplayAudioClipsMethod());
|
||||
XmlRpc::XmlRpcValue parameter;
|
||||
XmlRpc::XmlRpcValue rootParameter;
|
||||
rootParameter.setSize(1);
|
||||
XmlRpc::XmlRpcValue result;
|
||||
XmlRpc::XmlRpcValue audioClip;
|
||||
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||
XmlRpc::XmlRpcValue parameters;
|
||||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
result.clear();
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
rootParameter[0] = parameter;
|
||||
try {
|
||||
method->execute(rootParameter, result);
|
||||
}
|
||||
catch (XmlRpc::XmlRpcException &e) {
|
||||
std::stringstream eMsg;
|
||||
eMsg << "XML-RPC method returned error: " << e.getCode()
|
||||
<< " - " << e.getMessage();
|
||||
CPPUNIT_FAIL(eMsg.str());
|
||||
}
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
xmlRpcClient.execute("displayAudioClips", parameters, result);
|
||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||
CPPUNIT_ASSERT(result.size() == 2);
|
||||
|
||||
audioClip = result[0];
|
||||
CPPUNIT_ASSERT(int(audioClip["id"]) == 10001);
|
||||
XmlRpc::XmlRpcValue audioClip = result[0];
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -187,13 +187,18 @@ RpcDisplayPlaylistTest :: simpleTest(void)
|
|||
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
|
||||
result.clear();
|
||||
xmlRpcClient.execute("displayPlaylist", parameters, result);
|
||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||
CPPUNIT_ASSERT(((int) result["id"]) == 1);
|
||||
CPPUNIT_ASSERT(((int) result["playlength"]) == (90 * 60));
|
||||
CPPUNIT_ASSERT(result.hasMember("id"));
|
||||
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);
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 9999;
|
||||
parameters["playlistId"] = "0000000000009999";
|
||||
|
||||
result.clear();
|
||||
xmlRpcClient.execute("displayPlaylist", parameters, result);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -166,28 +166,22 @@ void
|
|||
DisplayPlaylistsMethodTest :: firstTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<DisplayPlaylistsMethod>::Ref method(new DisplayPlaylistsMethod());
|
||||
XmlRpc::XmlRpcValue parameters;
|
||||
XmlRpc::XmlRpcValue rootParameter;
|
||||
rootParameter.setSize(1);
|
||||
XmlRpc::XmlRpcValue result;
|
||||
XmlRpc::XmlRpcValue playlist;
|
||||
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||
XmlRpc::XmlRpcValue parameters;
|
||||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
result.clear();
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
rootParameter[0] = parameters;
|
||||
try {
|
||||
method->execute(rootParameter, result);
|
||||
}
|
||||
catch (XmlRpc::XmlRpcException &e) {
|
||||
std::stringstream eMsg;
|
||||
eMsg << "XML-RPC method returned error: " << e.getCode()
|
||||
<< " - " << e.getMessage();
|
||||
CPPUNIT_FAIL(eMsg.str());
|
||||
}
|
||||
xmlRpcClient.execute("displayPlaylists", parameters, result);
|
||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||
CPPUNIT_ASSERT(result.size() == 1);
|
||||
|
||||
playlist = result[0];
|
||||
CPPUNIT_ASSERT(((int) playlist["id"]) == 1);
|
||||
CPPUNIT_ASSERT(((int) playlist["playlength"]) == (90 * 60));
|
||||
XmlRpc::XmlRpcValue playlist = result[0];
|
||||
CPPUNIT_ASSERT(playlist.hasMember("id"));
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.1 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.2 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGetVersionTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -147,7 +147,8 @@ RpcGetVersionTest :: simpleTest(void)
|
|||
|
||||
result.clear();
|
||||
xmlRpcClient.execute("getVersion", parameters, result);
|
||||
CPPUNIT_ASSERT(!result.hasMember("errorCode"));
|
||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||
|
||||
CPPUNIT_ASSERT(result.hasMember("version"));
|
||||
std::string versionStr = result["version"];
|
||||
CPPUNIT_ASSERT(versionStr.find(versionPrefix) == 0);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -178,7 +178,7 @@ RpcRemoveFromScheduleTest :: simpleTest(void)
|
|||
|
||||
// first schedule a playlist, so that there is something to remove
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -191,9 +191,11 @@ RpcRemoveFromScheduleTest :: simpleTest(void)
|
|||
xmlRpcClient.execute("uploadPlaylist", parameters, result);
|
||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
||||
|
||||
Ptr<UniqueId>::Ref entryId(new UniqueId(int(result["scheduleEntryId"])));
|
||||
parameters["scheduleEntryId"] = (int) entryId->getId();
|
||||
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
||||
== XmlRpcValue::TypeString);
|
||||
Ptr<UniqueId>::Ref entryId(new UniqueId(std::string(
|
||||
result["scheduleEntryId"] )));
|
||||
parameters["scheduleEntryId"] = std::string(*entryId);
|
||||
|
||||
result.clear();
|
||||
xmlRpcClient.execute("removeFromSchedule", parameters, result);
|
||||
|
@ -214,7 +216,7 @@ RpcRemoveFromScheduleTest :: negativeTest(void)
|
|||
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["scheduleEntryId"] = 9999;
|
||||
parameters["scheduleEntryId"] = "0000000000009999";
|
||||
|
||||
result.clear();
|
||||
xmlRpcClient.execute("removeFromSchedule", parameters, result);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -177,7 +177,7 @@ RpcRescheduleTest :: simpleTest(void)
|
|||
|
||||
// first schedule a playlist, so that there is something to reschedule
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -190,11 +190,14 @@ RpcRescheduleTest :: simpleTest(void)
|
|||
xmlRpcClient.execute("uploadPlaylist", parameters, result);
|
||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||
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
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["scheduleEntryId"] = (int) entryId->getId();
|
||||
parameters["scheduleEntryId"] = std::string(*entryId);
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -209,7 +212,7 @@ RpcRescheduleTest :: simpleTest(void)
|
|||
|
||||
// now reschedule it unto itself, should fail
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["scheduleEntryId"] = (int) entryId->getId();
|
||||
parameters["scheduleEntryId"] = std::string(*entryId);
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -237,7 +240,7 @@ RpcRescheduleTest :: negativeTest(void)
|
|||
XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["scheduleEntryId"] = 9999;
|
||||
parameters["scheduleEntryId"] = "0000000000009999";
|
||||
|
||||
result.clear();
|
||||
xmlRpcClient.execute("removeFromSchedule", parameters, result);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -180,7 +180,7 @@ RpcUploadPlaylistTest :: simpleTest(void)
|
|||
|
||||
// try to schedule playlist #1 for the time below
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -175,7 +175,7 @@ SavePlaylistMethodTest :: firstTest(void)
|
|||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = 9999;
|
||||
parameter["playlistId"] = "0000000000009999";
|
||||
rootParameter[0] = parameter;
|
||||
|
||||
result.clear();
|
||||
|
@ -187,7 +187,7 @@ SavePlaylistMethodTest :: firstTest(void)
|
|||
CPPUNIT_ASSERT(e.getCode() == 703); // playlist not found
|
||||
}
|
||||
|
||||
parameter["playlistId"] = 1;
|
||||
parameter["playlistId"] = "0000000000000001";
|
||||
rootParameter[0] = parameter;
|
||||
result.clear();
|
||||
try {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -179,7 +179,7 @@ UpdateFadeInFadeOutMethodTest :: firstTest(void)
|
|||
XmlRpc::XmlRpcValue result;
|
||||
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
parameters["relativeOffset"] = 90*60;
|
||||
parameters["fadeIn"] = 0;
|
||||
rootParameter[0] = parameters;
|
||||
|
@ -219,7 +219,8 @@ UpdateFadeInFadeOutMethodTest :: firstTest(void)
|
|||
result.clear();
|
||||
try {
|
||||
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) {
|
||||
CPPUNIT_ASSERT(e.getCode() == 1608);// no audio clip at this rel offset
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -188,7 +188,7 @@ UploadPlaylistMethodTest :: firstTest(void)
|
|||
|
||||
// set up a structure for the parameters
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -228,7 +228,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
|
|||
|
||||
// load the first playlist, this will succeed
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -253,7 +253,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
|
|||
// try to load the same one, but in an overlapping time region
|
||||
// (we know that playlist with id 1 is 1 hour long)
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -274,7 +274,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
|
|||
|
||||
// try to load the same one, but now in good timing
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
@ -298,7 +298,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
|
|||
|
||||
// try to load the same one, this time overlapping both previos instances
|
||||
parameters["sessionId"] = sessionId->getId();
|
||||
parameters["playlistId"] = 1;
|
||||
parameters["playlistId"] = "0000000000000001";
|
||||
time.tm_year = 2001;
|
||||
time.tm_mon = 11;
|
||||
time.tm_mday = 12;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -182,7 +182,7 @@ ValidatePlaylistMethodTest :: firstTest(void)
|
|||
|
||||
result.clear();
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = 275;
|
||||
parameter["playlistId"] = "0000000000009999";
|
||||
rootParameter[0] = parameter;
|
||||
try {
|
||||
validatePlaylistMethod->execute(rootParameter, result);
|
||||
|
@ -195,7 +195,7 @@ ValidatePlaylistMethodTest :: firstTest(void)
|
|||
result.clear();
|
||||
parameter.clear();
|
||||
parameter["sessionId"] = sessionId->getId();
|
||||
parameter["playlistId"] = 1;
|
||||
parameter["playlistId"] = "0000000000000001";
|
||||
rootParameter[0] = parameter;
|
||||
try {
|
||||
openPlaylistMethod->execute(rootParameter, result);
|
||||
|
@ -244,5 +244,7 @@ ValidatePlaylistMethodTest :: firstTest(void)
|
|||
CPPUNIT_FAIL(eMsg.str());
|
||||
}
|
||||
CPPUNIT_ASSERT(result.hasMember("valid"));
|
||||
CPPUNIT_ASSERT(result["valid"].getType()
|
||||
== XmlRpc::XmlRpcValue::TypeBoolean);
|
||||
CPPUNIT_ASSERT(!bool(result["valid"])); // has a gap at the beginning
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -41,6 +41,7 @@
|
|||
|
||||
|
||||
#include <string>
|
||||
#include "LiveSupport/Core/TimeConversion.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
|
||||
*----------------------------------------------------------------------------*/
|
||||
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
|
||||
*----------------------------------------------------------------------------*/
|
||||
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
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string XmlRpcTools::relativeOffsetName = "relativeOffset";
|
||||
static const std::string relativeOffsetName = "relativeOffset";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the from member in the XML-RPC parameter
|
||||
* structure.
|
||||
* The name of the from member in the XML-RPC parameter structure.
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string XmlRpcTools::fromTimeName = "from";
|
||||
static const std::string fromTimeName = "from";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the to member in the XML-RPC parameter
|
||||
* structure.
|
||||
* The name of the to member in the XML-RPC parameter 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
|
||||
* structure.
|
||||
* The name of the playlist id member in the XML-RPC parameter structure.
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string XmlRpcTools::scheduleEntryIdName =
|
||||
"scheduleEntryId";
|
||||
static const std::string scheduleEntryIdName = "scheduleEntryId";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the playtime member in the XML-RPC parameter
|
||||
* structure.
|
||||
* The name of the playtime member in the XML-RPC parameter 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
|
||||
* structure.
|
||||
* The name of the fade in member in the XML-RPC parameter 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
|
||||
* structure.
|
||||
* The name of the fade out member in the XML-RPC parameter 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
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string XmlRpcTools::sessionIdName = "sessionId";
|
||||
static const std::string sessionIdName = "sessionId";
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
@ -129,11 +123,15 @@ XmlRpcTools :: extractScheduleEntryId(
|
|||
XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
if (!xmlRpcValue.hasMember(scheduleEntryIdName)) {
|
||||
throw std::invalid_argument("missing schedule entry ID argument");
|
||||
if (!xmlRpcValue.hasMember(scheduleEntryIdName)
|
||||
|| 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;
|
||||
}
|
||||
|
||||
|
@ -145,11 +143,14 @@ Ptr<UniqueId>::Ref
|
|||
XmlRpcTools :: extractPlaylistId(XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
if (!xmlRpcValue.hasMember(playlistIdName)) {
|
||||
throw std::invalid_argument("missing playlist ID argument");
|
||||
if (!xmlRpcValue.hasMember(playlistIdName)
|
||||
|| 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;
|
||||
}
|
||||
|
||||
|
@ -161,11 +162,14 @@ Ptr<UniqueId>::Ref
|
|||
XmlRpcTools :: extractAudioClipId(XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
if (!xmlRpcValue.hasMember(audioClipIdName)) {
|
||||
throw std::invalid_argument("missing audio clip ID argument");
|
||||
if (!xmlRpcValue.hasMember(audioClipIdName)
|
||||
|| 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;
|
||||
}
|
||||
|
||||
|
@ -177,12 +181,14 @@ Ptr<time_duration>::Ref
|
|||
XmlRpcTools :: extractRelativeOffset(XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
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");
|
||||
}
|
||||
|
||||
Ptr<time_duration>::Ref relativeOffset(new time_duration(0,0,
|
||||
(int) xmlRpcValue[relativeOffsetName], 0));
|
||||
int(xmlRpcValue[relativeOffsetName]), 0));
|
||||
return relativeOffset;
|
||||
}
|
||||
|
||||
|
@ -196,8 +202,8 @@ XmlRpcTools :: playlistToXmlRpcValue(
|
|||
XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw ()
|
||||
{
|
||||
xmlRpcValue["id"] = (int) (playlist->getId()->getId());
|
||||
xmlRpcValue["playlength"] = playlist->getPlaylength()->total_seconds();
|
||||
xmlRpcValue["id"] = std::string(*playlist->getId());
|
||||
xmlRpcValue["playlength"] = int(playlist->getPlaylength()->total_seconds());
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,8 +243,9 @@ XmlRpcTools :: audioClipToXmlRpcValue(
|
|||
XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw ()
|
||||
{
|
||||
xmlRpcValue["id"] = (int) (audioClip->getId()->getId());
|
||||
xmlRpcValue["playlength"] = audioClip->getPlaylength()->total_seconds();
|
||||
xmlRpcValue["id"] = std::string(*audioClip->getId());
|
||||
xmlRpcValue["playlength"] = int(audioClip->getPlaylength()
|
||||
->total_seconds());
|
||||
}
|
||||
|
||||
|
||||
|
@ -302,16 +309,15 @@ XmlRpcTools :: extractFromTime(
|
|||
XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
if (!xmlRpcValue.hasMember(fromTimeName)) {
|
||||
throw std::invalid_argument("no from part in parameter structure");
|
||||
if (!xmlRpcValue.hasMember(fromTimeName)
|
||||
|| 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];
|
||||
gregorian::date date(tm.tm_year, tm.tm_mon, tm.tm_mday);
|
||||
time_duration hours(tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
Ptr<ptime>::Ref ptime(new ptime(date, hours));
|
||||
|
||||
return ptime;
|
||||
struct tm time = (struct tm) xmlRpcValue[fromTimeName];
|
||||
return TimeConversion::tmToPtime(&time);
|
||||
}
|
||||
|
||||
|
||||
|
@ -323,16 +329,15 @@ XmlRpcTools :: extractToTime(
|
|||
XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
if (!xmlRpcValue.hasMember(toTimeName)) {
|
||||
throw std::invalid_argument("no to part in parameter structure");
|
||||
if (!xmlRpcValue.hasMember(toTimeName)
|
||||
|| 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];
|
||||
gregorian::date date(tm.tm_year, tm.tm_mon, tm.tm_mday);
|
||||
time_duration hours(tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
Ptr<ptime>::Ref ptime(new ptime(date, hours));
|
||||
|
||||
return ptime;
|
||||
struct tm time = (struct tm) xmlRpcValue[toTimeName];
|
||||
return TimeConversion::tmToPtime(&time);
|
||||
}
|
||||
|
||||
|
||||
|
@ -341,22 +346,14 @@ XmlRpcTools :: extractToTime(
|
|||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
XmlRpcTools :: ptimeToXmlRpcValue(
|
||||
Ptr<const ptime>::Ref ptime,
|
||||
XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
Ptr<const ptime>::Ref ptimeParam,
|
||||
XmlRpc::XmlRpcValue& xmlRpcValue)
|
||||
throw ()
|
||||
{
|
||||
gregorian::date date = ptime->date();
|
||||
posix_time::time_duration hours = ptime->time_of_day();
|
||||
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
|
||||
|
||||
struct tm time;
|
||||
Ptr<ptime>::Ref myPtime(new ptime(*ptimeParam)); // get rid of const
|
||||
|
||||
TimeConversion::ptimeToTm(myPtime, time);
|
||||
xmlRpcValue = XmlRpc::XmlRpcValue(&time);
|
||||
}
|
||||
|
||||
|
@ -381,8 +378,8 @@ XmlRpcTools :: scheduleEntriesToXmlRpcValue(
|
|||
while (it != scheduleEntries->end()) {
|
||||
Ptr<ScheduleEntry>::Ref entry = *it;
|
||||
XmlRpc::XmlRpcValue returnStruct;
|
||||
returnStruct["id"] = (int) (entry->getId()->getId());
|
||||
returnStruct["playlistId"] = (int) (entry->getPlaylistId()->getId());
|
||||
returnStruct["id"] = std::string(*entry->getId());
|
||||
returnStruct["playlistId"] = std::string(*entry->getPlaylistId());
|
||||
|
||||
XmlRpc::XmlRpcValue time;
|
||||
ptimeToXmlRpcValue(entry->getStartTime(), time);
|
||||
|
@ -405,16 +402,15 @@ XmlRpcTools :: extractPlayschedule(
|
|||
XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
if (!xmlRpcValue.hasMember(playtimeName)) {
|
||||
throw std::invalid_argument("no playtime in parameter structure");
|
||||
if (!xmlRpcValue.hasMember(playtimeName)
|
||||
|| xmlRpcValue[playtimeName].getType()
|
||||
!= XmlRpc::XmlRpcValue::TypeDateTime) {
|
||||
throw std::invalid_argument("missing or bad playtime in "
|
||||
"parameter structure");
|
||||
}
|
||||
|
||||
struct tm tm = (struct tm) xmlRpcValue[playtimeName];
|
||||
gregorian::date date(tm.tm_year, tm.tm_mon, tm.tm_mday);
|
||||
time_duration hours(tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
Ptr<ptime>::Ref ptime(new ptime(date, hours));
|
||||
|
||||
return ptime;
|
||||
struct tm time = (struct tm) xmlRpcValue[playtimeName];
|
||||
return TimeConversion::tmToPtime(&time);
|
||||
}
|
||||
|
||||
|
||||
|
@ -425,12 +421,14 @@ Ptr<time_duration>::Ref
|
|||
XmlRpcTools :: extractFadeIn(XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
if (!xmlRpcValue.hasMember(fadeInName)) {
|
||||
throw std::invalid_argument("missing fade in argument");
|
||||
if (!xmlRpcValue.hasMember(fadeInName)
|
||||
|| 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,
|
||||
(int) xmlRpcValue[fadeInName], 0));
|
||||
int(xmlRpcValue[fadeInName]), 0));
|
||||
return fadeIn;
|
||||
}
|
||||
|
||||
|
@ -442,12 +440,14 @@ Ptr<time_duration>::Ref
|
|||
XmlRpcTools :: extractFadeOut(XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
if (!xmlRpcValue.hasMember(fadeOutName)) {
|
||||
throw std::invalid_argument("missing fade out argument");
|
||||
if (!xmlRpcValue.hasMember(fadeOutName)
|
||||
|| 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,
|
||||
(int) xmlRpcValue[fadeOutName], 0));
|
||||
int(xmlRpcValue[fadeOutName]), 0));
|
||||
return fadeOut;
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ XmlRpcTools :: scheduleEntryIdToXmlRpcValue(
|
|||
XmlRpc::XmlRpcValue & returnValue)
|
||||
throw ()
|
||||
{
|
||||
returnValue[scheduleEntryIdName] = int(scheduleEntryId->getId());
|
||||
returnValue[scheduleEntryIdName] = std::string(*scheduleEntryId);
|
||||
}
|
||||
|
||||
|
||||
|
@ -474,11 +474,11 @@ XmlRpcTools :: playLogEntryToXmlRpcValue(
|
|||
XmlRpc::XmlRpcValue & returnValue)
|
||||
throw ()
|
||||
{
|
||||
returnValue["audioClipId"] = int(playLogEntry->getAudioClipId()->getId());
|
||||
returnValue["audioClipId"] = std::string(*playLogEntry->getAudioClipId());
|
||||
|
||||
XmlRpc::XmlRpcValue timestamp;
|
||||
ptimeToXmlRpcValue(playLogEntry->getTimestamp(), timestamp);
|
||||
returnValue["timestamp"] = timestamp;
|
||||
returnValue["timestamp"] = timestamp;
|
||||
}
|
||||
|
||||
|
||||
|
@ -518,11 +518,14 @@ XmlRpcTools :: extractSessionId(
|
|||
XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
if (!xmlRpcValue.hasMember(sessionIdName)) {
|
||||
throw std::invalid_argument("missing session ID argument");
|
||||
if (!xmlRpcValue.hasMember(sessionIdName)
|
||||
|| 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -74,70 +74,11 @@ using namespace LiveSupport::Core;
|
|||
* in the Scheduler.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.12 $
|
||||
* @version $Revision: 1.13 $
|
||||
*/
|
||||
class XmlRpcTools
|
||||
{
|
||||
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
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -137,39 +137,49 @@ XmlRpcToolsTest :: firstTest(void)
|
|||
XmlRpcTools :: playlistToXmlRpcValue(playlist, xmlRpcPlaylist);
|
||||
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(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);
|
||||
|
||||
XmlRpcValue xmlRpcPlaylistId;
|
||||
Ptr<UniqueId>::Ref playlistId;
|
||||
Ptr<UniqueId>::Ref audioClipId;
|
||||
Ptr<time_duration>::Ref relativeOffset;
|
||||
Ptr<UniqueId>::Ref playlistId(new UniqueId(rand()));
|
||||
Ptr<UniqueId>::Ref audioClipId(new UniqueId(rand()));
|
||||
Ptr<time_duration>::Ref relativeOffset(new time_duration(0,0,rand(),0));
|
||||
|
||||
int playlistIdNum = rand();
|
||||
int audioClipIdNum = rand();
|
||||
int relativeOffsetNum = rand();
|
||||
|
||||
xmlRpcPlaylistId["playlistId"] = playlistIdNum;
|
||||
xmlRpcPlaylistId["audioClipId"] = audioClipIdNum;
|
||||
xmlRpcPlaylistId["relativeOffset"] = relativeOffsetNum;
|
||||
xmlRpcPlaylistId["playlistId"] = std::string(*playlistId);
|
||||
xmlRpcPlaylistId["audioClipId"] = std::string(*audioClipId);
|
||||
xmlRpcPlaylistId["relativeOffset"] = relativeOffset->total_seconds();
|
||||
|
||||
// run the unpacking methods
|
||||
Ptr<UniqueId>::Ref newPlaylistId;
|
||||
Ptr<UniqueId>::Ref newAudioClipId;
|
||||
Ptr<time_duration>::Ref newRelativeOffset;
|
||||
try {
|
||||
playlistId = XmlRpcTools::extractPlaylistId(xmlRpcPlaylistId);
|
||||
audioClipId = XmlRpcTools::extractAudioClipId(xmlRpcPlaylistId);
|
||||
relativeOffset = XmlRpcTools::extractRelativeOffset(xmlRpcPlaylistId);
|
||||
newPlaylistId = XmlRpcTools::extractPlaylistId(xmlRpcPlaylistId);
|
||||
newAudioClipId = XmlRpcTools::extractAudioClipId(xmlRpcPlaylistId);
|
||||
newRelativeOffset = XmlRpcTools::extractRelativeOffset(xmlRpcPlaylistId);
|
||||
}
|
||||
catch (std::invalid_argument &e) {
|
||||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
|
||||
CPPUNIT_ASSERT((int)(playlistId->getId()) == playlistIdNum);
|
||||
CPPUNIT_ASSERT((int)(audioClipId->getId()) == audioClipIdNum);
|
||||
CPPUNIT_ASSERT((int)(relativeOffset->total_seconds())
|
||||
== relativeOffsetNum);
|
||||
CPPUNIT_ASSERT(*playlistId == *newPlaylistId);
|
||||
CPPUNIT_ASSERT(*audioClipId == *newAudioClipId);
|
||||
CPPUNIT_ASSERT(*relativeOffset == *newRelativeOffset);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue