From 90fd4b1ca8049a21a87d759d93debbc4a45e7176 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Wed, 1 Nov 2006 10:36:46 +0000 Subject: [PATCH] minor edit: openned -> opened; fixed a comment; brought the tests up to date with the recent API changes --- .../gLiveSupport/src/GLiveSupport.cxx | 46 +++++++++---------- .../products/gLiveSupport/src/GLiveSupport.h | 28 +++++------ .../gLiveSupport/src/GLiveSupportTest.cxx | 29 +++++++----- .../gLiveSupport/src/GLiveSupportTest.h | 23 +++++++++- 4 files changed, 75 insertions(+), 51 deletions(-) diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx b/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx index a2ee98c94..4f6f473e4 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx @@ -730,10 +730,10 @@ GLiveSupport :: getAudioClip(Ptr::Ref id) { Ptr::Ref clip; - clip = (*opennedAudioClips)[id->getId()]; + clip = (*openedAudioClips)[id->getId()]; if (!clip.get()) { clip = storage->getAudioClip(sessionId, id); - (*opennedAudioClips)[id->getId()] = clip; + (*openedAudioClips)[id->getId()] = clip; } return clip; @@ -751,10 +751,10 @@ GLiveSupport :: acquireAudioClip(Ptr::Ref id) { Ptr::Ref clip; - clip = (*opennedAudioClips)[id->getId()]; + clip = (*openedAudioClips)[id->getId()]; if (!clip.get() || !clip->getToken().get()) { clip = storage->acquireAudioClip(sessionId, id); - (*opennedAudioClips)[id->getId()] = clip; + (*openedAudioClips)[id->getId()] = clip; } return clip; @@ -772,10 +772,10 @@ GLiveSupport :: getPlaylist(Ptr::Ref id) { Ptr::Ref playlist; - playlist = (*opennedPlaylists)[id->getId()]; + playlist = (*openedPlaylists)[id->getId()]; if (!playlist.get()) { playlist = storage->getPlaylist(sessionId, id); - (*opennedPlaylists)[id->getId()] = playlist; + (*openedPlaylists)[id->getId()] = playlist; } return playlist; @@ -793,10 +793,10 @@ GLiveSupport :: acquirePlaylist(Ptr::Ref id) { Ptr::Ref playlist; - playlist = (*opennedPlaylists)[id->getId()]; + playlist = (*openedPlaylists)[id->getId()]; if (!playlist.get() || !playlist->getUri().get()) { playlist = storage->acquirePlaylist(sessionId, id); - (*opennedPlaylists)[id->getId()] = playlist; + (*openedPlaylists)[id->getId()] = playlist; } return playlist; @@ -854,7 +854,7 @@ GLiveSupport :: acquirePlayable(Ptr::Ref id) /*------------------------------------------------------------------------------ - * Release all openned audio clips. + * Remove a playlist from the playlist cache. *----------------------------------------------------------------------------*/ void LiveSupport :: GLiveSupport :: @@ -863,28 +863,28 @@ GLiveSupport :: uncachePlaylist(Ptr::Ref id) { Ptr::Ref playlist; PlaylistMap::iterator it; - PlaylistMap::iterator end = opennedPlaylists->end(); + PlaylistMap::iterator end = openedPlaylists->end(); - if ((it = opennedPlaylists->find(id->getId())) != end) { - playlist = (*opennedPlaylists)[id->getId()]; + if ((it = openedPlaylists->find(id->getId())) != end) { + playlist = (*openedPlaylists)[id->getId()]; if (playlist->getUri().get()) { storage->releasePlaylist(playlist); } - opennedPlaylists->erase(it); + openedPlaylists->erase(it); } } /*----------------------------------------------------------------------------- - * Release all openned audio clips. + * Release all opened audio clips. *----------------------------------------------------------------------------*/ void LiveSupport :: GLiveSupport :: -GLiveSupport :: releaseOpennedAudioClips(void) throw (XmlRpcException) +GLiveSupport :: releaseOpenedAudioClips(void) throw (XmlRpcException) { - AudioClipMap::iterator it = opennedAudioClips->begin(); - AudioClipMap::iterator end = opennedAudioClips->end(); + AudioClipMap::iterator it = openedAudioClips->begin(); + AudioClipMap::iterator end = openedAudioClips->end(); while (it != end) { Ptr::Ref clip = (*it).second; @@ -896,19 +896,19 @@ GLiveSupport :: releaseOpennedAudioClips(void) throw (XmlRpcException) ++it; } - opennedAudioClips->clear(); + openedAudioClips->clear(); } /*------------------------------------------------------------------------------ - * Release all openned playlists. + * Release all opened playlists. *----------------------------------------------------------------------------*/ void LiveSupport :: GLiveSupport :: -GLiveSupport :: releaseOpennedPlaylists(void) throw (XmlRpcException) +GLiveSupport :: releaseOpenedPlaylists(void) throw (XmlRpcException) { - PlaylistMap::iterator it = opennedPlaylists->begin(); - PlaylistMap::iterator end = opennedPlaylists->end(); + PlaylistMap::iterator it = openedPlaylists->begin(); + PlaylistMap::iterator end = openedPlaylists->end(); while (it != end) { Ptr::Ref playlist = (*it).second; @@ -920,7 +920,7 @@ GLiveSupport :: releaseOpennedPlaylists(void) throw (XmlRpcException) ++it; } - opennedPlaylists->clear(); + openedPlaylists->clear(); } diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h index 546bcf7cd..3d7ca03b3 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h @@ -203,15 +203,15 @@ class GLiveSupport : public LocalizedConfigurable, /** * A map, holding references to all AudioClip objects that are - * openned. + * opened. */ - Ptr::Ref opennedAudioClips; + Ptr::Ref openedAudioClips; /** * A map, holding references to all Playlist objects that are - * openned. + * opened. */ - Ptr::Ref opennedPlaylists; + Ptr::Ref openedPlaylists; /** * The one and only playlist that may be edited at any one time. @@ -360,8 +360,8 @@ class GLiveSupport : public LocalizedConfigurable, : outputPlayerIsPaused(false), cuePlayerIsPaused(false) { - opennedAudioClips.reset(new AudioClipMap()); - opennedPlaylists.reset(new PlaylistMap()); + openedAudioClips.reset(new AudioClipMap()); + openedPlaylists.reset(new PlaylistMap()); } /** @@ -377,11 +377,11 @@ class GLiveSupport : public LocalizedConfigurable, cuePlayer->deInitialize(); } try { - releaseOpennedAudioClips(); + releaseOpenedAudioClips(); } catch (XmlRpcException &e) { } try { - releaseOpennedPlaylists(); + releaseOpenedPlaylists(); } catch(XmlRpcException &e) { } } @@ -602,7 +602,7 @@ class GLiveSupport : public LocalizedConfigurable, * GLiveSupport object. * * @param id the audio clip id. - * @return the audio clip openned. + * @return the audio clip opened. * @exception XmlRpcException if no audio clip with the specified * id exists, or there was a communication problem. */ @@ -647,7 +647,7 @@ class GLiveSupport : public LocalizedConfigurable, * GLiveSupport object. * * @param id the playlist id. - * @return the playlist openned. + * @return the playlist opened. * @exception XmlRpcException if no playlist with the specified * id exists, or there was a communication problem. */ @@ -718,16 +718,16 @@ class GLiveSupport : public LocalizedConfigurable, throw (XmlRpcException); /** - * Release all openned audio clips. + * Release all opened audio clips. */ void - releaseOpennedAudioClips(void) throw (XmlRpcException); + releaseOpenedAudioClips(void) throw (XmlRpcException); /** - * Release all openned playlists. + * Release all opened playlists. */ void - releaseOpennedPlaylists(void) throw (XmlRpcException); + releaseOpenedPlaylists(void) throw (XmlRpcException); /** * Add a file to the Live Mode, and update it. diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupportTest.cxx b/campcaster/src/products/gLiveSupport/src/GLiveSupportTest.cxx index 1da5c6edb..097f51a8c 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupportTest.cxx +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupportTest.cxx @@ -153,6 +153,11 @@ GLiveSupportTest :: setUp(void) throw (CPPUNIT_NS::Exception) if (!gLiveSupport->login(login, password)) { std::cerr << "gLiveSupport unable to log in" << std::endl; } + + CPPUNIT_ASSERT_NO_THROW( + storage = gLiveSupport->getStorageClient(); + ); + CPPUNIT_ASSERT(storage); } @@ -192,8 +197,8 @@ GLiveSupportTest :: openAudioClipTest(void) Ptr::Ref id; Ptr::Ref clip; - CPPUNIT_ASSERT(gLiveSupport->getSearchResults()->size() >= 7); - id = gLiveSupport->getSearchResults()->at(6)->getId(); + CPPUNIT_ASSERT(sampleData()->size() >= 7); + id = sampleData()->at(6)->getId(); try { clip = gLiveSupport->getAudioClip(id); @@ -205,7 +210,7 @@ GLiveSupportTest :: openAudioClipTest(void) CPPUNIT_FAIL(e.what()); } - gLiveSupport->releaseOpennedAudioClips(); + gLiveSupport->releaseOpenedAudioClips(); try { clip = gLiveSupport->getAudioClip(id); @@ -226,8 +231,8 @@ GLiveSupportTest :: acquireAudioClipTest(void) Ptr::Ref id; Ptr::Ref clip; - CPPUNIT_ASSERT(gLiveSupport->getSearchResults()->size() >= 7); - id = gLiveSupport->getSearchResults()->at(6)->getId(); + CPPUNIT_ASSERT(sampleData()->size() >= 7); + id = sampleData()->at(6)->getId(); try { clip = gLiveSupport->acquireAudioClip(id); @@ -241,7 +246,7 @@ GLiveSupportTest :: acquireAudioClipTest(void) CPPUNIT_FAIL(e.what()); } - gLiveSupport->releaseOpennedAudioClips(); + gLiveSupport->releaseOpenedAudioClips(); try { clip = gLiveSupport->acquireAudioClip(id); @@ -263,8 +268,8 @@ GLiveSupportTest :: openPlaylistTest(void) Ptr::Ref id; Ptr::Ref playlist; - CPPUNIT_ASSERT(gLiveSupport->getSearchResults()->size() >= 2); - id = gLiveSupport->getSearchResults()->at(1)->getId(); + CPPUNIT_ASSERT(sampleData()->size() >= 2); + id = sampleData()->at(1)->getId(); try { playlist = gLiveSupport->getPlaylist(id); @@ -276,7 +281,7 @@ GLiveSupportTest :: openPlaylistTest(void) CPPUNIT_FAIL(e.what()); } - gLiveSupport->releaseOpennedPlaylists(); + gLiveSupport->releaseOpenedPlaylists(); try { playlist = gLiveSupport->getPlaylist(id); @@ -297,8 +302,8 @@ GLiveSupportTest :: acquirePlaylistTest(void) Ptr::Ref id; Ptr::Ref playlist; - CPPUNIT_ASSERT(gLiveSupport->getSearchResults()->size() >= 2); - id = gLiveSupport->getSearchResults()->at(1)->getId(); + CPPUNIT_ASSERT(sampleData()->size() >= 2); + id = sampleData()->at(1)->getId(); try { playlist = gLiveSupport->acquirePlaylist(id); @@ -312,7 +317,7 @@ GLiveSupportTest :: acquirePlaylistTest(void) CPPUNIT_FAIL(e.what()); } - gLiveSupport->releaseOpennedPlaylists(); + gLiveSupport->releaseOpenedPlaylists(); try { playlist = gLiveSupport->acquirePlaylist(id); diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupportTest.h b/campcaster/src/products/gLiveSupport/src/GLiveSupportTest.h index f96abb179..046a7e2c8 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupportTest.h +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupportTest.h @@ -82,9 +82,28 @@ class GLiveSupportTest : public BaseTestMethod private: /** - * The GLiveSupport object we're testing + * The GLiveSupport object we're testing. */ - Ptr::Ref gLiveSupport; + Ptr::Ref gLiveSupport; + + /** + * The storage object we get from gLiveSupport. + */ + Ptr::Ref storage; + + /** + * Get the list of test Playable objects. + * This gets the result of the latest "local search", which in + * this case is reset(), which loads the sample data into the + * local storage. + * + * @return a list of Playable items loaded by reset(). + */ + Ptr::Ref + sampleData(void) throw () + { + return storage->getLocalSearchResults(); + } protected: