first provisional implementation of the acquire and release methods in
the TestStorageClient class
This commit is contained in:
parent
611e8ea762
commit
d190bbaf7e
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.9 $
|
||||
Version : $Revision: 1.10 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Attic/StorageClientInterface.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -61,7 +61,7 @@ namespace Core {
|
|||
* An interface for storage clients.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.9 $
|
||||
* @version $Revision: 1.10 $
|
||||
*/
|
||||
class StorageClientInterface
|
||||
{
|
||||
|
@ -91,24 +91,22 @@ class StorageClientInterface
|
|||
= 0;
|
||||
|
||||
/**
|
||||
* Acquire the resources for the playlist
|
||||
* At this point, this does not do anything.
|
||||
* Acquire the resources for the playlist.
|
||||
*
|
||||
* @param id the id of the playlist to release.
|
||||
* @return something
|
||||
* @param id the id of the playlist to acquire.
|
||||
* @return a path (in the local storage) to the Playlist SMIL
|
||||
* temp file.
|
||||
* @exception std::invalid_argument if no playlist with the specified
|
||||
* specified id exists.
|
||||
*/
|
||||
virtual Ptr<std::string>::Ref
|
||||
acquirePlaylist(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error)
|
||||
throw (std::logic_error)
|
||||
= 0;
|
||||
|
||||
/**
|
||||
* Release the resources (audio clips, other playlists) used
|
||||
* in a playlist.
|
||||
* At this point, this does not do anything.
|
||||
*
|
||||
* @param id the id of the playlist to release.
|
||||
* @exception std::invalid_argument if no playlist with the specified
|
||||
|
@ -116,8 +114,7 @@ class StorageClientInterface
|
|||
*/
|
||||
virtual void
|
||||
releasePlaylist(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error)
|
||||
throw (std::logic_error)
|
||||
= 0;
|
||||
/**
|
||||
* Delete a playlist with the specified id.
|
||||
|
@ -171,6 +168,19 @@ class StorageClientInterface
|
|||
throw (std::invalid_argument)
|
||||
= 0;
|
||||
|
||||
/**
|
||||
* Acquire the resources for the audio clip with the specified id.
|
||||
*
|
||||
* @param id the id of the audio clip to acquire.
|
||||
* @return a URI to the audio clip.
|
||||
* @exception std::invalid_argument if no audio clip with the
|
||||
* specified id exists.
|
||||
*/
|
||||
virtual Ptr<std::string>::Ref
|
||||
acquireAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::logic_error)
|
||||
= 0;
|
||||
|
||||
/**
|
||||
* Release the lock on an audio clip with the specified id.
|
||||
*
|
||||
|
@ -180,7 +190,7 @@ class StorageClientInterface
|
|||
*/
|
||||
virtual void
|
||||
releaseAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::invalid_argument)
|
||||
throw (std::logic_error)
|
||||
= 0;
|
||||
|
||||
/**
|
||||
|
@ -203,7 +213,6 @@ class StorageClientInterface
|
|||
virtual Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref
|
||||
getAllAudioClips(void) const throw () = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.10 $
|
||||
Version : $Revision: 1.11 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -390,5 +390,5 @@ PlaylistTest :: toSmilTest(void)
|
|||
}
|
||||
CPPUNIT_ASSERT(newSmilPlaylist == smilPlaylist);
|
||||
|
||||
playlist->setLockedForPlaying(true);
|
||||
playlist->setLockedForPlaying(false);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.7 $
|
||||
Version : $Revision: 1.8 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -52,6 +52,62 @@ using namespace LiveSupport::Storage;
|
|||
*----------------------------------------------------------------------------*/
|
||||
const std::string TestStorageClient::configElementNameStr = "testStorage";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The path to the local temp storage
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string TestStorageClient::localTempStoragePath = "var/";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The XML version used to create the SMIL file.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string xmlVersion = "1.0";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the SMIL root node.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string smilRootNodeName = "smil";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the SMIL language description attribute.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string smilLanguageAttrName = "xmlns";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The value of the SMIL language description attribute.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string smilLanguageAttrValue
|
||||
= "http://www.w3.org/2001/SMIL20/Language";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the SMIL real networks extension attribute.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string smilExtensionsAttrName = "xmlns:rn";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The value of the SMIL real networks extension attribute.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string smilExtensionsAttrValue
|
||||
= "http://features.real.com/2001/SMIL20/Extensions";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the body node in the SMIL file.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string smilBodyNodeName = "body";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the sequential audio clip list node in the SMIL file.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string smilSeqNodeName = "seq";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the audio clip element node in the SMIL file.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string smilAudioClipNodeName = "audio";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the attribute containing the URI of the audio clip element.
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string smilAudioClipUriAttrName = "src";
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
@ -138,11 +194,49 @@ TestStorageClient :: getPlaylist(Ptr<const UniqueId>::Ref id) const
|
|||
*----------------------------------------------------------------------------*/
|
||||
Ptr<std::string>::Ref
|
||||
TestStorageClient :: acquirePlaylist(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error)
|
||||
throw (std::logic_error)
|
||||
{
|
||||
Ptr<std::string>::Ref returnValue(new std::string("/tmp/somefile.xml"));
|
||||
return returnValue;
|
||||
PlaylistMap::const_iterator playlistMapIt = playlistMap.find(id->getId());
|
||||
|
||||
if (playlistMapIt == playlistMap.end()) {
|
||||
throw std::invalid_argument("no such playlist");
|
||||
}
|
||||
|
||||
Ptr<Playlist>::Ref playlist = playlistMapIt->second;
|
||||
|
||||
Ptr<xmlpp::Document>::Ref
|
||||
smilDocument(new xmlpp::Document(xmlVersion));
|
||||
xmlpp::Element * smilRootNode
|
||||
= smilDocument->create_root_node(smilRootNodeName);
|
||||
smilRootNode->set_attribute(smilLanguageAttrName,
|
||||
smilLanguageAttrValue);
|
||||
smilRootNode->set_attribute(smilExtensionsAttrName,
|
||||
smilExtensionsAttrValue);
|
||||
|
||||
xmlpp::Element * smilBodyNode
|
||||
= smilRootNode->add_child(smilBodyNodeName);
|
||||
xmlpp::Element * smilSeqNode
|
||||
= smilBodyNode->add_child(smilSeqNodeName);
|
||||
|
||||
Playlist::const_iterator it = playlist->begin();
|
||||
|
||||
while (it != playlist->end()) {
|
||||
xmlpp::Element * smilAudioClipNode
|
||||
= smilSeqNode->add_child(smilAudioClipNodeName);
|
||||
smilAudioClipNode->set_attribute(
|
||||
smilAudioClipUriAttrName,
|
||||
* acquireAudioClip(it->second->getAudioClip()->getId()));
|
||||
++it; // may throw exception
|
||||
}
|
||||
|
||||
std::stringstream fileNameBuffer;
|
||||
fileNameBuffer << localTempStoragePath << "tempPlaylist"
|
||||
<< id->getId()
|
||||
<< ".smil";
|
||||
Ptr<std::string>::Ref fileName(new std::string(fileNameBuffer.str()));
|
||||
|
||||
smilDocument->write_to_file(*fileName, "UTF-8");
|
||||
return fileName;
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,33 +245,37 @@ TestStorageClient :: acquirePlaylist(Ptr<const UniqueId>::Ref id) const
|
|||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
TestStorageClient :: releasePlaylist(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error)
|
||||
throw (std::logic_error)
|
||||
{
|
||||
PlaylistMap::const_iterator it = playlistMap.find(id->getId());
|
||||
PlaylistMap::const_iterator playlistMapIt = playlistMap.find(id->getId());
|
||||
|
||||
if (it == playlistMap.end()) {
|
||||
if (playlistMapIt == playlistMap.end()) {
|
||||
throw std::invalid_argument("no such playlist");
|
||||
}
|
||||
|
||||
Ptr<Playlist>::Ref playlist = it->second;
|
||||
if (playlist->isLocked()) {
|
||||
throw std::logic_error("playlist is locked");
|
||||
}
|
||||
|
||||
Ptr<Playlist>::Ref playlist = playlistMapIt->second;
|
||||
|
||||
bool success = true;
|
||||
Playlist::const_iterator playlistIt = playlist->begin();
|
||||
while (playlistIt != playlist->end()) {
|
||||
Playlist::const_iterator it = playlist->begin();
|
||||
while (it != playlist->end()) {
|
||||
try {
|
||||
releaseAudioClip(playlistIt->second->getAudioClip()->getId());
|
||||
releaseAudioClip(it->second->getAudioClip()->getId());
|
||||
}
|
||||
catch (std::invalid_argument &e) {
|
||||
success = false;
|
||||
}
|
||||
++playlistIt;
|
||||
++it;
|
||||
}
|
||||
|
||||
std::stringstream fileNameBuffer;
|
||||
fileNameBuffer << localTempStoragePath << "tempPlaylist"
|
||||
<< id->getId()
|
||||
<< ".smil";
|
||||
std::remove(fileNameBuffer.str().c_str());
|
||||
|
||||
if (!success) {
|
||||
throw std::logic_error("some audio clips in playlist do not exist");
|
||||
throw std::logic_error("could not release some audio clips"
|
||||
" in playlist");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,12 +365,34 @@ TestStorageClient :: getAudioClip(Ptr<const UniqueId>::Ref id) const
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Acquire resources for an audio clip.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<std::string>::Ref
|
||||
TestStorageClient :: acquireAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::logic_error)
|
||||
{
|
||||
AudioClipMap::const_iterator it = audioClipMap.find(id->getId());
|
||||
|
||||
if (it == audioClipMap.end()) {
|
||||
throw std::invalid_argument("no such audio clip");
|
||||
}
|
||||
|
||||
std::stringstream fileNameBuffer;
|
||||
fileNameBuffer << localTempStoragePath << "test"
|
||||
<< id->getId()
|
||||
<< ".mp3";
|
||||
Ptr<std::string>::Ref fileName(new std::string(fileNameBuffer.str()));
|
||||
return fileName;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Release an audio clip.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
TestStorageClient :: releaseAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::invalid_argument)
|
||||
throw (std::logic_error)
|
||||
{
|
||||
AudioClipMap::const_iterator it = audioClipMap.find(id->getId());
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.9 $
|
||||
Version : $Revision: 1.10 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -67,7 +67,7 @@ using namespace LiveSupport::Core;
|
|||
* A dummy storage client, only used for test purposes.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.9 $
|
||||
* @version $Revision: 1.10 $
|
||||
*/
|
||||
class TestStorageClient :
|
||||
virtual public Configurable,
|
||||
|
@ -79,6 +79,11 @@ class TestStorageClient :
|
|||
*/
|
||||
static const std::string configElementNameStr;
|
||||
|
||||
/**
|
||||
* The path to the local temp storage
|
||||
*/
|
||||
static const std::string localTempStoragePath;
|
||||
|
||||
/**
|
||||
* The map type containing the playlists by their ids.
|
||||
*/
|
||||
|
@ -161,18 +166,17 @@ class TestStorageClient :
|
|||
throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Acquire the resources for the playlist
|
||||
* At this point, this does not do anything.
|
||||
* Acquire the resources for the playlist.
|
||||
*
|
||||
* @param id the id of the playlist to release.
|
||||
* @return something
|
||||
* @param id the id of the playlist to acquire.
|
||||
* @return a path (in the local storage) to the Playlist SMIL
|
||||
* temp file.
|
||||
* @exception std::invalid_argument if no playlist with the specified
|
||||
* specified id exists.
|
||||
*/
|
||||
virtual Ptr<std::string>::Ref
|
||||
acquirePlaylist(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error);
|
||||
throw (std::logic_error);
|
||||
|
||||
/**
|
||||
* Release the resources (audio clips, other playlists) used
|
||||
|
@ -185,8 +189,7 @@ class TestStorageClient :
|
|||
*/
|
||||
virtual void
|
||||
releasePlaylist(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error);
|
||||
throw (std::logic_error);
|
||||
|
||||
/**
|
||||
* Delete the playlist with the specified id.
|
||||
|
@ -238,6 +241,18 @@ class TestStorageClient :
|
|||
getAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Acquire the resources for the audio clip with the specified id.
|
||||
*
|
||||
* @param id the id of the audio clip to acquire.
|
||||
* @return a URI to the audio clip.
|
||||
* @exception std::invalid_argument if no audio clip with the
|
||||
* specified id exists.
|
||||
*/
|
||||
virtual Ptr<std::string>::Ref
|
||||
acquireAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::logic_error);
|
||||
|
||||
/**
|
||||
* Release the lock on an audio clip with the specified id.
|
||||
* At this point, this does not do anything.
|
||||
|
@ -248,7 +263,7 @@ class TestStorageClient :
|
|||
*/
|
||||
virtual void
|
||||
releaseAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||
throw (std::invalid_argument);
|
||||
throw (std::logic_error);
|
||||
|
||||
/**
|
||||
* Delete the audio clip with the specified id.
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.8 $
|
||||
Version : $Revision: 1.9 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -109,40 +109,13 @@ TestStorageClientTest :: firstTest(void)
|
|||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<UniqueId>::Ref id1(new UniqueId(1));
|
||||
Ptr<UniqueId>::Ref id2(new UniqueId(2));
|
||||
Ptr<UniqueId>::Ref id2(new UniqueId(77));
|
||||
|
||||
CPPUNIT_ASSERT(tsc->existsPlaylist(id1));
|
||||
CPPUNIT_ASSERT(!tsc->existsPlaylist(id2));
|
||||
|
||||
Ptr<Playlist>::Ref playlist = tsc->getPlaylist(id1);
|
||||
CPPUNIT_ASSERT(playlist->getId()->getId() == id1->getId());
|
||||
/*
|
||||
try {
|
||||
tsc->releasePlaylist(id1);
|
||||
}
|
||||
catch (std::invalid_argument &e) {
|
||||
std::string eMsg = "could not release playlist: ";
|
||||
eMsg += e.what();
|
||||
CPPUNIT_FAIL(eMsg);
|
||||
}
|
||||
catch (std::logic_error &e) {
|
||||
std::string eMsg = "could not release playlist: ";
|
||||
eMsg += e.what();
|
||||
CPPUNIT_FAIL(eMsg);
|
||||
}
|
||||
|
||||
try {
|
||||
tsc->releasePlaylist(id2);
|
||||
CPPUNIT_FAIL("allowed to release non-existent playlist");
|
||||
}
|
||||
catch (std::invalid_argument &e) {
|
||||
}
|
||||
catch (std::logic_error &e) {
|
||||
std::string eMsg = "release of non-existent playlist reports: ";
|
||||
eMsg += e.what();
|
||||
CPPUNIT_FAIL(eMsg);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,7 +127,7 @@ TestStorageClientTest :: deletePlaylistTest(void)
|
|||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<UniqueId>::Ref id1(new UniqueId(1));
|
||||
Ptr<UniqueId>::Ref id2(new UniqueId(2));
|
||||
Ptr<UniqueId>::Ref id2(new UniqueId(77));
|
||||
|
||||
try {
|
||||
tsc->deletePlaylist(id2);
|
||||
|
@ -211,10 +184,10 @@ TestStorageClientTest :: audioClipTest(void)
|
|||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<const UniqueId>::Ref id2(new UniqueId(10002));
|
||||
Ptr<const UniqueId>::Ref id7(new UniqueId(10077));
|
||||
Ptr<const UniqueId>::Ref id77(new UniqueId(10077));
|
||||
|
||||
CPPUNIT_ASSERT(tsc->existsAudioClip(id2));
|
||||
CPPUNIT_ASSERT(!tsc->existsAudioClip(id7));
|
||||
CPPUNIT_ASSERT(!tsc->existsAudioClip(id77));
|
||||
|
||||
Ptr<AudioClip>::Ref audioClip = tsc->getAudioClip(id2);
|
||||
CPPUNIT_ASSERT(audioClip->getId()->getId() == id2->getId());
|
||||
|
@ -231,3 +204,97 @@ TestStorageClientTest :: audioClipTest(void)
|
|||
tsc->deleteAudioClip(id2);
|
||||
CPPUNIT_ASSERT(!tsc->existsAudioClip(id2));
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Testing the acquire / release operations
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
TestStorageClientTest :: acquireAudioClipTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<const UniqueId>::Ref id2(new UniqueId(10002));
|
||||
Ptr<const UniqueId>::Ref id77(new UniqueId(10077));
|
||||
Ptr<std::string>::Ref audioClipPath;
|
||||
|
||||
try {
|
||||
audioClipPath = tsc->acquireAudioClip(id2);
|
||||
}
|
||||
catch (std::logic_error &e) {
|
||||
std::string eMsg = "could not acquire audio clip:\n";
|
||||
eMsg += e.what();
|
||||
CPPUNIT_FAIL(eMsg);
|
||||
}
|
||||
CPPUNIT_ASSERT(*audioClipPath == "var/test10002.mp3");
|
||||
|
||||
try {
|
||||
tsc->releaseAudioClip(id2);
|
||||
}
|
||||
catch (std::logic_error &e) {
|
||||
std::string eMsg = "could not release audio clip:\n";
|
||||
eMsg += e.what();
|
||||
CPPUNIT_FAIL(eMsg);
|
||||
}
|
||||
|
||||
try {
|
||||
audioClipPath = tsc->acquireAudioClip(id77);
|
||||
CPPUNIT_FAIL("allowed to acquire non-existent audio clip");
|
||||
}
|
||||
catch (std::logic_error &e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Testing the acquire / release operations
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
TestStorageClientTest :: acquirePlaylistTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<UniqueId>::Ref id1(new UniqueId(1));
|
||||
Ptr<UniqueId>::Ref id77(new UniqueId(77));
|
||||
Ptr<std::string>::Ref playlistPath;
|
||||
|
||||
try {
|
||||
playlistPath = tsc->acquirePlaylist(id1);
|
||||
}
|
||||
catch (std::logic_error &e) {
|
||||
std::string eMsg = "could not acquire playlist:\n";
|
||||
eMsg += e.what();
|
||||
CPPUNIT_FAIL(eMsg);
|
||||
}
|
||||
CPPUNIT_ASSERT(*playlistPath == "var/tempPlaylist1.smil");
|
||||
|
||||
try {
|
||||
std::FILE * f = fopen(playlistPath->c_str(), "r");
|
||||
CPPUNIT_ASSERT(f);
|
||||
std::fclose(f);
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
CPPUNIT_FAIL("temp file not created correctly");
|
||||
}
|
||||
|
||||
try {
|
||||
tsc->releasePlaylist(id1);
|
||||
}
|
||||
catch (std::logic_error &e) {
|
||||
std::string eMsg = "could not release playlist:\n";
|
||||
eMsg += e.what();
|
||||
CPPUNIT_FAIL(eMsg);
|
||||
}
|
||||
try {
|
||||
std::FILE * f = fopen(playlistPath->c_str(), "r");
|
||||
CPPUNIT_ASSERT(!f);
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
CPPUNIT_FAIL("temp file not created correctly");
|
||||
}
|
||||
|
||||
try {
|
||||
playlistPath = tsc->acquirePlaylist(id77);
|
||||
CPPUNIT_FAIL("allowed to acquire non-existent playlist");
|
||||
}
|
||||
catch (std::logic_error &e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.6 $
|
||||
Version : $Revision: 1.7 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -58,7 +58,7 @@ namespace Storage {
|
|||
* Unit test for the UploadPlaylistMetohd class.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.6 $
|
||||
* @version $Revision: 1.7 $
|
||||
* @see TestStorageClient
|
||||
*/
|
||||
class TestStorageClientTest : public CPPUNIT_NS::TestFixture
|
||||
|
@ -69,6 +69,8 @@ class TestStorageClientTest : public CPPUNIT_NS::TestFixture
|
|||
CPPUNIT_TEST(deletePlaylistTest);
|
||||
CPPUNIT_TEST(createPlaylistTest);
|
||||
CPPUNIT_TEST(audioClipTest);
|
||||
CPPUNIT_TEST(acquireAudioClipTest);
|
||||
CPPUNIT_TEST(acquirePlaylistTest);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
|
@ -119,6 +121,22 @@ class TestStorageClientTest : public CPPUNIT_NS::TestFixture
|
|||
void
|
||||
audioClipTest(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
/**
|
||||
* Testing the acquire / release operations on audio clips.
|
||||
*
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
void
|
||||
acquireAudioClipTest(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
/**
|
||||
* Testing the acquire / release operations on playlists.
|
||||
*
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
void
|
||||
acquirePlaylistTest(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
|
Loading…
Reference in New Issue