minor edit: openned -> opened; fixed a comment; brought the tests up to date with the recent API changes
This commit is contained in:
parent
5ad021fde3
commit
90fd4b1ca8
|
@ -730,10 +730,10 @@ GLiveSupport :: getAudioClip(Ptr<const UniqueId>::Ref id)
|
|||
{
|
||||
Ptr<AudioClip>::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<const UniqueId>::Ref id)
|
|||
{
|
||||
Ptr<AudioClip>::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<const UniqueId>::Ref id)
|
|||
{
|
||||
Ptr<Playlist>::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<const UniqueId>::Ref id)
|
|||
{
|
||||
Ptr<Playlist>::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<const UniqueId>::Ref id)
|
|||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Release all openned audio clips.
|
||||
* Remove a playlist from the playlist cache.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
|
@ -863,28 +863,28 @@ GLiveSupport :: uncachePlaylist(Ptr<const UniqueId>::Ref id)
|
|||
{
|
||||
Ptr<Playlist>::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<AudioClip>::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<Playlist>::Ref playlist = (*it).second;
|
||||
|
@ -920,7 +920,7 @@ GLiveSupport :: releaseOpennedPlaylists(void) throw (XmlRpcException)
|
|||
++it;
|
||||
}
|
||||
|
||||
opennedPlaylists->clear();
|
||||
openedPlaylists->clear();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -203,15 +203,15 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
|
||||
/**
|
||||
* A map, holding references to all AudioClip objects that are
|
||||
* openned.
|
||||
* opened.
|
||||
*/
|
||||
Ptr<AudioClipMap>::Ref opennedAudioClips;
|
||||
Ptr<AudioClipMap>::Ref openedAudioClips;
|
||||
|
||||
/**
|
||||
* A map, holding references to all Playlist objects that are
|
||||
* openned.
|
||||
* opened.
|
||||
*/
|
||||
Ptr<PlaylistMap>::Ref opennedPlaylists;
|
||||
Ptr<PlaylistMap>::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.
|
||||
|
|
|
@ -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<UniqueId>::Ref id;
|
||||
Ptr<Playable>::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<UniqueId>::Ref id;
|
||||
Ptr<Playable>::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<UniqueId>::Ref id;
|
||||
Ptr<Playable>::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<UniqueId>::Ref id;
|
||||
Ptr<Playable>::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);
|
||||
|
|
|
@ -82,9 +82,28 @@ class GLiveSupportTest : public BaseTestMethod
|
|||
private:
|
||||
|
||||
/**
|
||||
* The GLiveSupport object we're testing
|
||||
* The GLiveSupport object we're testing.
|
||||
*/
|
||||
Ptr<GLiveSupport>::Ref gLiveSupport;
|
||||
Ptr<GLiveSupport>::Ref gLiveSupport;
|
||||
|
||||
/**
|
||||
* The storage object we get from gLiveSupport.
|
||||
*/
|
||||
Ptr<StorageClientInterface>::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<StorageClientInterface::SearchResultsType>::Ref
|
||||
sampleData(void) throw ()
|
||||
{
|
||||
return storage->getLocalSearchResults();
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue