diff --git a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h index 1b305ba53..cf8fd4192 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h +++ b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.21 $ + Version : $Revision: 1.22 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $ ------------------------------------------------------------------------------*/ @@ -43,6 +43,7 @@ #include #include #include +#include #include #include "LiveSupport/Core/Ptr.h" @@ -96,17 +97,22 @@ using namespace boost::posix_time; * The metadata element is optional. The configure() method * sets only those fields which had not been set previously: e.g., if we set * some or all fields of the AudioClip in the constructor, then these fields - * in the XML element will be ignored by configure(). If both the - * playlength attribute and the - * <dcterms:extent> - * element are present, then the playlength is set from the attribute and - * <dcterms:extent> is ignored. Embedded XML elements are - * currently ignored: e.g.,
  <group>
+ *  in the XML element will be ignored by configure().
+ *  The title attribute and the <dc:title> 
+ *  element set the same field; if both are present, the title is set from
+ *  the attribute and the element is ignored..
+ *  The same is true for the playlength attribute and the 
+ *  <dcterms:extent> element.
+ *  It is required that by the end of the configure() method, the playlength
+ *  is set somehow (from a constructor, the attribute or the element).
+ *  If the title is not set by the end of the configure() method, it is then
+ *  set to the empty string.
+ *  Embedded XML elements are currently ignored: e.g., 
+ *  
  <group>
  *      <member1>value1</member1>
  *      <member2>value2</member2>
- *  </group>
produces a single metadata field - * group - * with an empty value, + * </group>
+ * produces a single metadata field group with an empty value, * and ignores member1 and member2. * TODO: fix this? * @@ -124,7 +130,7 @@ using namespace boost::posix_time; * * * @author $Author: fgerlits $ - * @version $Revision: 1.21 $ + * @version $Revision: 1.22 $ */ class AudioClip : public Configurable, public Playable @@ -291,6 +297,30 @@ class AudioClip : public Configurable, Ptr::Ref uri) throw (); + + /** + * Convert the audio clip to an XmlRpcValue (marshalling). + * + * @return an XmlRpcValue struct, containing a + * field named audioClip, with value of type string, + * which contains an XML document representing the audio clip. + */ + operator XmlRpc::XmlRpcValue() const + throw (); + + /** + * Construct an audio clip from an XmlRpcValue (demarshalling). + * + * @param xmlRpcValue an XmlRpcValue struct, containing a + * field named audioClip, with value of type string, + * which contains an XML document, the root node of which + * can be passed to the configure() method. + * @exception std::invalid_argument if the argument is invalid + */ + AudioClip(XmlRpc::XmlRpcValue & xmlRpcValue) + throw (std::invalid_argument); + + /** * A virtual destructor, as this class has virtual functions. */ @@ -299,6 +329,7 @@ class AudioClip : public Configurable, { } + /** * Return the name of the XML element this object expects * to be sent to a call to configure(). @@ -469,7 +500,7 @@ class AudioClip : public Configurable, * @return a string representation of the audio clip as an XML element */ virtual Ptr::Ref - getXmlElementString(void) throw (); + getXmlElementString(void) const throw (); /** @@ -512,7 +543,7 @@ class AudioClip : public Configurable, * @return a string representation of the audio clip as an XML document */ virtual Ptr::Ref - getXmlDocumentString(void) throw (); + getXmlDocumentString(void) const throw (); /** diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playable.h b/livesupport/modules/core/include/LiveSupport/Core/Playable.h index 121957b44..b6a8b8568 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playable.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playable.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.8 $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playable.h,v $ ------------------------------------------------------------------------------*/ @@ -73,7 +73,7 @@ using namespace boost::posix_time; * It contains the methods which are common to these classes. * * @author $Author: fgerlits $ - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ */ class Playable : public boost::enable_shared_from_this { @@ -225,7 +225,7 @@ class Playable : public boost::enable_shared_from_this * @return a string representation of the audio clip as an XML element */ virtual Ptr::Ref - getXmlElementString(void) throw () = 0; + getXmlElementString(void) const throw () = 0; /** @@ -256,7 +256,7 @@ class Playable : public boost::enable_shared_from_this * @return a string representation of the audio clip as an XML document */ virtual Ptr::Ref - getXmlDocumentString(void) throw () = 0; + getXmlDocumentString(void) const throw () = 0; /** @@ -265,7 +265,7 @@ class Playable : public boost::enable_shared_from_this * @return either AudioClipType or PlaylistType. */ Type - getType(void) const throw () + getType(void) const throw () { return type; } @@ -278,7 +278,7 @@ class Playable : public boost::enable_shared_from_this * @return an audio clip pointer to this object. */ Ptr::Ref - getAudioClip(void) throw (); + getAudioClip(void) throw (); /** * Return a playlist pointer to this object. If the object's @@ -288,7 +288,7 @@ class Playable : public boost::enable_shared_from_this * @return a playlist pointer to this object. */ Ptr::Ref - getPlaylist(void) throw (); + getPlaylist(void) throw (); }; diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h index a614e6655..0e6135a40 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.30 $ + Version : $Revision: 1.31 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $ ------------------------------------------------------------------------------*/ @@ -43,6 +43,7 @@ #include #include #include +#include #include #include "LiveSupport/Core/Ptr.h" @@ -75,25 +76,59 @@ using namespace boost::posix_time; * called playlist. This may look like the following: * *

- *  <playlist id="1" playlength="00:18:30.000000" >
+ *  <playlist id="1" title="My Playlist" playlength="00:18:30.000000" >
  *      <playlistElement> ... </playlistElement>
  *      ...
+ *      <playlistElement> ... </playlistElement>
+ *      <metadata
+ *                xmlns="http://www.streamonthefly.org/"
+ *                xmlns:dc="http://purl.org/dc/elements/1.1/"
+ *                xmlns:dcterms="http://purl.org/dc/terms/"
+ *                xmlns:xbmf="http://www.streamonthefly.org/xbmf"
+ *                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
+ *             <dc:title  >File Title txt</dc:title>
+ *             <dcterms:extent  >00:02:30.000000</dcterms:extent>
+ *             ...
+ *         </metadata>
  *  </playlist>
  *  
* * For detais of the playlistElement element, see the documentation * for the PlaylistElement class. * + * The metadata element is optional. The configure() method + * sets only those fields which had not been set previously: e.g., if we set + * some or all fields of the Playlist in the constructor, then these fields + * in the XML element will be ignored by configure(). + * The title attribute and the <dc:title> + * element set the same field; if both are present, the title is set from + * the attribute and the element is ignored.. + * The same is true for the playlength attribute and the + * <dcterms:extent> element. + * It is required that by the end of the configure() method, the playlength + * is set somehow (from a constructor, the attribute or the element). + * If the title is not set by the end of the configure() method, it is then + * set to the empty string. + * Embedded XML elements are currently ignored: e.g., + *
  <group>
+ *      <member1>value1</member1>
+ *      <member2>value2</member2>
+ *  </group>
+ * produces a single metadata field group with an empty value, + * and ignores member1 and member2. + * TODO: fix this? + * * The DTD for the above element is: * *

- *  <!ELEMENT playlist (playlistElement*) >
- *  <!ATTLIST playlist  id           NMTOKEN    #REQUIRED  >
- *  <!ATTLIST playlist  playlength   NMTOKEN    #REQUIRED  >
+ *  <!ELEMENT playlist (playlistElement*, metadata?) >
+ *  <!ATTLIST playlist  id           NMTOKEN    #REQUIRED >
+ *  <!ATTLIST playlist  title        CDATA      ""  >
+ *  <!ATTLIST playlist  playlength   NMTOKEN    #IMPLIED  >
  *  
