added embedded playlist test case
workaround for WebStorageClient::acquirePlaylist see http://bugs.campware.org/view.php?id=1440
This commit is contained in:
parent
8dbcf2182c
commit
f961cee180
3 changed files with 84 additions and 12 deletions
|
@ -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.47 $
|
Version : $Revision: 1.48 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -394,6 +394,11 @@ static const std::string getPlaylistSessionIdParamName = "sessid";
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
static const std::string getPlaylistPlaylistIdParamName = "plid";
|
static const std::string getPlaylistPlaylistIdParamName = "plid";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the recursive parameter in the input structure
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static const std::string getPlaylistRecursiveParamName = "recursive";
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* The name of the result URL parameter returned by the method
|
* The name of the result URL parameter returned by the method
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -931,7 +936,9 @@ WebStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
|
||||||
= sessionId->getId();
|
= sessionId->getId();
|
||||||
parameters[getPlaylistPlaylistIdParamName]
|
parameters[getPlaylistPlaylistIdParamName]
|
||||||
= std::string(*id);
|
= std::string(*id);
|
||||||
|
parameters[getPlaylistRecursiveParamName]
|
||||||
|
= false;
|
||||||
|
|
||||||
result.clear();
|
result.clear();
|
||||||
if (!xmlRpcClient.execute(getPlaylistOpenMethodName.c_str(),
|
if (!xmlRpcClient.execute(getPlaylistOpenMethodName.c_str(),
|
||||||
parameters, result)) {
|
parameters, result)) {
|
||||||
|
@ -950,7 +957,7 @@ WebStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
|
||||||
<< result;
|
<< result;
|
||||||
throw Core::XmlRpcMethodFaultException(eMsg.str());
|
throw Core::XmlRpcMethodFaultException(eMsg.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! result.hasMember(getPlaylistUrlParamName)
|
if (! result.hasMember(getPlaylistUrlParamName)
|
||||||
|| result[getPlaylistUrlParamName].getType()
|
|| result[getPlaylistUrlParamName].getType()
|
||||||
!= XmlRpcValue::TypeString
|
!= XmlRpcValue::TypeString
|
||||||
|
@ -1000,7 +1007,7 @@ WebStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
|
||||||
throw XmlRpcCommunicationException(eMsg);
|
throw XmlRpcCommunicationException(eMsg);
|
||||||
}
|
}
|
||||||
xmlRpcClient.close();
|
xmlRpcClient.close();
|
||||||
|
|
||||||
if (xmlRpcClient.isFault()) {
|
if (xmlRpcClient.isFault()) {
|
||||||
std::stringstream eMsg;
|
std::stringstream eMsg;
|
||||||
eMsg << "XML-RPC method '"
|
eMsg << "XML-RPC method '"
|
||||||
|
@ -1267,8 +1274,12 @@ WebStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
|
||||||
Ptr<Playlist>::Ref oldPlaylist = getPlaylist(sessionId, id);
|
Ptr<Playlist>::Ref oldPlaylist = getPlaylist(sessionId, id);
|
||||||
|
|
||||||
Ptr<time_duration>::Ref playlength = oldPlaylist->getPlaylength();
|
Ptr<time_duration>::Ref playlength = oldPlaylist->getPlaylength();
|
||||||
Ptr<Playlist>::Ref newPlaylist(new Playlist(UniqueId::generateId(),
|
Ptr<Playlist>::Ref newPlaylist(new Playlist(oldPlaylist->getId(),
|
||||||
playlength));
|
playlength));
|
||||||
|
newPlaylist->setTitle(oldPlaylist->getTitle());
|
||||||
|
newPlaylist->setToken(oldPlaylist->getToken());
|
||||||
|
// TODO: copy over all metadata as well
|
||||||
|
|
||||||
Ptr<xmlpp::Document>::Ref
|
Ptr<xmlpp::Document>::Ref
|
||||||
smilDocument(new xmlpp::Document(xmlVersion));
|
smilDocument(new xmlpp::Document(xmlVersion));
|
||||||
xmlpp::Element * smilRootNode
|
xmlpp::Element * smilRootNode
|
||||||
|
@ -1399,6 +1410,7 @@ WebStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
|
||||||
|
|
||||||
Ptr<std::string>::Ref playlistUri(new std::string(fileName.str()));
|
Ptr<std::string>::Ref playlistUri(new std::string(fileName.str()));
|
||||||
newPlaylist->setUri(playlistUri);
|
newPlaylist->setUri(playlistUri);
|
||||||
|
|
||||||
return newPlaylist;
|
return newPlaylist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.44 $
|
Version : $Revision: 1.45 $
|
||||||
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 $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -358,6 +358,57 @@ WebStorageClientTest :: playlistTest(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Test on an embedded playlist
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
WebStorageClientTest :: embeddedPlaylistTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
wsc->reset();
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(wsc->getPlaylistIds()->size() >= 3);
|
||||||
|
Ptr<UniqueId>::Ref playlistId = wsc->getPlaylistIds()->at(2);
|
||||||
|
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
try {
|
||||||
|
sessionId = authentication->login("root", "q");
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
|
|
||||||
|
// test acquirePlaylist()
|
||||||
|
Ptr<Playlist>::Ref playlist;
|
||||||
|
try {
|
||||||
|
playlist = wsc->acquirePlaylist(sessionId, playlistId);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(playlist);
|
||||||
|
CPPUNIT_ASSERT(playlist->getUri());
|
||||||
|
|
||||||
|
std::ifstream ifs(playlist->getUri()->substr(7).c_str());
|
||||||
|
if (!ifs) { // cut off "file://"
|
||||||
|
ifs.close();
|
||||||
|
CPPUNIT_FAIL("playlist temp file not found");
|
||||||
|
}
|
||||||
|
ifs.close();
|
||||||
|
|
||||||
|
// test releasePlaylist()
|
||||||
|
try {
|
||||||
|
wsc->releasePlaylist(playlist);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(!playlist->getUri());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Testing the audio clip operations
|
* Testing the audio clip operations
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -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.11 $
|
Version : $Revision: 1.12 $
|
||||||
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 $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -63,8 +63,8 @@ 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.11 $
|
* @version $Revision: 1.12 $
|
||||||
* @see WebStorageClient
|
* @see WebStorageClient
|
||||||
*/
|
*/
|
||||||
class WebStorageClientTest : public BaseTestMethod
|
class WebStorageClientTest : public BaseTestMethod
|
||||||
|
@ -74,6 +74,7 @@ class WebStorageClientTest : public BaseTestMethod
|
||||||
CPPUNIT_TEST(getVersionTest);
|
CPPUNIT_TEST(getVersionTest);
|
||||||
CPPUNIT_TEST(simplePlaylistTest);
|
CPPUNIT_TEST(simplePlaylistTest);
|
||||||
CPPUNIT_TEST(playlistTest);
|
CPPUNIT_TEST(playlistTest);
|
||||||
|
CPPUNIT_TEST(embeddedPlaylistTest);
|
||||||
CPPUNIT_TEST(audioClipTest);
|
CPPUNIT_TEST(audioClipTest);
|
||||||
CPPUNIT_TEST(searchTest);
|
CPPUNIT_TEST(searchTest);
|
||||||
CPPUNIT_TEST(getAllTest);
|
CPPUNIT_TEST(getAllTest);
|
||||||
|
@ -133,6 +134,14 @@ class WebStorageClientTest : public BaseTestMethod
|
||||||
void
|
void
|
||||||
playlistTest(void) throw (CPPUNIT_NS::Exception);
|
playlistTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Testing an embedded playlist
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
embeddedPlaylistTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Testing the search operations.
|
* Testing the search operations.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue