added simplePlaylistTest
This commit is contained in:
parent
24ccbdd770
commit
26da504e90
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.23 $
|
Version : $Revision: 1.24 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -507,3 +507,88 @@ WebStorageClientTest :: audioClipTest(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Simple playlist saving test.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
WebStorageClientTest :: simplePlaylistTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
Ptr<std::vector<Ptr<UniqueId>::Ref> >::Ref uniqueIdVector;
|
||||||
|
try {
|
||||||
|
uniqueIdVector = wsc->reset();
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(uniqueIdVector->size() >= 3);
|
||||||
|
Ptr<UniqueId>::Ref audioClipId = uniqueIdVector->at(0);
|
||||||
|
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
try {
|
||||||
|
sessionId = authentication->login("root", "q");
|
||||||
|
} catch (AuthenticationException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
|
|
||||||
|
// test createPlaylist()
|
||||||
|
Ptr<Playlist>::Ref playlist;
|
||||||
|
try{
|
||||||
|
playlist = wsc->createPlaylist(sessionId);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(playlist);
|
||||||
|
Ptr<UniqueId>::Ref playlistId = playlist->getId();
|
||||||
|
|
||||||
|
// test editPlaylist()
|
||||||
|
try {
|
||||||
|
playlist = wsc->editPlaylist(sessionId, playlistId);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(playlist);
|
||||||
|
|
||||||
|
Ptr<AudioClip>::Ref audioClip;
|
||||||
|
try {
|
||||||
|
audioClip = wsc->getAudioClip(sessionId, audioClipId);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<Glib::ustring>::Ref title(new Glib::ustring("simple playlist"));
|
||||||
|
|
||||||
|
playlist->addAudioClip(audioClip, playlist->getPlaylength());
|
||||||
|
playlist->setTitle(title);
|
||||||
|
|
||||||
|
try {
|
||||||
|
wsc->savePlaylist(sessionId, playlist);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
|
||||||
|
// test getPlaylist()
|
||||||
|
Ptr<Playlist>::Ref newPlaylist;
|
||||||
|
try {
|
||||||
|
newPlaylist = wsc->getPlaylist(sessionId, playlistId);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(newPlaylist);
|
||||||
|
CPPUNIT_ASSERT(newPlaylist->getPlaylength()->total_seconds()
|
||||||
|
== playlist->getPlaylength()->total_seconds());
|
||||||
|
CPPUNIT_ASSERT(newPlaylist->getTitle().get());
|
||||||
|
CPPUNIT_ASSERT(*newPlaylist->getTitle() == *title);
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
wsc->releasePlaylist(sessionId, newPlaylist);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(!newPlaylist->getUri());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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: fgerlits $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.5 $
|
Version : $Revision: 1.6 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -62,14 +62,15 @@ using namespace LiveSupport::Authentication;
|
||||||
/**
|
/**
|
||||||
* Unit test for the UploadPlaylistMetohd class.
|
* Unit test for the UploadPlaylistMetohd class.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.6 $
|
||||||
* @see WebStorageClient
|
* @see WebStorageClient
|
||||||
*/
|
*/
|
||||||
class WebStorageClientTest : public CPPUNIT_NS::TestFixture
|
class WebStorageClientTest : public CPPUNIT_NS::TestFixture
|
||||||
{
|
{
|
||||||
CPPUNIT_TEST_SUITE(WebStorageClientTest);
|
CPPUNIT_TEST_SUITE(WebStorageClientTest);
|
||||||
CPPUNIT_TEST(firstTest);
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST(simplePlaylistTest);
|
||||||
CPPUNIT_TEST(playlistTest);
|
CPPUNIT_TEST(playlistTest);
|
||||||
CPPUNIT_TEST(audioClipTest);
|
CPPUNIT_TEST(audioClipTest);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
@ -103,6 +104,14 @@ class WebStorageClientTest : public CPPUNIT_NS::TestFixture
|
||||||
void
|
void
|
||||||
audioClipTest(void) throw (CPPUNIT_NS::Exception);
|
audioClipTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Testing the playlist operations.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
simplePlaylistTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Testing the playlist operations.
|
* Testing the playlist operations.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue