added conversion to/from XmlRpcValue to AudioClip and Playlist;

modified Scheduler methods to use these conversions;
fixed bug in Scheduler: some methods caught wrong kind of exception;
modified Playlist to accept several PlaylistElements at the same
  relative offset;
modified methods for deleting playlist elements and updating fade info
  to refer to playlist elements by ID, not relative offset
This commit is contained in:
fgerlits 2005-02-05 08:12:37 +00:00
parent aca8977831
commit e85731b8e6
70 changed files with 849 additions and 518 deletions

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -43,6 +43,7 @@
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
#include <libxml++/libxml++.h> #include <libxml++/libxml++.h>
#include <XmlRpcValue.h>
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
@ -96,17 +97,22 @@ using namespace boost::posix_time;
* The metadata element is optional. The <code>configure()</code> method * The metadata element is optional. The <code>configure()</code> method
* sets only those fields which had not been set previously: e.g., if we set * 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 * some or all fields of the AudioClip in the constructor, then these fields
* in the XML element will be ignored by <code>configure()</code>. If both the * in the XML element will be ignored by <code>configure()</code>.
* <code>playlength</code> attribute and the * The <code>title</code> attribute and the <code>&lt;dc:title&gt;</code>
* <code>&lt;dcterms:extent&gt;</code> * element set the same field; if both are present, the title is set from
* element are present, then the playlength is set from the attribute and * the attribute and the element is ignored..
* <code>&lt;dcterms:extent&gt;</code> is ignored. Embedded XML elements are * The same is true for the <code>playlength</code> attribute and the
* currently ignored: e.g., <pre><code> &lt;group&gt; * <code>&lt;dcterms:extent&gt;</code> 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.,
* <pre><code> &lt;group&gt;
* &lt;member1&gt;value1&lt;/member1&gt; * &lt;member1&gt;value1&lt;/member1&gt;
* &lt;member2&gt;value2&lt;/member2&gt; * &lt;member2&gt;value2&lt;/member2&gt;
* &lt;/group&gt;</code></pre> produces a single metadata field * &lt;/group&gt;</code></pre>
* <code>group</code> * produces a single metadata field <code>group</code> with an empty value,
* with an empty value,
* and ignores <code>member1</code> and <code>member2</code>. * and ignores <code>member1</code> and <code>member2</code>.
* TODO: fix this? * TODO: fix this?
* *
@ -124,7 +130,7 @@ using namespace boost::posix_time;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.21 $ * @version $Revision: 1.22 $
*/ */
class AudioClip : public Configurable, class AudioClip : public Configurable,
public Playable public Playable
@ -291,6 +297,30 @@ class AudioClip : public Configurable,
Ptr<const std::string>::Ref uri) Ptr<const std::string>::Ref uri)
throw (); throw ();
/**
* Convert the audio clip to an XmlRpcValue (marshalling).
*
* @return an XmlRpcValue struct, containing a
* field named <i>audioClip</i>, 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 <i>audioClip</i>, 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. * 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 * Return the name of the XML element this object expects
* to be sent to a call to configure(). * 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 * @return a string representation of the audio clip as an XML element
*/ */
virtual Ptr<Glib::ustring>::Ref virtual Ptr<Glib::ustring>::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 * @return a string representation of the audio clip as an XML document
*/ */
virtual Ptr<Glib::ustring>::Ref virtual Ptr<Glib::ustring>::Ref
getXmlDocumentString(void) throw (); getXmlDocumentString(void) const throw ();
/** /**

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.8 $ Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playable.h,v $ 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. * It contains the methods which are common to these classes.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.8 $ * @version $Revision: 1.9 $
*/ */
class Playable : public boost::enable_shared_from_this<Playable> class Playable : public boost::enable_shared_from_this<Playable>
{ {
@ -225,7 +225,7 @@ class Playable : public boost::enable_shared_from_this<Playable>
* @return a string representation of the audio clip as an XML element * @return a string representation of the audio clip as an XML element
*/ */
virtual Ptr<Glib::ustring>::Ref virtual Ptr<Glib::ustring>::Ref
getXmlElementString(void) throw () = 0; getXmlElementString(void) const throw () = 0;
/** /**
@ -256,7 +256,7 @@ class Playable : public boost::enable_shared_from_this<Playable>
* @return a string representation of the audio clip as an XML document * @return a string representation of the audio clip as an XML document
*/ */
virtual Ptr<Glib::ustring>::Ref virtual Ptr<Glib::ustring>::Ref
getXmlDocumentString(void) throw () = 0; getXmlDocumentString(void) const throw () = 0;
/** /**
@ -265,7 +265,7 @@ class Playable : public boost::enable_shared_from_this<Playable>
* @return either AudioClipType or PlaylistType. * @return either AudioClipType or PlaylistType.
*/ */
Type Type
getType(void) const throw () getType(void) const throw ()
{ {
return type; return type;
} }
@ -278,7 +278,7 @@ class Playable : public boost::enable_shared_from_this<Playable>
* @return an audio clip pointer to this object. * @return an audio clip pointer to this object.
*/ */
Ptr<AudioClip>::Ref Ptr<AudioClip>::Ref
getAudioClip(void) throw (); getAudioClip(void) throw ();
/** /**
* Return a playlist pointer to this object. If the object's * Return a playlist pointer to this object. If the object's
@ -288,7 +288,7 @@ class Playable : public boost::enable_shared_from_this<Playable>
* @return a playlist pointer to this object. * @return a playlist pointer to this object.
*/ */
Ptr<Playlist>::Ref Ptr<Playlist>::Ref
getPlaylist(void) throw (); getPlaylist(void) throw ();
}; };

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -43,6 +43,7 @@
#include <map> #include <map>
#include <stdexcept> #include <stdexcept>
#include <libxml++/libxml++.h> #include <libxml++/libxml++.h>
#include <XmlRpcValue.h>
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
@ -75,25 +76,59 @@ using namespace boost::posix_time;
* called playlist. This may look like the following: * called playlist. This may look like the following:
* *
* <pre><code> * <pre><code>
* &lt;playlist id="1" playlength="00:18:30.000000" &gt; * &lt;playlist id="1" title="My Playlist" playlength="00:18:30.000000" &gt;
* &lt;playlistElement&gt; ... &lt;/playlistElement&gt; * &lt;playlistElement&gt; ... &lt;/playlistElement&gt;
* ... * ...
* &lt;playlistElement&gt; ... &lt;/playlistElement&gt;
* &lt;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" &gt;
* &lt;dc:title &gt;File Title txt&lt;/dc:title&gt;
* &lt;dcterms:extent &gt;00:02:30.000000&lt;/dcterms:extent&gt;
* ...
* &lt;/metadata&gt;
* &lt;/playlist&gt; * &lt;/playlist&gt;
* </code></pre> * </code></pre>
* *
* For detais of the playlistElement element, see the documentation * For detais of the playlistElement element, see the documentation
* for the PlaylistElement class. * for the PlaylistElement class.
* *
* The metadata element is optional. The <code>configure()</code> 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 <code>configure()</code>.
* The <code>title</code> attribute and the <code>&lt;dc:title&gt;</code>
* 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 <code>playlength</code> attribute and the
* <code>&lt;dcterms:extent&gt;</code> 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.,
* <pre><code> &lt;group&gt;
* &lt;member1&gt;value1&lt;/member1&gt;
* &lt;member2&gt;value2&lt;/member2&gt;
* &lt;/group&gt;</code></pre>
* produces a single metadata field <code>group</code> with an empty value,
* and ignores <code>member1</code> and <code>member2</code>.
* TODO: fix this?
*
* The DTD for the above element is: * The DTD for the above element is:
* *
* <pre><code> * <pre><code>
* &lt;!ELEMENT playlist (playlistElement*) &gt; * &lt;!ELEMENT playlist (playlistElement*, metadata?) &gt;
* &lt;!ATTLIST playlist id NMTOKEN #REQUIRED &gt; * &lt;!ATTLIST playlist id NMTOKEN #REQUIRED &gt;
* &lt;!ATTLIST playlist playlength NMTOKEN #REQUIRED &gt; * &lt;!ATTLIST playlist title CDATA "" &gt;
* &lt;!ATTLIST playlist playlength NMTOKEN #IMPLIED &gt;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.30 $ * @version $Revision: 1.31 $
*/ */
class Playlist : public Configurable, class Playlist : public Configurable,
public Playable public Playable
@ -133,7 +168,7 @@ class Playlist : public Configurable,
* A map type for storing the playlist elements associated with * A map type for storing the playlist elements associated with
* this playlist, indexed by their relative offsets. * this playlist, indexed by their relative offsets.
*/ */
typedef std::map<time_duration, Ptr<PlaylistElement>::Ref> typedef std::multimap<time_duration, Ptr<PlaylistElement>::Ref>
PlaylistElementListType; PlaylistElementListType;
/** /**
@ -184,6 +219,24 @@ class Playlist : public Configurable,
setPlaylength(Ptr<time_duration>::Ref playlength) setPlaylength(Ptr<time_duration>::Ref playlength)
throw (); 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 <code>this->end()</code> if it does not.
*/
iterator
find(Ptr<UniqueId>::Ref playlistElementId)
throw ();
public: public:
/** /**
@ -274,6 +327,29 @@ class Playlist : public Configurable,
Ptr<const std::string>::Ref uri = Ptr<std::string>::Ref()) Ptr<const std::string>::Ref uri = Ptr<std::string>::Ref())
throw (); throw ();
/**
* Convert the playlist to an XmlRpcValue (marshalling).
*
* @return an XmlRpcValue struct, containing a
* field named <i>playlist</i>, 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 <i>playlist</i>, 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. * 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 * Return the name of the XML element this object expects
* to be sent to a call to configure(). * 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. * relative offset.
*
* @param relativeOffset (a pointer to) the relative offset where * @param relativeOffset (a pointer to) the relative offset where
* the playlist element is. * the playlist element is.
* @return a constant iterator to the playlist element if it exists, * @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 * @param relativeOffset the start of the audio clip, relative
* to the start of the playlist * to the start of the playlist
* @param fadeInfo the fade in / fade out info (optional) * @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 * @exception std::invalid_argument if the playlist already contains
* a playlist element with the same relative offset * a playlist element with the same relative offset
*/ */
void Ptr<UniqueId>::Ref
addAudioClip(Ptr<AudioClip>::Ref audioClip, addAudioClip(Ptr<AudioClip>::Ref audioClip,
Ptr<time_duration>::Ref relativeOffset, Ptr<time_duration>::Ref relativeOffset,
Ptr<FadeInfo>::Ref fadeInfo Ptr<FadeInfo>::Ref fadeInfo
@ -491,10 +570,11 @@ class Playlist : public Configurable,
* @param relativeOffset the start of the sub-playlist, relative * @param relativeOffset the start of the sub-playlist, relative
* to the start of the containing playlist * to the start of the containing playlist
* @param fadeInfo the fade in / fade out info (optional) * @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 * @exception std::invalid_argument if the playlist already contains
* a playlist element with the same relative offset * a playlist element with the same relative offset
*/ */
void Ptr<UniqueId>::Ref
addPlaylist(Ptr<Playlist>::Ref playlist, addPlaylist(Ptr<Playlist>::Ref playlist,
Ptr<time_duration>::Ref relativeOffset, Ptr<time_duration>::Ref relativeOffset,
Ptr<FadeInfo>::Ref fadeInfo Ptr<FadeInfo>::Ref fadeInfo
@ -504,27 +584,25 @@ class Playlist : public Configurable,
/** /**
* Set the fade in / fade out info for a playlist element. * Set the fade in / fade out info for a playlist element.
* *
* @param relativeOffset the start of the playlist element, relative * @param playlistElementId the ID of the playlist element
* to the start of the playlist
* @param fadeInfo the new fade in / fade out info * @param fadeInfo the new fade in / fade out info
* @exception std::invalid_argument if there is no playlist element * @exception std::invalid_argument if there is no playlist element
* at the given relative offset * at the given relative offset
*/ */
void void
setFadeInfo(Ptr<time_duration>::Ref relativeOffset, setFadeInfo(Ptr<UniqueId>::Ref playlistElementId,
Ptr<FadeInfo>::Ref fadeInfo) Ptr<FadeInfo>::Ref fadeInfo)
throw (std::invalid_argument); throw (std::invalid_argument);
/** /**
* Remove a playlist element from the playlist. * Remove a playlist element from the playlist.
* *
* @param relativeOffset the start of the playlist element, relative * @param playlistElementId the ID of the playlist element
* to the start of the playlist * @exception std::invalid_argument if the playlist element does not
* @exception std::invalid_argument if the playlist does not contain * exist
* a playlist element at the specified relative offset
*/ */
void void
removePlaylistElement(Ptr<const time_duration>::Ref relativeOffset) removePlaylistElement(Ptr<UniqueId>::Ref playlistElementId)
throw (std::invalid_argument); throw (std::invalid_argument);
/** /**
@ -596,7 +674,7 @@ class Playlist : public Configurable,
* @return a string representation of the playlist as an XML element * @return a string representation of the playlist as an XML element
*/ */
virtual Ptr<Glib::ustring>::Ref virtual Ptr<Glib::ustring>::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 * @return a string representation of the playlist as an XML document
*/ */
virtual Ptr<Glib::ustring>::Ref virtual Ptr<Glib::ustring>::Ref
getXmlDocumentString(void) throw (); getXmlDocumentString(void) const throw ();
}; };

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.3 $ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/XmlRpcTools.h,v $ 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. * in the Scheduler.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.3 $ * @version $Revision: 1.4 $
*/ */
class XmlRpcTools class XmlRpcTools
{ {
@ -130,7 +130,7 @@ class XmlRpcTools
throw (std::invalid_argument); 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. * @param xmlRpcValue the XML-RPC parameter to extract from.
* @return a UniqueId that was found in the XML-RPC parameter. * @return a UniqueId that was found in the XML-RPC parameter.
@ -141,6 +141,18 @@ class XmlRpcTools
extractPlaylistId(XmlRpc::XmlRpcValue & xmlRpcValue) extractPlaylistId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument); 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<UniqueId>::Ref
extractPlaylistElementId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/** /**
* Extract the audio clip id from the XML-RPC parameters. * Extract the audio clip id from the XML-RPC parameters.
* *
@ -407,15 +419,28 @@ class XmlRpcTools
/** /**
* Add a playlist id to an XmlRpcValue * 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 * @param returnValue an output parameter, which has the
* playlist id added after the function returns. * playlist ID added after the function returns.
*/ */
static void static void
playlistIdToXmlRpcValue( playlistIdToXmlRpcValue(
Ptr<const UniqueId>::Ref playlistId, Ptr<const UniqueId>::Ref playlistId,
XmlRpc::XmlRpcValue & returnValue) throw (); 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<const UniqueId>::Ref playlistElementId,
XmlRpc::XmlRpcValue & returnValue) throw ();
/** /**
* Add a playtime value to an XmlRpcValue. * Add a playtime value to an XmlRpcValue.
* *

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -189,7 +189,8 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
} }
/*------------------------------------------------------------------------------ * Constructor without ID. /*------------------------------------------------------------------------------
* Constructor without ID.
*----------------------------------------------------------------------------*/AudioClip :: AudioClip(Ptr<const Glib::ustring>::Ref title, *----------------------------------------------------------------------------*/AudioClip :: AudioClip(Ptr<const Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength, Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri) Ptr<const std::string>::Ref uri)
@ -208,6 +209,41 @@ AudioClip :: AudioClip(Ptr<UniqueId>::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. * Set the value of the title field.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -338,11 +374,7 @@ AudioClip :: configure(const xmlpp::Element & element)
} }
if (!title) { if (!title) {
std::string eMsg = "missing attribute "; title.reset(new const Glib::ustring(""));
eMsg += titleAttrName;
eMsg += " or metadata element ";
eMsg += titleElementPrefix + ":" + titleElementName;
throw std::invalid_argument(eMsg);
} }
} }
@ -480,7 +512,7 @@ AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
* Return a string containing the essential fields of this object, in XML. * Return a string containing the essential fields of this object, in XML.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<Glib::ustring>::Ref Ptr<Glib::ustring>::Ref
AudioClip :: getXmlElementString(void) throw () AudioClip :: getXmlElementString(void) const throw ()
{ {
Ptr<Glib::ustring>::Ref xmlString(new Glib::ustring); Ptr<Glib::ustring>::Ref xmlString(new Glib::ustring);
@ -503,7 +535,7 @@ AudioClip :: getXmlElementString(void) throw ()
* Return a string containing an XML representation of this audio clip. * Return a string containing an XML representation of this audio clip.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<Glib::ustring>::Ref Ptr<Glib::ustring>::Ref
AudioClip :: getXmlDocumentString() throw () AudioClip :: getXmlDocumentString() const throw ()
{ {
Ptr<xmlpp::Document>::Ref localDocument; Ptr<xmlpp::Document>::Ref localDocument;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.cxx,v $ 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"); CPPUNIT_ASSERT(*artist == "The Muppets");
} }
/*------------------------------------------------------------------------------
* Marshalling test
*----------------------------------------------------------------------------*/
void
AudioClipTest :: marshallingTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<AudioClip>::Ref audioClip(new AudioClip());
try {
Ptr<xmlpp::DomParser>::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<AudioClip>::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());
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.3 $ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.h,v $ 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. * Unit test for the AudioClip class.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.3 $ * @version $Revision: 1.4 $
* @see AudioClip * @see AudioClip
*/ */
class AudioClipTest : public CPPUNIT_NS::TestFixture class AudioClipTest : public CPPUNIT_NS::TestFixture
@ -67,6 +67,7 @@ class AudioClipTest : public CPPUNIT_NS::TestFixture
CPPUNIT_TEST(firstTest); CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(conversionTest); CPPUNIT_TEST(conversionTest);
CPPUNIT_TEST(tagTest); CPPUNIT_TEST(tagTest);
CPPUNIT_TEST(marshallingTest);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
protected: protected:
@ -95,6 +96,14 @@ class AudioClipTest : public CPPUNIT_NS::TestFixture
void void
tagTest(void) throw (CPPUNIT_NS::Exception); 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: public:

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -188,6 +188,43 @@ Playlist :: Playlist(Ptr<UniqueId>::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. * Set the value of the title field.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -217,7 +254,7 @@ Playlist :: setPlaylength(Ptr<time_duration>::Ref playlength)
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
Playlist :: configure(const xmlpp::Element & element) Playlist :: configure(const xmlpp::Element & element)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
if (element.get_name() != configElementNameStr) { if (element.get_name() != configElementNameStr) {
std::string eMsg = "bad configuration element "; std::string eMsg = "bad configuration element ";
@ -347,37 +384,26 @@ Playlist :: configure(const xmlpp::Element & element)
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
Playlist::addPlaylistElement(Ptr<PlaylistElement>::Ref playlistElement) Playlist::addPlaylistElement(Ptr<PlaylistElement>::Ref playlistElement)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
Ptr<const time_duration>::Ref relativeOffset Ptr<const time_duration>::Ref relativeOffset
= playlistElement->getRelativeOffset(); = playlistElement->getRelativeOffset();
elementList->insert(std::make_pair(*relativeOffset, playlistElement));
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;
} }
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Add a new audio clip to the playlist. * Add a new audio clip to the playlist.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void Ptr<UniqueId>::Ref
Playlist::addAudioClip(Ptr<AudioClip>::Ref audioClip, Playlist::addAudioClip(Ptr<AudioClip>::Ref audioClip,
Ptr<time_duration>::Ref relativeOffset, Ptr<time_duration>::Ref relativeOffset,
Ptr<FadeInfo>::Ref fadeInfo) Ptr<FadeInfo>::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<PlaylistElement>::Ref playlistElement(new PlaylistElement( Ptr<PlaylistElement>::Ref playlistElement(new PlaylistElement(
relativeOffset, audioClip, fadeInfo)); relativeOffset, audioClip, fadeInfo));
(*elementList)[*relativeOffset] = playlistElement; elementList->insert(std::make_pair(*relativeOffset, playlistElement));
Ptr<time_duration>::Ref endOffset(new time_duration( Ptr<time_duration>::Ref endOffset(new time_duration(
*relativeOffset *relativeOffset
@ -385,26 +411,23 @@ Playlist::addAudioClip(Ptr<AudioClip>::Ref audioClip,
if (*endOffset > *playlength) { if (*endOffset > *playlength) {
setPlaylength(endOffset); setPlaylength(endOffset);
} }
return playlistElement->getId();
} }
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Add a new sub-playlist to the playlist. * Add a new sub-playlist to the playlist.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void Ptr<UniqueId>::Ref
Playlist::addPlaylist(Ptr<Playlist>::Ref playlist, Playlist::addPlaylist(Ptr<Playlist>::Ref playlist,
Ptr<time_duration>::Ref relativeOffset, Ptr<time_duration>::Ref relativeOffset,
Ptr<FadeInfo>::Ref fadeInfo) Ptr<FadeInfo>::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<PlaylistElement>::Ref playlistElement(new PlaylistElement( Ptr<PlaylistElement>::Ref playlistElement(new PlaylistElement(
relativeOffset, playlist, fadeInfo)); relativeOffset, playlist, fadeInfo));
(*elementList)[*relativeOffset] = playlistElement; elementList->insert(std::make_pair(*relativeOffset, playlistElement));
Ptr<time_duration>::Ref endOffset(new time_duration( Ptr<time_duration>::Ref endOffset(new time_duration(
*relativeOffset *relativeOffset
@ -412,6 +435,24 @@ Playlist::addPlaylist(Ptr<Playlist>::Ref playlist,
if (*endOffset > *playlength) { if (*endOffset > *playlength) {
setPlaylength(endOffset); setPlaylength(endOffset);
} }
return playlistElement->getId();
}
/*------------------------------------------------------------------------------
* Get an iterator pointing to a playlist element with a given ID.
*----------------------------------------------------------------------------*/
Playlist::iterator
Playlist::find(Ptr<UniqueId>::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<Playlist>::Ref playlist,
* Change the fade in / fade out info of a playlist element. * Change the fade in / fade out info of a playlist element.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
Playlist::setFadeInfo(Ptr<time_duration>::Ref relativeOffset, Playlist::setFadeInfo(Ptr<UniqueId>::Ref playlistElementId,
Ptr<FadeInfo>::Ref fadeInfo) Ptr<FadeInfo>::Ref fadeInfo)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
PlaylistElementListType::iterator it = elementList->find(*relativeOffset); Playlist::iterator it = this->find(playlistElementId);
if (it == elementList->end()) { if (it == this->end()) {
std::string eMsg = "no playlist element at this relative offset"; throw std::invalid_argument("no playlist element with this ID");
throw std::invalid_argument(eMsg);
} }
it->second->setFadeInfo(fadeInfo); it->second->setFadeInfo(fadeInfo);
@ -438,15 +478,16 @@ Playlist::setFadeInfo(Ptr<time_duration>::Ref relativeOffset,
* Remove a playlist element from the playlist. * Remove a playlist element from the playlist.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
Playlist::removePlaylistElement(Ptr<const time_duration>::Ref relativeOffset) Playlist::removePlaylistElement(Ptr<UniqueId>::Ref playlistElementId)
throw (std::invalid_argument) throw (std::invalid_argument)
{ {
// this returns the number of elements found and erased Playlist::iterator it = this->find(playlistElementId);
if (!elementList->erase(*relativeOffset)) {
std::string eMsg = "no playlist element found " if (it == this->end()) {
"at the specified relative offset"; throw std::invalid_argument("no playlist element with this ID");
throw std::invalid_argument(eMsg);
} }
elementList->erase(it);
} }
@ -454,7 +495,7 @@ Playlist::removePlaylistElement(Ptr<const time_duration>::Ref relativeOffset)
* Validate the playlist. * Validate the playlist.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
bool bool
Playlist::valid(void) throw () Playlist::valid(void) throw ()
{ {
Ptr<time_duration>::Ref runningTime(new time_duration(0,0,0,0)); Ptr<time_duration>::Ref runningTime(new time_duration(0,0,0,0));
Ptr<PlaylistElement>::Ref playlistElement; Ptr<PlaylistElement>::Ref playlistElement;
@ -491,7 +532,7 @@ Playlist::valid(void) throw ()
* Create a saved copy of the playlist. * Create a saved copy of the playlist.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
Playlist::createSavedCopy(void) throw () Playlist::createSavedCopy(void) throw ()
{ {
savedCopy = Ptr<Playlist>::Ref(new Playlist(*this)); savedCopy = Ptr<Playlist>::Ref(new Playlist(*this));
} }
@ -501,7 +542,7 @@ Playlist::createSavedCopy(void) throw ()
* Revert to a saved copy of the playlist. * Revert to a saved copy of the playlist.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
Playlist::revertToSavedCopy(void) throw (std::invalid_argument) Playlist::revertToSavedCopy(void) throw (std::invalid_argument)
{ {
if (savedCopy == 0) { if (savedCopy == 0) {
throw (std::invalid_argument("playlist has no saved copy")); throw (std::invalid_argument("playlist has no saved copy"));
@ -652,7 +693,7 @@ Playlist :: setMetadata(Ptr<const Glib::ustring>::Ref value,
* Return a string containing the essential fields of this object, in XML. * Return a string containing the essential fields of this object, in XML.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<Glib::ustring>::Ref Ptr<Glib::ustring>::Ref
Playlist :: getXmlElementString(void) throw () Playlist :: getXmlElementString(void) const throw ()
{ {
Ptr<Glib::ustring>::Ref xmlString(new Glib::ustring); Ptr<Glib::ustring>::Ref xmlString(new Glib::ustring);
@ -685,7 +726,7 @@ Playlist :: getXmlElementString(void) throw ()
* Return a string containing an XML representation of this playlist. * Return a string containing an XML representation of this playlist.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<Glib::ustring>::Ref Ptr<Glib::ustring>::Ref
Playlist :: getXmlDocumentString() throw () Playlist :: getXmlDocumentString() const throw ()
{ {
Ptr<xmlpp::Document>::Ref localDocument; Ptr<xmlpp::Document>::Ref localDocument;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ 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()); CPPUNIT_ASSERT(it == playlist->end());
try { try {
playlist->removePlaylistElement(relativeOffset); playlist->removePlaylistElement(playlistElement->getId());
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
string eMsg = "removePlaylistElement returned with error: "; string eMsg = "removePlaylistElement returned with error: ";
eMsg += e.what(); eMsg += e.what();
@ -228,10 +228,9 @@ PlaylistTest :: audioClipTest(void)
++it; ++it;
CPPUNIT_ASSERT(it == playlist->end()); CPPUNIT_ASSERT(it == playlist->end());
Ptr<const time_duration>::Ref phonyRelativeOffset( Ptr<UniqueId>::Ref phonyPlaylistElementId(new UniqueId(9999));
new time_duration(0,0,1,0));
try { try {
playlist->removePlaylistElement(phonyRelativeOffset); playlist->removePlaylistElement(phonyPlaylistElementId);
CPPUNIT_FAIL("removePlaylistElement allowed to remove " CPPUNIT_FAIL("removePlaylistElement allowed to remove "
"non-existent audio clip"); "non-existent audio clip");
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
@ -253,12 +252,9 @@ PlaylistTest :: savedCopyTest(void)
} }
playlist->createSavedCopy(); playlist->createSavedCopy();
playlist->removePlaylistElement(Ptr<time_duration>::Ref( playlist->removePlaylistElement(playlist->begin()->second->getId());
new time_duration(0,0,0,0))); playlist->removePlaylistElement(playlist->begin()->second->getId());
playlist->removePlaylistElement(Ptr<time_duration>::Ref( playlist->removePlaylistElement(playlist->begin()->second->getId());
new time_duration(0,0,11,0)));
playlist->removePlaylistElement(Ptr<time_duration>::Ref(
new time_duration(0,0,23,0)));
CPPUNIT_ASSERT(playlist->begin() == playlist->end()); CPPUNIT_ASSERT(playlist->begin() == playlist->end());
try { try {
@ -297,18 +293,21 @@ void
PlaylistTest :: fadeInfoTest(void) PlaylistTest :: fadeInfoTest(void)
throw (CPPUNIT_NS::Exception) throw (CPPUNIT_NS::Exception)
{ {
Playlist::const_iterator it = playlist->begin(); Ptr<PlaylistElement>::Ref playlistElementOne,
playlistElementTwo;
Playlist::const_iterator it = playlist->begin();
CPPUNIT_ASSERT(it != playlist->end()); CPPUNIT_ASSERT(it != playlist->end());
Ptr<PlaylistElement>::Ref playlistElement = it->second; playlistElementOne = it->second;
CPPUNIT_ASSERT(playlistElement->getFadeInfo().get() == 0); CPPUNIT_ASSERT(playlistElementOne->getFadeInfo().get() == 0);
++it; ++it;
CPPUNIT_ASSERT(it != playlist->end()); CPPUNIT_ASSERT(it != playlist->end());
playlistElement = it->second; playlistElementTwo = it->second;
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeIn() CPPUNIT_ASSERT(playlistElementTwo->getFadeInfo()->getFadeIn()
->total_milliseconds() == 2000); ->total_milliseconds() == 2000);
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeOut() CPPUNIT_ASSERT(playlistElementTwo->getFadeInfo()->getFadeOut()
->total_milliseconds() == 1500); ->total_milliseconds() == 1500);
++it; ++it;
CPPUNIT_ASSERT(it != playlist->end()); CPPUNIT_ASSERT(it != playlist->end());
@ -319,37 +318,34 @@ PlaylistTest :: fadeInfoTest(void)
Ptr<time_duration>::Ref fadeOut(new time_duration(0,0,4,0)); Ptr<time_duration>::Ref fadeOut(new time_duration(0,0,4,0));
Ptr<FadeInfo>::Ref fadeInfo(new FadeInfo(fadeIn, fadeOut)); Ptr<FadeInfo>::Ref fadeInfo(new FadeInfo(fadeIn, fadeOut));
Ptr<time_duration>::Ref relativeOffset (new time_duration(0,0,0,0));
try { try {
playlist->setFadeInfo(relativeOffset, fadeInfo); playlist->setFadeInfo(playlistElementOne->getId(), fadeInfo);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
CPPUNIT_FAIL("could not add new fade info"); CPPUNIT_FAIL("could not add new fade info");
} }
relativeOffset.reset(new time_duration(0,0,11,0));
try { try {
playlist->setFadeInfo(relativeOffset, fadeInfo); playlist->setFadeInfo(playlistElementTwo->getId(), fadeInfo);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
CPPUNIT_FAIL("could not update fade info"); CPPUNIT_FAIL("could not update fade info");
} }
it = playlist->begin(); it = playlist->begin();
playlistElement = it->second; playlistElementOne = it->second;
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeIn() CPPUNIT_ASSERT(playlistElementOne->getFadeInfo()->getFadeIn()
->total_milliseconds() == 3200); ->total_milliseconds() == 3200);
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeOut() CPPUNIT_ASSERT(playlistElementOne->getFadeInfo()->getFadeOut()
->total_milliseconds() == 4000); ->total_milliseconds() == 4000);
++it; ++it;
playlistElement = it->second; playlistElementTwo = it->second;
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeIn() CPPUNIT_ASSERT(playlistElementTwo->getFadeInfo()->getFadeIn()
->total_milliseconds() == 3200); ->total_milliseconds() == 3200);
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeOut() CPPUNIT_ASSERT(playlistElementTwo->getFadeInfo()->getFadeOut()
->total_milliseconds() == 4000); ->total_milliseconds() == 4000);
relativeOffset.reset(new time_duration(0,0,7,0));
Ptr<UniqueId>::Ref phonyPlaylistElementId(new UniqueId(9999));
try { try {
playlist->setFadeInfo(relativeOffset, fadeInfo); playlist->setFadeInfo(phonyPlaylistElementId, fadeInfo);
CPPUNIT_FAIL("allowed to set fade info for non-existent element"); CPPUNIT_FAIL("allowed to set fade info for non-existent element");
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
} }
@ -377,3 +373,39 @@ PlaylistTest :: conversionTest(void)
CPPUNIT_ASSERT(!audioClip); CPPUNIT_ASSERT(!audioClip);
} }
/*------------------------------------------------------------------------------
* Marshalling test
*----------------------------------------------------------------------------*/
void
PlaylistTest :: marshallingTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<Playlist>::Ref playlist(new Playlist());
try {
Ptr<xmlpp::DomParser>::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<Playlist>::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());
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.h,v $ 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. * Unit test for the UploadPlaylistMetohd class.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.10 $ * @version $Revision: 1.11 $
* @see Playlist * @see Playlist
*/ */
class PlaylistTest : public CPPUNIT_NS::TestFixture class PlaylistTest : public CPPUNIT_NS::TestFixture
@ -69,6 +69,7 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture
CPPUNIT_TEST(savedCopyTest); CPPUNIT_TEST(savedCopyTest);
CPPUNIT_TEST(fadeInfoTest); CPPUNIT_TEST(fadeInfoTest);
CPPUNIT_TEST(conversionTest); CPPUNIT_TEST(conversionTest);
CPPUNIT_TEST(marshallingTest);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
@ -120,6 +121,14 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture
void void
conversionTest(void) throw (CPPUNIT_NS::Exception); 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: public:

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/XmlRpcTools.cxx,v $ 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"; 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 * 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<UniqueId>::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<UniqueId>::Ref id(new UniqueId(std::string(
xmlRpcValue[playlistElementIdName] )));
return id;
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Extract the audio clip ID from an XML-RPC function call parameter * Extract the audio clip ID from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -243,8 +268,7 @@ XmlRpcTools :: playlistToXmlRpcValue(
XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpc::XmlRpcValue & xmlRpcValue)
throw () throw ()
{ {
xmlRpcValue["id"] = std::string(*playlist->getId()); xmlRpcValue["playlist"] = std::string(*playlist->getXmlDocumentString());
xmlRpcValue["playlength"] = int(playlist->getPlaylength()->total_seconds());
} }
@ -284,9 +308,7 @@ XmlRpcTools :: audioClipToXmlRpcValue(
XmlRpc::XmlRpcValue & xmlRpcValue) XmlRpc::XmlRpcValue & xmlRpcValue)
throw () throw ()
{ {
xmlRpcValue["id"] = std::string(*audioClip->getId()); xmlRpcValue["audioClip"] = std::string(*audioClip->getXmlDocumentString());
xmlRpcValue["playlength"] = int(audioClip->getPlaylength()
->total_seconds());
} }
@ -605,6 +627,19 @@ XmlRpcTools :: playlistIdToXmlRpcValue(
} }
/*------------------------------------------------------------------------------
* Add a playlist element ID to an XmlRpcValue
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: playlistElementIdToXmlRpcValue(
Ptr<const UniqueId>::Ref playlistElementId,
XmlRpc::XmlRpcValue & returnValue)
throw ()
{
returnValue[playlistElementIdName] = std::string(*playlistElementId);
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Add a playtime value to an XmlRpcValue * Add a playtime value to an XmlRpcValue
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/XmlRpcToolsTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/XmlRpcToolsTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -122,7 +122,7 @@ XmlRpcToolsTest :: firstTest(void)
{ {
XmlRpcValue xmlRpcPlaylist; XmlRpcValue xmlRpcPlaylist;
XmlRpcValue xmlRpcAudioClip; XmlRpcValue xmlRpcAudioClip;
Ptr<Playlist>::Ref playlist = Ptr<Playlist>::Ref(new Playlist); Ptr<Playlist>::Ref playlist = Ptr<Playlist>::Ref(new Playlist());
Ptr<const AudioClip>::Ref audioClip; Ptr<const AudioClip>::Ref audioClip;
// set up a playlist instance // set up a playlist instance
@ -133,23 +133,39 @@ XmlRpcToolsTest :: firstTest(void)
XmlRpcTools :: playlistToXmlRpcValue(playlist, xmlRpcPlaylist); XmlRpcTools :: playlistToXmlRpcValue(playlist, xmlRpcPlaylist);
XmlRpcTools :: audioClipToXmlRpcValue(audioClip, xmlRpcAudioClip); XmlRpcTools :: audioClipToXmlRpcValue(audioClip, xmlRpcAudioClip);
CPPUNIT_ASSERT(xmlRpcPlaylist.hasMember("id")); CPPUNIT_ASSERT(xmlRpcPlaylist.hasMember("playlist"));
CPPUNIT_ASSERT(xmlRpcPlaylist["id"].getType() == XmlRpcValue::TypeString); CPPUNIT_ASSERT(xmlRpcPlaylist["playlist"].getType()
CPPUNIT_ASSERT(std::string(xmlRpcPlaylist["id"]) == "0000000000000001"); == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(xmlRpcPlaylist.hasMember("playlength")); Ptr<Playlist>::Ref copyOfPlaylist(new Playlist());
CPPUNIT_ASSERT(xmlRpcPlaylist["playlength"].getType() xmlpp::DomParser parser;
== XmlRpcValue::TypeInt); CPPUNIT_ASSERT_NO_THROW(parser.parse_memory(std::string(
CPPUNIT_ASSERT(int(xmlRpcPlaylist["playlength"]) == 34); 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(*copyOfPlaylist->getId() == *playlist->getId());
CPPUNIT_ASSERT(xmlRpcAudioClip["id"].getType() == XmlRpcValue::TypeString); CPPUNIT_ASSERT(*copyOfPlaylist->getTitle() == *playlist->getTitle());
CPPUNIT_ASSERT(std::string(xmlRpcAudioClip["id"]) == "0000000000010001"); CPPUNIT_ASSERT(*copyOfPlaylist->getPlaylength()
== *playlist->getPlaylength());
CPPUNIT_ASSERT(xmlRpcAudioClip.hasMember("playlength")); CPPUNIT_ASSERT(xmlRpcAudioClip.hasMember("audioClip"));
CPPUNIT_ASSERT(xmlRpcAudioClip["playlength"].getType() CPPUNIT_ASSERT(xmlRpcAudioClip["audioClip"].getType()
== XmlRpcValue::TypeInt); == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(int(xmlRpcAudioClip["playlength"]) == 11);
Ptr<AudioClip>::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; XmlRpcValue xmlRpcPlaylistId;
Ptr<UniqueId>::Ref playlistId(new UniqueId(rand())); Ptr<UniqueId>::Ref playlistId(new UniqueId(rand()));

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -110,7 +110,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<SessionId>::Ref sessionId; Ptr<SessionId>::Ref sessionId;
try{ try{
sessionId = XmlRpcTools::extractSessionId(parameters); sessionId = XmlRpcTools::extractSessionId(parameters);
} catch (XmlRpcException &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+20, XmlRpcTools::markError(errorId+20,
"missing session ID argument", "missing session ID argument",
returnValue); returnValue);
@ -120,7 +120,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<UniqueId>::Ref playlistId; Ptr<UniqueId>::Ref playlistId;
try{ try{
playlistId = XmlRpcTools::extractPlaylistId(parameters); playlistId = XmlRpcTools::extractPlaylistId(parameters);
} catch (XmlRpcException &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+2, "missing playlist ID argument", XmlRpcTools::markError(errorId+2, "missing playlist ID argument",
returnValue); returnValue);
return; return;
@ -129,7 +129,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<UniqueId>::Ref audioClipId; Ptr<UniqueId>::Ref audioClipId;
try{ try{
audioClipId = XmlRpcTools::extractAudioClipId(parameters); audioClipId = XmlRpcTools::extractAudioClipId(parameters);
} catch (XmlRpcException &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+3, "missing audio clip ID argument", XmlRpcTools::markError(errorId+3, "missing audio clip ID argument",
returnValue); returnValue);
return; return;
@ -138,7 +138,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<time_duration>::Ref relativeOffset; Ptr<time_duration>::Ref relativeOffset;
try{ try{
relativeOffset = XmlRpcTools::extractRelativeOffset(parameters); relativeOffset = XmlRpcTools::extractRelativeOffset(parameters);
} catch (XmlRpcException &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+4, "missing relative offset argument", XmlRpcTools::markError(errorId+4, "missing relative offset argument",
returnValue); returnValue);
return; return;
@ -152,7 +152,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
XmlRpcTools::markError(errorId+5, "playlist not found", XmlRpcTools::markError(errorId+5, "playlist not found",
returnValue); returnValue);
return; return;
@ -168,18 +168,21 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<AudioClip>::Ref audioClip; Ptr<AudioClip>::Ref audioClip;
try { try {
audioClip = storage->getAudioClip(sessionId, audioClipId); audioClip = storage->getAudioClip(sessionId, audioClipId);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
XmlRpcTools::markError(errorId+7, "audio clip does not exist", XmlRpcTools::markError(errorId+7, "audio clip does not exist",
returnValue); returnValue);
return; return;
} }
Ptr<UniqueId>::Ref playlistElementId;
try { // and finally, the beef try { // and finally, the beef
playlist->addAudioClip(audioClip, relativeOffset); playlistElementId = playlist->addAudioClip(audioClip, relativeOffset);
} catch(std::invalid_argument &e) { } catch(std::invalid_argument &e) {
XmlRpcTools::markError(errorId+8, XmlRpcTools::markError(errorId+8,
"two audio clips at the same relative offset", "two audio clips at the same relative offset",
returnValue); returnValue);
return; return;
} }
XmlRpcTools::playlistElementIdToXmlRpcValue(playlistElementId, returnValue);
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -76,13 +76,20 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>playlistId - int - the unique id of the playlist.</li> * <li>playlistId - string - the unique id of the playlist.</li>
* <li>audioClipId - int - the unique id of the audio clip to * <li>audioClipId - string - the unique id of the audio clip to
* be added.</li> * be added.</li>
* <li>relativeOffset - int - the number of seconds between the * <li>relativeOffset - int - the number of seconds between the
* start of the playlist and the start of the audio clip.</li> * start of the playlist and the start of the audio clip.</li>
* </ul> * </ul>
* *
* The XML-RPC function returns an XML-RPC structure, containing the following
* fields:
* <ul>
* <li>playlistElementId - string - the unique id of the newly created
* playlist element</li>
* </ul>
*
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
* and a {&nbsp;faultCode, faultString&nbsp;} structure is returned. The * and a {&nbsp;faultCode, faultString&nbsp;} structure is returned. The
* possible errors are: * possible errors are:
@ -99,7 +106,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.9 $ * @version $Revision: 1.10 $
*/ */
class AddAudioClipToPlaylistMethod : public XmlRpc::XmlRpcServerMethod class AddAudioClipToPlaylistMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ 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()); 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.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = "0000000000000001"; parameters["playlistId"] = "0000000000000001";
@ -218,4 +210,7 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void)
<< " - " << e.getMessage(); << " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.hasMember("playlistElementId"));
CPPUNIT_ASSERT(result["playlistElementId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -125,7 +125,7 @@ CreatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<UniqueId>::Ref playlistId; Ptr<UniqueId>::Ref playlistId;
try { try {
playlistId = storage->createPlaylist(sessionId); playlistId = storage->createPlaylist(sessionId);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "could not create playlist:\n"; std::string eMsg = "could not create playlist:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools :: markError(errorId+2, XmlRpcTools :: markError(errorId+2,
@ -137,7 +137,7 @@ CreatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->editPlaylist(sessionId, playlistId); playlist = storage->editPlaylist(sessionId, playlistId);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "could not create playlist:\n"; std::string eMsg = "could not create playlist:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools :: markError(errorId+2, XmlRpcTools :: markError(errorId+2,

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.8 $ Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.h,v $ 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 * The XML-RPC function returns an XML-RPC structure, containing the following
* fields: * fields:
* <ul> * <ul>
* <li>id - int - the unique id of the new playlist</li> * <li>playlist - string - an XML representation of the playlist; this
* <li>playlength - int - the playlist length of the playlist, in seconds * XML element can be used as argument to Playlist::configure()</li>
* </li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -94,7 +93,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.8 $ * @version $Revision: 1.9 $
*/ */
class CreatePlaylistMethod : public XmlRpc::XmlRpcServerMethod class CreatePlaylistMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -185,12 +185,13 @@ CreatePlaylistMethodTest :: firstTest(void)
<< " - " << e.getMessage(); << " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("playlist"));
CPPUNIT_ASSERT(result["id"].getType() == XmlRpc::XmlRpcValue::TypeString); CPPUNIT_ASSERT(result["playlist"].getType()
CPPUNIT_ASSERT(result.hasMember("playlength")); == XmlRpc::XmlRpcValue::TypeString);
CPPUNIT_ASSERT(result["playlength"].getType() Ptr<Playlist>::Ref playlist;
== XmlRpc::XmlRpcValue::TypeInt); CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result)));
CPPUNIT_ASSERT(int(result["playlength"]) == 0); CPPUNIT_ASSERT(playlist->getId()->getId() >= 0);
CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 0);
method.reset(new OpenPlaylistForEditingMethod()); method.reset(new OpenPlaylistForEditingMethod());
parameter.clear(); parameter.clear();

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.11 $ Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethod.cxx,v $ 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<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "playlist not found:\n"; std::string eMsg = "playlist not found:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue); XmlRpcTools::markError(errorId+3, eMsg, returnValue);
@ -138,7 +138,7 @@ DeletePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
storage->deletePlaylist(sessionId, playlistId); storage->deletePlaylist(sessionId, playlistId);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "playlist could not be deleted:\n"; std::string eMsg = "playlist could not be deleted:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+5, eMsg, returnValue); XmlRpcTools::markError(errorId+5, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -74,7 +74,7 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>playlistId - int - the unique id of the playlist * <li>playlistId - string - the unique id of the playlist
* to be deleted.</li> * to be deleted.</li>
* </ul> * </ul>
* *
@ -91,7 +91,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
class DeletePlaylistMethod : public XmlRpc::XmlRpcServerMethod class DeletePlaylistMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -134,7 +134,7 @@ DisplayAudioClipMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<AudioClip>::Ref audioClip; Ptr<AudioClip>::Ref audioClip;
try { try {
audioClip = storage->getAudioClip(sessionId, id); audioClip = storage->getAudioClip(sessionId, id);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "audio clip not found:\n"; std::string eMsg = "audio clip not found:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue); XmlRpcTools::markError(errorId+3, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -75,15 +75,14 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>audioClipId - int - the unique id of the audio clip requested.</li> * <li>audioClipId - string - the unique id of the audio clip requested.</li>
* </ul> * </ul>
* *
* The XML-RPC function returns an XML-RPC structure, containing the following * The XML-RPC function returns an XML-RPC structure, containing the following
* fields: * fields:
* <ul> * <ul>
* <li>id - int - the unique id of the audio clip</li> * <li>audioClip - string - an XML representation of the audio clip; this
* <li>playlength - int - the length of the audio clip, in seconds * XML element can be used as argument to AudioClip::configure()</li>
* </li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -97,7 +96,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.4 $ * @version $Revision: 1.5 $
*/ */
class DisplayAudioClipMethod : public XmlRpc::XmlRpcServerMethod class DisplayAudioClipMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -186,14 +186,13 @@ DisplayAudioClipMethodTest :: firstTest(void)
<< " - " << e.getMessage(); << " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("audioClip"));
CPPUNIT_ASSERT(result["id"].getType() == XmlRpc::XmlRpcValue::TypeString); CPPUNIT_ASSERT(result["audioClip"].getType()
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000010001"); == XmlRpc::XmlRpcValue::TypeString);
Ptr<AudioClip>::Ref audioClip;
CPPUNIT_ASSERT(result.hasMember("playlength")); CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result)));
CPPUNIT_ASSERT(result["playlength"].getType() CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10001);
== XmlRpc::XmlRpcValue::TypeInt); CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 60 * 60);
CPPUNIT_ASSERT(int(result["playlength"]) == 60 * 60);
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -115,7 +115,7 @@ DisplayAudioClipsMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<std::vector<Ptr<UniqueId>::Ref> >::Ref audioClipIds; Ptr<std::vector<Ptr<UniqueId>::Ref> >::Ref audioClipIds;
try { try {
audioClipIds = storage->getAudioClipIds(); audioClipIds = storage->getAudioClipIds();
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "getAudioClipIds returned error:\n"; std::string eMsg = "getAudioClipIds returned error:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+2, eMsg, returnValue); XmlRpcTools::markError(errorId+2, eMsg, returnValue);
@ -128,7 +128,7 @@ DisplayAudioClipsMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
while (it != audioClipIds->end()) { while (it != audioClipIds->end()) {
try { try {
audioClips->push_back(storage->getAudioClip(sessionId, *it)); audioClips->push_back(storage->getAudioClip(sessionId, *it));
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "audio clip not found:\n"; std::string eMsg = "audio clip not found:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue); XmlRpcTools::markError(errorId+3, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethod.h,v $ 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 * 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: * audio clip store is empty. Each structure is as follows:
* <ul> * <ul>
* <li>id - int - the unique id of the audio clip</li> * <li>audioClip - string - an XML representation of the audio clip; this
* <li>playlength - int - the length of the audio clip, in seconds * XML element can be used as argument to AudioClip::configure()</li>
* </li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -99,7 +98,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.5 $ * @version $Revision: 1.6 $
*/ */
class DisplayAudioClipsMethod : public XmlRpc::XmlRpcServerMethod class DisplayAudioClipsMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -172,7 +172,6 @@ DisplayAudioClipsMethodTest :: firstTest(void)
XmlRpc::XmlRpcValue rootParameter; XmlRpc::XmlRpcValue rootParameter;
rootParameter.setSize(1); rootParameter.setSize(1);
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
XmlRpc::XmlRpcValue audioClip;
result.clear(); result.clear();
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();
@ -187,26 +186,21 @@ DisplayAudioClipsMethodTest :: firstTest(void)
} }
CPPUNIT_ASSERT(result.size() >= 2); CPPUNIT_ASSERT(result.size() >= 2);
audioClip = result[0]; XmlRpc::XmlRpcValue result0 = result[0];
CPPUNIT_ASSERT(audioClip.hasMember("id")); CPPUNIT_ASSERT(result0.hasMember("audioClip"));
CPPUNIT_ASSERT(audioClip["id"].getType() CPPUNIT_ASSERT(result0["audioClip"].getType()
== XmlRpc::XmlRpcValue::TypeString); == XmlRpc::XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(audioClip["id"]) == "0000000000010001"); Ptr<AudioClip>::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")); XmlRpc::XmlRpcValue result1 = result[1];
CPPUNIT_ASSERT(audioClip["playlength"].getType() CPPUNIT_ASSERT(result1.hasMember("audioClip"));
== XmlRpc::XmlRpcValue::TypeInt); CPPUNIT_ASSERT(result1["audioClip"].getType()
CPPUNIT_ASSERT(int(audioClip["playlength"]) == 60 * 60);
audioClip = result[1];
CPPUNIT_ASSERT(audioClip.hasMember("id"));
CPPUNIT_ASSERT(audioClip["id"].getType()
== XmlRpc::XmlRpcValue::TypeString); == XmlRpc::XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(audioClip["id"]) == "0000000000010002"); CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result1)));
CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10002);
CPPUNIT_ASSERT(audioClip.hasMember("playlength")); CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 30 * 60);
CPPUNIT_ASSERT(audioClip["playlength"].getType()
== XmlRpc::XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(audioClip["playlength"]) == 30 * 60);
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -134,7 +134,7 @@ DisplayPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->getPlaylist(sessionId, id); playlist = storage->getPlaylist(sessionId, id);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "playlist not found:\n"; std::string eMsg = "playlist not found:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue); XmlRpcTools::markError(errorId+3, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -75,15 +75,14 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>playlistId - int - the unique id of the playlist requested.</li> * <li>playlistId - string - the unique id of the playlist requested.</li>
* </ul> * </ul>
* *
* The XML-RPC function returns an XML-RPC structure, containing the following * The XML-RPC function returns an XML-RPC structure, containing the following
* fields: * fields:
* <ul> * <ul>
* <li>id - int - the unique id of the playlist</li> * <li>playlist - string - an XML representation of the playlist; this
* <li>playlength - int - the playlist length of the playlist, in seconds * XML element can be used as argument to Playlist::configure()</li>
* </li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -97,7 +96,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
class DisplayPlaylistMethod : public XmlRpc::XmlRpcServerMethod class DisplayPlaylistMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -186,13 +186,13 @@ DisplayPlaylistMethodTest :: firstTest(void)
<< " - " << e.getMessage(); << " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("playlist"));
CPPUNIT_ASSERT(result["id"].getType() == XmlRpc::XmlRpcValue::TypeString); CPPUNIT_ASSERT(result["playlist"].getType()
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000000001"); == XmlRpc::XmlRpcValue::TypeString);
CPPUNIT_ASSERT(result.hasMember("playlength")); Ptr<Playlist>::Ref playlist;
CPPUNIT_ASSERT(result["playlength"].getType() CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result)));
== XmlRpc::XmlRpcValue::TypeInt); CPPUNIT_ASSERT(playlist->getId()->getId() == 1);
CPPUNIT_ASSERT(int(result["playlength"]) == 90 * 60); CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60);
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethod.cxx,v $ 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(); playlistIds = storage->getPlaylistIds();
//std::cerr << "\nplaylistIds: " << playlistIds << "\n" //std::cerr << "\nplaylistIds: " << playlistIds << "\n"
// << "size: " << playlistIds->size() << "n"; // << "size: " << playlistIds->size() << "n";
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "getPlaylistsIds() returned error:\n"; std::string eMsg = "getPlaylistsIds() returned error:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+2, eMsg, returnValue); XmlRpcTools::markError(errorId+2, eMsg, returnValue);
@ -131,7 +131,7 @@ DisplayPlaylistsMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
while (it != playlistIds->end()) { while (it != playlistIds->end()) {
try { try {
playlists->push_back(storage->getPlaylist(sessionId, *it)); playlists->push_back(storage->getPlaylist(sessionId, *it));
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "audio clip not found:\n"; std::string eMsg = "audio clip not found:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue); XmlRpcTools::markError(errorId+3, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.7 $ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h,v $ 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 * for each playlist in the playlist store. An array of size 0 means the
* playlist store is empty. Each structure is as follows: * playlist store is empty. Each structure is as follows:
* <ul> * <ul>
* <li>id - int - the unique id of the playlist</li> * <li>playlist - string - an XML representation of the playlist; this
* <li>playlength - int - the playlist length of the playlist, in seconds * XML element can be used as argument to Playlist::configure()</li>
* </li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -99,7 +98,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.7 $ * @version $Revision: 1.8 $
*/ */
class DisplayPlaylistsMethod : public XmlRpc::XmlRpcServerMethod class DisplayPlaylistsMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx,v $ 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_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result.size() == 1);
XmlRpc::XmlRpcValue playlist = result[0]; XmlRpc::XmlRpcValue result0 = result[0];
CPPUNIT_ASSERT(playlist.hasMember("id")); CPPUNIT_ASSERT(result0.hasMember("playlist"));
CPPUNIT_ASSERT(playlist["id"].getType() == XmlRpc::XmlRpcValue::TypeString); CPPUNIT_ASSERT(result0["playlist"].getType()
CPPUNIT_ASSERT(std::string(playlist["id"]) == "0000000000000001"); == XmlRpc::XmlRpcValue::TypeString);
Ptr<Playlist>::Ref playlist;
CPPUNIT_ASSERT(playlist.hasMember("playlength")); CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result0)));
CPPUNIT_ASSERT(playlist["playlength"].getType() CPPUNIT_ASSERT(playlist->getId()->getId() == 1);
== XmlRpc::XmlRpcValue::TypeInt); CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60);
CPPUNIT_ASSERT(int(playlist["playlength"]) == 90 * 60);
} }

View File

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $ Author : $Author: fgerlits $
Version : $Revision: 1.7 $ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayScheduleMethod.h,v $ 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: * are not scheduled entries. Each structure is as follows:
* <ul> * <ul>
* <li>id - int - the id of the scheduled entry</li> * <li>id - int - the id of the scheduled entry</li>
* <li>playlistId - int - the id of the playlist associated with the entry * <li>playlistId - string - the id of the playlist associated with the entry
* </li> * </li>
* <li>start - datetime - the start of the scheduled item</li> * <li>start - datetime - the start of the scheduled item</li>
* <li>end - datetime - the end of the scheduled item</li> * <li>end - datetime - the end of the scheduled item</li>
@ -106,8 +106,8 @@ using namespace LiveSupport::Core;
* <li>1120 - missing session ID argument </li> * <li>1120 - missing session ID argument </li>
* </ul> * </ul>
* *
* @author $Author: maroy $ * @author $Author: fgerlits $
* @version $Revision: 1.7 $ * @version $Revision: 1.8 $
*/ */
class DisplayScheduleMethod : public XmlRpc::XmlRpcServerMethod class DisplayScheduleMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GeneratePlayReportMethod.h,v $ 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 * 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: * are no play log entries. Each structure is as follows:
* <ul> * <ul>
* <li>audioClipId - int - the id of the audio clip played </li> * <li>audioClipId - string - the id of the audio clip played </li>
* <li>timestamp - datetime - the time the clip was played (started) </li> * <li>timestamp - datetime - the time the clip was played (started)</li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -104,7 +104,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.5 $ * @version $Revision: 1.6 $
*/ */
class GeneratePlayReportMethod : public XmlRpc::XmlRpcServerMethod class GeneratePlayReportMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GetVersionMethod.h,v $ 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 * The XML-RPC function returns an XML-RPC structure, containing the following
* fields: * fields:
* <ul> * <ul>
* <li>version - string - the version string of the Scheduler Daemon * <li>version - string - the version string of the Scheduler Daemon </li>
* </li>
* </ul> * </ul>
* *
* There are no possible internal error condititons for this function. * There are no possible internal error condititons for this function.
* *
* @author $Author: maroy $ * @author $Author: fgerlits $
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
*/ */
class GetVersionMethod : public XmlRpc::XmlRpcServerMethod class GetVersionMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/LoginMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/LoginMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -89,7 +89,7 @@ LoginMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<std::string>::Ref loginName; Ptr<std::string>::Ref loginName;
try{ try{
loginName = XmlRpcTools::extractLoginName(parameters); loginName = XmlRpcTools::extractLoginName(parameters);
} catch (XmlRpcException &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+2, "missing login argument", XmlRpcTools::markError(errorId+2, "missing login argument",
returnValue); returnValue);
return; return;
@ -98,7 +98,7 @@ LoginMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<std::string>::Ref password; Ptr<std::string>::Ref password;
try{ try{
password = XmlRpcTools::extractPassword(parameters); password = XmlRpcTools::extractPassword(parameters);
} catch (XmlRpcException &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+3, "missing password argument", XmlRpcTools::markError(errorId+3, "missing password argument",
returnValue); returnValue);
return; return;
@ -112,7 +112,7 @@ LoginMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<SessionId>::Ref sessionId; Ptr<SessionId>::Ref sessionId;
try { try {
sessionId = authentication->login(*loginName, *password); sessionId = authentication->login(*loginName, *password);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "authentication login() returned error:\n"; std::string eMsg = "authentication login() returned error:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+4, eMsg, returnValue); XmlRpcTools::markError(errorId+4, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/LogoutMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/LogoutMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -89,7 +89,7 @@ LogoutMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<SessionId>::Ref sessionId; Ptr<SessionId>::Ref sessionId;
try{ try{
sessionId = XmlRpcTools::extractSessionId(parameters); sessionId = XmlRpcTools::extractSessionId(parameters);
} catch (XmlRpcException &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+20, "missing logout argument", XmlRpcTools::markError(errorId+20, "missing logout argument",
returnValue); returnValue);
return; return;
@ -102,7 +102,7 @@ LogoutMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
authentication->logout(sessionId); authentication->logout(sessionId);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "authentication logout() returned error:\n"; std::string eMsg = "authentication logout() returned error:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+4, eMsg, returnValue); XmlRpcTools::markError(errorId+4, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -135,7 +135,7 @@ OpenPlaylistForEditingMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->editPlaylist(sessionId, id); playlist = storage->editPlaylist(sessionId, id);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "could not open playlist for editing:\n"; std::string eMsg = "could not open playlist for editing:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+4, eMsg, returnValue); XmlRpcTools::markError(errorId+4, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -76,15 +76,14 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>playlistId - int - the unique id of the playlist requested.</li> * <li>playlistId - string - the unique id of the playlist requested.</li>
* </ul> * </ul>
* *
* The XML-RPC function returns an XML-RPC structure, containing the following * The XML-RPC function returns an XML-RPC structure, containing the following
* fields: * fields:
* <ul> * <ul>
* <li>id - int - the unique id of the playlist</li> * <li>playlist - string - an XML representation of the playlist; this
* <li>playlength - int - the playlist length of the playlist, in seconds * XML element can be used as argument to Playlist::configure()</li>
* </li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -97,7 +96,7 @@ using namespace LiveSupport::Core;
* <li>120 - missing session ID argument </li> * <li>120 - missing session ID argument </li>
* </ul> * </ul>
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.10 $ * @version $Revision: 1.11 $
*/ */
class OpenPlaylistForEditingMethod : public XmlRpc::XmlRpcServerMethod class OpenPlaylistForEditingMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -187,14 +187,13 @@ OpenPlaylistForEditingMethodTest :: firstTest(void)
<< " - " << e.getMessage(); << " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str()); CPPUNIT_FAIL(eMsg.str());
} }
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("playlist"));
CPPUNIT_ASSERT(result["id"].getType() == XmlRpc::XmlRpcValue::TypeString); CPPUNIT_ASSERT(result["playlist"].getType()
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000000001"); == XmlRpc::XmlRpcValue::TypeString);
Ptr<Playlist>::Ref playlist;
CPPUNIT_ASSERT(result.hasMember("playlength")); CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result)));
CPPUNIT_ASSERT(result["playlength"].getType() CPPUNIT_ASSERT(playlist->getId()->getId() == 1);
== XmlRpc::XmlRpcValue::TypeInt); CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60);
CPPUNIT_ASSERT(int(result["playlength"]) == 90 * 60);
parameter.clear(); parameter.clear();
parameter["sessionId"] = sessionId->getId(); parameter["sessionId"] = sessionId->getId();

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.12 $ Version : $Revision: 1.13 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -106,9 +106,9 @@ RemoveAudioClipFromPlaylistMethod :: execute(
returnValue); returnValue);
return; return;
} }
XmlRpc::XmlRpcValue parameters = rootParameter[0]; XmlRpc::XmlRpcValue parameters = rootParameter[0];
Ptr<SessionId>::Ref sessionId; Ptr<SessionId>::Ref sessionId;
try{ try{
sessionId = XmlRpcTools::extractSessionId(parameters); sessionId = XmlRpcTools::extractSessionId(parameters);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
@ -118,7 +118,7 @@ RemoveAudioClipFromPlaylistMethod :: execute(
return; return;
} }
Ptr<UniqueId>::Ref playlistId; Ptr<UniqueId>::Ref playlistId;
try{ try{
playlistId = XmlRpcTools::extractPlaylistId(parameters); playlistId = XmlRpcTools::extractPlaylistId(parameters);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
@ -128,12 +128,12 @@ RemoveAudioClipFromPlaylistMethod :: execute(
return; return;
} }
Ptr<time_duration>::Ref relativeOffset; Ptr<UniqueId>::Ref playlistElementId;
try{ try{
relativeOffset = XmlRpcTools::extractRelativeOffset(parameters); playlistElementId = XmlRpcTools::extractPlaylistElementId(parameters);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+3, XmlRpcTools::markError(errorId+3,
"missing relative offset argument", "missing playlist element ID argument",
returnValue); returnValue);
return; return;
} }
@ -146,7 +146,7 @@ RemoveAudioClipFromPlaylistMethod :: execute(
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "playlist does not exist:\n"; std::string eMsg = "playlist does not exist:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+4, eMsg, returnValue); XmlRpcTools::markError(errorId+4, eMsg, returnValue);
@ -161,7 +161,7 @@ RemoveAudioClipFromPlaylistMethod :: execute(
} }
try { // and finally, the beef try { // and finally, the beef
playlist->removePlaylistElement(relativeOffset); playlist->removePlaylistElement(playlistElementId);
} catch(std::invalid_argument &e) { } catch(std::invalid_argument &e) {
XmlRpcTools::markError(errorId+6, XmlRpcTools::markError(errorId+6,
"no audio clip at the specified " "no audio clip at the specified "

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -76,10 +76,9 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>playlistId - int - the unique id of the playlist.</li> * <li>playlistId - string - the unique id of the playlist.</li>
* <li>relativeOffset - int - the number of seconds between the * <li>playlistElementId - string - the unique id of the playlist element
* start of the playlist and the start of the audio clip * to be removed.</li>
* to be removed.</li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -95,7 +94,7 @@ using namespace LiveSupport::Core;
* <li>420 - missing session ID argument </li> * <li>420 - missing session ID argument </li>
* </ul> * </ul>
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.4 $ * @version $Revision: 1.5 $
*/ */
class RemoveAudioClipFromPlaylistMethod : public XmlRpc::XmlRpcServerMethod class RemoveAudioClipFromPlaylistMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.12 $ Version : $Revision: 1.13 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -183,11 +183,12 @@ RemoveAudioClipFromPlaylistMethodTest :: firstTest(void)
rootParameter.setSize(1); rootParameter.setSize(1);
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = "0000000000000001"; parameters["playlistId"] = "0000000000000001";
parameters["audioClipId"] = "0000000000010001"; parameters["audioClipId"] = "0000000000010001";
parameters["relativeOffset"] = 90*60; parameters["relativeOffset"] = 60*60;
rootParameter[0] = parameters; parameters["playlistElementId"] = "0000000000009999";
rootParameter[0] = parameters;
result.clear(); result.clear();
try { try {
@ -212,7 +213,7 @@ RemoveAudioClipFromPlaylistMethodTest :: firstTest(void)
removeAudioClipMethod->execute(rootParameter, result); removeAudioClipMethod->execute(rootParameter, result);
CPPUNIT_FAIL("allowed to remove non-existent audio clip from playlist"); CPPUNIT_FAIL("allowed to remove non-existent audio clip from playlist");
} catch (XmlRpc::XmlRpcException &e) { } 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(); result.clear();
@ -224,6 +225,16 @@ RemoveAudioClipFromPlaylistMethodTest :: firstTest(void)
<< " - " << e.getMessage(); << " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str()); 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(); result.clear();
try { try {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveFromScheduleMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveFromScheduleMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -75,7 +75,8 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>scheduleEntryId - int - the id of the scheduled entry to remove</li> * <li>scheduleEntryId - string - the id of the scheduled entry
* to remove</li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -89,7 +90,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
class RemoveFromScheduleMethod : public XmlRpc::XmlRpcServerMethod class RemoveFromScheduleMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RescheduleMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RescheduleMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -75,8 +75,8 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>scheduleEntryId - int - the id of the schedule entry to reschedule * <li>scheduleEntryId - string - the id of the schedule entry
* </li> * to reschedule </li>
* <li>playtime - datetime - the new playing time for the entry</li> * <li>playtime - datetime - the new playing time for the entry</li>
* </ul> * </ul>
* *
@ -93,7 +93,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
class RescheduleMethod : public XmlRpc::XmlRpcServerMethod class RescheduleMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ResetStorageMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ResetStorageMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -90,7 +90,7 @@ ResetStorageMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
storage->reset(); storage->reset();
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "storage reset() returned error:\n"; std::string eMsg = "storage reset() returned error:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+1, eMsg, returnValue); XmlRpcTools::markError(errorId+1, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ResetStorageMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ResetStorageMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -67,7 +67,6 @@ ResetStorageMethodTest :: tearDown(void) throw ()
{ {
} }
#include <iostream>
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Just a very simple smoke test * Just a very simple smoke test
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -99,7 +98,7 @@ ResetStorageMethodTest :: firstTest(void)
result.clear(); result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("displayPlaylist", parameters, result)); CPPUNIT_ASSERT(xmlRpcClient.execute("displayPlaylist", parameters, result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("playlist"));
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId; parameters["sessionId"] = sessionId;
@ -135,7 +134,7 @@ ResetStorageMethodTest :: firstTest(void)
result.clear(); result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("displayPlaylist", parameters, result)); CPPUNIT_ASSERT(xmlRpcClient.execute("displayPlaylist", parameters, result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("playlist"));
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId; parameters["sessionId"] = sessionId;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -130,7 +130,7 @@ RevertEditedPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->getPlaylist(sessionId, id); playlist = storage->getPlaylist(sessionId, id);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "playlist not found:\n"; std::string eMsg = "playlist not found:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue); XmlRpcTools::markError(errorId+3, eMsg, returnValue);
@ -139,7 +139,7 @@ RevertEditedPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
playlist->revertToSavedCopy(); playlist->revertToSavedCopy();
} catch (std::logic_error) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+4, "could not revert playlist", XmlRpcTools::markError(errorId+4, "could not revert playlist",
returnValue); returnValue);
return; return;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -76,7 +76,7 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>playlistId - int - the unique id of the playlist requested.</li> * <li>playlistId - string - the unique id of the playlist to revert.</li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -90,7 +90,7 @@ using namespace LiveSupport::Core;
* <li>820 - missing session ID argument </li> * <li>820 - missing session ID argument </li>
* </ul> * </ul>
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.4 $ * @version $Revision: 1.5 $
*/ */
class RevertEditedPlaylistMethod : public XmlRpc::XmlRpcServerMethod class RevertEditedPlaylistMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

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

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.12 $ Version : $Revision: 1.13 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -119,14 +119,7 @@ RpcAddAudioClipToPlaylistTest :: firstTest(void)
result.clear(); result.clear();
xmlRpcClient.execute("openPlaylistForEditing", parameters, result); xmlRpcClient.execute("openPlaylistForEditing", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("id"));
CPPUNIT_ASSERT(result["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.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = "0000000000000001"; parameters["playlistId"] = "0000000000000001";

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -115,12 +115,13 @@ RpcCreatePlaylistTest :: firstTest(void)
result.clear(); result.clear();
xmlRpcClient.execute("createPlaylist", parameters, result); xmlRpcClient.execute("createPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("playlist"));
CPPUNIT_ASSERT(result["id"].getType() == XmlRpc::XmlRpcValue::TypeString); CPPUNIT_ASSERT(result["playlist"].getType()
CPPUNIT_ASSERT(result.hasMember("playlength")); == XmlRpc::XmlRpcValue::TypeString);
CPPUNIT_ASSERT(result["playlength"].getType() Ptr<Playlist>::Ref playlist;
== XmlRpc::XmlRpcValue::TypeInt); CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result)));
CPPUNIT_ASSERT(int(result["playlength"]) == 0); CPPUNIT_ASSERT(playlist->getId()->getId() >= 0);
CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 0);
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.8 $ Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx,v $ 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); xmlRpcClient.execute("displayAudioClip", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("audioClip"));
CPPUNIT_ASSERT(result["id"].getType() == XmlRpcValue::TypeString); CPPUNIT_ASSERT(result["audioClip"].getType()
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000010001"); == XmlRpc::XmlRpcValue::TypeString);
Ptr<AudioClip>::Ref audioClip;
CPPUNIT_ASSERT(result.hasMember("playlength")); CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result)));
CPPUNIT_ASSERT(result["playlength"].getType() == XmlRpcValue::TypeInt); CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10001);
CPPUNIT_ASSERT(int(result["playlength"]) == 60 * 60); CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 60 * 60);
xmlRpcClient.close(); xmlRpcClient.close();
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx,v $ 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(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.size() >= 2); CPPUNIT_ASSERT(result.size() >= 2);
XmlRpc::XmlRpcValue audioClip = result[0]; XmlRpc::XmlRpcValue result0 = result[0];
CPPUNIT_ASSERT(audioClip.hasMember("id")); CPPUNIT_ASSERT(result0.hasMember("audioClip"));
CPPUNIT_ASSERT(audioClip["id"].getType() == XmlRpcValue::TypeString); CPPUNIT_ASSERT(result0["audioClip"].getType()
CPPUNIT_ASSERT(std::string(audioClip["id"]) == "0000000000010001"); == XmlRpc::XmlRpcValue::TypeString);
Ptr<AudioClip>::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")); XmlRpc::XmlRpcValue result1 = result[1];
CPPUNIT_ASSERT(audioClip["playlength"].getType() == XmlRpcValue::TypeInt); CPPUNIT_ASSERT(result1.hasMember("audioClip"));
CPPUNIT_ASSERT(int(audioClip["playlength"]) == 60 * 60); CPPUNIT_ASSERT(result1["audioClip"].getType()
== XmlRpc::XmlRpcValue::TypeString);
audioClip = result[1]; CPPUNIT_ASSERT_NO_THROW(audioClip.reset(new AudioClip(result1)));
CPPUNIT_ASSERT(audioClip.hasMember("id")); CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10002);
CPPUNIT_ASSERT(audioClip["id"].getType() == XmlRpcValue::TypeString); CPPUNIT_ASSERT(audioClip->getPlaylength()->total_seconds() == 30 * 60);
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);
xmlRpcClient.close(); xmlRpcClient.close();
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.11 $ Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -117,13 +117,14 @@ RpcDisplayPlaylistTest :: simpleTest(void)
result.clear(); result.clear();
xmlRpcClient.execute("displayPlaylist", parameters, result); xmlRpcClient.execute("displayPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("id"));
CPPUNIT_ASSERT(result["id"].getType() == XmlRpcValue::TypeString); CPPUNIT_ASSERT(result.hasMember("playlist"));
CPPUNIT_ASSERT(result.hasMember("playlength")); CPPUNIT_ASSERT(result["playlist"].getType()
CPPUNIT_ASSERT(result["playlength"].getType() == XmlRpcValue::TypeInt); == XmlRpc::XmlRpcValue::TypeString);
Ptr<Playlist>::Ref playlist;
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000000001"); CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result)));
CPPUNIT_ASSERT(int(result["playlength"]) == 90 * 60); CPPUNIT_ASSERT(playlist->getId()->getId() == 1);
CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60);
xmlRpcClient.close(); xmlRpcClient.close();
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.8 $ Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx,v $ 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(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result.size() == 1);
XmlRpc::XmlRpcValue playlist = result[0]; XmlRpc::XmlRpcValue result0 = result[0];
CPPUNIT_ASSERT(playlist.hasMember("id")); CPPUNIT_ASSERT(result0.hasMember("playlist"));
CPPUNIT_ASSERT(playlist["id"].getType() == XmlRpcValue::TypeString); CPPUNIT_ASSERT(result0["playlist"].getType()
CPPUNIT_ASSERT(std::string(playlist["id"]) == "0000000000000001"); == XmlRpc::XmlRpcValue::TypeString);
Ptr<Playlist>::Ref playlist;
CPPUNIT_ASSERT(playlist.hasMember("playlength")); CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result0)));
CPPUNIT_ASSERT(playlist["playlength"].getType() == XmlRpcValue::TypeInt); CPPUNIT_ASSERT(playlist->getId()->getId() == 1);
CPPUNIT_ASSERT(int(playlist["playlength"]) == 90 * 60); CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60);
xmlRpcClient.close(); xmlRpcClient.close();
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcOpenPlaylistForEditingTest.cxx,v $ 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", CPPUNIT_ASSERT(xmlRpcClient.execute("openPlaylistForEditing",
parameters, result)); parameters, result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("id")); CPPUNIT_ASSERT(result.hasMember("playlist"));
CPPUNIT_ASSERT(result["id"].getType() == XmlRpc::XmlRpcValue::TypeString); CPPUNIT_ASSERT(result["playlist"].getType()
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000000001"); == XmlRpc::XmlRpcValue::TypeString);
Ptr<Playlist>::Ref playlist;
CPPUNIT_ASSERT(result.hasMember("playlength")); CPPUNIT_ASSERT_NO_THROW(playlist.reset(new Playlist(result)));
CPPUNIT_ASSERT(result["playlength"].getType() CPPUNIT_ASSERT(playlist->getId()->getId() == 1);
== XmlRpc::XmlRpcValue::TypeInt); CPPUNIT_ASSERT(playlist->getPlaylength()->total_seconds() == 90 * 60);
CPPUNIT_ASSERT(int(result["playlength"]) == 90 * 60);
parameters.clear(); parameters.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveAudioClipFromPlaylistTest.cxx,v $ 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); XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = "0000000000000001"; parameters["playlistId"] = "0000000000000001";
parameters["audioClipId"] = "0000000000010001"; parameters["audioClipId"] = "0000000000010001";
parameters["relativeOffset"] = 90*60; parameters["relativeOffset"] = 60*60;
parameters["playlistElementId"] = "0000000000009999";
result.clear(); result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist", CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist",
@ -143,6 +144,15 @@ RpcRemoveAudioClipFromPlaylistTest :: firstTest(void)
CPPUNIT_ASSERT(xmlRpcClient.execute("addAudioClipToPlaylist", CPPUNIT_ASSERT(xmlRpcClient.execute("addAudioClipToPlaylist",
parameters, result)); parameters, result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); 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(); result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist", CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist",

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRevertEditedPlaylistTest.cxx,v $ 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); XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = "0000000000000001"; parameters["playlistId"] = "0000000000000001";
parameters["relativeOffset"] = 0; parameters["playlistElementId"] = "0000000000000101";
CPPUNIT_ASSERT(xmlRpcClient.execute("revertEditedPlaylist", CPPUNIT_ASSERT(xmlRpcClient.execute("revertEditedPlaylist",
parameters, result)); parameters, result));

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUpdateFadeInFadeOutTest.cxx,v $ 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); XmlRpc::XmlRpcClient xmlRpcClient("localhost", 3344, "/RPC2", false);
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = "0000000000000001"; parameters["playlistId"] = "0000000000000001";
parameters["relativeOffset"] = 90*60; parameters["playlistElementId"] = "0000000000009999";
parameters["fadeIn"] = 0; parameters["fadeIn"] = 0;
result.clear(); result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("updateFadeInFadeOut", CPPUNIT_ASSERT(xmlRpcClient.execute("updateFadeInFadeOut",
@ -146,9 +146,9 @@ RpcUpdateFadeInFadeOutTest :: firstTest(void)
xmlRpcClient.isFault()); xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("faultCode")); CPPUNIT_ASSERT(result.hasMember("faultCode"));
CPPUNIT_ASSERT(int(result["faultCode"]) == 1608); 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(); result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("updateFadeInFadeOut", CPPUNIT_ASSERT(xmlRpcClient.execute("updateFadeInFadeOut",

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcValidatePlaylistTest.cxx,v $ 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"])); CPPUNIT_ASSERT(bool(result["valid"]));
result.clear(); result.clear();
parameters["relativeOffset"] = 0; parameters["playlistElementId"] = "0000000000000101";
CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist", CPPUNIT_ASSERT(xmlRpcClient.execute("removeAudioClipFromPlaylist",
parameters, result)); parameters, result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(!xmlRpcClient.isFault());

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -130,7 +130,7 @@ SavePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->getPlaylist(sessionId, id); playlist = storage->getPlaylist(sessionId, id);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "playlist not found:\n"; std::string eMsg = "playlist not found:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue); XmlRpcTools::markError(errorId+3, eMsg, returnValue);
@ -141,7 +141,7 @@ SavePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
storage->savePlaylist(sessionId, playlist); storage->savePlaylist(sessionId, playlist);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "could not save playlist:\n"; std::string eMsg = "could not save playlist:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+5, eMsg, returnValue); XmlRpcTools::markError(errorId+5, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -77,7 +77,7 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>playlistId - int - the unique id of the playlist to save.</li> * <li>playlistId - string - the unique id of the playlist to save.</li>
* </ul> * </ul>
* *
* In case of an error, a standard XML-RPC fault response is generated, * In case of an error, a standard XML-RPC fault response is generated,
@ -91,7 +91,7 @@ using namespace LiveSupport::Core;
* <li>720 - missing session ID argument </li> * <li>720 - missing session ID argument </li>
* </ul> * </ul>
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
class SavePlaylistMethod : public XmlRpc::XmlRpcServerMethod class SavePlaylistMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -108,35 +108,29 @@ UpdateFadeInFadeOutMethod :: execute(
returnValue); returnValue);
return; return;
} }
XmlRpc::XmlRpcValue parameters = rootParameter[0]; XmlRpc::XmlRpcValue parameters = rootParameter[0];
Ptr<SessionId>::Ref sessionId; Ptr<SessionId>::Ref sessionId;
try{ try{
sessionId = XmlRpcTools::extractSessionId(parameters); sessionId = XmlRpcTools::extractSessionId(parameters);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+20, XmlRpcTools::markError(errorId+20, e.what(), returnValue);
"missing session ID argument",
returnValue);
return; return;
} }
Ptr<UniqueId>::Ref playlistId; Ptr<UniqueId>::Ref playlistId;
try{ try{
playlistId = XmlRpcTools::extractPlaylistId(parameters); playlistId = XmlRpcTools::extractPlaylistId(parameters);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+2, XmlRpcTools::markError(errorId+2, e.what(), returnValue);
"missing playlist ID argument",
returnValue);
return; return;
} }
Ptr<time_duration>::Ref relativeOffset; Ptr<UniqueId>::Ref playlistElementId;
try{ try{
relativeOffset = XmlRpcTools::extractRelativeOffset(parameters); playlistElementId = XmlRpcTools::extractPlaylistElementId(parameters);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+3, XmlRpcTools::markError(errorId+3, e.what(), returnValue);
"missing relative offset argument",
returnValue);
return; return;
} }
@ -144,9 +138,7 @@ UpdateFadeInFadeOutMethod :: execute(
try{ try{
fadeIn = XmlRpcTools::extractFadeIn(parameters); fadeIn = XmlRpcTools::extractFadeIn(parameters);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+4, XmlRpcTools::markError(errorId+4, e.what(), returnValue);
"missing fade in argument",
returnValue);
return; return;
} }
@ -154,9 +146,7 @@ UpdateFadeInFadeOutMethod :: execute(
try{ try{
fadeOut = XmlRpcTools::extractFadeOut(parameters); fadeOut = XmlRpcTools::extractFadeOut(parameters);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
XmlRpcTools::markError(errorId+5, XmlRpcTools::markError(errorId+5, e.what(), returnValue);
"missing fade out argument",
returnValue);
return; return;
} }
@ -168,28 +158,23 @@ UpdateFadeInFadeOutMethod :: execute(
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "playlist does not exist:\n"; XmlRpcTools::markError(errorId+6, e.what(), returnValue);
eMsg += e.what();
XmlRpcTools::markError(errorId+6, eMsg, returnValue);
return; return;
} }
if (!playlist->isLocked()) { if (!playlist->isLocked()) {
XmlRpcTools::markError(errorId+7, XmlRpcTools::markError(errorId+7,
"playlist has not been opened for editing", "playlist has not been opened for editing",
returnValue); returnValue);
return; return;
} }
Ptr<FadeInfo>::Ref fadeInfo(new FadeInfo(fadeIn, fadeOut)); Ptr<FadeInfo>::Ref fadeInfo(new FadeInfo(fadeIn, fadeOut));
try { // and finally, the beef try { // and finally, the beef
playlist->setFadeInfo(relativeOffset, fadeInfo); playlist->setFadeInfo(playlistElementId, fadeInfo);
} catch(std::invalid_argument &e) { } catch(std::invalid_argument &e) {
XmlRpcTools::markError(errorId+8, XmlRpcTools::markError(errorId+8, e.what(), returnValue);
"no audio clip at the specified "
"relative offset",
returnValue);
return; return;
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -76,10 +76,9 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>playlistId - int - the unique id of the playlist.</li> * <li>playlistId - string - the unique ID of the playlist.</li>
* <li>relativeOffset - int - the number of seconds between the * <li>playlistElementId - string - the unique ID of the playlist element
* start of the playlist and the start of the audio clip * to be removed.</li>
* to be removed.</li>
* <li>fadeIn - int - the length (in milliseconds) of the fade in. </li> * <li>fadeIn - int - the length (in milliseconds) of the fade in. </li>
* <li>fadeOut - int - the length (in milliseconds) of the fade out. </li> * <li>fadeOut - int - the length (in milliseconds) of the fade out. </li>
* </ul> * </ul>
@ -90,16 +89,16 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>1601 - invalid argument format </li> * <li>1601 - invalid argument format </li>
* <li>1602 - missing playlist ID argument </li> * <li>1602 - missing playlist ID argument </li>
* <li>1603 - missing relative offset argument </li> * <li>1603 - missing playlist element ID argument </li>
* <li>1604 - missing fade in argument </li> * <li>1604 - missing fade in argument </li>
* <li>1605 - missing fade out argument </li> * <li>1605 - missing fade out argument </li>
* <li>1606 - playlist does not exist </li> * <li>1606 - playlist does not exist </li>
* <li>1607 - playlist has not been opened for editing </li> * <li>1607 - playlist has not been opened for editing </li>
* <li>1608 - no audio clip at the specified relative offset </li> * <li>1608 - error executing setFadeInfo() method </li>
* <li>1620 - missing session ID argument </li> * <li>1620 - missing session ID argument </li>
* </ul> * </ul>
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.4 $ * @version $Revision: 1.5 $
*/ */
class UpdateFadeInFadeOutMethod : public XmlRpc::XmlRpcServerMethod class UpdateFadeInFadeOutMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

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

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UploadPlaylistMethod.h,v $ 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 * If the upload is successful, the method returns an XML-RPC structure with
* the following members: * the following members:
* <ul> * <ul>
* <li>scheduleEntryId - int - the id of the schedule entry created * <li>scheduleEntryId - string - the id of the schedule entry created
* by the upload </li> * by the upload </li>
* </ul> * </ul>
* *
@ -102,7 +102,7 @@ using namespace LiveSupport::Core;
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.9 $ * @version $Revision: 1.10 $
*/ */
class UploadPlaylistMethod : public XmlRpc::XmlRpcServerMethod class UploadPlaylistMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.11 $ Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -135,7 +135,7 @@ ValidatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} catch (XmlRpcException &e) { } catch (Core::XmlRpcException &e) {
std::string eMsg = "playlist does not exist:\n"; std::string eMsg = "playlist does not exist:\n";
eMsg += e.what(); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue); XmlRpcTools::markError(errorId+3, eMsg, returnValue);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -75,7 +75,7 @@ using namespace LiveSupport::Core;
* <ul> * <ul>
* <li>sessionId - string - the session ID obtained via the login() * <li>sessionId - string - the session ID obtained via the login()
* method of the authentication client </li> * method of the authentication client </li>
* <li>playlistId - int - the unique id of the playlist.</li> * <li>playlistId - string - the unique id of the playlist.</li>
* </ul> * </ul>
* *
* The XML-RPC function returns an XML-RPC structure, containing the following * The XML-RPC function returns an XML-RPC structure, containing the following
@ -95,7 +95,7 @@ using namespace LiveSupport::Core;
* <li>520 - missing session ID argument </li> * <li>520 - missing session ID argument </li>
* </ul> * </ul>
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.4 $ * @version $Revision: 1.5 $
*/ */
class ValidatePlaylistMethod : public XmlRpc::XmlRpcServerMethod class ValidatePlaylistMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx,v $ 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"])); CPPUNIT_ASSERT(bool(result["valid"]));
result.clear(); result.clear();
parameter["relativeOffset"] = 0; parameter["playlistElementId"] = "0000000000000101";
rootParameter[0] = parameter; rootParameter[0] = parameter;
try { try {
removeAudioClipMethod->execute(rootParameter, result); removeAudioClipMethod->execute(rootParameter, result);
} catch (XmlRpc::XmlRpcException &e) { } catch (XmlRpc::XmlRpcException &e) {