* * @author $Author: fgerlits $ - * @version $Revision: 1.30 $ + * @version $Revision: 1.31 $ */ class Playlist : public Configurable, public Playable @@ -133,7 +168,7 @@ class Playlist : public Configurable, * A map type for storing the playlist elements associated with * this playlist, indexed by their relative offsets. */ - typedef std::map::Ref> + typedef std::multimap::Ref> PlaylistElementListType; /** @@ -184,6 +219,24 @@ class Playlist : public Configurable, setPlaylength(Ptr::Ref playlength) throw (); + /** + * A private iterator type for internal use. It is non-constant; + * otherwise it is the same as Playlist::const_iterator. + */ + typedef PlaylistElementListType::iterator iterator; + + /** + * Get an iterator pointing to a playlist element with a given ID. + * + * @param playlistElementId (a pointer to) the ID of the + * playlist element. + * @return an iterator to the playlist element if it exists, + * or this->end() if it does not. + */ + iterator + find(Ptr::Ref playlistElementId) + throw (); + public: /** @@ -274,6 +327,29 @@ class Playlist : public Configurable, Ptr::Ref uri = Ptr::Ref()) throw (); + /** + * Convert the playlist to an XmlRpcValue (marshalling). + * + * @return an XmlRpcValue struct, containing a + * field named playlist, with value of type string, + * which contains an XML document representing the playlist. + */ + operator XmlRpc::XmlRpcValue() const + throw (); + + /** + * Construct a playlist from an XmlRpcValue (demarshalling). + * + * @param xmlRpcValue an XmlRpcValue struct, containing a + * field named playlist, with value of type string, + * which contains an XML document, the root node of which + * can be passed to the configure() method. + * @exception std::invalid_argument if the argument is invalid + */ + Playlist(XmlRpc::XmlRpcValue & xmlRpcValue) + throw (std::invalid_argument); + + /** * A virtual destructor, as this class has virtual functions. */ @@ -282,6 +358,7 @@ class Playlist : public Configurable, { } + /** * Return the name of the XML element this object expects * to be sent to a call to configure(). @@ -445,8 +522,9 @@ class Playlist : public Configurable, } /** - * Get an iterator pointing to a playlist element at a given + * Get an iterator pointing to the first playlist element at a given * relative offset. + * * @param relativeOffset (a pointer to) the relative offset where * the playlist element is. * @return a constant iterator to the playlist element if it exists, @@ -470,10 +548,11 @@ class Playlist : public Configurable, * @param relativeOffset the start of the audio clip, relative * to the start of the playlist * @param fadeInfo the fade in / fade out info (optional) + * @return the ID of the new PlaylistElement * @exception std::invalid_argument if the playlist already contains * a playlist element with the same relative offset */ - void + Ptr::Ref addAudioClip(Ptr::Ref audioClip, Ptr::Ref relativeOffset, Ptr::Ref fadeInfo @@ -491,10 +570,11 @@ class Playlist : public Configurable, * @param relativeOffset the start of the sub-playlist, relative * to the start of the containing playlist * @param fadeInfo the fade in / fade out info (optional) + * @return the ID of the new PlaylistElement * @exception std::invalid_argument if the playlist already contains * a playlist element with the same relative offset */ - void + Ptr::Ref addPlaylist(Ptr::Ref playlist, Ptr::Ref relativeOffset, Ptr::Ref fadeInfo @@ -504,27 +584,25 @@ class Playlist : public Configurable, /** * Set the fade in / fade out info for a playlist element. * - * @param relativeOffset the start of the playlist element, relative - * to the start of the playlist + * @param playlistElementId the ID of the playlist element * @param fadeInfo the new fade in / fade out info * @exception std::invalid_argument if there is no playlist element * at the given relative offset */ void - setFadeInfo(Ptr::Ref relativeOffset, - Ptr::Ref fadeInfo) + setFadeInfo(Ptr::Ref playlistElementId, + Ptr::Ref fadeInfo) throw (std::invalid_argument); /** * Remove a playlist element from the playlist. * - * @param relativeOffset the start of the playlist element, relative - * to the start of the playlist - * @exception std::invalid_argument if the playlist does not contain - * a playlist element at the specified relative offset + * @param playlistElementId the ID of the playlist element + * @exception std::invalid_argument if the playlist element does not + * exist */ void - removePlaylistElement(Ptr::Ref relativeOffset) + removePlaylistElement(Ptr::Ref playlistElementId) throw (std::invalid_argument); /** @@ -596,7 +674,7 @@ class Playlist : public Configurable, * @return a string representation of the playlist as an XML element */ virtual Ptr::Ref - getXmlElementString(void) throw (); + getXmlElementString(void) const throw (); /** @@ -632,7 +710,7 @@ class Playlist : public Configurable, * @return a string representation of the playlist as an XML document */ virtual Ptr::Ref - getXmlDocumentString(void) throw (); + getXmlDocumentString(void) const throw (); }; diff --git a/livesupport/modules/core/include/LiveSupport/Core/XmlRpcTools.h b/livesupport/modules/core/include/LiveSupport/Core/XmlRpcTools.h index 98c171a19..2512c88a7 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/XmlRpcTools.h +++ b/livesupport/modules/core/include/LiveSupport/Core/XmlRpcTools.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/XmlRpcTools.h,v $ ------------------------------------------------------------------------------*/ @@ -74,7 +74,7 @@ using namespace LiveSupport::Core; * in the Scheduler. * * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ */ class XmlRpcTools { @@ -130,7 +130,7 @@ class XmlRpcTools throw (std::invalid_argument); /** - * Extract the playlist id from the XML-RPC parameters. + * Extract the playlist ID from the XML-RPC parameters. * * @param xmlRpcValue the XML-RPC parameter to extract from. * @return a UniqueId that was found in the XML-RPC parameter. @@ -141,6 +141,18 @@ class XmlRpcTools extractPlaylistId(XmlRpc::XmlRpcValue & xmlRpcValue) throw (std::invalid_argument); + /** + * Extract the playlist element ID from the XML-RPC parameters. + * + * @param xmlRpcValue the XML-RPC parameter to extract from. + * @return a UniqueId that was found in the XML-RPC parameter. + * @exception std::invalid_argument if there was no playlistElementId + * member in xmlRpcValue + */ + static Ptr::Ref + extractPlaylistElementId(XmlRpc::XmlRpcValue & xmlRpcValue) + throw (std::invalid_argument); + /** * Extract the audio clip id from the XML-RPC parameters. * @@ -407,15 +419,28 @@ class XmlRpcTools /** * Add a playlist id to an XmlRpcValue * - * @param playlist the playlist idt o add to the XmlRpcValue + * @param playlistId the playlist ID to add to the XmlRpcValue * @param returnValue an output parameter, which has the - * playlist id added after the function returns. + * playlist ID added after the function returns. */ static void playlistIdToXmlRpcValue( Ptr::Ref playlistId, XmlRpc::XmlRpcValue & returnValue) throw (); + /** + * Add a playlist element id to an XmlRpcValue + * + * @param playlistElementId the playlist element ID + * to add to the XmlRpcValue + * @param returnValue an output parameter, which has the + * playlist element ID added after the function returns. + */ + static void + playlistElementIdToXmlRpcValue( + Ptr::Ref playlistElementId, + XmlRpc::XmlRpcValue & returnValue) throw (); + /** * Add a playtime value to an XmlRpcValue. * diff --git a/livesupport/modules/core/src/AudioClip.cxx b/livesupport/modules/core/src/AudioClip.cxx index 23da67dd6..dfed81d90 100644 --- a/livesupport/modules/core/src/AudioClip.cxx +++ b/livesupport/modules/core/src/AudioClip.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.20 $ + Version : $Revision: 1.21 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $ ------------------------------------------------------------------------------*/ @@ -189,7 +189,8 @@ AudioClip :: AudioClip(Ptr::Ref id, } -/*------------------------------------------------------------------------------ * Constructor without ID. +/*------------------------------------------------------------------------------ + * Constructor without ID. *----------------------------------------------------------------------------*/AudioClip :: AudioClip(Ptr::Ref title, Ptr::Ref playlength, Ptr::Ref uri) @@ -208,6 +209,41 @@ AudioClip :: AudioClip(Ptr::Ref id, } +/*------------------------------------------------------------------------------ + * Convert to an XmlRpcValue. + *----------------------------------------------------------------------------*/ +AudioClip :: operator XmlRpc::XmlRpcValue() const + throw() +{ + XmlRpc::XmlRpcValue xmlRpcValue; + xmlRpcValue[configElementNameStr] = std::string(*getXmlDocumentString()); + + return xmlRpcValue; +} + + +/*------------------------------------------------------------------------------ + * Construct from an XmlRpcValue. + *----------------------------------------------------------------------------*/ +AudioClip :: AudioClip(XmlRpc::XmlRpcValue & xmlRpcValue) + throw (std::invalid_argument) + : Playable(AudioClipType) +{ + if (!xmlRpcValue.hasMember(configElementNameStr)) { + throw std::invalid_argument("no audio clip data found in XmlRpcValue"); + } + + xmlpp::DomParser parser; + try { + parser.parse_memory(std::string(xmlRpcValue[configElementNameStr])); + } catch (xmlpp::exception &e) { + throw std::invalid_argument("error parsing XML document"); + } + + configure(*parser.get_document()->get_root_node()); // may throw +} + + /*------------------------------------------------------------------------------ * Set the value of the title field. *----------------------------------------------------------------------------*/ @@ -338,11 +374,7 @@ AudioClip :: configure(const xmlpp::Element & element) } if (!title) { - std::string eMsg = "missing attribute "; - eMsg += titleAttrName; - eMsg += " or metadata element "; - eMsg += titleElementPrefix + ":" + titleElementName; - throw std::invalid_argument(eMsg); + title.reset(new const Glib::ustring("")); } } @@ -480,7 +512,7 @@ AudioClip :: setMetadata(Ptr::Ref value, * Return a string containing the essential fields of this object, in XML. *----------------------------------------------------------------------------*/ Ptr::Ref -AudioClip :: getXmlElementString(void) throw () +AudioClip :: getXmlElementString(void) const throw () { Ptr::Ref xmlString(new Glib::ustring); @@ -503,7 +535,7 @@ AudioClip :: getXmlElementString(void) throw () * Return a string containing an XML representation of this audio clip. *----------------------------------------------------------------------------*/ Ptr::Ref -AudioClip :: getXmlDocumentString() throw () +AudioClip :: getXmlDocumentString() const throw () { Ptr::Ref localDocument; diff --git a/livesupport/modules/core/src/AudioClipTest.cxx b/livesupport/modules/core/src/AudioClipTest.cxx index 9a4775147..fbc7b811a 100644 --- a/livesupport/modules/core/src/AudioClipTest.cxx +++ b/livesupport/modules/core/src/AudioClipTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.10 $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -219,3 +219,39 @@ AudioClipTest :: tagTest(void) CPPUNIT_ASSERT(*artist == "The Muppets"); } + +/*------------------------------------------------------------------------------ + * Marshalling test + *----------------------------------------------------------------------------*/ +void +AudioClipTest :: marshallingTest(void) + throw (CPPUNIT_NS::Exception) +{ + Ptr::Ref audioClip(new AudioClip()); + try { + Ptr::Ref parser( + new xmlpp::DomParser(configFileName, false)); + const xmlpp::Document * document = parser->get_document(); + const xmlpp::Element * root = document->get_root_node(); + + audioClip->configure(*root); + + } catch (std::invalid_argument &e) { + CPPUNIT_FAIL(e.what()); + } catch (xmlpp::exception &e) { + CPPUNIT_FAIL(e.what()); + } + + XmlRpc::XmlRpcValue xmlRpcValue = *audioClip; + CPPUNIT_ASSERT(xmlRpcValue.hasMember("audioClip")); + + Ptr::Ref otherAudioClip; + CPPUNIT_ASSERT_NO_THROW(otherAudioClip.reset(new AudioClip(xmlRpcValue))); + + CPPUNIT_ASSERT(*audioClip->getId() == *otherAudioClip->getId()); + CPPUNIT_ASSERT(*audioClip->getTitle() + == *otherAudioClip->getTitle()); + CPPUNIT_ASSERT(*audioClip->getPlaylength() + == *otherAudioClip->getPlaylength()); +} + diff --git a/livesupport/modules/core/src/AudioClipTest.h b/livesupport/modules/core/src/AudioClipTest.h index 15b40c59f..2a5205ea1 100644 --- a/livesupport/modules/core/src/AudioClipTest.h +++ b/livesupport/modules/core/src/AudioClipTest.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.h,v $ ------------------------------------------------------------------------------*/ @@ -58,7 +58,7 @@ namespace Core { * Unit test for the AudioClip class. * * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * @see AudioClip */ class AudioClipTest : public CPPUNIT_NS::TestFixture @@ -67,6 +67,7 @@ class AudioClipTest : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(firstTest); CPPUNIT_TEST(conversionTest); CPPUNIT_TEST(tagTest); + CPPUNIT_TEST(marshallingTest); CPPUNIT_TEST_SUITE_END(); protected: @@ -95,6 +96,14 @@ class AudioClipTest : public CPPUNIT_NS::TestFixture void tagTest(void) throw (CPPUNIT_NS::Exception); + /** + * Testing conversion to and from XmlRpcValue. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + marshallingTest(void) throw (CPPUNIT_NS::Exception); + public: diff --git a/livesupport/modules/core/src/Playlist.cxx b/livesupport/modules/core/src/Playlist.cxx index 051128de8..9fc0bbed1 100644 --- a/livesupport/modules/core/src/Playlist.cxx +++ b/livesupport/modules/core/src/Playlist.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.29 $ + Version : $Revision: 1.30 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $ ------------------------------------------------------------------------------*/ @@ -188,6 +188,43 @@ Playlist :: Playlist(Ptr::Ref id, } +/*------------------------------------------------------------------------------ + * Convert to an XmlRpcValue. + *----------------------------------------------------------------------------*/ +Playlist :: operator XmlRpc::XmlRpcValue() const + throw() +{ + XmlRpc::XmlRpcValue xmlRpcValue; + xmlRpcValue[configElementNameStr] = std::string(*getXmlDocumentString()); + + return xmlRpcValue; +} + + +/*------------------------------------------------------------------------------ + * Construct from an XmlRpcValue. + *----------------------------------------------------------------------------*/ +Playlist :: Playlist(XmlRpc::XmlRpcValue & xmlRpcValue) + throw (std::invalid_argument) + : Playable(PlaylistType) +{ + elementList.reset(new PlaylistElementListType); + + if (!xmlRpcValue.hasMember(configElementNameStr)) { + throw std::invalid_argument("no playlist data found in XmlRpcValue"); + } + + xmlpp::DomParser parser; + try { + parser.parse_memory(std::string(xmlRpcValue[configElementNameStr])); + } catch (xmlpp::exception &e) { + throw std::invalid_argument("error parsing XML document"); + } + + configure(*parser.get_document()->get_root_node()); // may throw +} + + /*------------------------------------------------------------------------------ * Set the value of the title field. *----------------------------------------------------------------------------*/ @@ -217,7 +254,7 @@ Playlist :: setPlaylength(Ptr::Ref playlength) *----------------------------------------------------------------------------*/ void Playlist :: configure(const xmlpp::Element & element) - throw (std::invalid_argument) + throw (std::invalid_argument) { if (element.get_name() != configElementNameStr) { std::string eMsg = "bad configuration element "; @@ -347,37 +384,26 @@ Playlist :: configure(const xmlpp::Element & element) *----------------------------------------------------------------------------*/ void Playlist::addPlaylistElement(Ptr::Ref playlistElement) - throw (std::invalid_argument) + throw (std::invalid_argument) { Ptr::Ref relativeOffset = playlistElement->getRelativeOffset(); - - if (elementList->find(*relativeOffset) != elementList->end()) { - std::string eMsg = "two playlist elements at the same relative offset"; - throw std::invalid_argument(eMsg); - } - - (*elementList)[*relativeOffset] = playlistElement; + elementList->insert(std::make_pair(*relativeOffset, playlistElement)); } /*------------------------------------------------------------------------------ * Add a new audio clip to the playlist. *----------------------------------------------------------------------------*/ -void +Ptr::Ref Playlist::addAudioClip(Ptr::Ref audioClip, Ptr::Ref relativeOffset, Ptr::Ref fadeInfo) - throw (std::invalid_argument) + throw (std::invalid_argument) { - if (elementList->find(*relativeOffset) != elementList->end()) { - std::string eMsg = "two playlist elements at the same relative offset"; - throw std::invalid_argument(eMsg); - } - Ptr::Ref playlistElement(new PlaylistElement( relativeOffset, audioClip, fadeInfo)); - (*elementList)[*relativeOffset] = playlistElement; + elementList->insert(std::make_pair(*relativeOffset, playlistElement)); Ptr::Ref endOffset(new time_duration( *relativeOffset @@ -385,26 +411,23 @@ Playlist::addAudioClip(Ptr::Ref audioClip, if (*endOffset > *playlength) { setPlaylength(endOffset); } + + return playlistElement->getId(); } /*------------------------------------------------------------------------------ * Add a new sub-playlist to the playlist. *----------------------------------------------------------------------------*/ -void +Ptr::Ref Playlist::addPlaylist(Ptr::Ref playlist, Ptr::Ref relativeOffset, Ptr::Ref fadeInfo) - throw (std::invalid_argument) + throw (std::invalid_argument) { - if (elementList->find(*relativeOffset) != elementList->end()) { - std::string eMsg = "two playlist elements at the same relative offset"; - throw std::invalid_argument(eMsg); - } - Ptr::Ref playlistElement(new PlaylistElement( relativeOffset, playlist, fadeInfo)); - (*elementList)[*relativeOffset] = playlistElement; + elementList->insert(std::make_pair(*relativeOffset, playlistElement)); Ptr::Ref endOffset(new time_duration( *relativeOffset @@ -412,6 +435,24 @@ Playlist::addPlaylist(Ptr::Ref playlist, if (*endOffset > *playlength) { setPlaylength(endOffset); } + + return playlistElement->getId(); +} + + +/*------------------------------------------------------------------------------ + * Get an iterator pointing to a playlist element with a given ID. + *----------------------------------------------------------------------------*/ +Playlist::iterator +Playlist::find(Ptr::Ref playlistElementId) + throw () +{ + Playlist::iterator it = elementList->begin(); + while (it != elementList->end() + && *(it->second->getId()) != *playlistElementId) { + ++it; + } + return it; } @@ -419,15 +460,14 @@ Playlist::addPlaylist(Ptr::Ref playlist, * Change the fade in / fade out info of a playlist element. *----------------------------------------------------------------------------*/ void -Playlist::setFadeInfo(Ptr::Ref relativeOffset, - Ptr::Ref fadeInfo) - throw (std::invalid_argument) +Playlist::setFadeInfo(Ptr::Ref playlistElementId, + Ptr::Ref fadeInfo) + throw (std::invalid_argument) { - PlaylistElementListType::iterator it = elementList->find(*relativeOffset); + Playlist::iterator it = this->find(playlistElementId); - if (it == elementList->end()) { - std::string eMsg = "no playlist element at this relative offset"; - throw std::invalid_argument(eMsg); + if (it == this->end()) { + throw std::invalid_argument("no playlist element with this ID"); } it->second->setFadeInfo(fadeInfo); @@ -438,15 +478,16 @@ Playlist::setFadeInfo(Ptr::Ref relativeOffset, * Remove a playlist element from the playlist. *----------------------------------------------------------------------------*/ void -Playlist::removePlaylistElement(Ptr::Ref relativeOffset) - throw (std::invalid_argument) +Playlist::removePlaylistElement(Ptr::Ref playlistElementId) + throw (std::invalid_argument) { - // this returns the number of elements found and erased - if (!elementList->erase(*relativeOffset)) { - std::string eMsg = "no playlist element found " - "at the specified relative offset"; - throw std::invalid_argument(eMsg); + Playlist::iterator it = this->find(playlistElementId); + + if (it == this->end()) { + throw std::invalid_argument("no playlist element with this ID"); } + + elementList->erase(it); } @@ -454,7 +495,7 @@ Playlist::removePlaylistElement(Ptr::Ref relativeOffset) * Validate the playlist. *----------------------------------------------------------------------------*/ bool -Playlist::valid(void) throw () +Playlist::valid(void) throw () { Ptr::Ref runningTime(new time_duration(0,0,0,0)); Ptr::Ref playlistElement; @@ -491,7 +532,7 @@ Playlist::valid(void) throw () * Create a saved copy of the playlist. *----------------------------------------------------------------------------*/ void -Playlist::createSavedCopy(void) throw () +Playlist::createSavedCopy(void) throw () { savedCopy = Ptr::Ref(new Playlist(*this)); } @@ -501,7 +542,7 @@ Playlist::createSavedCopy(void) throw () * Revert to a saved copy of the playlist. *----------------------------------------------------------------------------*/ void -Playlist::revertToSavedCopy(void) throw (std::invalid_argument) +Playlist::revertToSavedCopy(void) throw (std::invalid_argument) { if (savedCopy == 0) { throw (std::invalid_argument("playlist has no saved copy")); @@ -652,7 +693,7 @@ Playlist :: setMetadata(Ptr::Ref value, * Return a string containing the essential fields of this object, in XML. *----------------------------------------------------------------------------*/ Ptr::Ref -Playlist :: getXmlElementString(void) throw () +Playlist :: getXmlElementString(void) const throw () { Ptr::Ref xmlString(new Glib::ustring); @@ -685,7 +726,7 @@ Playlist :: getXmlElementString(void) throw () * Return a string containing an XML representation of this playlist. *----------------------------------------------------------------------------*/ Ptr::Ref -Playlist :: getXmlDocumentString() throw () +Playlist :: getXmlDocumentString() const throw () { Ptr::Ref localDocument; diff --git a/livesupport/modules/core/src/PlaylistTest.cxx b/livesupport/modules/core/src/PlaylistTest.cxx index 5e21ffa5b..1beed5416 100644 --- a/livesupport/modules/core/src/PlaylistTest.cxx +++ b/livesupport/modules/core/src/PlaylistTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.21 $ + Version : $Revision: 1.22 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -212,7 +212,7 @@ PlaylistTest :: audioClipTest(void) CPPUNIT_ASSERT(it == playlist->end()); try { - playlist->removePlaylistElement(relativeOffset); + playlist->removePlaylistElement(playlistElement->getId()); } catch (std::invalid_argument &e) { string eMsg = "removePlaylistElement returned with error: "; eMsg += e.what(); @@ -228,10 +228,9 @@ PlaylistTest :: audioClipTest(void) ++it; CPPUNIT_ASSERT(it == playlist->end()); - Ptr::Ref phonyRelativeOffset( - new time_duration(0,0,1,0)); + Ptr::Ref phonyPlaylistElementId(new UniqueId(9999)); try { - playlist->removePlaylistElement(phonyRelativeOffset); + playlist->removePlaylistElement(phonyPlaylistElementId); CPPUNIT_FAIL("removePlaylistElement allowed to remove " "non-existent audio clip"); } catch (std::invalid_argument &e) { @@ -253,12 +252,9 @@ PlaylistTest :: savedCopyTest(void) } playlist->createSavedCopy(); - playlist->removePlaylistElement(Ptr::Ref( - new time_duration(0,0,0,0))); - playlist->removePlaylistElement(Ptr::Ref( - new time_duration(0,0,11,0))); - playlist->removePlaylistElement(Ptr::Ref( - new time_duration(0,0,23,0))); + playlist->removePlaylistElement(playlist->begin()->second->getId()); + playlist->removePlaylistElement(playlist->begin()->second->getId()); + playlist->removePlaylistElement(playlist->begin()->second->getId()); CPPUNIT_ASSERT(playlist->begin() == playlist->end()); try { @@ -297,18 +293,21 @@ void PlaylistTest :: fadeInfoTest(void) throw (CPPUNIT_NS::Exception) { - Playlist::const_iterator it = playlist->begin(); + Ptr::Ref playlistElementOne, + playlistElementTwo; + + Playlist::const_iterator it = playlist->begin(); CPPUNIT_ASSERT(it != playlist->end()); - Ptr::Ref playlistElement = it->second; - CPPUNIT_ASSERT(playlistElement->getFadeInfo().get() == 0); + playlistElementOne = it->second; + CPPUNIT_ASSERT(playlistElementOne->getFadeInfo().get() == 0); ++it; CPPUNIT_ASSERT(it != playlist->end()); - playlistElement = it->second; - CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeIn() - ->total_milliseconds() == 2000); - CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeOut() - ->total_milliseconds() == 1500); + playlistElementTwo = it->second; + CPPUNIT_ASSERT(playlistElementTwo->getFadeInfo()->getFadeIn() + ->total_milliseconds() == 2000); + CPPUNIT_ASSERT(playlistElementTwo->getFadeInfo()->getFadeOut() + ->total_milliseconds() == 1500); ++it; CPPUNIT_ASSERT(it != playlist->end()); @@ -319,37 +318,34 @@ PlaylistTest :: fadeInfoTest(void) Ptr::Ref fadeOut(new time_duration(0,0,4,0)); Ptr::Ref fadeInfo(new FadeInfo(fadeIn, fadeOut)); - Ptr::Ref relativeOffset (new time_duration(0,0,0,0)); try { - playlist->setFadeInfo(relativeOffset, fadeInfo); + playlist->setFadeInfo(playlistElementOne->getId(), fadeInfo); } catch (std::invalid_argument &e) { CPPUNIT_FAIL("could not add new fade info"); } - relativeOffset.reset(new time_duration(0,0,11,0)); try { - playlist->setFadeInfo(relativeOffset, fadeInfo); + playlist->setFadeInfo(playlistElementTwo->getId(), fadeInfo); } catch (std::invalid_argument &e) { CPPUNIT_FAIL("could not update fade info"); } it = playlist->begin(); - playlistElement = it->second; - CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeIn() - ->total_milliseconds() == 3200); - CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeOut() - ->total_milliseconds() == 4000); + playlistElementOne = it->second; + CPPUNIT_ASSERT(playlistElementOne->getFadeInfo()->getFadeIn() + ->total_milliseconds() == 3200); + CPPUNIT_ASSERT(playlistElementOne->getFadeInfo()->getFadeOut() + ->total_milliseconds() == 4000); ++it; - playlistElement = it->second; - CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeIn() - ->total_milliseconds() == 3200); - CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeOut() - ->total_milliseconds() == 4000); - - relativeOffset.reset(new time_duration(0,0,7,0)); + playlistElementTwo = it->second; + CPPUNIT_ASSERT(playlistElementTwo->getFadeInfo()->getFadeIn() + ->total_milliseconds() == 3200); + CPPUNIT_ASSERT(playlistElementTwo->getFadeInfo()->getFadeOut() + ->total_milliseconds() == 4000); + Ptr::Ref phonyPlaylistElementId(new UniqueId(9999)); try { - playlist->setFadeInfo(relativeOffset, fadeInfo); + playlist->setFadeInfo(phonyPlaylistElementId, fadeInfo); CPPUNIT_FAIL("allowed to set fade info for non-existent element"); } catch (std::invalid_argument &e) { } @@ -377,3 +373,39 @@ PlaylistTest :: conversionTest(void) CPPUNIT_ASSERT(!audioClip); } + +/*------------------------------------------------------------------------------ + * Marshalling test + *----------------------------------------------------------------------------*/ +void +PlaylistTest :: marshallingTest(void) + throw (CPPUNIT_NS::Exception) +{ + Ptr::Ref playlist(new Playlist()); + try { + Ptr::Ref parser( + new xmlpp::DomParser(configFileName, false)); + const xmlpp::Document * document = parser->get_document(); + const xmlpp::Element * root = document->get_root_node(); + + playlist->configure(*root); + + } catch (std::invalid_argument &e) { + CPPUNIT_FAIL(e.what()); + } catch (xmlpp::exception &e) { + CPPUNIT_FAIL(e.what()); + } + + XmlRpc::XmlRpcValue xmlRpcValue = *playlist; + CPPUNIT_ASSERT(xmlRpcValue.hasMember("playlist")); + + Ptr::Ref otherPlaylist; + CPPUNIT_ASSERT_NO_THROW(otherPlaylist.reset(new Playlist(xmlRpcValue))); + + CPPUNIT_ASSERT(*playlist->getId() == *otherPlaylist->getId()); + CPPUNIT_ASSERT(*playlist->getTitle() + == *otherPlaylist->getTitle()); + CPPUNIT_ASSERT(*playlist->getPlaylength() + == *otherPlaylist->getPlaylength()); +} + diff --git a/livesupport/modules/core/src/PlaylistTest.h b/livesupport/modules/core/src/PlaylistTest.h index aa72ad85e..b34b62781 100644 --- a/livesupport/modules/core/src/PlaylistTest.h +++ b/livesupport/modules/core/src/PlaylistTest.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.10 $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -58,7 +58,7 @@ namespace Core { * Unit test for the UploadPlaylistMetohd class. * * @author $Author: fgerlits $ - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ * @see Playlist */ class PlaylistTest : public CPPUNIT_NS::TestFixture @@ -69,6 +69,7 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(savedCopyTest); CPPUNIT_TEST(fadeInfoTest); CPPUNIT_TEST(conversionTest); + CPPUNIT_TEST(marshallingTest); CPPUNIT_TEST_SUITE_END(); private: @@ -120,6 +121,14 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture void conversionTest(void) throw (CPPUNIT_NS::Exception); + /** + * Testing conversion to and from XmlRpcValue. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + marshallingTest(void) throw (CPPUNIT_NS::Exception); + public: diff --git a/livesupport/modules/core/src/XmlRpcTools.cxx b/livesupport/modules/core/src/XmlRpcTools.cxx index b37af9267..231dd7827 100644 --- a/livesupport/modules/core/src/XmlRpcTools.cxx +++ b/livesupport/modules/core/src/XmlRpcTools.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/XmlRpcTools.cxx,v $ ------------------------------------------------------------------------------*/ @@ -64,6 +64,11 @@ static const std::string idName = "id"; *----------------------------------------------------------------------------*/ static const std::string playlistIdName = "playlistId"; +/*------------------------------------------------------------------------------ + * The name of the playlist element ID member in the XML-RPC param structure + *----------------------------------------------------------------------------*/ +static const std::string playlistElementIdName = "playlistElementId"; + /*------------------------------------------------------------------------------ * The name of the audio clip ID member in the XML-RPC parameter structure *----------------------------------------------------------------------------*/ @@ -196,6 +201,26 @@ XmlRpcTools :: extractPlaylistId(XmlRpc::XmlRpcValue & xmlRpcValue) } +/*------------------------------------------------------------------------------ + * Extract the playlist element ID from an XML-RPC function call parameter + *----------------------------------------------------------------------------*/ +Ptr::Ref +XmlRpcTools :: extractPlaylistElementId(XmlRpc::XmlRpcValue & xmlRpcValue) + throw (std::invalid_argument) +{ + if (!xmlRpcValue.hasMember(playlistElementIdName) + || xmlRpcValue[playlistElementIdName].getType() + != XmlRpc::XmlRpcValue::TypeString) { + throw std::invalid_argument("missing or bad playlist element ID " + "argument"); + } + + Ptr::Ref id(new UniqueId(std::string( + xmlRpcValue[playlistElementIdName] ))); + return id; +} + + /*------------------------------------------------------------------------------ * Extract the audio clip ID from an XML-RPC function call parameter *----------------------------------------------------------------------------*/ @@ -243,8 +268,7 @@ XmlRpcTools :: playlistToXmlRpcValue( XmlRpc::XmlRpcValue & xmlRpcValue) throw () { - xmlRpcValue["id"] = std::string(*playlist->getId()); - xmlRpcValue["playlength"] = int(playlist->getPlaylength()->total_seconds()); + xmlRpcValue["playlist"] = std::string(*playlist->getXmlDocumentString()); } @@ -284,9 +308,7 @@ XmlRpcTools :: audioClipToXmlRpcValue( XmlRpc::XmlRpcValue & xmlRpcValue) throw () { - xmlRpcValue["id"] = std::string(*audioClip->getId()); - xmlRpcValue["playlength"] = int(audioClip->getPlaylength() - ->total_seconds()); + xmlRpcValue["audioClip"] = std::string(*audioClip->getXmlDocumentString()); } @@ -605,6 +627,19 @@ XmlRpcTools :: playlistIdToXmlRpcValue( } +/*------------------------------------------------------------------------------ + * Add a playlist element ID to an XmlRpcValue + *----------------------------------------------------------------------------*/ +void +XmlRpcTools :: playlistElementIdToXmlRpcValue( + Ptr::Ref playlistElementId, + XmlRpc::XmlRpcValue & returnValue) + throw () +{ + returnValue[playlistElementIdName] = std::string(*playlistElementId); +} + + /*------------------------------------------------------------------------------ * Add a playtime value to an XmlRpcValue *----------------------------------------------------------------------------*/ diff --git a/livesupport/modules/core/src/XmlRpcToolsTest.cxx b/livesupport/modules/core/src/XmlRpcToolsTest.cxx index 5711fd0b5..c4109d41f 100644 --- a/livesupport/modules/core/src/XmlRpcToolsTest.cxx +++ b/livesupport/modules/core/src/XmlRpcToolsTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/XmlRpcToolsTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -122,7 +122,7 @@ XmlRpcToolsTest :: firstTest(void) { XmlRpcValue xmlRpcPlaylist; XmlRpcValue xmlRpcAudioClip; - Ptr::Ref playlist = Ptr::Ref(new Playlist); + Ptr::Ref playlist = Ptr::Ref(new Playlist()); Ptr::Ref audioClip; // set up a playlist instance @@ -133,23 +133,39 @@ XmlRpcToolsTest :: firstTest(void) XmlRpcTools :: playlistToXmlRpcValue(playlist, xmlRpcPlaylist); XmlRpcTools :: audioClipToXmlRpcValue(audioClip, xmlRpcAudioClip); - CPPUNIT_ASSERT(xmlRpcPlaylist.hasMember("id")); - CPPUNIT_ASSERT(xmlRpcPlaylist["id"].getType() == XmlRpcValue::TypeString); - CPPUNIT_ASSERT(std::string(xmlRpcPlaylist["id"]) == "0000000000000001"); + CPPUNIT_ASSERT(xmlRpcPlaylist.hasMember("playlist")); + CPPUNIT_ASSERT(xmlRpcPlaylist["playlist"].getType() + == XmlRpcValue::TypeString); - CPPUNIT_ASSERT(xmlRpcPlaylist.hasMember("playlength")); - CPPUNIT_ASSERT(xmlRpcPlaylist["playlength"].getType() - == XmlRpcValue::TypeInt); - CPPUNIT_ASSERT(int(xmlRpcPlaylist["playlength"]) == 34); + Ptr::Ref copyOfPlaylist(new Playlist()); + xmlpp::DomParser parser; + CPPUNIT_ASSERT_NO_THROW(parser.parse_memory(std::string( + xmlRpcPlaylist["playlist"] ))); + xmlpp::Element* configElement; + CPPUNIT_ASSERT_NO_THROW(configElement = parser.get_document() + ->get_root_node()); + CPPUNIT_ASSERT_NO_THROW(copyOfPlaylist->configure(*configElement)); - CPPUNIT_ASSERT(xmlRpcAudioClip.hasMember("id")); - CPPUNIT_ASSERT(xmlRpcAudioClip["id"].getType() == XmlRpcValue::TypeString); - CPPUNIT_ASSERT(std::string(xmlRpcAudioClip["id"]) == "0000000000010001"); + CPPUNIT_ASSERT(*copyOfPlaylist->getId() == *playlist->getId()); + CPPUNIT_ASSERT(*copyOfPlaylist->getTitle() == *playlist->getTitle()); + CPPUNIT_ASSERT(*copyOfPlaylist->getPlaylength() + == *playlist->getPlaylength()); - CPPUNIT_ASSERT(xmlRpcAudioClip.hasMember("playlength")); - CPPUNIT_ASSERT(xmlRpcAudioClip["playlength"].getType() - == XmlRpcValue::TypeInt); - CPPUNIT_ASSERT(int(xmlRpcAudioClip["playlength"]) == 11); + CPPUNIT_ASSERT(xmlRpcAudioClip.hasMember("audioClip")); + CPPUNIT_ASSERT(xmlRpcAudioClip["audioClip"].getType() + == XmlRpcValue::TypeString); + + Ptr::Ref copyOfAudioClip(new AudioClip()); + CPPUNIT_ASSERT_NO_THROW(parser.parse_memory(std::string( + xmlRpcAudioClip["audioClip"] ))); + CPPUNIT_ASSERT_NO_THROW(configElement = parser.get_document() + ->get_root_node()); + CPPUNIT_ASSERT_NO_THROW(copyOfAudioClip->configure(*configElement)); + + CPPUNIT_ASSERT(*copyOfAudioClip->getId() == *audioClip->getId()); + CPPUNIT_ASSERT(*copyOfAudioClip->getTitle() == *audioClip->getTitle()); + CPPUNIT_ASSERT(*copyOfAudioClip->getPlaylength() + == *audioClip->getPlaylength()); XmlRpcValue xmlRpcPlaylistId; Ptr::Ref playlistId(new UniqueId(rand())); diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx index f2ce0a470..9186f3051 100644 --- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx +++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.15 $ + Version : $Revision: 1.16 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -110,7 +110,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref sessionId; try{ sessionId = XmlRpcTools::extractSessionId(parameters); - } catch (XmlRpcException &e) { + } catch (std::invalid_argument &e) { XmlRpcTools::markError(errorId+20, "missing session ID argument", returnValue); @@ -120,7 +120,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref playlistId; try{ playlistId = XmlRpcTools::extractPlaylistId(parameters); - } catch (XmlRpcException &e) { + } catch (std::invalid_argument &e) { XmlRpcTools::markError(errorId+2, "missing playlist ID argument", returnValue); return; @@ -129,7 +129,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref audioClipId; try{ audioClipId = XmlRpcTools::extractAudioClipId(parameters); - } catch (XmlRpcException &e) { + } catch (std::invalid_argument &e) { XmlRpcTools::markError(errorId+3, "missing audio clip ID argument", returnValue); return; @@ -138,7 +138,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref relativeOffset; try{ relativeOffset = XmlRpcTools::extractRelativeOffset(parameters); - } catch (XmlRpcException &e) { + } catch (std::invalid_argument &e) { XmlRpcTools::markError(errorId+4, "missing relative offset argument", returnValue); return; @@ -152,7 +152,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref playlist; try { playlist = storage->getPlaylist(sessionId, playlistId); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { XmlRpcTools::markError(errorId+5, "playlist not found", returnValue); return; @@ -168,18 +168,21 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref audioClip; try { audioClip = storage->getAudioClip(sessionId, audioClipId); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { XmlRpcTools::markError(errorId+7, "audio clip does not exist", returnValue); return; } + Ptr::Ref playlistElementId; try { // and finally, the beef - playlist->addAudioClip(audioClip, relativeOffset); + playlistElementId = playlist->addAudioClip(audioClip, relativeOffset); } catch(std::invalid_argument &e) { XmlRpcTools::markError(errorId+8, "two audio clips at the same relative offset", returnValue); return; } + + XmlRpcTools::playlistElementIdToXmlRpcValue(playlistElementId, returnValue); } diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h index 50740d71f..acc44e4b9 100644 --- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h +++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h @@ -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/AddAudioClipToPlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -76,13 +76,20 @@ using namespace LiveSupport::Core; *
    *
  • sessionId - string - the session ID obtained via the login() * method of the authentication client
  • - *
  • playlistId - int - the unique id of the playlist.
  • - *
  • audioClipId - int - the unique id of the audio clip to + *
  • playlistId - string - the unique id of the playlist.
  • + *
  • audioClipId - string - the unique id of the audio clip to * be added.
  • *
  • relativeOffset - int - the number of seconds between the * start of the playlist and the start of the audio clip.
  • *
* + * The XML-RPC function returns an XML-RPC structure, containing the following + * fields: + *
    + *
  • playlistElementId - string - the unique id of the newly created + * playlist element
  • + *
+ * * In case of an error, a standard XML-RPC fault response is generated, * and a { faultCode, faultString } structure is returned. The * possible errors are: @@ -99,7 +106,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ class AddAudioClipToPlaylistMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx index 14cd154ff..c73ff1796 100644 --- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.14 $ + Version : $Revision: 1.15 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -194,14 +194,6 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void) CPPUNIT_FAIL(eMsg.str()); } - result.clear(); - try { - addAudioClipMethod->execute(rootParameter, result); - CPPUNIT_FAIL("allowed to add overlapping audio clip"); - } catch (XmlRpc::XmlRpcException &e) { - CPPUNIT_ASSERT(e.getCode() == 308); - } - parameters.clear(); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000000001"; @@ -218,4 +210,7 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void) << " - " << e.getMessage(); CPPUNIT_FAIL(eMsg.str()); } + CPPUNIT_ASSERT(result.hasMember("playlistElementId")); + CPPUNIT_ASSERT(result["playlistElementId"].getType() + == XmlRpc::XmlRpcValue::TypeString); } diff --git a/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx b/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx index 27a16a583..c1d74b40b 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.13 $ + Version : $Revision: 1.14 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -125,7 +125,7 @@ CreatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref playlistId; try { playlistId = storage->createPlaylist(sessionId); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "could not create playlist:\n"; eMsg += e.what(); XmlRpcTools :: markError(errorId+2, @@ -137,7 +137,7 @@ CreatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref playlist; try { playlist = storage->editPlaylist(sessionId, playlistId); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "could not create playlist:\n"; eMsg += e.what(); XmlRpcTools :: markError(errorId+2, diff --git a/livesupport/products/scheduler/src/CreatePlaylistMethod.h b/livesupport/products/scheduler/src/CreatePlaylistMethod.h index 721e52374..f3bd2337e 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.8 $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -79,9 +79,8 @@ using namespace LiveSupport::Core; * The XML-RPC function returns an XML-RPC structure, containing the following * fields: *
    - *
  • id - int - the unique id of the new playlist
  • - *
  • playlength - int - the playlist length of the playlist, in seconds - *
  • + *
  • playlist - string - an XML representation of the playlist; this + * XML element can be used as argument to Playlist::configure()
  • *
* * In case of an error, a standard XML-RPC fault response is generated, @@ -94,7 +93,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ */ class CreatePlaylistMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx b/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx index 61262f1ba..5954c984b 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.14 $ + Version : $Revision: 1.15 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -185,12 +185,13 @@ CreatePlaylistMethodTest :: firstTest(void) << " - " << e.getMessage(); CPPUNIT_FAIL(eMsg.str()); } - CPPUNIT_ASSERT(result.hasMember("id")); - 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); + CPPUNIT_ASSERT(result.hasMember("playlist")); + CPPUNIT_ASSERT(result["playlist"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref playlist; + CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result))); + CPPUNIT_ASSERT(playlist->getId()->getId() >= 0); + CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 0); method.reset(new OpenPlaylistForEditingMethod()); parameter.clear(); diff --git a/livesupport/products/scheduler/src/DeletePlaylistMethod.cxx b/livesupport/products/scheduler/src/DeletePlaylistMethod.cxx index 38d2344aa..fae4388ab 100644 --- a/livesupport/products/scheduler/src/DeletePlaylistMethod.cxx +++ b/livesupport/products/scheduler/src/DeletePlaylistMethod.cxx @@ -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/DeletePlaylistMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -123,7 +123,7 @@ DeletePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref playlist; try { playlist = storage->getPlaylist(sessionId, playlistId); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "playlist not found:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+3, eMsg, returnValue); @@ -138,7 +138,7 @@ DeletePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, try { storage->deletePlaylist(sessionId, playlistId); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "playlist could not be deleted:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+5, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/DeletePlaylistMethod.h b/livesupport/products/scheduler/src/DeletePlaylistMethod.h index 27a32b40d..428a4647e 100644 --- a/livesupport/products/scheduler/src/DeletePlaylistMethod.h +++ b/livesupport/products/scheduler/src/DeletePlaylistMethod.h @@ -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/Attic/DeletePlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -74,7 +74,7 @@ using namespace LiveSupport::Core; *
    *
  • sessionId - string - the session ID obtained via the login() * method of the authentication client
  • - *
  • playlistId - int - the unique id of the playlist + *
  • playlistId - string - the unique id of the playlist * to be deleted.
  • *
* @@ -91,7 +91,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ class DeletePlaylistMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/DisplayAudioClipMethod.cxx b/livesupport/products/scheduler/src/DisplayAudioClipMethod.cxx index bc623efe0..e124e011f 100644 --- a/livesupport/products/scheduler/src/DisplayAudioClipMethod.cxx +++ b/livesupport/products/scheduler/src/DisplayAudioClipMethod.cxx @@ -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/DisplayAudioClipMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -134,7 +134,7 @@ DisplayAudioClipMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref audioClip; try { audioClip = storage->getAudioClip(sessionId, id); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "audio clip not found:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+3, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/DisplayAudioClipMethod.h b/livesupport/products/scheduler/src/DisplayAudioClipMethod.h index 214300813..273f42732 100644 --- a/livesupport/products/scheduler/src/DisplayAudioClipMethod.h +++ b/livesupport/products/scheduler/src/DisplayAudioClipMethod.h @@ -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/DisplayAudioClipMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -75,15 +75,14 @@ using namespace LiveSupport::Core; *
    *
  • sessionId - string - the session ID obtained via the login() * method of the authentication client
  • - *
  • audioClipId - int - the unique id of the audio clip requested.
  • + *
  • audioClipId - string - the unique id of the audio clip requested.
  • *
* * The XML-RPC function returns an XML-RPC structure, containing the following * fields: *
    - *
  • id - int - the unique id of the audio clip
  • - *
  • playlength - int - the length of the audio clip, in seconds - *
  • + *
  • audioClip - string - an XML representation of the audio clip; this + * XML element can be used as argument to AudioClip::configure()
  • *
* * In case of an error, a standard XML-RPC fault response is generated, @@ -97,7 +96,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ class DisplayAudioClipMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx b/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx index 8d2ac6dfe..e5e596741 100644 --- a/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx +++ b/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx @@ -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/DisplayAudioClipMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -186,14 +186,13 @@ DisplayAudioClipMethodTest :: firstTest(void) << " - " << e.getMessage(); CPPUNIT_FAIL(eMsg.str()); } - 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); + CPPUNIT_ASSERT(result.hasMember("audioClip")); + CPPUNIT_ASSERT(result["audioClip"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref audioClip; + CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result))); + CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10001); + CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 60 * 60); } diff --git a/livesupport/products/scheduler/src/DisplayAudioClipsMethod.cxx b/livesupport/products/scheduler/src/DisplayAudioClipsMethod.cxx index 077fc1005..90452bf32 100644 --- a/livesupport/products/scheduler/src/DisplayAudioClipsMethod.cxx +++ b/livesupport/products/scheduler/src/DisplayAudioClipsMethod.cxx @@ -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/DisplayAudioClipsMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -115,7 +115,7 @@ DisplayAudioClipsMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref> >::Ref audioClipIds; try { audioClipIds = storage->getAudioClipIds(); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "getAudioClipIds returned error:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+2, eMsg, returnValue); @@ -128,7 +128,7 @@ DisplayAudioClipsMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, while (it != audioClipIds->end()) { try { audioClips->push_back(storage->getAudioClip(sessionId, *it)); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "audio clip not found:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+3, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/DisplayAudioClipsMethod.h b/livesupport/products/scheduler/src/DisplayAudioClipsMethod.h index ae6cd366a..b9d361011 100644 --- a/livesupport/products/scheduler/src/DisplayAudioClipsMethod.h +++ b/livesupport/products/scheduler/src/DisplayAudioClipsMethod.h @@ -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/DisplayAudioClipsMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -84,9 +84,8 @@ using namespace LiveSupport::Core; * for each audio clip in the audio clip store. An array of size 0 means the * audio clip store is empty. Each structure is as follows: *
    - *
  • id - int - the unique id of the audio clip
  • - *
  • playlength - int - the length of the audio clip, in seconds - *
  • + *
  • audioClip - string - an XML representation of the audio clip; this + * XML element can be used as argument to AudioClip::configure()
  • *
* * In case of an error, a standard XML-RPC fault response is generated, @@ -99,7 +98,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ class DisplayAudioClipsMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx b/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx index 521caf068..596cf62fc 100644 --- a/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx +++ b/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx @@ -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/DisplayAudioClipsMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -172,7 +172,6 @@ DisplayAudioClipsMethodTest :: firstTest(void) XmlRpc::XmlRpcValue rootParameter; rootParameter.setSize(1); XmlRpc::XmlRpcValue result; - XmlRpc::XmlRpcValue audioClip; result.clear(); parameter["sessionId"] = sessionId->getId(); @@ -187,26 +186,21 @@ DisplayAudioClipsMethodTest :: firstTest(void) } CPPUNIT_ASSERT(result.size() >= 2); - audioClip = result[0]; - CPPUNIT_ASSERT(audioClip.hasMember("id")); - CPPUNIT_ASSERT(audioClip["id"].getType() + XmlRpc::XmlRpcValue result0 = result[0]; + CPPUNIT_ASSERT(result0.hasMember("audioClip")); + CPPUNIT_ASSERT(result0["audioClip"].getType() == XmlRpc::XmlRpcValue::TypeString); - CPPUNIT_ASSERT(std::string(audioClip["id"]) == "0000000000010001"); + Ptr::Ref audioClip; + CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result0))); + CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10001); + CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 60 * 60); - 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(audioClip.hasMember("id")); - CPPUNIT_ASSERT(audioClip["id"].getType() + XmlRpc::XmlRpcValue result1 = result[1]; + CPPUNIT_ASSERT(result1.hasMember("audioClip")); + CPPUNIT_ASSERT(result1["audioClip"].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_NO_THROW(audioClip.reset(new AudioClip(result1))); + CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10002); + CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 30 * 60); } diff --git a/livesupport/products/scheduler/src/DisplayPlaylistMethod.cxx b/livesupport/products/scheduler/src/DisplayPlaylistMethod.cxx index b1c1dccc2..123dc252f 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistMethod.cxx +++ b/livesupport/products/scheduler/src/DisplayPlaylistMethod.cxx @@ -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/DisplayPlaylistMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -134,7 +134,7 @@ DisplayPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref playlist; try { playlist = storage->getPlaylist(sessionId, id); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "playlist not found:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+3, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/DisplayPlaylistMethod.h b/livesupport/products/scheduler/src/DisplayPlaylistMethod.h index 034ce0949..af52f290b 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistMethod.h +++ b/livesupport/products/scheduler/src/DisplayPlaylistMethod.h @@ -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/DisplayPlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -75,15 +75,14 @@ using namespace LiveSupport::Core; *
    *
  • sessionId - string - the session ID obtained via the login() * method of the authentication client
  • - *
  • playlistId - int - the unique id of the playlist requested.
  • + *
  • playlistId - string - the unique id of the playlist requested.
  • *
* * The XML-RPC function returns an XML-RPC structure, containing the following * fields: *
    - *
  • id - int - the unique id of the playlist
  • - *
  • playlength - int - the playlist length of the playlist, in seconds - *
  • + *
  • playlist - string - an XML representation of the playlist; this + * XML element can be used as argument to Playlist::configure()
  • *
* * In case of an error, a standard XML-RPC fault response is generated, @@ -97,7 +96,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ class DisplayPlaylistMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx index d44e00feb..078269a73 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx @@ -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/DisplayPlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -186,13 +186,13 @@ DisplayPlaylistMethodTest :: firstTest(void) << " - " << e.getMessage(); CPPUNIT_FAIL(eMsg.str()); } - 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(result.hasMember("playlist")); + CPPUNIT_ASSERT(result["playlist"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref playlist; + CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result))); + CPPUNIT_ASSERT(playlist->getId()->getId() == 1); + CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60); } diff --git a/livesupport/products/scheduler/src/DisplayPlaylistsMethod.cxx b/livesupport/products/scheduler/src/DisplayPlaylistsMethod.cxx index cac7f3450..d43493fc1 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistsMethod.cxx +++ b/livesupport/products/scheduler/src/DisplayPlaylistsMethod.cxx @@ -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/DisplayPlaylistsMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -118,7 +118,7 @@ DisplayPlaylistsMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, playlistIds = storage->getPlaylistIds(); //std::cerr << "\nplaylistIds: " << playlistIds << "\n" // << "size: " << playlistIds->size() << "n"; - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "getPlaylistsIds() returned error:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+2, eMsg, returnValue); @@ -131,7 +131,7 @@ DisplayPlaylistsMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, while (it != playlistIds->end()) { try { playlists->push_back(storage->getPlaylist(sessionId, *it)); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "audio clip not found:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+3, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h b/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h index 2f50fc38a..b5842f079 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h +++ b/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h @@ -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/DisplayPlaylistsMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -84,9 +84,8 @@ using namespace LiveSupport::Core; * for each playlist in the playlist store. An array of size 0 means the * playlist store is empty. Each structure is as follows: *
    - *
  • id - int - the unique id of the playlist
  • - *
  • playlength - int - the playlist length of the playlist, in seconds - *
  • + *
  • playlist - string - an XML representation of the playlist; this + * XML element can be used as argument to Playlist::configure()
  • *
