added reset() method to StorageClientInterface;
modified scheduler tests to use this reset() method; changed getAllPlaylists() and getAllAudioClips() in StorageClientInterface to use the search() method, and added optional limit and offset arguments; changed the Makefile.in in modules/storage and products/scheduler to initialize the storage server after compilation and before running tests; modified some scheduler tests to work correctly with either Test- or Web- StorageClient
This commit is contained in:
parent
56e7c95d2a
commit
bc49af1e38
41 changed files with 641 additions and 323 deletions
livesupport/modules/storage/src
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.34 $
|
||||
Version : $Revision: 1.35 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -116,6 +116,7 @@ WebStorageClientTest :: setUp(void) throw ()
|
|||
|
||||
wsc.reset(new WebStorageClient());
|
||||
wsc->configure(*root);
|
||||
wsc->reset();
|
||||
} catch (std::invalid_argument &e) {
|
||||
CPPUNIT_FAIL("semantic error in storage configuration file");
|
||||
} catch (xmlpp::exception &e) {
|
||||
|
@ -473,17 +474,6 @@ WebStorageClientTest :: audioClipTest(void)
|
|||
}
|
||||
CPPUNIT_ASSERT(!newAudioClip->getUri());
|
||||
|
||||
|
||||
// test getAllAudioClips() [pointless]
|
||||
Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector;
|
||||
try {
|
||||
audioClipVector = wsc->getAllAudioClips(sessionId);
|
||||
} catch (XmlRpcException &e) {
|
||||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
CPPUNIT_ASSERT(audioClipVector->size() == 0);
|
||||
|
||||
|
||||
try{
|
||||
authentication->logout(sessionId);
|
||||
} catch (XmlRpcException &e) {
|
||||
|
@ -707,3 +697,50 @@ WebStorageClientTest :: searchTest(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Testing getAllPlaylists() and getAllAudioClips().
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WebStorageClientTest :: getAllTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<SessionId>::Ref sessionId;
|
||||
try {
|
||||
sessionId = authentication->login("root", "q");
|
||||
} catch (XmlRpcException &e) {
|
||||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
CPPUNIT_ASSERT(sessionId);
|
||||
|
||||
Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref
|
||||
playlists = wsc->getAllPlaylists(sessionId);
|
||||
CPPUNIT_ASSERT(playlists);
|
||||
CPPUNIT_ASSERT(playlists->size() >= 1);
|
||||
|
||||
Ptr<Playlist>::Ref playlist = playlists->at(0);
|
||||
CPPUNIT_ASSERT(playlist);
|
||||
CPPUNIT_ASSERT(playlist->getId());
|
||||
CPPUNIT_ASSERT(playlist->getId()->getId() == 1);
|
||||
|
||||
Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref
|
||||
audioClips = wsc->getAllAudioClips(sessionId);
|
||||
CPPUNIT_ASSERT(audioClips);
|
||||
CPPUNIT_ASSERT(audioClips->size() >= 5);
|
||||
|
||||
audioClips = wsc->getAllAudioClips(sessionId, 2, 1);
|
||||
CPPUNIT_ASSERT(audioClips);
|
||||
CPPUNIT_ASSERT(audioClips->size() == 2);
|
||||
|
||||
Ptr<AudioClip>::Ref audioClip = audioClips->at(0);
|
||||
CPPUNIT_ASSERT(audioClip);
|
||||
CPPUNIT_ASSERT(audioClip->getId());
|
||||
CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x10002);
|
||||
|
||||
try{
|
||||
authentication->logout(sessionId);
|
||||
} catch (XmlRpcException &e) {
|
||||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue