diff --git a/livesupport/products/scheduler/doc/model/SchedulerModel.zuml b/livesupport/products/scheduler/doc/model/SchedulerModel.zuml index 75fbc75fe..9618bc077 100644 Binary files a/livesupport/products/scheduler/doc/model/SchedulerModel.zuml and b/livesupport/products/scheduler/doc/model/SchedulerModel.zuml differ diff --git a/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx b/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx index 16321894a..257d9e675 100644 --- a/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx +++ b/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx @@ -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/CreatePlaylistMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -70,6 +70,11 @@ using namespace LiveSupport::Scheduler; *----------------------------------------------------------------------------*/ const std::string CreatePlaylistMethod::methodName = "createPlaylist"; +/*------------------------------------------------------------------------------ + * The ID of this method for error reporting purposes. + *----------------------------------------------------------------------------*/ +const int CreatePlaylistMethod::errorId = 2000; + /* =============================================== local function prototypes */ @@ -102,5 +107,11 @@ CreatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters, Ptr::Ref playlist = storage->createPlaylist(); + if (!playlist->setLockedForEditing(true)) { // this should never happen + XmlRpcTools :: markError(errorId+1, + "could not open new playlist for editing", + returnValue); + return; + } XmlRpcTools :: playlistToXmlRpcValue(playlist, returnValue); } diff --git a/livesupport/products/scheduler/src/CreatePlaylistMethod.h b/livesupport/products/scheduler/src/CreatePlaylistMethod.h index a27d6373a..50a3a00c9 100644 --- a/livesupport/products/scheduler/src/CreatePlaylistMethod.h +++ b/livesupport/products/scheduler/src/CreatePlaylistMethod.h @@ -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/CreatePlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -75,9 +75,15 @@ using namespace LiveSupport::Core; *
  • playlength - int - the playlist length of the playlist, in seconds *
  • * + * If there is an error, an XML-RPC structure is returned, with the following + * fields: + * * * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ class CreatePlaylistMethod : public XmlRpc::XmlRpcServerMethod { @@ -88,6 +94,11 @@ class CreatePlaylistMethod : public XmlRpc::XmlRpcServerMethod */ static const std::string methodName; + /** + * The ID of this method for error reporting purposes. + */ + static const int errorId; + public: /** diff --git a/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx b/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx index 278b86434..d9ce1ce50 100644 --- a/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx @@ -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/CreatePlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -47,8 +47,10 @@ #include "LiveSupport/Db/ConnectionManagerFactory.h" #include "LiveSupport/Storage/StorageClientFactory.h" #include "CreatePlaylistMethod.h" +#include "OpenPlaylistForEditingMethod.h" #include "CreatePlaylistMethodTest.h" +using namespace XmlRpc; using namespace LiveSupport::Db; using namespace LiveSupport::Storage; @@ -138,11 +140,23 @@ void CreatePlaylistMethodTest :: firstTest(void) throw (CPPUNIT_NS::Exception) { - Ptr::Ref method(new CreatePlaylistMethod()); + Ptr::Ref method(new CreatePlaylistMethod()); XmlRpc::XmlRpcValue parameter; XmlRpc::XmlRpcValue result; method->execute(parameter, result); CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(((int) result["playlength"]) == 0); + + int playlistId = (int) result["id"]; + method.reset(new OpenPlaylistForEditingMethod()); + parameter.clear(); + result.clear(); + parameter["playlistId"] = playlistId; + + // should not allow to open the same playlist for editing again + method->execute(parameter, result); + CPPUNIT_ASSERT((int) result["errorCode"] == 1005); + CPPUNIT_ASSERT((const std::string) result["errorMessage"] == + "playlist cannot be edited"); }