From 3da6eaa61f2f4766e191455862f29e5eb0c11dee Mon Sep 17 00:00:00 2001
From: maroy <maroy@cfc7b370-4200-0410-a6e3-cb6bdb053afe>
Date: Tue, 9 Nov 2004 11:25:28 +0000
Subject: [PATCH] added PlaylistEvent and PlaylistEventContianer tests

---
 .../products/scheduler/etc/Makefile.in        |   6 +-
 .../products/scheduler/etc/audioPlayer.xml    |  12 +
 .../src/PlaylistEventContainerTest.cxx        | 215 ++++++++++++++++++
 .../src/PlaylistEventContainerTest.h          | 150 ++++++++++++
 .../scheduler/src/PlaylistEventTest.cxx       | 203 +++++++++++++++++
 .../scheduler/src/PlaylistEventTest.h         | 157 +++++++++++++
 6 files changed, 741 insertions(+), 2 deletions(-)
 create mode 100644 livesupport/products/scheduler/etc/audioPlayer.xml
 create mode 100644 livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx
 create mode 100644 livesupport/products/scheduler/src/PlaylistEventContainerTest.h
 create mode 100644 livesupport/products/scheduler/src/PlaylistEventTest.cxx
 create mode 100644 livesupport/products/scheduler/src/PlaylistEventTest.h

diff --git a/livesupport/products/scheduler/etc/Makefile.in b/livesupport/products/scheduler/etc/Makefile.in
index 029a5a004..2a784ce39 100644
--- a/livesupport/products/scheduler/etc/Makefile.in
+++ b/livesupport/products/scheduler/etc/Makefile.in
@@ -21,7 +21,7 @@
 #
 #
 #   Author   : $Author: maroy $
-#   Version  : $Revision: 1.21 $
+#   Version  : $Revision: 1.22 $
 #   Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $
 #
 #   @configure_input@
@@ -171,6 +171,7 @@ SCHEDULER_EXE_LIBS = -l${EVENT_SCHEDULER_LIB} -l${PLAYLIST_EXECUTOR_LIB} \
                      -lxmlrpc++ -lssl -lxml++-1.0
 
 TEST_RUNNER_OBJS = ${SCHEDULER_OBJS} \
+                   ${TMP_DIR}/TestRunner.o \
                    ${TMP_DIR}/SchedulerDaemonTest.o \
                    ${TMP_DIR}/SchedulerDaemonUploadTest.o \
                    ${TMP_DIR}/SchedulerDaemonDisplayScheduleTest.o \
@@ -198,7 +199,8 @@ TEST_RUNNER_OBJS = ${SCHEDULER_OBJS} \
                    ${TMP_DIR}/PostgresqlPlayLogTest.o \
                    ${TMP_DIR}/GeneratePlayReportMethodTest.o \
                    ${TMP_DIR}/UpdateFadeInFadeOutMethodTest.o \
-                   ${TMP_DIR}/TestRunner.o
+                   ${TMP_DIR}/PlaylistEventContainerTest.o \
+                   ${TMP_DIR}/PlaylistEventTest.o
 TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl
 
 
