updated tests to reflect added playlog to playlist events

This commit is contained in:
maroy 2005-03-23 09:02:14 +00:00
parent de1e870d3f
commit 0b72824f47
4 changed files with 59 additions and 14 deletions

View file

@ -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/products/scheduler/src/PlaylistEventContainerTest.cxx,v $
------------------------------------------------------------------------------*/
@ -47,6 +47,7 @@
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "LiveSupport/PlaylistExecutor/AudioPlayerFactory.h"
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"
#include "PlayLogFactory.h"
#include "PlaylistEventContainer.h"
#include "PlaylistEventContainerTest.h"
@ -96,6 +97,11 @@ static const std::string scheduleConfigFileName = "etc/scheduleFactory.xml";
static const std::string authenticationClientConfigFileName =
"etc/authenticationClient.xml";
/**
* The name of the configuration file for the play log factory.
*/
static const std::string playLogConfigFileName = "etc/playLogFactory.xml";
/* =============================================== local function prototypes */
@ -149,6 +155,12 @@ PlaylistEventContainerTest :: setUp(void) throw ()
acf->configure(*(parser->get_document()->get_root_node()));
authentication = acf->getAuthenticationClient();
// get an playlog factory
Ptr<PlayLogFactory>::Ref plf = PlayLogFactory::getInstance();
parser.reset(new xmlpp::DomParser(playLogConfigFileName, true));
plf->configure(*(parser->get_document()->get_root_node()));
playLog = plf->getPlayLog();
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
CPPUNIT_FAIL("semantic error in configuration file");
@ -159,6 +171,7 @@ PlaylistEventContainerTest :: setUp(void) throw ()
try {
scheduleFactory->install();
playLog->install();
} catch (std::exception &e) {
std::cerr << e.what() << std::endl;
CPPUNIT_FAIL("can't install schedule factory");
@ -179,7 +192,9 @@ PlaylistEventContainerTest :: tearDown(void) throw ()
{
audioPlayer->deInitialize();
scheduleFactory->uninstall();
playLog->uninstall();
playLog.reset();
schedule.reset();
scheduleFactory.reset();
storage.reset();
@ -202,7 +217,8 @@ PlaylistEventContainerTest :: simpleTest(void)
container.reset(new PlaylistEventContainer(sessionId,
storage,
schedule,
audioPlayer));
audioPlayer,
playLog));
// see that there are no events scheduled
Ptr<ScheduledEventInterface>::Ref scheduledEvent;
@ -222,7 +238,8 @@ PlaylistEventContainerTest :: scheduleTest(void)
container.reset(new PlaylistEventContainer(sessionId,
storage,
schedule,
audioPlayer));
audioPlayer,
playLog));
// schedule playlist 1 at 10 seconds from now
Ptr<UniqueId>::Ref playlistId(new UniqueId(1));

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.3 $
Author : $Author: maroy $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventContainerTest.h,v $
------------------------------------------------------------------------------*/
@ -48,6 +48,7 @@
#include "LiveSupport/Storage/StorageClientInterface.h"
#include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h"
#include "ScheduleInterface.h"
#include "PlayLogInterface.h"
#include "ScheduleFactory.h"
namespace LiveSupport {
@ -74,8 +75,8 @@ using namespace LiveSupport::Storage;
/**
* Unit test for the PlaylistEventContainer class
*
* @author $Author: fgerlits $
* @version $Revision: 1.3 $
* @author $Author: maroy $
* @version $Revision: 1.4 $
* @see PlaylistEventContainer
*/
class PlaylistEventContainerTest : public CPPUNIT_NS::TestFixture
@ -111,6 +112,11 @@ class PlaylistEventContainerTest : public CPPUNIT_NS::TestFixture
*/
Ptr<AuthenticationClientInterface>::Ref authentication;
/**
* A playlog interface.
*/
Ptr<PlayLogInterface>::Ref playLog;
/**
* A session ID from the authentication client login() method.
*/

View file

@ -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/products/scheduler/src/PlaylistEventTest.cxx,v $
------------------------------------------------------------------------------*/
@ -46,6 +46,7 @@
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "LiveSupport/PlaylistExecutor/AudioPlayerFactory.h"
#include "PlayLogFactory.h"
#include "PlaylistEvent.h"
#include "PlaylistEventTest.h"
@ -82,6 +83,11 @@ static const std::string authenticationClientConfigFileName =
*/
static const std::string storageClientConfigFileName = "etc/storageClient.xml";
/**
* The name of the configuration file for the play log factory.
*/
static const std::string playLogConfigFileName = "etc/playLogFactory.xml";
/* =============================================== local function prototypes */
@ -121,6 +127,12 @@ PlaylistEventTest :: setUp(void) throw ()
acf->configure(*(parser->get_document()->get_root_node()));
authentication = acf->getAuthenticationClient();
// get an playlog factory
Ptr<PlayLogFactory>::Ref plf = PlayLogFactory::getInstance();
parser.reset(new xmlpp::DomParser(playLogConfigFileName, true));
plf->configure(*(parser->get_document()->get_root_node()));
playLog = plf->getPlayLog();
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
CPPUNIT_FAIL("semantic error in configuration file");
@ -130,6 +142,7 @@ PlaylistEventTest :: setUp(void) throw ()
}
audioPlayer->initialize();
playLog->install();
duration.reset(new time_duration(seconds(30)));
@ -145,11 +158,13 @@ PlaylistEventTest :: setUp(void) throw ()
void
PlaylistEventTest :: tearDown(void) throw ()
{
playLog->uninstall();
audioPlayer->deInitialize();
duration.reset();
storage.reset();
audioPlayer.reset();
playLog.reset();
authentication->logout(sessionId);
sessionId.reset();
@ -178,6 +193,7 @@ PlaylistEventTest :: createTestEvent(void) throw ()
Ptr<PlaylistEvent>::Ref playlistEvent(new PlaylistEvent(sessionId,
audioPlayer,
storage,
playLog,
scheduleEntry));
return playlistEvent;

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.4 $
Author : $Author: maroy $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventTest.h,v $
------------------------------------------------------------------------------*/
@ -45,6 +45,7 @@
#include "LiveSupport/Authentication/AuthenticationClientInterface.h"
#include "LiveSupport/Storage/StorageClientInterface.h"
#include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h"
#include "PlayLogInterface.h"
namespace LiveSupport {
@ -68,8 +69,8 @@ using namespace LiveSupport::PlaylistExecutor;
/**
* Unit test for the PlaylistEvent class
*
* @author $Author: fgerlits $
* @version $Revision: 1.4 $
* @author $Author: maroy $
* @version $Revision: 1.5 $
* @see PlaylistEvent
*/
class PlaylistEventTest : public CPPUNIT_NS::TestFixture
@ -101,6 +102,11 @@ class PlaylistEventTest : public CPPUNIT_NS::TestFixture
*/
Ptr<AuthenticationClientInterface>::Ref authentication;
/**
* A playlog interface.
*/
Ptr<PlayLogInterface>::Ref playLog;
/**
* A session ID from the authentication client login() method.
*/