* * In case of an error, a standard XML-RPC fault response is generated, @@ -99,7 +98,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ */ class DisplayPlaylistsMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx b/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx index 4ed24cf34..71c809b01 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx +++ b/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx @@ -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/DisplayPlaylistsMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -185,14 +185,13 @@ DisplayPlaylistsMethodTest :: firstTest(void) CPPUNIT_FAIL(eMsg.str()); } CPPUNIT_ASSERT(result.size() == 1); - XmlRpc::XmlRpcValue playlist = result[0]; + XmlRpc::XmlRpcValue result0 = result[0]; - 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); + CPPUNIT_ASSERT(result0.hasMember("playlist")); + CPPUNIT_ASSERT(result0["playlist"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref playlist; + CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result0))); + CPPUNIT_ASSERT(playlist->getId()->getId() == 1); + CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60); } diff --git a/livesupport/products/scheduler/src/DisplayScheduleMethod.h b/livesupport/products/scheduler/src/DisplayScheduleMethod.h index 645349c67..19c8f7de1 100644 --- a/livesupport/products/scheduler/src/DisplayScheduleMethod.h +++ b/livesupport/products/scheduler/src/DisplayScheduleMethod.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.7 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayScheduleMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -90,7 +90,7 @@ using namespace LiveSupport::Core; * are not scheduled entries. Each structure is as follows: *
    *
  • id - int - the id of the scheduled entry
  • - *
  • playlistId - int - the id of the playlist associated with the entry + *
  • playlistId - string - the id of the playlist associated with the entry *
  • *
  • start - datetime - the start of the scheduled item
  • *
  • end - datetime - the end of the scheduled item
  • @@ -106,8 +106,8 @@ using namespace LiveSupport::Core; *
  • 1120 - missing session ID argument
  • *
