From 0b72824f47bf5ba786ca1afd57d7b61d89007578 Mon Sep 17 00:00:00 2001 From: maroy Date: Wed, 23 Mar 2005 09:02:14 +0000 Subject: [PATCH] updated tests to reflect added playlog to playlist events --- .../src/PlaylistEventContainerTest.cxx | 25 ++++++++++++++++--- .../src/PlaylistEventContainerTest.h | 14 ++++++++--- .../scheduler/src/PlaylistEventTest.cxx | 20 +++++++++++++-- .../scheduler/src/PlaylistEventTest.h | 14 ++++++++--- 4 files changed, 59 insertions(+), 14 deletions(-) diff --git a/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx b/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx index 3d8b00c4b..99a67add3 100644 --- a/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx +++ b/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx @@ -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::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::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::Ref playlistId(new UniqueId(1)); diff --git a/livesupport/products/scheduler/src/PlaylistEventContainerTest.h b/livesupport/products/scheduler/src/PlaylistEventContainerTest.h index 8ac044670..18a3fad8d 100644 --- a/livesupport/products/scheduler/src/PlaylistEventContainerTest.h +++ b/livesupport/products/scheduler/src/PlaylistEventContainerTest.h @@ -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::Ref authentication; + /** + * A playlog interface. + */ + Ptr::Ref playLog; + /** * A session ID from the authentication client login() method. */ diff --git a/livesupport/products/scheduler/src/PlaylistEventTest.cxx b/livesupport/products/scheduler/src/PlaylistEventTest.cxx index b83e84b3c..91939c708 100644 --- a/livesupport/products/scheduler/src/PlaylistEventTest.cxx +++ b/livesupport/products/scheduler/src/PlaylistEventTest.cxx @@ -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::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::Ref playlistEvent(new PlaylistEvent(sessionId, audioPlayer, storage, + playLog, scheduleEntry)); return playlistEvent; diff --git a/livesupport/products/scheduler/src/PlaylistEventTest.h b/livesupport/products/scheduler/src/PlaylistEventTest.h index 9a225eab5..9e1718c13 100644 --- a/livesupport/products/scheduler/src/PlaylistEventTest.h +++ b/livesupport/products/scheduler/src/PlaylistEventTest.h @@ -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::Ref authentication; + /** + * A playlog interface. + */ + Ptr::Ref playLog; + /** * A session ID from the authentication client login() method. */