diff --git a/livesupport/modules/storage/src/WebStorageClientTest.cxx b/livesupport/modules/storage/src/WebStorageClientTest.cxx index 58b40dc6a..e88b3c95c 100644 --- a/livesupport/modules/storage/src/WebStorageClientTest.cxx +++ b/livesupport/modules/storage/src/WebStorageClientTest.cxx @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -507,3 +507,88 @@ WebStorageClientTest :: audioClipTest(void) } } + +/*------------------------------------------------------------------------------ + * Simple playlist saving test. + *----------------------------------------------------------------------------*/ +void +WebStorageClientTest :: simplePlaylistTest(void) + throw (CPPUNIT_NS::Exception) +{ + Ptr::Ref> >::Ref uniqueIdVector; + try { + uniqueIdVector = wsc->reset(); + } catch (XmlRpcException &e) { + CPPUNIT_FAIL(e.what()); + } + CPPUNIT_ASSERT(uniqueIdVector->size() >= 3); + Ptr::Ref audioClipId = uniqueIdVector->at(0); + + Ptr::Ref sessionId; + try { + sessionId = authentication->login("root", "q"); + } catch (AuthenticationException &e) { + CPPUNIT_FAIL(e.what()); + } + CPPUNIT_ASSERT(sessionId); + + + // test createPlaylist() + Ptr::Ref playlist; + try{ + playlist = wsc->createPlaylist(sessionId); + } catch (XmlRpcException &e) { + CPPUNIT_FAIL(e.what()); + } + CPPUNIT_ASSERT(playlist); + Ptr::Ref playlistId = playlist->getId(); + + // test editPlaylist() + try { + playlist = wsc->editPlaylist(sessionId, playlistId); + } catch (XmlRpcException &e) { + CPPUNIT_FAIL(e.what()); + } + CPPUNIT_ASSERT(playlist); + + Ptr::Ref audioClip; + try { + audioClip = wsc->getAudioClip(sessionId, audioClipId); + } catch (XmlRpcException &e) { + CPPUNIT_FAIL(e.what()); + } + + Ptr::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::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()); +} + + diff --git a/livesupport/modules/storage/src/WebStorageClientTest.h b/livesupport/modules/storage/src/WebStorageClientTest.h index 7113e0830..1bf8f591d 100644 --- a/livesupport/modules/storage/src/WebStorageClientTest.h +++ b/livesupport/modules/storage/src/WebStorageClientTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Author : $Author: maroy $ + Version : $Revision: 1.6 $ 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. * - * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @author $Author: maroy $ + * @version $Revision: 1.6 $ * @see WebStorageClient */ class WebStorageClientTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE(WebStorageClientTest); CPPUNIT_TEST(firstTest); + CPPUNIT_TEST(simplePlaylistTest); CPPUNIT_TEST(playlistTest); CPPUNIT_TEST(audioClipTest); CPPUNIT_TEST_SUITE_END(); @@ -103,6 +104,14 @@ class WebStorageClientTest : public CPPUNIT_NS::TestFixture void 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. *