* - * @author $Author: maroy $ - * @version $Revision: 1.7 $ + * @author $Author: fgerlits $ + * @version $Revision: 1.8 $ */ class DisplayScheduleMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/GeneratePlayReportMethod.h b/livesupport/products/scheduler/src/GeneratePlayReportMethod.h index f20f34eb8..ccd403b54 100644 --- a/livesupport/products/scheduler/src/GeneratePlayReportMethod.h +++ b/livesupport/products/scheduler/src/GeneratePlayReportMethod.h @@ -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/GeneratePlayReportMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -89,8 +89,8 @@ using namespace LiveSupport::Core; * for each play log item in the interval. An array of size 0 means there * are no play log entries. Each structure is as follows: *
    - *
  • audioClipId - int - the id of the audio clip played
  • - *
  • timestamp - datetime - the time the clip was played (started)
  • + *
  • audioClipId - string - the id of the audio clip played
  • + *
  • timestamp - datetime - the time the clip was played (started)
  • *
* * In case of an error, a standard XML-RPC fault response is generated, @@ -104,7 +104,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ class GeneratePlayReportMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/GetVersionMethod.h b/livesupport/products/scheduler/src/GetVersionMethod.h index d5603cd26..38d76ac58 100644 --- a/livesupport/products/scheduler/src/GetVersionMethod.h +++ b/livesupport/products/scheduler/src/GetVersionMethod.h @@ -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/GetVersionMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -74,14 +74,13 @@ using namespace LiveSupport::Core; * The XML-RPC function returns an XML-RPC structure, containing the following * fields: *
    - *
  • version - string - the version string of the Scheduler Daemon - *
  • + *
  • version - string - the version string of the Scheduler Daemon
  • *
