added PlayLogEntry class
This commit is contained in:
parent
680d7eccf9
commit
c36fb8fec2
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: fgerlits $
|
# Author : $Author: fgerlits $
|
||||||
# Version : $Revision: 1.7 $
|
# Version : $Revision: 1.8 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -85,10 +85,12 @@ LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} -L${LIB_DIR}
|
||||||
# Dependencies
|
# Dependencies
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
CORE_LIB_OBJS = ${TMP_DIR}/UniqueId.o \
|
CORE_LIB_OBJS = ${TMP_DIR}/UniqueId.o \
|
||||||
|
${TMP_DIR}/AudioClip.o \
|
||||||
${TMP_DIR}/PlaylistElement.o \
|
${TMP_DIR}/PlaylistElement.o \
|
||||||
${TMP_DIR}/Playlist.o
|
${TMP_DIR}/Playlist.o
|
||||||
|
|
||||||
TEST_RUNNER_OBJS = ${TMP_DIR}/PlaylistElementTest.o \
|
TEST_RUNNER_OBJS = ${TMP_DIR}/AudioClipTest.o \
|
||||||
|
${TMP_DIR}/PlaylistElementTest.o \
|
||||||
${TMP_DIR}/PlaylistTest.o \
|
${TMP_DIR}/PlaylistTest.o \
|
||||||
${TMP_DIR}/TestRunner.o
|
${TMP_DIR}/TestRunner.o
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.2 $
|
Version : $Revision: 1.3 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -75,9 +75,8 @@ static const std::string playlengthAttrName = "playlength";
|
||||||
* Create an audio clip object based on an XML element.
|
* Create an audio clip object based on an XML element.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
AudioClip :: configure(const xmlpp::Element & element)
|
AudioClip :: configure(const xmlpp::Element & element)
|
||||||
throw (std::logic_error,
|
throw (std::invalid_argument)
|
||||||
std::invalid_argument)
|
|
||||||
{
|
{
|
||||||
if (element.get_name() != configElementNameStr) {
|
if (element.get_name() != configElementNameStr) {
|
||||||
std::string eMsg = "bad configuration element ";
|
std::string eMsg = "bad configuration element ";
|
||||||
|
|
Binary file not shown.
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: fgerlits $
|
# Author : $Author: fgerlits $
|
||||||
# Version : $Revision: 1.16 $
|
# Version : $Revision: 1.17 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -129,7 +129,8 @@ SCHEDULER_OBJS = ${TMP_DIR}/SignalDispatcher.o \
|
||||||
${TMP_DIR}/DisplayAudioClipMethod.o \
|
${TMP_DIR}/DisplayAudioClipMethod.o \
|
||||||
${TMP_DIR}/DisplayAudioClipsMethod.o \
|
${TMP_DIR}/DisplayAudioClipsMethod.o \
|
||||||
${TMP_DIR}/RevertEditedPlaylistMethod.o \
|
${TMP_DIR}/RevertEditedPlaylistMethod.o \
|
||||||
${TMP_DIR}/SavePlaylistMethod.o
|
${TMP_DIR}/SavePlaylistMethod.o \
|
||||||
|
${TMP_DIR}/PlayLogEntry.o
|
||||||
|
|
||||||
SCHEDULER_EXE_OBJS = ${SCHEDULER_OBJS} \
|
SCHEDULER_EXE_OBJS = ${SCHEDULER_OBJS} \
|
||||||
${TMP_DIR}/main.o
|
${TMP_DIR}/main.o
|
||||||
|
@ -162,6 +163,7 @@ TEST_RUNNER_OBJS = ${SCHEDULER_OBJS} \
|
||||||
${TMP_DIR}/DisplayAudioClipsMethodTest.o \
|
${TMP_DIR}/DisplayAudioClipsMethodTest.o \
|
||||||
${TMP_DIR}/SavePlaylistMethodTest.o \
|
${TMP_DIR}/SavePlaylistMethodTest.o \
|
||||||
${TMP_DIR}/RevertEditedPlaylistMethodTest.o \
|
${TMP_DIR}/RevertEditedPlaylistMethodTest.o \
|
||||||
|
${TMP_DIR}/PlayLogEntryTest.o \
|
||||||
${TMP_DIR}/TestRunner.o
|
${TMP_DIR}/TestRunner.o
|
||||||
TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl
|
TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!DOCTYPE playLogEntry [
|
||||||
|
|
||||||
|
<!ELEMENT playLogEntry EMPTY >
|
||||||
|
<!ATTLIST playLogEntry id NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST playLogEntry audioClipId NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST playLogEntry timeStamp CDATA #REQUIRED >
|
||||||
|
]>
|
||||||
|
<playLogEntry id="1" audioClipId="10001" timeStamp="1770-12-16 07:00:00.000"/>
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/PlayLogEntry.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "PlayLogEntry.h"
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the config element for this class
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string PlayLogEntry::configElementNameStr = "playLogEntry";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the attribute to get the id of the audio clip.
|
||||||
|
*/
|
||||||
|
static const std::string idAttrName = "id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the attribute to get the ID of the audio clip logged.
|
||||||
|
*/
|
||||||
|
static const std::string audioClipIdAttrName = "audioClipId";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the attribute to get the time the audio clip was played.
|
||||||
|
*/
|
||||||
|
static const std::string timeStampAttrName = "timeStamp";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Create a play log entry object based on an XML element.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlayLogEntry :: configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
if (element.get_name() != configElementNameStr) {
|
||||||
|
std::string eMsg = "bad configuration element ";
|
||||||
|
eMsg += element.get_name();
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
const xmlpp::Attribute * attribute;
|
||||||
|
std::stringstream idStrStream;
|
||||||
|
unsigned long int idValue;
|
||||||
|
|
||||||
|
if (!(attribute = element.get_attribute(idAttrName))) {
|
||||||
|
std::string eMsg = "missing attribute ";
|
||||||
|
eMsg += idAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
idStrStream.str(attribute->get_value());
|
||||||
|
idStrStream >> idValue;
|
||||||
|
id.reset(new UniqueId(idValue));
|
||||||
|
|
||||||
|
std::stringstream audioClipIdStrStream;
|
||||||
|
unsigned long int audioClipIdValue;
|
||||||
|
|
||||||
|
if (!(attribute = element.get_attribute(audioClipIdAttrName))) {
|
||||||
|
std::string eMsg = "Missing attribute ";
|
||||||
|
eMsg += audioClipIdAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
audioClipIdStrStream.str(attribute->get_value());
|
||||||
|
audioClipIdStrStream >> audioClipIdValue;
|
||||||
|
audioClipId.reset(new UniqueId(audioClipIdValue));
|
||||||
|
|
||||||
|
if (!(attribute = element.get_attribute(timeStampAttrName))) {
|
||||||
|
std::string eMsg = "missing attribute ";
|
||||||
|
eMsg += timeStampAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
timeStamp.reset(new ptime(time_from_string(attribute->get_value())));
|
||||||
|
}
|
|
@ -0,0 +1,202 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/PlayLogEntry.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Scheduler_PlayLogEntry_h
|
||||||
|
#define LiveSupport_Scheduler_PlayLogEntry_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <libxml++/libxml++.h>
|
||||||
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/UniqueId.h"
|
||||||
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class representing a play log entry.
|
||||||
|
* PlayLogEntries contain information about the audio clips played.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class PlayLogEntry : public Configurable
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The name of the configuration XML elmenent used by PlayLogEntry.
|
||||||
|
*/
|
||||||
|
static const std::string configElementNameStr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique id of the play log entry.
|
||||||
|
*/
|
||||||
|
Ptr<UniqueId>::Ref id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the audio clip referenced by this play log entry.
|
||||||
|
*/
|
||||||
|
Ptr<UniqueId>::Ref audioClipId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The time this audio clip was played.
|
||||||
|
*/
|
||||||
|
Ptr<ptime>::Ref timeStamp;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
PlayLogEntry(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a play log entry by specifying all details.
|
||||||
|
* This is used for testing purposes.
|
||||||
|
*
|
||||||
|
* @param id the ID of the play log entry.
|
||||||
|
* @param audioClipId the ID of the audio clip logged
|
||||||
|
* @param timeStamp the time this audio clip was played.
|
||||||
|
*/
|
||||||
|
PlayLogEntry(Ptr<UniqueId>::Ref id,
|
||||||
|
Ptr<UniqueId>::Ref audioClipId,
|
||||||
|
Ptr<ptime>::Ref timeStamp) throw()
|
||||||
|
{
|
||||||
|
this->id = id;
|
||||||
|
this->audioClipId = audioClipId;
|
||||||
|
this->timeStamp = timeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A virtual destructor, as this class has virtual functions.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~PlayLogEntry(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the XML element this object expects
|
||||||
|
* to be sent to a call to configure().
|
||||||
|
*
|
||||||
|
* @return the name of the expected XML configuration element.
|
||||||
|
*/
|
||||||
|
static const std::string
|
||||||
|
getConfigElementName(void) throw ()
|
||||||
|
{
|
||||||
|
return configElementNameStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the object based on the XML element supplied.
|
||||||
|
* The supplied element is expected to be of the name
|
||||||
|
* returned by configElementName().
|
||||||
|
*
|
||||||
|
* @param element the XML element to configure the object from.
|
||||||
|
* @exception std::invalid_argument if the supplied XML element
|
||||||
|
* contains bad configuration information
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ID of the play log entry.
|
||||||
|
*
|
||||||
|
* @return the unique ID of the play log entry.
|
||||||
|
*/
|
||||||
|
Ptr<const UniqueId>::Ref
|
||||||
|
getId(void) const throw ()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ID of the audio clip referenced by this entry.
|
||||||
|
*
|
||||||
|
* @return the unique ID of the audio clip.
|
||||||
|
*/
|
||||||
|
Ptr<const UniqueId>::Ref
|
||||||
|
getAudioClipId(void) const throw ()
|
||||||
|
{
|
||||||
|
return audioClipId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the time this audio clip was played.
|
||||||
|
*
|
||||||
|
* @return the the time the audio clip was played.
|
||||||
|
*/
|
||||||
|
Ptr<const ptime>::Ref
|
||||||
|
getTimeStamp(void) const throw ()
|
||||||
|
{
|
||||||
|
return timeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Scheduler
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Scheduler_PlayLogEntry_h
|
||||||
|
|
|
@ -0,0 +1,124 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/PlayLogEntryTest.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 <iostream>
|
||||||
|
|
||||||
|
#include "PlayLogEntry.h"
|
||||||
|
#include "PlayLogEntryTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(PlayLogEntryTest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration file for the audio clip.
|
||||||
|
*/
|
||||||
|
static const std::string configFileName = "etc/playLogEntry.xml";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlayLogEntryTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlayLogEntryTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Test to see if the singleton Hello object is accessible
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlayLogEntryTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Ptr<xmlpp::DomParser>::Ref parser(
|
||||||
|
new xmlpp::DomParser(configFileName, true));
|
||||||
|
const xmlpp::Document * document
|
||||||
|
= parser->get_document();
|
||||||
|
const xmlpp::Element * root
|
||||||
|
= document->get_root_node();
|
||||||
|
Ptr<PlayLogEntry>::Ref playLogEntry(new PlayLogEntry());
|
||||||
|
|
||||||
|
playLogEntry->configure(*root);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(playLogEntry->getId()->getId() == 1);
|
||||||
|
CPPUNIT_ASSERT(playLogEntry->getAudioClipId()->getId() == 10001);
|
||||||
|
|
||||||
|
Ptr<const ptime>::Ref
|
||||||
|
timeStamp = playLogEntry->getTimeStamp();
|
||||||
|
ptime beethovensBirthDay(time_from_string("1770-12-16 07:00:00"));
|
||||||
|
CPPUNIT_ASSERT(*timeStamp == beethovensBirthDay);
|
||||||
|
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
|
} catch (xmlpp::exception &e) {
|
||||||
|
std::string eMsg = "error parsing configuration file: ";
|
||||||
|
eMsg += e.what();
|
||||||
|
CPPUNIT_FAIL(eMsg);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/PlayLogEntryTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef PlayLogEntryTest_h
|
||||||
|
#define PlayLogEntryTest_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>
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the PlayLogEntry class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see PlayLogEntry
|
||||||
|
*/
|
||||||
|
class PlayLogEntryTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(PlayLogEntryTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple test.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
firstTest(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 // PlayLogEntryTest_h
|
||||||
|
|
Loading…
Reference in New Issue