From 7a56bbf8bea03cad2132652724ef43b093676942 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Tue, 4 Jan 2005 21:47:56 +0000 Subject: [PATCH] added AudioClip constructor without ID, to be used before storeAudioClip() added run-time type info to Playable: getType(), getAudioClip() and getPlaylist() --- livesupport/modules/core/etc/Makefile.in | 3 +- .../core/include/LiveSupport/Core/AudioClip.h | 42 +++++++++- .../core/include/LiveSupport/Core/Playable.h | 78 ++++++++++++++++++- .../core/include/LiveSupport/Core/Playlist.h | 8 +- livesupport/modules/core/src/AudioClip.cxx | 31 ++++++-- .../modules/core/src/AudioClipTest.cxx | 39 +++++++++- livesupport/modules/core/src/AudioClipTest.h | 13 +++- livesupport/modules/core/src/Playable.cxx | 78 +++++++++++++++++++ livesupport/modules/core/src/PlaylistTest.cxx | 25 +++++- livesupport/modules/core/src/PlaylistTest.h | 13 +++- .../modules/storage/src/WebStorageClient.cxx | 18 +++-- .../modules/storage/src/WebStorageClient.h | 7 +- .../storage/src/WebStorageClientTest.cxx | 13 +++- 13 files changed, 333 insertions(+), 35 deletions(-) create mode 100644 livesupport/modules/core/src/Playable.cxx diff --git a/livesupport/modules/core/etc/Makefile.in b/livesupport/modules/core/etc/Makefile.in index 3068612d8..e05862a95 100644 --- a/livesupport/modules/core/etc/Makefile.in +++ b/livesupport/modules/core/etc/Makefile.in @@ -21,7 +21,7 @@ # # # Author : $Author: fgerlits $ -# Version : $Revision: 1.19 $ +# Version : $Revision: 1.20 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/etc/Makefile.in,v $ # # @configure_input@ @@ -108,6 +108,7 @@ LDFLAGS = @LDFLAGS@ -pthread \ # Dependencies #------------------------------------------------------------------------------- CORE_LIB_OBJS = ${TMP_DIR}/UniqueId.o \ + ${TMP_DIR}/Playable.o \ ${TMP_DIR}/AudioClip.o \ ${TMP_DIR}/FadeInfo.o \ ${TMP_DIR}/PlaylistElement.o \ diff --git a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h index 6860bf1b2..7963a6be8 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h +++ b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.15 $ + Version : $Revision: 1.16 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $ ------------------------------------------------------------------------------*/ @@ -124,7 +124,7 @@ using namespace boost::posix_time; * * * @author $Author: fgerlits $ - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ */ class AudioClip : public Configurable, public Playable @@ -171,6 +171,7 @@ class AudioClip : public Configurable, * Default constructor. */ AudioClip(void) throw () + : Playable(AudioClipType) { } @@ -180,8 +181,8 @@ class AudioClip : public Configurable, * * @param id the id of the audio clip. */ - AudioClip(Ptr::Ref id) - throw () + AudioClip(Ptr::Ref id) throw () + : Playable(AudioClipType) { this->id = id; } @@ -216,6 +217,22 @@ class AudioClip : public Configurable, Ptr::Ref uri = Ptr::Ref()) throw (); + /** + * Create an audio clip by specifying all details which need + * to be set by the user. + * The ID is left blank, and can be set later using setId(). + * This is used when a new audio clip is uploaded to storage. + * + * @param playlength the playing length of the audio clip. + * @param title the title of the audio clip. + * @param uri the location of the sound file corresponding to + * this audio clip object. + */ + AudioClip(Ptr::Ref title, + Ptr::Ref playlength, + Ptr::Ref uri) + throw (); + /** * A virtual destructor, as this class has virtual functions. */ @@ -260,6 +277,23 @@ class AudioClip : public Configurable, return id; } + /** + * Set the ID of the object. This is only allowed if the ID was + * a null pointer; once the ID is set, it can not be changed. + * + * @param the new unique id of the audio clip. + */ + void + setId(Ptr::Ref id) throw (std::invalid_argument) + { + if (!this->id) { + this->id = id; + } + else { + throw std::invalid_argument("can not set the ID twice"); + } + } + /** * Return the total playing length for this audio clip. * diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playable.h b/livesupport/modules/core/include/LiveSupport/Core/Playable.h index fd4ada3d2..8ce3d3846 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playable.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playable.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playable.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include #include #include +#include #include #include "LiveSupport/Core/Ptr.h" @@ -54,6 +55,9 @@ namespace LiveSupport { namespace Core { +class AudioClip; // forward declarations to avoid circularity +class Playlist; + using namespace boost::posix_time; /* ================================================================ constants */ @@ -65,16 +69,51 @@ using namespace boost::posix_time; /* =============================================================== data types */ /** - * A purely abstract class which is extended by AudioClip and Playlist. + * An abstract class which is extended by AudioClip and Playlist. * It contains the methods which are common to these classes. * * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ -class Playable +class Playable : public boost::enable_shared_from_this { public: + /** + * The sub-types a Playable object can belong to. + */ + enum Type { AudioClipType, PlaylistType }; + + private: + + /** + * The type of this playable object (audio clip or playlist). + */ + Type type; + + protected: + + /** + * Only my children are allowed to instantiate me. + * + * @param typeParam either AudioClipType or PlaylistType. + */ + Playable(Type typeParam) throw () + : type(typeParam) + { + } + + + public: + + /** + * A virtual destructor, as this class has virtual functions. + */ + virtual + ~Playable(void) throw () + { + } + /** * Return the id of the audio clip or playlist. * @@ -185,6 +224,37 @@ class Playable virtual Ptr::Ref getXmlString(void) throw () = 0; + + /** + * Return the type of this object. + * + * @return either AudioClipType or PlaylistType. + */ + Type + getType(void) const throw () + { + return type; + } + + /** + * Return an audio clip pointer to this object. If the object's + * type is not AudioClipType, returns a zero pointer. + * + * @see getType() + * @return an audio clip pointer to this object. + */ + Ptr::Ref + getAudioClip(void) throw (); + + /** + * Return a playlist pointer to this object. If the object's + * type is not PlaylistType, returns a zero pointer. + * + * @see getType() + * @return a playlist pointer to this object. + */ + Ptr::Ref + getPlaylist(void) throw (); }; diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h index ad3618200..5a7a1b39e 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.24 $ + Version : $Revision: 1.25 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $ ------------------------------------------------------------------------------*/ @@ -93,7 +93,7 @@ using namespace boost::posix_time; * * * @author $Author: fgerlits $ - * @version $Revision: 1.24 $ + * @version $Revision: 1.25 $ */ class Playlist : public Configurable, public Playable @@ -185,6 +185,7 @@ class Playlist : public Configurable, * Default constructor. */ Playlist(void) throw () + : Playable(PlaylistType) { elementList.reset(new PlaylistElementListType); this->isLockedForPlaying = false; @@ -195,6 +196,7 @@ class Playlist : public Configurable, * Create a playlist by specifying its ID only. */ Playlist(Ptr::Ref id) throw () + : Playable(PlaylistType) { this->id = id; @@ -216,6 +218,7 @@ class Playlist : public Configurable, Ptr::Ref playlength, Ptr::Ref uri = Ptr::Ref()) throw () + : Playable(PlaylistType) { this->id = id; this->title.reset(new Glib::ustring("")); @@ -241,6 +244,7 @@ class Playlist : public Configurable, Ptr::Ref playlength, Ptr::Ref uri = Ptr::Ref()) throw () + : Playable(PlaylistType) { this->id = id; this->title = title; diff --git a/livesupport/modules/core/src/AudioClip.cxx b/livesupport/modules/core/src/AudioClip.cxx index 4ee7df105..e0e6c5c21 100644 --- a/livesupport/modules/core/src/AudioClip.cxx +++ b/livesupport/modules/core/src/AudioClip.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.14 $ + Version : $Revision: 1.15 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $ ------------------------------------------------------------------------------*/ @@ -124,17 +124,18 @@ AudioClip :: AudioClip(Ptr::Ref id, Ptr::Ref playlength, Ptr::Ref uri) throw () + : Playable(AudioClipType) { this->id = id; this->title.reset(new Glib::ustring("")); this->playlength = playlength; this->uri = uri; + + setMetadata(title, titleElementName, titleElementPrefix); Ptr::Ref playlengthString(new const Glib::ustring( to_simple_string(*playlength) )); setMetadata(playlengthString, extentElementName, extentElementPrefix); - - setMetadata(title, titleElementName, titleElementPrefix); } /*------------------------------------------------------------------------------ @@ -145,20 +146,40 @@ AudioClip :: AudioClip(Ptr::Ref id, Ptr::Ref playlength, Ptr::Ref uri) throw () + : Playable(AudioClipType) { this->id = id; this->title = title; this->playlength = playlength; this->uri = uri; + setMetadata(title, titleElementName, titleElementPrefix); + Ptr::Ref playlengthString(new const Glib::ustring( to_simple_string(*playlength) )); setMetadata(playlengthString, extentElementName, extentElementPrefix); - - setMetadata(title, titleElementName, titleElementPrefix); } +/*------------------------------------------------------------------------------ * Constructor without ID. + *----------------------------------------------------------------------------*/AudioClip :: AudioClip(Ptr::Ref title, + Ptr::Ref playlength, + Ptr::Ref uri) + throw () + : Playable(AudioClipType) +{ + this->title = title; + this->playlength = playlength; + this->uri = uri; + + setMetadata(title, titleElementName, titleElementPrefix); + + Ptr::Ref playlengthString(new const Glib::ustring( + to_simple_string(*playlength) )); + setMetadata(playlengthString, extentElementName, extentElementPrefix); +} + + /*------------------------------------------------------------------------------ * Set the value of the title field. *----------------------------------------------------------------------------*/ diff --git a/livesupport/modules/core/src/AudioClipTest.cxx b/livesupport/modules/core/src/AudioClipTest.cxx index 060bfc9f6..5fc9d7294 100644 --- a/livesupport/modules/core/src/AudioClipTest.cxx +++ b/livesupport/modules/core/src/AudioClipTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.7 $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include #include "LiveSupport/Core/AudioClip.h" +#include "LiveSupport/Core/Playlist.h" #include "AudioClipTest.h" @@ -140,3 +141,39 @@ AudioClipTest :: firstTest(void) CPPUNIT_FAIL(eMsg); } } + + +/*------------------------------------------------------------------------------ + * Test conversion to and from Playable + *----------------------------------------------------------------------------*/ +void +AudioClipTest :: conversionTest(void) + throw (CPPUNIT_NS::Exception) +{ + Ptr::Ref audioClip(new AudioClip()); + try { + Ptr::Ref parser( + new xmlpp::DomParser(configFileName, false)); + const xmlpp::Document * document = parser->get_document(); + const xmlpp::Element * root = document->get_root_node(); + + audioClip->configure(*root); + + } catch (std::invalid_argument &e) { + CPPUNIT_FAIL("semantic error in configuration file"); + } catch (xmlpp::exception &e) { + std::string eMsg = "error parsing configuration file\n"; + eMsg += e.what(); + CPPUNIT_FAIL(eMsg); + } + + Ptr::Ref playable = audioClip; + CPPUNIT_ASSERT(playable->getType() == Playable::AudioClipType); + + Ptr::Ref otherAudioClip = playable->getAudioClip(); + CPPUNIT_ASSERT(otherAudioClip == audioClip); + + Ptr::Ref playlist = playable->getPlaylist(); + CPPUNIT_ASSERT(!playlist); +} + diff --git a/livesupport/modules/core/src/AudioClipTest.h b/livesupport/modules/core/src/AudioClipTest.h index 153061740..a9b033e60 100644 --- a/livesupport/modules/core/src/AudioClipTest.h +++ b/livesupport/modules/core/src/AudioClipTest.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.h,v $ ------------------------------------------------------------------------------*/ @@ -58,13 +58,14 @@ namespace Core { * Unit test for the AudioClip class. * * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @see AudioClip */ class AudioClipTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE(AudioClipTest); CPPUNIT_TEST(firstTest); + CPPUNIT_TEST(conversionTest); CPPUNIT_TEST_SUITE_END(); protected: @@ -77,6 +78,14 @@ class AudioClipTest : public CPPUNIT_NS::TestFixture void firstTest(void) throw (CPPUNIT_NS::Exception); + /** + * Testing conversion to and from Playable. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + conversionTest(void) throw (CPPUNIT_NS::Exception); + public: diff --git a/livesupport/modules/core/src/Playable.cxx b/livesupport/modules/core/src/Playable.cxx new file mode 100644 index 000000000..75f8fb231 --- /dev/null +++ b/livesupport/modules/core/src/Playable.cxx @@ -0,0 +1,78 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playable.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#include "LiveSupport/Core/AudioClip.h" +#include "LiveSupport/Core/Playlist.h" + +#include "LiveSupport/Core/Playable.h" + +using namespace LiveSupport::Core; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Return an audio clip pointer to this object. + *----------------------------------------------------------------------------*/ +Ptr::Ref +Playable :: getAudioClip(void) throw () +{ + Ptr::Ref audioClip; + if (type == AudioClipType) { + audioClip = boost::dynamic_pointer_cast + (shared_from_this()); + } + return audioClip; +} + + +/*------------------------------------------------------------------------------ + * Return a playlist pointer to this object. + *----------------------------------------------------------------------------*/ +Ptr::Ref +Playable :: getPlaylist(void) throw () +{ + Ptr::Ref playlist; + if (type == PlaylistType) { + playlist = boost::dynamic_pointer_cast + (shared_from_this()); + } + return playlist; +} + diff --git a/livesupport/modules/core/src/PlaylistTest.cxx b/livesupport/modules/core/src/PlaylistTest.cxx index b87f3d6d8..753bcf0d1 100644 --- a/livesupport/modules/core/src/PlaylistTest.cxx +++ b/livesupport/modules/core/src/PlaylistTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.16 $ + Version : $Revision: 1.17 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -389,3 +389,26 @@ PlaylistTest :: fadeInfoTest(void) catch (std::invalid_argument &e) { } } + + +/*------------------------------------------------------------------------------ + * Test conversion to and from Playable + *----------------------------------------------------------------------------*/ +void +PlaylistTest :: conversionTest(void) + throw (CPPUNIT_NS::Exception) +{ + CPPUNIT_ASSERT(playlist.use_count() == 1); + + Ptr::Ref playable = playlist; + CPPUNIT_ASSERT(playable->getType() == Playable::PlaylistType); + CPPUNIT_ASSERT(playlist.use_count() == 2); + + Ptr::Ref otherPlaylist = playable->getPlaylist(); + CPPUNIT_ASSERT(otherPlaylist == playlist); + CPPUNIT_ASSERT(playlist.use_count() == 3); + + Ptr::Ref audioClip = playable->getAudioClip(); + CPPUNIT_ASSERT(!audioClip); +} + diff --git a/livesupport/modules/core/src/PlaylistTest.h b/livesupport/modules/core/src/PlaylistTest.h index ec74c93fe..8dd419080 100644 --- a/livesupport/modules/core/src/PlaylistTest.h +++ b/livesupport/modules/core/src/PlaylistTest.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.8 $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -58,7 +58,7 @@ namespace Core { * Unit test for the UploadPlaylistMetohd class. * * @author $Author: fgerlits $ - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ * @see Playlist */ class PlaylistTest : public CPPUNIT_NS::TestFixture @@ -69,6 +69,7 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(audioClipTest); CPPUNIT_TEST(savedCopyTest); CPPUNIT_TEST(fadeInfoTest); + CPPUNIT_TEST(conversionTest); CPPUNIT_TEST_SUITE_END(); private: @@ -120,6 +121,14 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture void fadeInfoTest(void) throw (CPPUNIT_NS::Exception); + /** + * Testing conversion to and from Playable. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + conversionTest(void) throw (CPPUNIT_NS::Exception); + public: diff --git a/livesupport/modules/storage/src/WebStorageClient.cxx b/livesupport/modules/storage/src/WebStorageClient.cxx index 10ecdeb4d..104fdb050 100644 --- a/livesupport/modules/storage/src/WebStorageClient.cxx +++ b/livesupport/modules/storage/src/WebStorageClient.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.18 $ + Version : $Revision: 1.19 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $ ------------------------------------------------------------------------------*/ @@ -1190,9 +1190,7 @@ WebStorageClient :: createPlaylist(Ptr::Ref sessionId) parameters.clear(); parameters[createPlaylistSessionIdParamName] = sessionId->getId(); - parameters[createPlaylistPlaylistIdParamName] - = std::string(*UniqueId::generateId()); // TODO: the server - // should generate the ID + result.clear(); if (!xmlRpcClient.execute(createPlaylistMethodName.c_str(), parameters, result)) { @@ -1443,8 +1441,8 @@ WebStorageClient :: storeAudioClip(Ptr::Ref sessionId, parameters.clear(); parameters[storeAudioClipSessionIdParamName] = sessionId->getId(); - if (audioClip->getId()->getId() != 0) { // ID==0 means 'please - parameters[storeAudioClipAudioClipIdParamName] // generate new ID' + if (audioClip->getId()) { + parameters[storeAudioClipAudioClipIdParamName] = std::string(*audioClip->getId()); } parameters[storeAudioClipMetadataParamName] @@ -1549,7 +1547,7 @@ WebStorageClient :: storeAudioClip(Ptr::Ref sessionId, if (! result.hasMember(storeAudioClipAudioClipIdParamName) || result[storeAudioClipAudioClipIdParamName].getType() != XmlRpcValue::TypeString - || (audioClip->getId()->getId() != 0 + || (audioClip->getId() && std::string(result[storeAudioClipAudioClipIdParamName]) != std::string(*audioClip->getId()))) { @@ -1561,6 +1559,12 @@ WebStorageClient :: storeAudioClip(Ptr::Ref sessionId, throw XmlRpcMethodResponseException(eMsg.str()); } + if (!audioClip->getId()) { + Ptr::Ref newId(new UniqueId(std::string( + result[storeAudioClipAudioClipIdParamName] ))); + audioClip->setId(newId); + } + return true; } diff --git a/livesupport/modules/storage/src/WebStorageClient.h b/livesupport/modules/storage/src/WebStorageClient.h index 2a44d49bd..ce6e12490 100644 --- a/livesupport/modules/storage/src/WebStorageClient.h +++ b/livesupport/modules/storage/src/WebStorageClient.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.13 $ + Version : $Revision: 1.14 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.h,v $ ------------------------------------------------------------------------------*/ @@ -99,7 +99,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ */ class WebStorageClient : virtual public Configurable, @@ -359,6 +359,9 @@ class WebStorageClient : * Store an audio clip. The uri field of the audio clip * is expected to contain the valid URI of a binary audio file. * + * If the ID of the audio clip is UniqueId::NoId, a new globally unique + * ID is generated, and the audioClip ID is changed to the new ID. + * * In this testing version, the audio clip URI is expected in the * form file:relative_path/file_name.mp3. Later this * should be changed to an absolute URI. diff --git a/livesupport/modules/storage/src/WebStorageClientTest.cxx b/livesupport/modules/storage/src/WebStorageClientTest.cxx index 46cab8d06..085d8cfd1 100644 --- a/livesupport/modules/storage/src/WebStorageClientTest.cxx +++ b/livesupport/modules/storage/src/WebStorageClientTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.20 $ + Version : $Revision: 1.21 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -430,10 +430,12 @@ WebStorageClientTest :: audioClipTest(void) // test storeAudioClip() and getAudioClip() - Ptr::Ref idxx = UniqueId::generateId(); + Ptr::Ref title(new Glib::ustring( + "Muppet Show theme")); Ptr::Ref playlength(new time_duration(0,0,11,0)); - Ptr::Ref uri(new std::string("file:var/test10001.mp3")); - audioClip.reset(new AudioClip(idxx, playlength, uri)); + Ptr::Ref uri(new std::string( + "file:var/test10001.mp3")); + audioClip.reset(new AudioClip(title, playlength, uri)); try { wsc->storeAudioClip(sessionId, audioClip); @@ -442,6 +444,9 @@ WebStorageClientTest :: audioClipTest(void) CPPUNIT_FAIL(e.what()); } + CPPUNIT_ASSERT(audioClip->getId()); + Ptr::Ref idxx = audioClip->getId(); + try { CPPUNIT_ASSERT( wsc->existsAudioClip(sessionId, idxx)); }