* * There are no possible internal error condititons for this function. * - * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @author $Author: fgerlits $ + * @version $Revision: 1.2 $ */ class GetVersionMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/LoginMethod.cxx b/livesupport/products/scheduler/src/LoginMethod.cxx index 11d315cbf..94bee3c17 100644 --- a/livesupport/products/scheduler/src/LoginMethod.cxx +++ b/livesupport/products/scheduler/src/LoginMethod.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/LoginMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -89,7 +89,7 @@ LoginMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref loginName; try{ loginName = XmlRpcTools::extractLoginName(parameters); - } catch (XmlRpcException &e) { + } catch (std::invalid_argument &e) { XmlRpcTools::markError(errorId+2, "missing login argument", returnValue); return; @@ -98,7 +98,7 @@ LoginMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref password; try{ password = XmlRpcTools::extractPassword(parameters); - } catch (XmlRpcException &e) { + } catch (std::invalid_argument &e) { XmlRpcTools::markError(errorId+3, "missing password argument", returnValue); return; @@ -112,7 +112,7 @@ LoginMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref sessionId; try { sessionId = authentication->login(*loginName, *password); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "authentication login() returned error:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+4, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/LogoutMethod.cxx b/livesupport/products/scheduler/src/LogoutMethod.cxx index 00c86f124..64d879cb3 100644 --- a/livesupport/products/scheduler/src/LogoutMethod.cxx +++ b/livesupport/products/scheduler/src/LogoutMethod.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/LogoutMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -89,7 +89,7 @@ LogoutMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref sessionId; try{ sessionId = XmlRpcTools::extractSessionId(parameters); - } catch (XmlRpcException &e) { + } catch (std::invalid_argument &e) { XmlRpcTools::markError(errorId+20, "missing logout argument", returnValue); return; @@ -102,7 +102,7 @@ LogoutMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, try { authentication->logout(sessionId); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "authentication logout() returned error:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+4, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx index 0e30b583c..25e43200a 100644 --- a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx +++ b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.16 $ + Version : $Revision: 1.17 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -135,7 +135,7 @@ OpenPlaylistForEditingMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref playlist; try { playlist = storage->editPlaylist(sessionId, id); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "could not open playlist for editing:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+4, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h index 940854cf3..384715802 100644 --- a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h +++ b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h @@ -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/OpenPlaylistForEditingMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -76,15 +76,14 @@ using namespace LiveSupport::Core; *
    *
  • sessionId - string - the session ID obtained via the login() * method of the authentication client
  • - *
  • playlistId - int - the unique id of the playlist requested.
  • + *
  • playlistId - string - the unique id of the playlist requested.
  • *
* * The XML-RPC function returns an XML-RPC structure, containing the following * fields: *
    - *
  • id - int - the unique id of the playlist
  • - *
  • playlength - int - the playlist length of the playlist, in seconds - *
  • + *
  • playlist - string - an XML representation of the playlist; this + * XML element can be used as argument to Playlist::configure()
  • *
* * In case of an error, a standard XML-RPC fault response is generated, @@ -97,7 +96,7 @@ using namespace LiveSupport::Core; *
  • 120 - missing session ID argument
  • * * @author $Author: fgerlits $ - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ class OpenPlaylistForEditingMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx index ac36cb32f..c1ca7e310 100644 --- a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx +++ b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.15 $ + Version : $Revision: 1.16 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -187,14 +187,13 @@ OpenPlaylistForEditingMethodTest :: firstTest(void) << " - " << e.getMessage(); CPPUNIT_FAIL(eMsg.str()); } - 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(result.hasMember("playlist")); + CPPUNIT_ASSERT(result["playlist"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref playlist; + CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result))); + CPPUNIT_ASSERT(playlist->getId()->getId() == 1); + CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60); parameter.clear(); parameter["sessionId"] = sessionId->getId(); diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx index 020f95fb3..19cc7d8be 100644 --- a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx +++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx @@ -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/RemoveAudioClipFromPlaylistMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -106,9 +106,9 @@ RemoveAudioClipFromPlaylistMethod :: execute( returnValue); return; } - XmlRpc::XmlRpcValue parameters = rootParameter[0]; + XmlRpc::XmlRpcValue parameters = rootParameter[0]; - Ptr::Ref sessionId; + Ptr::Ref sessionId; try{ sessionId = XmlRpcTools::extractSessionId(parameters); } catch (std::invalid_argument &e) { @@ -118,7 +118,7 @@ RemoveAudioClipFromPlaylistMethod :: execute( return; } - Ptr::Ref playlistId; + Ptr::Ref playlistId; try{ playlistId = XmlRpcTools::extractPlaylistId(parameters); } catch (std::invalid_argument &e) { @@ -128,12 +128,12 @@ RemoveAudioClipFromPlaylistMethod :: execute( return; } - Ptr::Ref relativeOffset; + Ptr::Ref playlistElementId; try{ - relativeOffset = XmlRpcTools::extractRelativeOffset(parameters); + playlistElementId = XmlRpcTools::extractPlaylistElementId(parameters); } catch (std::invalid_argument &e) { XmlRpcTools::markError(errorId+3, - "missing relative offset argument", + "missing playlist element ID argument", returnValue); return; } @@ -146,7 +146,7 @@ RemoveAudioClipFromPlaylistMethod :: execute( Ptr::Ref playlist; try { playlist = storage->getPlaylist(sessionId, playlistId); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "playlist does not exist:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+4, eMsg, returnValue); @@ -161,7 +161,7 @@ RemoveAudioClipFromPlaylistMethod :: execute( } try { // and finally, the beef - playlist->removePlaylistElement(relativeOffset); + playlist->removePlaylistElement(playlistElementId); } catch(std::invalid_argument &e) { XmlRpcTools::markError(errorId+6, "no audio clip at the specified " diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.h b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.h index 68e5034f7..70616fa91 100644 --- a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.h +++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.h @@ -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/RemoveAudioClipFromPlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -76,10 +76,9 @@ using namespace LiveSupport::Core; *
      *
    • sessionId - string - the session ID obtained via the login() * method of the authentication client
    • - *
    • playlistId - int - the unique id of the playlist.
    • - *
    • relativeOffset - int - the number of seconds between the - * start of the playlist and the start of the audio clip - * to be removed.
    • + *
    • playlistId - string - the unique id of the playlist.
    • + *
    • playlistElementId - string - the unique id of the playlist element + * to be removed.
    • *
    * * In case of an error, a standard XML-RPC fault response is generated, @@ -95,7 +94,7 @@ using namespace LiveSupport::Core; *
  • 420 - missing session ID argument
  • * * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ class RemoveAudioClipFromPlaylistMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx index 6f377afd7..5e904ba7c 100644 --- a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx @@ -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/RemoveAudioClipFromPlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -183,11 +183,12 @@ RemoveAudioClipFromPlaylistMethodTest :: firstTest(void) rootParameter.setSize(1); XmlRpc::XmlRpcValue result; - parameters["sessionId"] = sessionId->getId(); - parameters["playlistId"] = "0000000000000001"; - parameters["audioClipId"] = "0000000000010001"; - parameters["relativeOffset"] = 90*60; - rootParameter[0] = parameters; + parameters["sessionId"] = sessionId->getId(); + parameters["playlistId"] = "0000000000000001"; + parameters["audioClipId"] = "0000000000010001"; + parameters["relativeOffset"] = 60*60; + parameters["playlistElementId"] = "0000000000009999"; + rootParameter[0] = parameters; result.clear(); try { @@ -212,7 +213,7 @@ RemoveAudioClipFromPlaylistMethodTest :: firstTest(void) removeAudioClipMethod->execute(rootParameter, result); CPPUNIT_FAIL("allowed to remove non-existent audio clip from playlist"); } catch (XmlRpc::XmlRpcException &e) { - CPPUNIT_ASSERT(e.getCode() == 406); // no audio clip at this rel offset + CPPUNIT_ASSERT(e.getCode() == 406); // no such playlist element } result.clear(); @@ -224,6 +225,16 @@ RemoveAudioClipFromPlaylistMethodTest :: firstTest(void) << " - " << e.getMessage(); CPPUNIT_FAIL(eMsg.str()); } + CPPUNIT_ASSERT(result.hasMember("playlistElementId")); + CPPUNIT_ASSERT(result["playlistElementId"].getType() + == XmlRpc::XmlRpcValue::TypeString); + std::string playlistElementId(result["playlistElementId"]); + + parameters.clear(); + parameters["sessionId"] = sessionId->getId(); + parameters["playlistId"] = "0000000000000001"; + parameters["playlistElementId"] = playlistElementId; + rootParameter[0] = parameters; result.clear(); try { diff --git a/livesupport/products/scheduler/src/RemoveFromScheduleMethod.h b/livesupport/products/scheduler/src/RemoveFromScheduleMethod.h index abd734d97..928340894 100644 --- a/livesupport/products/scheduler/src/RemoveFromScheduleMethod.h +++ b/livesupport/products/scheduler/src/RemoveFromScheduleMethod.h @@ -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/RemoveFromScheduleMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -75,7 +75,8 @@ using namespace LiveSupport::Core; *
      *
    • sessionId - string - the session ID obtained via the login() * method of the authentication client
    • - *
    • scheduleEntryId - int - the id of the scheduled entry to remove
    • + *
    • scheduleEntryId - string - the id of the scheduled entry + * to remove
    • *
    * * In case of an error, a standard XML-RPC fault response is generated, @@ -89,7 +90,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ class RemoveFromScheduleMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/RescheduleMethod.h b/livesupport/products/scheduler/src/RescheduleMethod.h index 910e03192..2f172aec9 100644 --- a/livesupport/products/scheduler/src/RescheduleMethod.h +++ b/livesupport/products/scheduler/src/RescheduleMethod.h @@ -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/RescheduleMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -75,8 +75,8 @@ using namespace LiveSupport::Core; *
      *
    • sessionId - string - the session ID obtained via the login() * method of the authentication client
    • - *
    • scheduleEntryId - int - the id of the schedule entry to reschedule - *
    • + *
    • scheduleEntryId - string - the id of the schedule entry + * to reschedule
    • *
    • playtime - datetime - the new playing time for the entry
    • *
    * @@ -93,7 +93,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ class RescheduleMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/ResetStorageMethod.cxx b/livesupport/products/scheduler/src/ResetStorageMethod.cxx index 2ec4e8d93..e2dc8311e 100644 --- a/livesupport/products/scheduler/src/ResetStorageMethod.cxx +++ b/livesupport/products/scheduler/src/ResetStorageMethod.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/ResetStorageMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -90,7 +90,7 @@ ResetStorageMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, try { storage->reset(); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "storage reset() returned error:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+1, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/ResetStorageMethodTest.cxx b/livesupport/products/scheduler/src/ResetStorageMethodTest.cxx index 470f1a3a7..7005cb889 100644 --- a/livesupport/products/scheduler/src/ResetStorageMethodTest.cxx +++ b/livesupport/products/scheduler/src/ResetStorageMethodTest.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/ResetStorageMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -67,7 +67,6 @@ ResetStorageMethodTest :: tearDown(void) throw () { } -#include /*------------------------------------------------------------------------------ * Just a very simple smoke test *----------------------------------------------------------------------------*/ @@ -99,7 +98,7 @@ ResetStorageMethodTest :: firstTest(void) result.clear(); CPPUNIT_ASSERT(xmlRpcClient.execute("displayPlaylist", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); - CPPUNIT_ASSERT(result.hasMember("id")); + CPPUNIT_ASSERT(result.hasMember("playlist")); parameters.clear(); parameters["sessionId"] = sessionId; @@ -135,7 +134,7 @@ ResetStorageMethodTest :: firstTest(void) result.clear(); CPPUNIT_ASSERT(xmlRpcClient.execute("displayPlaylist", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); - CPPUNIT_ASSERT(result.hasMember("id")); + CPPUNIT_ASSERT(result.hasMember("playlist")); parameters.clear(); parameters["sessionId"] = sessionId; diff --git a/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.cxx b/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.cxx index 1cdf38778..d9cbe6bf4 100644 --- a/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.cxx +++ b/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.cxx @@ -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/RevertEditedPlaylistMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -130,7 +130,7 @@ RevertEditedPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref playlist; try { playlist = storage->getPlaylist(sessionId, id); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "playlist not found:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+3, eMsg, returnValue); @@ -139,7 +139,7 @@ RevertEditedPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, try { playlist->revertToSavedCopy(); - } catch (std::logic_error) { + } catch (std::invalid_argument &e) { XmlRpcTools::markError(errorId+4, "could not revert playlist", returnValue); return; diff --git a/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.h b/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.h index e167df2eb..d038b1249 100644 --- a/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.h +++ b/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.h @@ -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/RevertEditedPlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -76,7 +76,7 @@ using namespace LiveSupport::Core; *
      *
    • sessionId - string - the session ID obtained via the login() * method of the authentication client
    • - *
    • playlistId - int - the unique id of the playlist requested.
    • + *
    • playlistId - string - the unique id of the playlist to revert.
    • *
    * * In case of an error, a standard XML-RPC fault response is generated, @@ -90,7 +90,7 @@ using namespace LiveSupport::Core; *
  • 820 - missing session ID argument
  • * * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ class RevertEditedPlaylistMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx index 0b4897b44..b91614541 100644 --- a/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx @@ -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/RevertEditedPlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -183,10 +183,10 @@ RevertEditedPlaylistMethodTest :: firstTest(void) rootParameter.setSize(1); XmlRpc::XmlRpcValue result; - parameters["sessionId"] = sessionId->getId(); - parameters["playlistId"] = "0000000000000001"; - parameters["relativeOffset"] = 0; - rootParameter[0] = parameters; + parameters["sessionId"] = sessionId->getId(); + parameters["playlistId"] = "0000000000000001"; + parameters["playlistElementId"] = "0000000000000101"; + rootParameter[0] = parameters; result.clear(); try { diff --git a/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx b/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx index b5cef19d7..82ee5f1cc 100644 --- a/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx @@ -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/RpcAddAudioClipToPlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -119,14 +119,7 @@ RpcAddAudioClipToPlaylistTest :: firstTest(void) result.clear(); xmlRpcClient.execute("openPlaylistForEditing", parameters, result); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); - CPPUNIT_ASSERT(result.hasMember("id")); - CPPUNIT_ASSERT(result["id"].getType() == XmlRpcValue::TypeString); - CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000000001"); - result.clear(); - xmlRpcClient.execute("addAudioClipToPlaylist", parameters, result); - CPPUNIT_ASSERT(xmlRpcClient.isFault()); - parameters.clear(); parameters["sessionId"] = sessionId->getId(); parameters["playlistId"] = "0000000000000001"; diff --git a/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx b/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx index ddb357fae..fa9299298 100644 --- a/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx @@ -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/RpcCreatePlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -115,12 +115,13 @@ RpcCreatePlaylistTest :: firstTest(void) result.clear(); xmlRpcClient.execute("createPlaylist", parameters, result); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); - CPPUNIT_ASSERT(result.hasMember("id")); - 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); + CPPUNIT_ASSERT(result.hasMember("playlist")); + CPPUNIT_ASSERT(result["playlist"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref playlist; + CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result))); + CPPUNIT_ASSERT(playlist->getId()->getId() >= 0); + CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 0); parameters.clear(); parameters["sessionId"] = sessionId->getId(); diff --git a/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx b/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx index bd7081770..641b0821b 100644 --- a/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx +++ b/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx @@ -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/RpcDisplayAudioClipTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -117,13 +117,13 @@ RpcDisplayAudioClipTest :: firstTest(void) 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); + CPPUNIT_ASSERT(result.hasMember("audioClip")); + CPPUNIT_ASSERT(result["audioClip"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref audioClip; + CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result))); + CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10001); + CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 60 * 60); xmlRpcClient.close(); } diff --git a/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx b/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx index 1cb1df0d6..9d71fbbab 100644 --- a/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx +++ b/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx @@ -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/RpcDisplayAudioClipsTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -116,23 +116,22 @@ RpcDisplayAudioClipsTest :: firstTest(void) CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(result.size() >= 2); - XmlRpc::XmlRpcValue audioClip = result[0]; - CPPUNIT_ASSERT(audioClip.hasMember("id")); - CPPUNIT_ASSERT(audioClip["id"].getType() == XmlRpcValue::TypeString); - CPPUNIT_ASSERT(std::string(audioClip["id"]) == "0000000000010001"); + XmlRpc::XmlRpcValue result0 = result[0]; + CPPUNIT_ASSERT(result0.hasMember("audioClip")); + CPPUNIT_ASSERT(result0["audioClip"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref audioClip; + CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result0))); + CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10001); + CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 60 * 60); - CPPUNIT_ASSERT(audioClip.hasMember("playlength")); - CPPUNIT_ASSERT(audioClip["playlength"].getType() == XmlRpcValue::TypeInt); - CPPUNIT_ASSERT(int(audioClip["playlength"]) == 60 * 60); - - audioClip = result[1]; - 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); + XmlRpc::XmlRpcValue result1 = result[1]; + CPPUNIT_ASSERT(result1.hasMember("audioClip")); + CPPUNIT_ASSERT(result1["audioClip"].getType() + == XmlRpc::XmlRpcValue::TypeString); + CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result1))); + CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10002); + CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 30 * 60); xmlRpcClient.close(); } diff --git a/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx b/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx index 295e8c642..397274065 100644 --- a/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx @@ -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/RpcDisplayPlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -117,13 +117,14 @@ RpcDisplayPlaylistTest :: simpleTest(void) result.clear(); xmlRpcClient.execute("displayPlaylist", parameters, result); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); - 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); + + CPPUNIT_ASSERT(result.hasMember("playlist")); + CPPUNIT_ASSERT(result["playlist"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref playlist; + CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result))); + CPPUNIT_ASSERT(playlist->getId()->getId() == 1); + CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60); xmlRpcClient.close(); } diff --git a/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx b/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx index 3d366c17e..83056766d 100644 --- a/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx +++ b/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx @@ -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/RpcDisplayPlaylistsTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -116,14 +116,14 @@ RpcDisplayPlaylistsTest :: firstTest(void) CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(result.size() == 1); - 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); + XmlRpc::XmlRpcValue result0 = result[0]; + CPPUNIT_ASSERT(result0.hasMember("playlist")); + CPPUNIT_ASSERT(result0["playlist"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref playlist; + CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result0))); + CPPUNIT_ASSERT(playlist->getId()->getId() == 1); + CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60); xmlRpcClient.close(); } diff --git a/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.cxx b/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.cxx index db6d651b3..beed5d99a 100644 --- a/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.cxx +++ b/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.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/RpcOpenPlaylistForEditingTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -118,14 +118,13 @@ RpcOpenPlaylistForEditingTest :: firstTest(void) CPPUNIT_ASSERT(xmlRpcClient.execute("openPlaylistForEditing", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); - CPPUNIT_ASSERT(result.hasMember("id")); - CPPUNIT_ASSERT(result["id"].getType() == XmlRpc::XmlRpcValue::TypeString); - CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000000001"); - - CPPUNIT_ASSERT(result.hasMember("playlength")); - CPPUNIT_ASSERT(result["playlength"].getType() - == XmlRpc::XmlRpcValue::TypeInt); - CPPUNIT_ASSERT(int(result["playlength"]) == 90 * 60); + CPPUNIT_ASSERT(result.hasMember("playlist")); + CPPUNIT_ASSERT(result["playlist"].getType() + == XmlRpc::XmlRpcValue::TypeString); + Ptr::Ref playlist; + CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result))); + CPPUNIT_ASSERT(playlist->getId()->getId() == 1); + CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60); parameters.clear(); parameters["sessionId"] = sessionId->getId(); diff --git a/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.cxx b/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.cxx index ac67428d6..21cab3c9b 100644 --- a/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.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/RpcRemoveAudioClipFromPlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -111,10 +111,11 @@ RpcRemoveAudioClipFromPlaylistTest :: firstTest(void) XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); - parameters["sessionId"] = sessionId->getId(); - parameters["playlistId"] = "0000000000000001"; - parameters["audioClipId"] = "0000000000010001"; - parameters["relativeOffset"] = 90*60; + parameters["sessionId"] = sessionId->getId(); + parameters["playlistId"] = "0000000000000001"; + parameters["audioClipId"] = "0000000000010001"; + parameters["relativeOffset"] = 60*60; + parameters["playlistElementId"] = "0000000000009999"; result.clear(); CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist", @@ -143,6 +144,15 @@ RpcRemoveAudioClipFromPlaylistTest :: firstTest(void) CPPUNIT_ASSERT(xmlRpcClient.execute("addAudioClipToPlaylist", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); + CPPUNIT_ASSERT(result.hasMember("playlistElementId")); + CPPUNIT_ASSERT(result["playlistElementId"].getType() + == XmlRpc::XmlRpcValue::TypeString); + std::string playlistElementId = std::string(result["playlistElementId"]); + + parameters.clear(); + parameters["sessionId"] = sessionId->getId(); + parameters["playlistId"] = "0000000000000001"; + parameters["playlistElementId"] = playlistElementId; result.clear(); CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist", diff --git a/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.cxx b/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.cxx index 58a74ebd3..f598b5822 100644 --- a/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.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/RpcRevertEditedPlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -111,9 +111,9 @@ RpcRevertEditedPlaylistTest :: firstTest(void) XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); - parameters["sessionId"] = sessionId->getId(); - parameters["playlistId"] = "0000000000000001"; - parameters["relativeOffset"] = 0; + parameters["sessionId"] = sessionId->getId(); + parameters["playlistId"] = "0000000000000001"; + parameters["playlistElementId"] = "0000000000000101"; CPPUNIT_ASSERT(xmlRpcClient.execute("revertEditedPlaylist", parameters, result)); diff --git a/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.cxx b/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.cxx index 377e54277..2eaf93f52 100644 --- a/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.cxx +++ b/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.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/RpcUpdateFadeInFadeOutTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -109,10 +109,10 @@ RpcUpdateFadeInFadeOutTest :: firstTest(void) XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false); - parameters["sessionId"] = sessionId->getId(); - parameters["playlistId"] = "0000000000000001"; - parameters["relativeOffset"] = 90*60; - parameters["fadeIn"] = 0; + parameters["sessionId"] = sessionId->getId(); + parameters["playlistId"] = "0000000000000001"; + parameters["playlistElementId"] = "0000000000009999"; + parameters["fadeIn"] = 0; result.clear(); CPPUNIT_ASSERT(xmlRpcClient.execute("updateFadeInFadeOut", @@ -146,9 +146,9 @@ RpcUpdateFadeInFadeOutTest :: firstTest(void) xmlRpcClient.isFault()); CPPUNIT_ASSERT(result.hasMember("faultCode")); CPPUNIT_ASSERT(int(result["faultCode"]) == 1608); - // no audio clip at this rel offset + // no such playlist element - parameters["relativeOffset"] = 0; + parameters["playlistElementId"] = "0000000000000101"; result.clear(); CPPUNIT_ASSERT(xmlRpcClient.execute("updateFadeInFadeOut", diff --git a/livesupport/products/scheduler/src/RpcValidatePlaylistTest.cxx b/livesupport/products/scheduler/src/RpcValidatePlaylistTest.cxx index caa079b24..fb087a59f 100644 --- a/livesupport/products/scheduler/src/RpcValidatePlaylistTest.cxx +++ b/livesupport/products/scheduler/src/RpcValidatePlaylistTest.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/RpcValidatePlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -136,7 +136,7 @@ RpcValidatePlaylistTest :: firstTest(void) CPPUNIT_ASSERT(bool(result["valid"])); result.clear(); - parameters["relativeOffset"] = 0; + parameters["playlistElementId"] = "0000000000000101"; CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); diff --git a/livesupport/products/scheduler/src/SavePlaylistMethod.cxx b/livesupport/products/scheduler/src/SavePlaylistMethod.cxx index e508cf387..0e4643c14 100644 --- a/livesupport/products/scheduler/src/SavePlaylistMethod.cxx +++ b/livesupport/products/scheduler/src/SavePlaylistMethod.cxx @@ -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/SavePlaylistMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -130,7 +130,7 @@ SavePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref playlist; try { playlist = storage->getPlaylist(sessionId, id); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "playlist not found:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+3, eMsg, returnValue); @@ -141,7 +141,7 @@ SavePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, try { storage->savePlaylist(sessionId, playlist); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "could not save playlist:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+5, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/SavePlaylistMethod.h b/livesupport/products/scheduler/src/SavePlaylistMethod.h index 83d5b1eb3..dadb8fd75 100644 --- a/livesupport/products/scheduler/src/SavePlaylistMethod.h +++ b/livesupport/products/scheduler/src/SavePlaylistMethod.h @@ -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/SavePlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -77,7 +77,7 @@ using namespace LiveSupport::Core; *
      *
    • sessionId - string - the session ID obtained via the login() * method of the authentication client
    • - *
    • playlistId - int - the unique id of the playlist to save.
    • + *
    • playlistId - string - the unique id of the playlist to save.
    • *
    * * In case of an error, a standard XML-RPC fault response is generated, @@ -91,7 +91,7 @@ using namespace LiveSupport::Core; *
  • 720 - missing session ID argument
  • * * @author $Author: fgerlits $ - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ class SavePlaylistMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.cxx b/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.cxx index 7ef09c99b..bb75e743a 100644 --- a/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.cxx +++ b/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.cxx @@ -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/UpdateFadeInFadeOutMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -108,35 +108,29 @@ UpdateFadeInFadeOutMethod :: execute( returnValue); return; } - XmlRpc::XmlRpcValue parameters = rootParameter[0]; + XmlRpc::XmlRpcValue parameters = rootParameter[0]; - Ptr::Ref sessionId; + Ptr::Ref sessionId; try{ sessionId = XmlRpcTools::extractSessionId(parameters); } catch (std::invalid_argument &e) { - XmlRpcTools::markError(errorId+20, - "missing session ID argument", - returnValue); + XmlRpcTools::markError(errorId+20, e.what(), returnValue); return; } - Ptr::Ref playlistId; + Ptr::Ref playlistId; try{ playlistId = XmlRpcTools::extractPlaylistId(parameters); } catch (std::invalid_argument &e) { - XmlRpcTools::markError(errorId+2, - "missing playlist ID argument", - returnValue); + XmlRpcTools::markError(errorId+2, e.what(), returnValue); return; } - Ptr::Ref relativeOffset; + Ptr::Ref playlistElementId; try{ - relativeOffset = XmlRpcTools::extractRelativeOffset(parameters); + playlistElementId = XmlRpcTools::extractPlaylistElementId(parameters); } catch (std::invalid_argument &e) { - XmlRpcTools::markError(errorId+3, - "missing relative offset argument", - returnValue); + XmlRpcTools::markError(errorId+3, e.what(), returnValue); return; } @@ -144,9 +138,7 @@ UpdateFadeInFadeOutMethod :: execute( try{ fadeIn = XmlRpcTools::extractFadeIn(parameters); } catch (std::invalid_argument &e) { - XmlRpcTools::markError(errorId+4, - "missing fade in argument", - returnValue); + XmlRpcTools::markError(errorId+4, e.what(), returnValue); return; } @@ -154,9 +146,7 @@ UpdateFadeInFadeOutMethod :: execute( try{ fadeOut = XmlRpcTools::extractFadeOut(parameters); } catch (std::invalid_argument &e) { - XmlRpcTools::markError(errorId+5, - "missing fade out argument", - returnValue); + XmlRpcTools::markError(errorId+5, e.what(), returnValue); return; } @@ -168,28 +158,23 @@ UpdateFadeInFadeOutMethod :: execute( Ptr::Ref playlist; try { playlist = storage->getPlaylist(sessionId, playlistId); - } catch (XmlRpcException &e) { - std::string eMsg = "playlist does not exist:\n"; - eMsg += e.what(); - XmlRpcTools::markError(errorId+6, eMsg, returnValue); + } catch (Core::XmlRpcException &e) { + XmlRpcTools::markError(errorId+6, e.what(), returnValue); return; } if (!playlist->isLocked()) { XmlRpcTools::markError(errorId+7, - "playlist has not been opened for editing", + "playlist has not been opened for editing", returnValue); return; } Ptr::Ref fadeInfo(new FadeInfo(fadeIn, fadeOut)); try { // and finally, the beef - playlist->setFadeInfo(relativeOffset, fadeInfo); + playlist->setFadeInfo(playlistElementId, fadeInfo); } catch(std::invalid_argument &e) { - XmlRpcTools::markError(errorId+8, - "no audio clip at the specified " - "relative offset", - returnValue); + XmlRpcTools::markError(errorId+8, e.what(), returnValue); return; } } diff --git a/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.h b/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.h index 4c2fd2fac..5e190d176 100644 --- a/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.h +++ b/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.h @@ -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/UpdateFadeInFadeOutMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -76,10 +76,9 @@ using namespace LiveSupport::Core; *
      *
    • sessionId - string - the session ID obtained via the login() * method of the authentication client
    • - *
    • playlistId - int - the unique id of the playlist.
    • - *
    • relativeOffset - int - the number of seconds between the - * start of the playlist and the start of the audio clip - * to be removed.
    • + *
    • playlistId - string - the unique ID of the playlist.
    • + *
    • playlistElementId - string - the unique ID of the playlist element + * to be removed.
    • *
    • fadeIn - int - the length (in milliseconds) of the fade in.
    • *
    • fadeOut - int - the length (in milliseconds) of the fade out.
    • *
    @@ -90,16 +89,16 @@ using namespace LiveSupport::Core; *
      *
    • 1601 - invalid argument format
    • *
    • 1602 - missing playlist ID argument
    • - *
    • 1603 - missing relative offset argument
    • + *
    • 1603 - missing playlist element ID argument
    • *
    • 1604 - missing fade in argument
    • *
    • 1605 - missing fade out argument
    • *
    • 1606 - playlist does not exist
    • *
    • 1607 - playlist has not been opened for editing
    • - *
    • 1608 - no audio clip at the specified relative offset
    • + *
    • 1608 - error executing setFadeInfo() method
    • *
    • 1620 - missing session ID argument
    • *
    * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ class UpdateFadeInFadeOutMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx b/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx index 37c9df7fc..dbc3d485b 100644 --- a/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx +++ b/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx @@ -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/UpdateFadeInFadeOutMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -179,11 +179,11 @@ UpdateFadeInFadeOutMethodTest :: firstTest(void) rootParameter.setSize(1); XmlRpc::XmlRpcValue result; - parameters["sessionId"] = sessionId->getId(); - parameters["playlistId"] = "0000000000000001"; - parameters["relativeOffset"] = 90*60; - parameters["fadeIn"] = 0; - rootParameter[0] = parameters; + parameters["sessionId"] = sessionId->getId(); + parameters["playlistId"] = "0000000000000001"; + parameters["playlistElementId"] = "0000000000009999"; + parameters["fadeIn"] = 0; + rootParameter[0] = parameters; result.clear(); try { @@ -220,11 +220,11 @@ UpdateFadeInFadeOutMethodTest :: firstTest(void) 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 + CPPUNIT_ASSERT(e.getCode() == 1608);// no such playlist element } - parameters["relativeOffset"] = 0; - rootParameter[0] = parameters; + parameters["playlistElementId"] = "0000000000000101"; + rootParameter[0] = parameters; result.clear(); try { diff --git a/livesupport/products/scheduler/src/UploadPlaylistMethod.h b/livesupport/products/scheduler/src/UploadPlaylistMethod.h index 89663e08b..b04e3a439 100644 --- a/livesupport/products/scheduler/src/UploadPlaylistMethod.h +++ b/livesupport/products/scheduler/src/UploadPlaylistMethod.h @@ -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/UploadPlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -84,7 +84,7 @@ using namespace LiveSupport::Core; * If the upload is successful, the method returns an XML-RPC structure with * the following members: *
      - *
    • scheduleEntryId - int - the id of the schedule entry created + *
    • scheduleEntryId - string - the id of the schedule entry created * by the upload
    • *
    * @@ -102,7 +102,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ class UploadPlaylistMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx b/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx index 2c472f2f8..4737a8ced 100644 --- a/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx +++ b/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx @@ -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/ValidatePlaylistMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -135,7 +135,7 @@ ValidatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter, Ptr::Ref playlist; try { playlist = storage->getPlaylist(sessionId, playlistId); - } catch (XmlRpcException &e) { + } catch (Core::XmlRpcException &e) { std::string eMsg = "playlist does not exist:\n"; eMsg += e.what(); XmlRpcTools::markError(errorId+3, eMsg, returnValue); diff --git a/livesupport/products/scheduler/src/ValidatePlaylistMethod.h b/livesupport/products/scheduler/src/ValidatePlaylistMethod.h index 5e9d9b0bc..d988369e7 100644 --- a/livesupport/products/scheduler/src/ValidatePlaylistMethod.h +++ b/livesupport/products/scheduler/src/ValidatePlaylistMethod.h @@ -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/ValidatePlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -75,7 +75,7 @@ using namespace LiveSupport::Core; *
      *
    • sessionId - string - the session ID obtained via the login() * method of the authentication client
    • - *
    • playlistId - int - the unique id of the playlist.
    • + *
    • playlistId - string - the unique id of the playlist.
    • *
    * * The XML-RPC function returns an XML-RPC structure, containing the following @@ -95,7 +95,7 @@ using namespace LiveSupport::Core; *
  • 520 - missing session ID argument
  • * * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ class ValidatePlaylistMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx b/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx index 676f8b5b7..a13f1e067 100644 --- a/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx @@ -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/ValidatePlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -219,8 +219,8 @@ ValidatePlaylistMethodTest :: firstTest(void) CPPUNIT_ASSERT(bool(result["valid"])); result.clear(); - parameter["relativeOffset"] = 0; - rootParameter[0] = parameter; + parameter["playlistElementId"] = "0000000000000101"; + rootParameter[0] = parameter; try { removeAudioClipMethod->execute(rootParameter, result); } catch (XmlRpc::XmlRpcException &e) {