diff --git a/livesupport/products/scheduler/etc/audioPlayer.xml b/livesupport/products/scheduler/etc/audioPlayer.xml
new file mode 100644
index 000000000..0d7c6505b
--- /dev/null
+++ b/livesupport/products/scheduler/etc/audioPlayer.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE audioPlayer [
+
+<!ELEMENT audioPlayer   (helixPlayer) >
+
+<!ELEMENT helixPlayer   EMPTY >
+<!ATTLIST helixPlayer   dllPath     CDATA   #REQUIRED >
+]>
+<audioPlayer>
+    <helixPlayer dllPath = "../../usr/lib/helix"
+    />
+</audioPlayer>
diff --git a/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx b/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx
new file mode 100644
index 000000000..9f385dcb0
--- /dev/null
+++ b/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx
@@ -0,0 +1,215 @@
+/*------------------------------------------------------------------------------
+
+    Copyright (c) 2004 Media Development Loan Fund
+ 
+    This file is part of the LiveSupport project.
+    http://livesupport.campware.org/
+    To report bugs, send an e-mail to bugs@campware.org
+ 
+    LiveSupport is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+  
+    LiveSupport is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with LiveSupport; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ 
+ 
+    Author   : $Author: maroy $
+    Version  : $Revision: 1.1 $
+    Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventContainerTest.cxx,v $
+
+------------------------------------------------------------------------------*/
+
+/* ============================================================ include files */
+
+#ifdef HAVE_CONFIG_H
+#include "configure.h"
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#else
+#error "Need unistd.h"
+#endif
+
+
+#include <string>
+
+#include "LiveSupport/Core/TimeConversion.h"
+#include "LiveSupport/Db/ConnectionManagerFactory.h"
+#include "LiveSupport/Storage/StorageClientFactory.h"
+#include "LiveSupport/PlaylistExecutor/AudioPlayerFactory.h"
+
+#include "PlaylistEventContainer.h"
+#include "PlaylistEventContainerTest.h"
+
+
+using namespace boost::posix_time;
+
+using namespace LiveSupport::Core;
+using namespace LiveSupport::Db;
+using namespace LiveSupport::Storage;
+using namespace LiveSupport::PlaylistExecutor;
+using namespace LiveSupport::Scheduler;
+
+/* ===================================================  local data structures */
+
+
+/* ================================================  local constants & macros */
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PlaylistEventContainerTest);
+
+/**
+ *  The name of the configuration file for the audio player
+ */
+static const std::string audioPlayerConfigFileName = "etc/audioPlayer.xml";
+
+/**
+ *  The name of the configuration file for the connection manager
+ */
+static const std::string connectionManagerConfigFileName =
+                                        "etc/connectionManagerFactory.xml";
+
+/**
+ *  The name of the configuration file for the storage client
+ */
+static const std::string storageClientConfigFileName = "etc/storageClient.xml";
+
+/**
+ *  The name of the configuration file for the schedule factory
+ */
+static const std::string scheduleConfigFileName = "etc/scheduleFactory.xml";
+
+
+/* ===============================================  local function prototypes */
+
+
+/* =============================================================  module code */
+
+/*------------------------------------------------------------------------------
+ *  Set up the test environment
+ *----------------------------------------------------------------------------*/
+void
+PlaylistEventContainerTest :: setUp(void)                        throw ()
+{
+    try {
+        Ptr<xmlpp::DomParser>::Ref      parser;
+
+        // configure the audio player factory
+        Ptr<AudioPlayerFactory>::Ref    apf = AudioPlayerFactory::getInstance();
+        parser.reset(new xmlpp::DomParser(audioPlayerConfigFileName, true));
+        apf->configure(*(parser->get_document()->get_root_node()));
+
+        audioPlayer = apf->getAudioPlayer();
+
+        // configure the connection manager factory
+        Ptr<ConnectionManagerFactory>::Ref  cmf =
+                                    ConnectionManagerFactory::getInstance();
+        parser.reset(new xmlpp::DomParser(connectionManagerConfigFileName,
+                                          true));
+        cmf->configure(*(parser->get_document()->get_root_node()));
+
+        // configure the storage client factory
+        Ptr<StorageClientFactory>::Ref  scf =
+                                            StorageClientFactory::getInstance();
+        parser.reset(new xmlpp::DomParser(storageClientConfigFileName, true));
+        scf->configure(*(parser->get_document()->get_root_node()));
+
+        storage = scf->getStorageClient();
+
+        // configure the schedule factory
+        scheduleFactory = ScheduleFactory::getInstance();
+        parser.reset(new xmlpp::DomParser(scheduleConfigFileName, true));
+        scheduleFactory->configure(*(parser->get_document()->get_root_node()));
+
+        schedule = scheduleFactory->getSchedule();
+
+    } catch (std::invalid_argument &e) {
+        std::cerr << e.what() << std::endl;
+        CPPUNIT_FAIL("semantic error in configuration file");
+    } catch (xmlpp::exception &e) {
+        std::cerr << e.what() << std::endl;
+        CPPUNIT_FAIL("error parsing configuration file");
+    }
+
+    scheduleFactory->install();
+    audioPlayer->initialize();
+}
+
+
+/*------------------------------------------------------------------------------
+ *  Clean up the test environment
+ *----------------------------------------------------------------------------*/
+void
+PlaylistEventContainerTest :: tearDown(void)                     throw ()
+{
+    audioPlayer->deInitialize();
+    scheduleFactory->uninstall();
+
+    schedule.reset();
+    scheduleFactory.reset();
+    storage.reset();
+    audioPlayer.reset();
+}
+
+
+/*------------------------------------------------------------------------------
+ *  A simple smoke test.
+ *----------------------------------------------------------------------------*/
+void
+PlaylistEventContainerTest :: simpleTest(void)
+                                                throw (CPPUNIT_NS::Exception)
+{
+    Ptr<PlaylistEventContainer>::Ref    container;
+    container.reset(new PlaylistEventContainer(storage, schedule, audioPlayer));
+
+    // see that there are no events scheduled
+    Ptr<ScheduledEventInterface>::Ref   scheduledEvent;
+    scheduledEvent = container->getNextEvent(TimeConversion::now());
+    CPPUNIT_ASSERT(!scheduledEvent.get());
+}
+
+
+/*------------------------------------------------------------------------------
+ *  Schedule something, and see if we can get it back.
+ *----------------------------------------------------------------------------*/
+void
+PlaylistEventContainerTest :: scheduleTest(void)
+                                                throw (CPPUNIT_NS::Exception)
+{
+    Ptr<PlaylistEventContainer>::Ref    container;
+    container.reset(new PlaylistEventContainer(storage, schedule, audioPlayer));
+
+    // schedule playlist 1 at 10 seconds from now
+    Ptr<UniqueId>::Ref      playlistId(new UniqueId(1));
+    Ptr<Playlist>::Ref      playlist = storage->getPlaylist(playlistId);
+    CPPUNIT_ASSERT(playlist.get());
+    Ptr<ptime>::Ref         now = TimeConversion::now();
+    Ptr<ptime>::Ref         from(new ptime(*now + seconds(10)));
+
+    try {
+        schedule->schedulePlaylist(playlist, from);
+    } catch (std::invalid_argument &e) {
+        CPPUNIT_FAIL(e.what());
+    }
+
+    Ptr<ScheduledEventInterface>::Ref   scheduledEvent;
+
+    // see if we can get back the scheduled playlist
+    scheduledEvent = container->getNextEvent(now);
+    CPPUNIT_ASSERT(scheduledEvent.get());
+    CPPUNIT_ASSERT(*scheduledEvent->eventLength()
+                == *playlist->getPlaylength());
+
+    // see that there are no events scheduled after from
+    scheduledEvent = container->getNextEvent(from);
+    CPPUNIT_ASSERT(!scheduledEvent.get());
+}
+
diff --git a/livesupport/products/scheduler/src/PlaylistEventContainerTest.h b/livesupport/products/scheduler/src/PlaylistEventContainerTest.h
new file mode 100644
index 000000000..1529400cf
--- /dev/null
+++ b/livesupport/products/scheduler/src/PlaylistEventContainerTest.h
@@ -0,0 +1,150 @@
+/*------------------------------------------------------------------------------
+
+    Copyright (c) 2004 Media Development Loan Fund
+ 
+    This file is part of the LiveSupport project.
+    http://livesupport.campware.org/
+    To report bugs, send an e-mail to bugs@campware.org
+ 
+    LiveSupport is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+  
+    LiveSupport is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with LiveSupport; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ 
+ 
+    Author   : $Author: maroy $
+    Version  : $Revision: 1.1 $
+    Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventContainerTest.h,v $
+
+------------------------------------------------------------------------------*/
+#ifndef PlaylistEventContainerTest_h
+#define PlaylistEventContainerTest_h
+
+#ifndef __cplusplus
+#error This is a C++ include file
+#endif
+
+
+/* ============================================================ include files */
+
+#ifdef HAVE_CONFIG_H
+#include "configure.h"
+#endif
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "LiveSupport/Core/StorageClientInterface.h"
+#include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h"
+#include "ScheduleInterface.h"
+#include "ScheduleFactory.h"
+
+
+namespace LiveSupport {
+namespace Scheduler {
+
+using namespace boost::posix_time;
+
+using namespace LiveSupport;
+using namespace LiveSupport::Core;
+using namespace LiveSupport::PlaylistExecutor;
+using namespace LiveSupport::Scheduler;
+
+/* ================================================================ constants */
+
+
+/* =================================================================== macros */
+
+
+/* =============================================================== data types */
+
+/**
+ *  Unit test for the PlaylistEventContainer class
+ *
+ *  @author  $Author: maroy $
+ *  @version $Revision: 1.1 $
+ *  @see PlaylistEventContainer
+ */
+class PlaylistEventContainerTest : public CPPUNIT_NS::TestFixture
+{
+    CPPUNIT_TEST_SUITE(PlaylistEventContainerTest);
+    CPPUNIT_TEST(simpleTest);
+    CPPUNIT_TEST(scheduleTest);
+    CPPUNIT_TEST_SUITE_END();
+
+    private:
+        /**
+         *  The audio player used by the test.
+         */
+        Ptr<AudioPlayerInterface>::Ref      audioPlayer;
+
+        /**
+         *  The storage used by the container.
+         */
+        Ptr<StorageClientInterface>::Ref    storage;
+
+        /**
+         *  The schedule factory used in the test.
+         */
+        Ptr<ScheduleFactory>::Ref           scheduleFactory;
+
+        /**
+         *  The schedule used by the container.
+         */
+        Ptr<ScheduleInterface>::Ref         schedule;
+
+
+    protected:
+
+        /**
+         *  Simple smoke test.
+         *
+         *  @exception CPPUNIT_NS::Exception on test failures.
+         */
+        void
+        simpleTest(void)                     throw (CPPUNIT_NS::Exception);
+
+        /**
+         *  Test to see if we can get back a scheduled event.
+         *
+         *  @exception CPPUNIT_NS::Exception on test failures.
+         */
+        void
+        scheduleTest(void)                  throw (CPPUNIT_NS::Exception);
+
+
+    public:
+        
+        /**
+         *  Set up the environment for the test case.
+         */
+        void
+        setUp(void)                                     throw ();
+
+        /**
+         *  Clean up the environment after the test case.
+         */
+        void
+        tearDown(void)                                  throw ();
+};
+
+
+/* ================================================= external data structures */
+
+
+/* ====================================================== function prototypes */
+
+
+} // namespace Scheduler
+} // namespace LiveSupport
+
+#endif // PlaylistEventContainerTest_h
+
diff --git a/livesupport/products/scheduler/src/PlaylistEventTest.cxx b/livesupport/products/scheduler/src/PlaylistEventTest.cxx
new file mode 100644
index 000000000..3eee0f3f8
--- /dev/null
+++ b/livesupport/products/scheduler/src/PlaylistEventTest.cxx
@@ -0,0 +1,203 @@
+/*------------------------------------------------------------------------------
+
+    Copyright (c) 2004 Media Development Loan Fund
+ 
+    This file is part of the LiveSupport project.
+    http://livesupport.campware.org/
+    To report bugs, send an e-mail to bugs@campware.org
+ 
+    LiveSupport is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+  
+    LiveSupport is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with LiveSupport; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ 
+ 
+    Author   : $Author: maroy $
+    Version  : $Revision: 1.1 $
+    Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventTest.cxx,v $
+
+------------------------------------------------------------------------------*/
+
+/* ============================================================ include files */
+
+#ifdef HAVE_CONFIG_H
+#include "configure.h"
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#else
+#error "Need unistd.h"
+#endif
+
+
+#include <string>
+
+#include "LiveSupport/Core/TimeConversion.h"
+#include "LiveSupport/Storage/StorageClientFactory.h"
+#include "LiveSupport/PlaylistExecutor/AudioPlayerFactory.h"
+
+#include "PlaylistEvent.h"
+#include "PlaylistEventTest.h"
+
+
+using namespace boost::posix_time;
+
+using namespace LiveSupport::Core;
+using namespace LiveSupport::Storage;
+using namespace LiveSupport::PlaylistExecutor;
+using namespace LiveSupport::Scheduler;
+
+/* ===================================================  local data structures */
+
+
+/* ================================================  local constants & macros */
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PlaylistEventTest);
+
+/**
+ *  The name of the configuration file for the audio player
+ */
+static const std::string audioPlayerConfigFileName = "etc/audioPlayer.xml";
+
+/**
+ *  The name of the configuration file for the storage client
+ */
+static const std::string storageClientConfigFileName = "etc/storageClient.xml";
+
+
+/* ===============================================  local function prototypes */
+
+
+/* =============================================================  module code */
+
+/*------------------------------------------------------------------------------
+ *  Set up the test environment
+ *----------------------------------------------------------------------------*/
+void
+PlaylistEventTest :: setUp(void)                        throw ()
+{
+    try {
+        Ptr<xmlpp::DomParser>::Ref      parser;
+
+        // configure the audio player factory
+        Ptr<AudioPlayerFactory>::Ref    apf = AudioPlayerFactory::getInstance();
+        parser.reset(new xmlpp::DomParser(audioPlayerConfigFileName, true));
+        apf->configure(*(parser->get_document()->get_root_node()));
+
+        audioPlayer = apf->getAudioPlayer();
+
+        // configure the storage client factory
+        Ptr<StorageClientFactory>::Ref  scf =
+                                            StorageClientFactory::getInstance();
+        parser.reset(new xmlpp::DomParser(storageClientConfigFileName, true));
+        scf->configure(*(parser->get_document()->get_root_node()));
+
+        storage = scf->getStorageClient();
+
+    } catch (std::invalid_argument &e) {
+        std::cerr << e.what() << std::endl;
+        CPPUNIT_FAIL("semantic error in configuration file");
+    } catch (xmlpp::exception &e) {
+        std::cerr << e.what() << std::endl;
+        CPPUNIT_FAIL("error parsing configuration file");
+    }
+
+    audioPlayer->initialize();
+
+    duration.reset(new time_duration(seconds(30)));
+}
+
+
+/*------------------------------------------------------------------------------
+ *  Clean up the test environment
+ *----------------------------------------------------------------------------*/
+void
+PlaylistEventTest :: tearDown(void)                     throw ()
+{
+    audioPlayer->deInitialize();
+
+    duration.reset();
+    storage.reset();
+    audioPlayer.reset();
+}
+
+
+/*------------------------------------------------------------------------------
+ *  Create a sample playlist event
+ *----------------------------------------------------------------------------*/
+Ptr<PlaylistEvent>::Ref
+PlaylistEventTest :: createTestEvent(void)              throw ()
+{
+    // create a fake schedule entry, with id 1 for playlist 1, starting
+    // 10 seconds from now, and lasting 30 seconds
+    Ptr<UniqueId>::Ref          entryId(new UniqueId(1));
+    Ptr<UniqueId>::Ref          playlistId(new UniqueId(1));
+    Ptr<ptime>::Ref             now = TimeConversion::now();
+    Ptr<ptime>::Ref             startTime(new ptime(*now + seconds(10)));
+    Ptr<ptime>::Ref             endTime(new ptime(*startTime + *duration));
+    Ptr<ScheduleEntry>::Ref     scheduleEntry(new ScheduleEntry(entryId,
+                                                                playlistId,
+                                                                startTime,
+                                                                endTime));
+
+    Ptr<PlaylistEvent>::Ref     playlistEvent(new PlaylistEvent(audioPlayer,
+                                                                storage,
+                                                                scheduleEntry));
+
+    return playlistEvent;
+}
+
+
+/*------------------------------------------------------------------------------
+ *  A simple smoke test.
+ *----------------------------------------------------------------------------*/
+void
+PlaylistEventTest :: simpleTest(void)
+                                                throw (CPPUNIT_NS::Exception)
+{
+    Ptr<PlaylistEvent>::Ref     playlistEvent = createTestEvent();
+
+    CPPUNIT_ASSERT(*playlistEvent->eventLength() == seconds(30));
+}
+
+
+/*------------------------------------------------------------------------------
+ *  See if the playlist event can be initialized.
+ *----------------------------------------------------------------------------*/
+void
+PlaylistEventTest :: initializeTest(void)
+                                                throw (CPPUNIT_NS::Exception)
+{
+    Ptr<PlaylistEvent>::Ref     playlistEvent = createTestEvent();
+
+    playlistEvent->initialize();
+    playlistEvent->deInitialize();
+}
+
+
+/*------------------------------------------------------------------------------
+ *  See if the playlist can be played
+ *----------------------------------------------------------------------------*/
+void
+PlaylistEventTest :: playTest(void)
+                                                throw (CPPUNIT_NS::Exception)
+{
+    Ptr<PlaylistEvent>::Ref     playlistEvent = createTestEvent();
+
+    playlistEvent->initialize();
+    playlistEvent->start();
+    TimeConversion::sleep(duration);
+    playlistEvent->stop();
+    playlistEvent->deInitialize();
+}
+
diff --git a/livesupport/products/scheduler/src/PlaylistEventTest.h b/livesupport/products/scheduler/src/PlaylistEventTest.h
new file mode 100644
index 000000000..60753695d
--- /dev/null
+++ b/livesupport/products/scheduler/src/PlaylistEventTest.h
@@ -0,0 +1,157 @@
+/*------------------------------------------------------------------------------
+
+    Copyright (c) 2004 Media Development Loan Fund
+ 
+    This file is part of the LiveSupport project.
+    http://livesupport.campware.org/
+    To report bugs, send an e-mail to bugs@campware.org
+ 
+    LiveSupport is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+  
+    LiveSupport is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with LiveSupport; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ 
+ 
+    Author   : $Author: maroy $
+    Version  : $Revision: 1.1 $
+    Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventTest.h,v $
+
+------------------------------------------------------------------------------*/
+#ifndef PlaylistEventTest_h
+#define PlaylistEventTest_h
+
+#ifndef __cplusplus
+#error This is a C++ include file
+#endif
+
+
+/* ============================================================ include files */
+
+#ifdef HAVE_CONFIG_H
+#include "configure.h"
+#endif
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "LiveSupport/Core/StorageClientInterface.h"
+#include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h"
+
+
+namespace LiveSupport {
+namespace Scheduler {
+
+using namespace boost::posix_time;
+
+using namespace LiveSupport;
+using namespace LiveSupport::Core;
+using namespace LiveSupport::PlaylistExecutor;
+
+/* ================================================================ constants */
+
+
+/* =================================================================== macros */
+
+
+/* =============================================================== data types */
+
+/**
+ *  Unit test for the PlaylistEvent class
+ *
+ *  @author  $Author: maroy $
+ *  @version $Revision: 1.1 $
+ *  @see PlaylistEvent
+ */
+class PlaylistEventTest : public CPPUNIT_NS::TestFixture
+{
+    CPPUNIT_TEST_SUITE(PlaylistEventTest);
+    CPPUNIT_TEST(simpleTest);
+    CPPUNIT_TEST(initializeTest);
+    CPPUNIT_TEST(playTest);
+    CPPUNIT_TEST_SUITE_END();
+
+    private:
+        /**
+         *  The audio player used by the test.
+         */
+        Ptr<AudioPlayerInterface>::Ref      audioPlayer;
+
+        /**
+         *  The storage used by the interface.
+         */
+        Ptr<StorageClientInterface>::Ref    storage;
+
+        /**
+         *  The duration of the testing events.
+         */
+        Ptr<time_duration>::Ref             duration;
+
+        /**
+         *  Create a playlist event for testing purposes.
+         */
+        Ptr<PlaylistEvent>::Ref
+        createTestEvent(void)                       throw ();
+
+
+    protected:
+
+        /**
+         *  Simple smoke test.
+         *
+         *  @exception CPPUNIT_NS::Exception on test failures.
+         */
+        void
+        simpleTest(void)                     throw (CPPUNIT_NS::Exception);
+
+        /**
+         *  A test to see if the playlist event can be initialized.
+         *
+         *  @exception CPPUNIT_NS::Exception on test failures.
+         */
+        void
+        initializeTest(void)                throw (CPPUNIT_NS::Exception);
+
+        /**
+         *  A test to see if the playlist event can be played.
+         *
+         *  @exception CPPUNIT_NS::Exception on test failures.
+         */
+        void
+        playTest(void)                      throw (CPPUNIT_NS::Exception);
+
+
+    public:
+        
+        /**
+         *  Set up the environment for the test case.
+         */
+        void
+        setUp(void)                                     throw ();
+
+        /**
+         *  Clean up the environment after the test case.
+         */
+        void
+        tearDown(void)                                  throw ();
+};
+
+
+/* ================================================= external data structures */
+
+
+/* ====================================================== function prototypes */
+
+
+} // namespace Scheduler
+} // namespace LiveSupport
+
+#endif // PlaylistEventTest_h
+