Centralized the install/uninstall operations for the scheduler into a set of PHP files. This will make it easier to maintain the database because 1) the code is now in a scripting language which means, for instance, that writing upgrade scripts will be easier and also allows these install scripts to use the same infrastructure and code as the storageServer, 2) it allows the developers to see the database creation all in one place 3) simplifies and speeds up the C++ code.

This commit is contained in:
paul 2007-01-09 17:26:53 +00:00
parent 7911089b62
commit 219c8cc06f
43 changed files with 602 additions and 1270 deletions

View File

@ -83,12 +83,12 @@ case "$mode" in
'install')
echo "Installing Campcaster scheduler database tables..."
$scheduler_exe -c $config_file install
php install.php -c $config_file
;;
'uninstall')
echo "Uninstalling Campcaster scheduler database tables..."
$scheduler_exe -c $config_file uninstall
php uninstall.php -c $config_file
;;
'kill')

View File

@ -0,0 +1,27 @@
<?php
/**
* @author Paul Baranowski <paul@paulbaranowski.org>
* @version $Revision: 2774 $
* @package Campcaster
* @subpackage Scheduler
* @copyright 2006 MDLF, Inc.
* @license http://www.gnu.org/licenses/gpl.txt
* @link http://www.campware.org
*
*/
// Do not allow remote execution
$arr = array_diff_assoc($_SERVER, $_ENV);
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
header("HTTP/1.1 400");
header("Content-type: text/plain; charset=UTF-8");
echo "400 Not executable\r\n";
exit(1);
}
require_once('installInit.php');
require_once('installScheduler.php');
echo " * Scheduler install complete\n";
?>

View File

@ -0,0 +1,80 @@
<?php
if (!function_exists('pg_connect')) {
trigger_error("PostgreSQL PHP extension required and not found.", E_USER_ERROR);
exit(2);
}
require_once('DB.php');
function camp_db_table_exists($p_name)
{
global $CC_DBC;
$sql = "SELECT * FROM ".$p_name;
$result = $CC_DBC->GetOne($sql);
if (PEAR::isError($result)) {
return false;
}
return true;
}
function camp_install_query($sql)
{
global $CC_DBC;
$result = $CC_DBC->query($sql);
if (PEAR::isError($result)) {
echo "Error! ".$result->getMessage()."\n";
echo " SQL statement was:\n";
echo " ".$sql."\n\n";
} else {
echo "done.\n";
}
}
$options = getopt("c:");
if (!$options) {
echo "\nYou must specific the config file with -c.\n\n";
exit;
}
$configFile = $options['c'];
if (!file_exists($configFile)) {
echo "\nThe config file '$configFile' does not exist.\n\n";
exit;
}
echo " * Using config file $configFile\n";
$xml = file_get_contents($configFile);
$parser = xml_parser_create();
xml_parse_into_struct($parser, $xml, $vals, $index);
xml_parser_free($parser);
$CC_CONFIG['dsn'] = array('hostspec' => 'localhost',
'phptype' => 'pgsql');
// Get the user index
$userIndex = $index['SIMPLECONNECTIONMANAGER'][0];
$CC_CONFIG['dsn']['username'] = $vals[$userIndex]['attributes']['USERNAME'];
$CC_CONFIG['dsn']['password'] = $vals[$userIndex]['attributes']['PASSWORD'];
$CC_CONFIG['dsn']['database'] = $vals[$userIndex]['attributes']['DSN'];
$CC_CONFIG['playlogTable'] = 'playlog';
$CC_CONFIG['scheduleTable'] = 'schedule';
$CC_CONFIG['backupTable'] = 'backup';
$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE);
if (PEAR::isError($CC_DBC)) {
echo $CC_DBC->getMessage()."\n";
echo $CC_DBC->getUserInfo()."\n";
echo "Database connection problem.\n";
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
" with corresponding permissions.\n";
exit(1);
} else {
echo " * Connected to database\n";
}
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
?>

View File

@ -0,0 +1,51 @@
<?php
// Do not allow remote execution
$arr = array_diff_assoc($_SERVER, $_ENV);
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
header("HTTP/1.1 400");
header("Content-type: text/plain; charset=UTF-8");
echo "400 Not executable\r\n";
exit(1);
}
if (!camp_db_table_exists($CC_CONFIG['scheduleTable'])) {
echo " * Creating database table ".$CC_CONFIG['scheduleTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['scheduleTable']."("
." id BIGINT NOT NULL,"
." playlist BIGINT NOT NULL,"
." starts TIMESTAMP NOT NULL,"
." ends TIMESTAMP NOT NULL,"
." PRIMARY KEY(id))";
camp_install_query($sql);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['scheduleTable']."\n";
}
if (!camp_db_table_exists($CC_CONFIG['playlogTable'])) {
echo " * Creating database table ".$CC_CONFIG['playlogTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['playlogTable']."("
." id BIGINT NOT NULL,"
." audioClipId BIGINT NOT NULL,"
." timestamp TIMESTAMP NOT NULL,"
." PRIMARY KEY(id))";
camp_install_query($sql);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['playlogTable']."\n";
}
if (!camp_db_table_exists($CC_CONFIG['backupTable'])) {
echo " * Creating database table ".$CC_CONFIG['backupTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['backupTable']." ("
." token VARCHAR(64) NOT NULL,"
." sessionId VARCHAR(64) NOT NULL,"
." status VARCHAR(32) NOT NULL,"
." fromTime TIMESTAMP NOT NULL,"
." toTime TIMESTAMP NOT NULL,"
." PRIMARY KEY(token))";
camp_install_query($sql);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['backupTable']."\n";
}
?>

View File

@ -0,0 +1,27 @@
<?php
/**
* @author Paul Baranowski <paul@paulbaranowski.org>
* @version $Revision: 2774 $
* @package Campcaster
* @subpackage Scheduler
* @copyright 2006 MDLF, Inc.
* @license http://www.gnu.org/licenses/gpl.txt
* @link http://www.campware.org
*/
// Do not allow remote execution.
$arr = array_diff_assoc($_SERVER, $_ENV);
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
header("HTTP/1.1 400");
header("Content-type: text/plain; charset=UTF-8");
echo "400 Not executable\r\n";
exit;
}
require_once('installInit.php');
require_once('uninstallScheduler.php');
echo " * Scheduler uninstall complete\n";
?>

View File

@ -0,0 +1,34 @@
<?PHP
// Do not allow remote execution.
$arr = array_diff_assoc($_SERVER, $_ENV);
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
header("HTTP/1.1 400");
header("Content-type: text/plain; charset=UTF-8");
echo "400 Not executable\r\n";
exit;
}
if (camp_db_table_exists($CC_CONFIG['scheduleTable'])) {
echo " * Removing database table ".$CC_CONFIG['scheduleTable']."...";
camp_install_query("DROP TABLE ".$CC_CONFIG['scheduleTable']);
} else {
echo " * Skipping: database table ".$CC_CONFIG['scheduleTable']."\n";
}
if (camp_db_table_exists($CC_CONFIG['backupTable'])) {
echo " * Removing database table ".$CC_CONFIG['backupTable']."...";
camp_install_query("DROP TABLE ".$CC_CONFIG['backupTable']);
} else {
echo " * Skipping: database table ".$CC_CONFIG['backupTable']."\n";
}
if (camp_db_table_exists($CC_CONFIG['playlogTable'])) {
echo " * Removing database table ".$CC_CONFIG['playlogTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['playlogTable'];
camp_install_query($sql);
} else {
echo " * Skipping: database table ".$CC_CONFIG['playlogTable']."\n";
}
?>

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -96,7 +96,7 @@ BackupFactory :: configure(const xmlpp::Element & element)
cmf = ConnectionManagerFactory::getInstance();
Ptr<ConnectionManagerInterface>::Ref
connection = cmf->getConnectionManager();
Ptr<StorageClientFactory>::Ref
scf = StorageClientFactory::getInstance();
Ptr<StorageClientInterface>::Ref
@ -106,7 +106,7 @@ BackupFactory :: configure(const xmlpp::Element & element)
sf = ScheduleFactory::getInstance();
Ptr<ScheduleInterface>::Ref
schedule = sf->getSchedule();
// try to look for a PostgresqlBackup configuration element
xmlpp::Node::NodeList nodes =
element.get_children(PostgresqlBackup::getConfigElementName());
@ -124,46 +124,3 @@ BackupFactory :: configure(const xmlpp::Element & element)
throw std::invalid_argument("could not configure BackupFactory");
}
}
/*------------------------------------------------------------------------------
* Install the backup factory.
*----------------------------------------------------------------------------*/
void
BackupFactory :: install(void) throw (std::exception)
{
if (!backup) {
throw std::logic_error("BackupFactory not yet configured");
}
backup->install();
}
/*------------------------------------------------------------------------------
* Check to see if the backup factory has already been installed.
*----------------------------------------------------------------------------*/
bool
BackupFactory :: isInstalled(void) throw (std::exception)
{
if (!backup) {
throw std::logic_error("BackupFactory not yet configured");
}
return backup->isInstalled();
}
/*------------------------------------------------------------------------------
* Install the backup factory.
*----------------------------------------------------------------------------*/
void
BackupFactory :: uninstall(void) throw (std::exception)
{
if (!backup) {
throw std::logic_error("BackupFactory not yet configured");
}
backup->uninstall();
}

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -39,7 +39,6 @@
#include <stdexcept>
#include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Core/Installable.h"
#include "BackupInterface.h"
@ -88,8 +87,7 @@ using namespace LiveSupport::Core;
* @version $Revision$
* @see PostgresqlBackup
*/
class BackupFactory : virtual public Configurable,
virtual public Installable
class BackupFactory : virtual public Configurable
{
private:
/**
@ -127,7 +125,7 @@ class BackupFactory : virtual public Configurable,
/**
* 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
@ -158,38 +156,6 @@ class BackupFactory : virtual public Configurable,
throw (std::invalid_argument,
std::logic_error);
/**
* Install the component.
* This step involves creating the environment in which the component
* will run. This may be creation of coniguration files,
* database tables, etc.
*
* @exception std::exception on installation problems,
* especially if the BackupFactory was not yet configured.
*/
virtual void
install(void) throw (std::exception);
/**
* Check to see if the component has already been installed.
*
* @return true if the component is properly installed,
* false otherwise
* @exception std::exception on generic problems
*/
virtual bool
isInstalled(void) throw (std::exception);
/**
* Uninstall the component.
* Removes all the resources created in the install step.
*
* @exception std::exception on unistallation problems,
e especially if the BackupFactory was not yet configured.
*/
virtual void
uninstall(void) throw (std::exception);
/**
* Return a backup.
*

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -40,7 +40,6 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/Installable.h"
#include "LiveSupport/Core/Playlist.h"
#include "LiveSupport/Core/ScheduleEntry.h"
#include "LiveSupport/StorageClient/StorageClientInterface.h"
@ -67,7 +66,7 @@ using namespace LiveSupport::StorageClient;
/**
* The generic interface for creating and restoring schedule backups.
*
* There is a singleton instance of this type, which is manufactured by the
* There is a singleton instance of this type, which is manufactured by the
* BackupFactory class.
*
* There are separate xxxxMethod classes which perform these
@ -78,7 +77,7 @@ using namespace LiveSupport::StorageClient;
* @author $Author$
* @version $Revision$
*/
class BackupInterface : virtual public Installable
class BackupInterface
{
public:
/**
@ -93,7 +92,7 @@ class BackupInterface : virtual public Installable
* @param criteria the criteria to use for backing up the storage
* @param fromTime entries are included in the schedule export starting
* from this time.
* @param toTime entries as included in the schedule export
* @param toTime entries as included in the schedule export
* up to but not including this time.
* @return a token, which can be used to query the backup process.
* @exception XmlRpcException on XML-RPC issues.
@ -113,7 +112,7 @@ class BackupInterface : virtual public Installable
*
* @param token the identifier of this backup task.
* @param url return parameter;
* if the status is "success", it contains the
* if the status is "success", it contains the
* URL of the created backup file.
* @param path return parameter;
* if the status is "success", it contains the
@ -155,10 +154,10 @@ class BackupInterface : virtual public Installable
* Restore a schedule backup.
*
* All playlist IDs contained in the backup should already be in the
* storage. If this is a combined backup, with both storage and
* storage. If this is a combined backup, with both storage and
* schedule components, then restore this backup to the storage
* first, and then call this function.
*
*
* @param sessionId a valid session ID to identify the user.
* @param path the location of the archive to upload.
* @exception XmlRpcException if there is an error.

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -88,7 +88,6 @@ DisplayScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
storage->reset();
schedule = scheduler->getSchedule();
schedule->install();
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
@ -97,7 +96,7 @@ DisplayScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
} catch (std::exception &e) {
CPPUNIT_FAIL(e.what());
}
authentication = scheduler->getAuthentication();
try {
sessionId = authentication->login("root", "q");
@ -117,8 +116,6 @@ DisplayScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
void
DisplayScheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
schedule->uninstall();
authentication->logout(sessionId);
sessionId.reset();
authentication.reset();
@ -251,7 +248,7 @@ DisplayScheduleMethodTest :: insertEntries(void)
}
}
/*------------------------------------------------------------------------------
* Look at some intervals and check against test data
*----------------------------------------------------------------------------*/
@ -297,7 +294,7 @@ DisplayScheduleMethodTest :: intervalTest(void)
// check the returned values
CPPUNIT_ASSERT(result.size() == 1);
CPPUNIT_ASSERT(result[0].hasMember("playlistId"));
CPPUNIT_ASSERT(result[0]["playlistId"].getType()
CPPUNIT_ASSERT(result[0]["playlistId"].getType()
== XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(result[0]["playlistId"]) == "0000000000000001");
time = result[0]["start"];
@ -346,7 +343,7 @@ DisplayScheduleMethodTest :: intervalTest(void)
// check the returned values
CPPUNIT_ASSERT(result.size() == 2);
CPPUNIT_ASSERT(result[0].hasMember("playlistId"));
CPPUNIT_ASSERT(result[0]["playlistId"].getType()
CPPUNIT_ASSERT(result[0]["playlistId"].getType()
== XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(result[0]["playlistId"]) == "0000000000000001");
time = result[0]["start"];
@ -365,7 +362,7 @@ DisplayScheduleMethodTest :: intervalTest(void)
CPPUNIT_ASSERT(time.tm_sec == 0);
CPPUNIT_ASSERT(result[1].hasMember("playlistId"));
CPPUNIT_ASSERT(result[1]["playlistId"].getType()
CPPUNIT_ASSERT(result[1]["playlistId"].getType()
== XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(result[1]["playlistId"]) == "0000000000000001");
time = result[1]["start"];

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -87,8 +87,6 @@ GeneratePlayReportMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
storage->reset();
playLog = scheduler->getPlayLog();
playLog->install();
insertEntries();
} catch (std::invalid_argument &e) {
@ -98,7 +96,7 @@ GeneratePlayReportMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
} catch (std::exception &e) {
CPPUNIT_FAIL(e.what());
}
authentication = scheduler->getAuthentication();
try {
sessionId = authentication->login("root", "q");
@ -116,8 +114,6 @@ GeneratePlayReportMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
void
GeneratePlayReportMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
playLog->uninstall();
authentication->logout(sessionId);
sessionId.reset();
authentication.reset();
@ -236,13 +232,13 @@ GeneratePlayReportMethodTest :: intervalTest(void)
// check the returned values
CPPUNIT_ASSERT(result.size() == 1);
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
UniqueId newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
== XmlRpc::XmlRpcValue::TypeDateTime);
time = result[0]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
@ -284,13 +280,13 @@ GeneratePlayReportMethodTest :: intervalTest(void)
// check the returned values
CPPUNIT_ASSERT(result.size() == 1);
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
== XmlRpc::XmlRpcValue::TypeDateTime);
time = result[0]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
@ -332,13 +328,13 @@ GeneratePlayReportMethodTest :: intervalTest(void)
// check the returned values
CPPUNIT_ASSERT(result.size() == 2);
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
CPPUNIT_ASSERT(newAudioClipId.getId() == 10017);
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
== XmlRpc::XmlRpcValue::TypeDateTime);
time = result[0]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
@ -349,13 +345,13 @@ GeneratePlayReportMethodTest :: intervalTest(void)
CPPUNIT_ASSERT(time.tm_sec == 0);
CPPUNIT_ASSERT(result[1].hasMember("audioClipId"));
CPPUNIT_ASSERT(result[1]["audioClipId"].getType()
CPPUNIT_ASSERT(result[1]["audioClipId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
newAudioClipId = UniqueId(std::string(result[1]["audioClipId"]));
CPPUNIT_ASSERT(newAudioClipId.getId() == 10003);
CPPUNIT_ASSERT(result[1].hasMember("timestamp"));
CPPUNIT_ASSERT(result[1]["timestamp"].getType()
CPPUNIT_ASSERT(result[1]["timestamp"].getType()
== XmlRpc::XmlRpcValue::TypeDateTime);
time = result[1]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 104); // 2004

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -114,45 +114,3 @@ PlayLogFactory :: configure(const xmlpp::Element & element)
}
}
/*------------------------------------------------------------------------------
* Install the play log factory.
*----------------------------------------------------------------------------*/
void
PlayLogFactory :: install(void) throw (std::exception)
{
if (!playLog) {
throw std::logic_error("PlayLogFactory not yet configured");
}
playLog->install();
}
/*------------------------------------------------------------------------------
* Check to see if the factory has already been installed.
*----------------------------------------------------------------------------*/
bool
PlayLogFactory :: isInstalled(void) throw (std::exception)
{
if (!playLog) {
throw std::logic_error("PlayLogFactory not yet configured");
}
return playLog->isInstalled();
}
/*------------------------------------------------------------------------------
* Uninstall the play log factory.
*----------------------------------------------------------------------------*/
void
PlayLogFactory :: uninstall(void) throw (std::exception)
{
if (!playLog) {
throw std::logic_error("PlayLogFactory not yet configured");
}
playLog->uninstall();
}

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -43,7 +43,6 @@
#include <stdexcept>
#include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Core/Installable.h"
#include "PlayLogInterface.h"
@ -89,8 +88,7 @@ using namespace LiveSupport::Core;
* @version $Revision$
* @see PostgresqlPlayLog
*/
class PlayLogFactory : virtual public Configurable,
virtual public Installable
class PlayLogFactory : virtual public Configurable
{
private:
/**
@ -128,7 +126,7 @@ class PlayLogFactory : virtual public Configurable,
/**
* 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
@ -159,38 +157,6 @@ class PlayLogFactory : virtual public Configurable,
throw (std::invalid_argument,
std::logic_error);
/**
* Install the component.
* This step involves creating the environment in which the component
* will run. This may be creation of coniguration files,
* database tables, etc.
*
* @exception std::exception on installation problems,
* especially if the PlayLogFactory was not yet configured.
*/
virtual void
install(void) throw (std::exception);
/**
* Check to see if the component has already been installed.
*
* @return true if the component is properly installed,
* false otherwise
* @exception std::exception on generic problems
*/
virtual bool
isInstalled(void) throw (std::exception);
/**
* Uninstall the component.
* Removes all the resources created in the install step.
*
* @exception std::exception on unistallation problems,
e especially if the PlayLogFactory was not yet configured.
*/
virtual void
uninstall(void) throw (std::exception);
/**
* Return a play log.
*

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -44,7 +44,6 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/Installable.h"
#include "LiveSupport/Core/Playlist.h"
#include "LiveSupport/Core/PlayLogEntry.h"
@ -72,7 +71,7 @@ using namespace LiveSupport::Core;
* @author $Author$
* @version $Revision$
*/
class PlayLogInterface : virtual public Installable
class PlayLogInterface
{
public:
/**

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -99,13 +99,6 @@ PlaylistEventContainerTest :: setUp(void) throw (CPPUNIT_NS::Exception)
std::cerr << e.what() << std::endl;
CPPUNIT_FAIL("error parsing configuration file");
}
try {
schedule->install();
playLog->install();
} catch (std::exception &e) {
std::cerr << e.what() << std::endl;
CPPUNIT_FAIL("can't install schedule factory");
}
audioPlayer->initialize();
if (!(sessionId = authentication->login("root", "q"))) {
@ -121,8 +114,6 @@ void
PlaylistEventContainerTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
audioPlayer->deInitialize();
schedule->uninstall();
playLog->uninstall();
playLog.reset();
schedule.reset();
@ -172,7 +163,7 @@ PlaylistEventContainerTest :: scheduleTest(void)
// schedule playlist 1 at 10 seconds from now
Ptr<UniqueId>::Ref playlistId(new UniqueId(1));
Ptr<Playlist>::Ref playlist = storage->getPlaylist(sessionId,
Ptr<Playlist>::Ref playlist = storage->getPlaylist(sessionId,
playlistId);
CPPUNIT_ASSERT(playlist.get());
Ptr<ptime>::Ref now = TimeConversion::now();

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -97,7 +97,6 @@ PlaylistEventTest :: setUp(void) throw (CPPUNIT_NS::Exception)
}
audioPlayer->initialize();
playLog->install();
duration.reset(new time_duration(seconds(30)));
@ -113,7 +112,6 @@ PlaylistEventTest :: setUp(void) throw (CPPUNIT_NS::Exception)
void
PlaylistEventTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
playLog->uninstall();
audioPlayer->deInitialize();
duration.reset();

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -109,26 +109,6 @@ const std::string scheduleExportFileName = "meta-inf/scheduler.xml";
*----------------------------------------------------------------------------*/
const std::string check1Stmt = "SELECT 1";
/*------------------------------------------------------------------------------
* The SQL create statement, used for installation.
*----------------------------------------------------------------------------*/
const std::string createStmt =
"CREATE TABLE backup\n"
"(\n"
" token VARCHAR(64) NOT NULL,\n"
" sessionId VARCHAR(64) NOT NULL,\n"
" status VARCHAR(32) NOT NULL,\n"
" fromTime TIMESTAMP NOT NULL,\n"
" toTime TIMESTAMP NOT NULL,\n"
"\n"
" PRIMARY KEY(token)\n"
");";
/*------------------------------------------------------------------------------
* The SQL create statement, used for installation.
*----------------------------------------------------------------------------*/
const std::string dropStmt = "DROP TABLE backup;";
/*------------------------------------------------------------------------------
* A statement to check if the backup table exists.
*----------------------------------------------------------------------------*/
@ -192,97 +172,6 @@ PostgresqlBackup :: configure(const xmlpp::Element & element)
}
/*------------------------------------------------------------------------------
* Install the PostgresqlBackup.
*----------------------------------------------------------------------------*/
void
PostgresqlBackup :: install(void) throw (std::exception)
{
if (!isInstalled()) {
Ptr<Connection>::Ref conn;
try {
conn = connectionManager->getConnection();
Ptr<Statement>::Ref stmt(conn->createStatement());
stmt->execute(createStmt);
connectionManager->returnConnection(conn);
} catch (std::exception &e) {
if (conn) {
connectionManager->returnConnection(conn);
}
throw;
}
}
}
/*------------------------------------------------------------------------------
* Check to see if the PostgresqlBackup has already been installed.
*----------------------------------------------------------------------------*/
bool
PostgresqlBackup :: isInstalled(void) throw (std::exception)
{
Ptr<Connection>::Ref conn;
try {
Ptr<Statement>::Ref stmt;
ResultSet * res;
conn = connectionManager->getConnection();
// see if we can connect at all
stmt.reset(conn->createStatement());
stmt->execute(check1Stmt);
res = stmt->getResultSet();
if (!res->next() || (res->getInt(1) != 1)) {
throw std::runtime_error("Can't connect to database");
}
// see if the backup table exists
try {
stmt.reset(conn->createStatement());
stmt->execute(backupCountStmt);
res = stmt->getResultSet();
if (!res->next() || (res->getInt(1) < 0)) {
connectionManager->returnConnection(conn);
return false;
}
} catch (std::exception &e) {
connectionManager->returnConnection(conn);
return false;
}
connectionManager->returnConnection(conn);
} catch (std::exception &e) {
if (conn) {
connectionManager->returnConnection(conn);
}
throw;
}
return true;
}
/*------------------------------------------------------------------------------
* Uninstall the PostgresqlBackup.
*----------------------------------------------------------------------------*/
void
PostgresqlBackup :: uninstall(void) throw (std::exception)
{
Ptr<Connection>::Ref conn;
try {
conn = connectionManager->getConnection();
Ptr<Statement>::Ref stmt(conn->createStatement());
stmt->execute(dropStmt);
connectionManager->returnConnection(conn);
} catch (std::exception &e) {
if (conn) {
connectionManager->returnConnection(conn);
}
throw;
}
}
/*------------------------------------------------------------------------------
* Start a backup process.
*----------------------------------------------------------------------------*/
@ -364,7 +253,7 @@ PostgresqlBackup ::createBackupCheck(
Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
if (rs->next()) {
status = stringToAsyncState(rs->getString(3));
timestamp.reset(new Timestamp(rs->getTimestamp(4)));
fromTime = Conversion::timestampToPtime(timestamp);
@ -514,7 +403,7 @@ PostgresqlBackup :: restoreBackup(Ptr<SessionId>::Ref sessionId,
throw (XmlRpcException)
{
//TODO: check the session ID
std::string tmpFileName = FileTools::tempnam();
try {
FileTools::extractFileFromTarball(*path,
@ -526,7 +415,7 @@ PostgresqlBackup :: restoreBackup(Ptr<SessionId>::Ref sessionId,
errorMsg += e.what();
throw XmlRpcIOException(errorMsg);
}
Ptr<DomParser>::Ref parser(new DomParser(tmpFileName,
false /* do not expect a DTD */));
const Document * document = parser->get_document();

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -105,12 +105,12 @@ class PostgresqlBackup : public Configurable,
* The storage client to use for connecting to the storage server.
*/
Ptr<StorageClientInterface>::Ref storage;
/**
* The schedule to use for reading the schedule entries from.
*/
Ptr<ScheduleInterface>::Ref schedule;
/**
* The default constructor.
*/
@ -132,7 +132,7 @@ class PostgresqlBackup : public Configurable,
Ptr<ptime>::Ref fromTime,
Ptr<ptime>::Ref toTime)
throw (std::runtime_error);
/**
* Convert a string status to an AsyncState.
* It converts
@ -145,7 +145,7 @@ class PostgresqlBackup : public Configurable,
*/
AsyncState
stringToAsyncState(const std::string & statusString) throw ();
/**
* Convert an AsyncState to a string.
* It converts
@ -190,7 +190,7 @@ class PostgresqlBackup : public Configurable,
/**
* 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
@ -215,36 +215,6 @@ class PostgresqlBackup : public Configurable,
throw (std::invalid_argument,
std::logic_error);
/**
* Install the component.
* This step involves creating the environment in which the component
* will run. This may be creation of coniguration files,
* database tables, etc.
*
* @exception std::exception on installation problems.
*/
virtual void
install(void) throw (std::exception);
/**
* Check to see if the component has already been installed.
*
* @return true if the component is properly installed,
* false otherwise
* @exception std::exception on generic problems
*/
virtual bool
isInstalled(void) throw (std::exception);
/**
* Uninstall the component.
* Removes all the resources created in the install step.
*
* @exception std::exception on unistallation problems.
*/
virtual void
uninstall(void) throw (std::exception);
/**
* Start to create a backup by calling the storage, and also
* adding a backup of the schedule.
@ -257,7 +227,7 @@ class PostgresqlBackup : public Configurable,
* @param criteria the criteria to use for backing up the storage
* @param fromTime entries are included in the schedule export starting
* from this time.
* @param toTime entries as included in the schedule export
* @param toTime entries as included in the schedule export
* up to but not including this time.
* @return a token, which can be used to query the backup process.
* @exception XmlRpcException on XML-RPC issues.
@ -276,7 +246,7 @@ class PostgresqlBackup : public Configurable,
*
* @param token the identifier of this backup task.
* @param url return parameter;
* if the status is "success", it contains the
* if the status is "success", it contains the
* URL of the created backup file.
* @param path return parameter;
* if the status is "success", it contains the
@ -316,10 +286,10 @@ class PostgresqlBackup : public Configurable,
* Restore a schedule backup.
*
* All playlist IDs contained in the backup should already be in the
* storage. If this is a combined backup, with both storage and
* storage. If this is a combined backup, with both storage and
* schedule components, then restore this backup to the storage
* first, and then call this function.
*
*
* @param sessionId a valid session ID to identify the user.
* @param path the location of the archive to upload.
* @exception XmlRpcException if there is an error.

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -83,21 +83,20 @@ PostgresqlBackupTest :: setUp(void) throw (CPPUNIT_NS::Exception)
Ptr<ConnectionManagerInterface>::Ref connectionManager;
Ptr<StorageClientInterface>::Ref storage;
Ptr<ScheduleInterface>::Ref schedule;
connectionManager = daemon->getConnectionManager();
storage = daemon->getStorage();
schedule = daemon->getSchedule();
backup.reset(new PostgresqlBackup(connectionManager,
storage,
schedule));
backup->install();
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
} catch (xmlpp::exception &e) {
CPPUNIT_FAIL("error parsing configuration file");
}
authentication = daemon->getAuthentication();
try {
sessionId = authentication->login("root", "q");
@ -118,10 +117,7 @@ PostgresqlBackupTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
CPPUNIT_ASSERT_NO_THROW(
authentication->logout(sessionId);
);
CPPUNIT_ASSERT_NO_THROW(
backup->uninstall();
);
remove(tempBackupTarFileName.c_str());
}
@ -159,11 +155,11 @@ PostgresqlBackupTest :: createBackup(void)
|| status == AsyncState::finishedState
|| status == AsyncState::failedState);
} while (--iterations && status == AsyncState::pendingState);
CPPUNIT_ASSERT_EQUAL(AsyncState::finishedState, status);
CPPUNIT_ASSERT(url);
CPPUNIT_ASSERT(path);
// copy the backup file
CPPUNIT_ASSERT_NO_THROW(
remove(tempBackupTarFileName.c_str());
@ -171,7 +167,7 @@ PostgresqlBackupTest :: createBackup(void)
std::ofstream ofs(tempBackupTarFileName.c_str(), std::ios::binary);
ofs << ifs.rdbuf();
);
CPPUNIT_ASSERT_NO_THROW(
backup->createBackupClose(*token);
);
@ -188,7 +184,7 @@ PostgresqlBackupTest :: createBackupTest(void)
CPPUNIT_ASSERT_NO_THROW(
createBackup()
);
bool exists;
std::string schedulerBackupInTarball = "meta-inf/scheduler.xml";
CPPUNIT_ASSERT_NO_THROW(
@ -196,24 +192,24 @@ PostgresqlBackupTest :: createBackupTest(void)
schedulerBackupInTarball)
);
CPPUNIT_ASSERT(exists);
std::string extractedTempFileName = "tmp/scheduler.tmp.xml";
FILE * file;
remove(extractedTempFileName.c_str());
file = fopen(extractedTempFileName.c_str(), "r");
CPPUNIT_ASSERT(file == 0);
CPPUNIT_ASSERT_NO_THROW(
FileTools::extractFileFromTarball(tempBackupTarFileName,
schedulerBackupInTarball,
extractedTempFileName)
);
file = fopen(extractedTempFileName.c_str(), "r");
CPPUNIT_ASSERT(file != 0);
CPPUNIT_ASSERT(fclose(file) == 0);
CPPUNIT_ASSERT(remove(extractedTempFileName.c_str()) == 0);
file = fopen(extractedTempFileName.c_str(), "r");
CPPUNIT_ASSERT(file == 0);
@ -230,7 +226,7 @@ PostgresqlBackupTest :: restoreBackupTest(void)
CPPUNIT_ASSERT_NO_THROW(
createBackup()
);
Ptr<const Glib::ustring>::Ref backupFile(new const Glib::ustring(
tempBackupTarFileName));
CPPUNIT_ASSERT_NO_THROW(

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -68,25 +68,6 @@ const std::string PostgresqlPlayLog::check1Stmt = "SELECT 1";
const std::string PostgresqlPlayLog::logCountStmt =
"SELECT COUNT(*) FROM playLog";
/*------------------------------------------------------------------------------
* The SQL create statement, used for installation.
*----------------------------------------------------------------------------*/
const std::string PostgresqlPlayLog::createStmt =
"CREATE TABLE playLog\n"
"(\n"
" id BIGINT NOT NULL,\n"
" audioClipId BIGINT NOT NULL,\n"
" timestamp TIMESTAMP NOT NULL,\n"
"\n"
" PRIMARY KEY(id)\n"
");";
/*------------------------------------------------------------------------------
* The SQL create statement, used for installation.
*----------------------------------------------------------------------------*/
const std::string PostgresqlPlayLog::dropStmt =
"DROP TABLE playLog;";
/*------------------------------------------------------------------------------
* The SQL statement for adding a play log entry.
* It's a simple insert.
@ -131,97 +112,6 @@ PostgresqlPlayLog :: configure(const xmlpp::Element & element)
}
/*------------------------------------------------------------------------------
* Install the PostgresqlPlayLog.
*----------------------------------------------------------------------------*/
void
PostgresqlPlayLog :: install(void) throw (std::exception)
{
if (!isInstalled()) {
Ptr<Connection>::Ref conn;
try {
conn = cm->getConnection();
Ptr<Statement>::Ref stmt(conn->createStatement());
stmt->execute(createStmt);
cm->returnConnection(conn);
} catch (std::exception &e) {
if (conn) {
cm->returnConnection(conn);
}
throw std::logic_error(e.what());
}
}
}
/*------------------------------------------------------------------------------
* Check to see if the PostgresqlPlayLog has already been installed.
*----------------------------------------------------------------------------*/
bool
PostgresqlPlayLog :: isInstalled(void) throw (std::exception)
{
Ptr<Connection>::Ref conn;
try {
Ptr<Statement>::Ref stmt;
ResultSet * res;
conn = cm->getConnection();
// see if we can connect at all
stmt.reset(conn->createStatement());
stmt->execute(check1Stmt);
res = stmt->getResultSet();
if (!res->next() || (res->getInt(1) != 1)) {
throw std::runtime_error("Can't connect to database");
}
// see if the schedule table exists
try {
stmt.reset(conn->createStatement());
stmt->execute(logCountStmt);
res = stmt->getResultSet();
if (!res->next() || (res->getInt(1) < 0)) {
cm->returnConnection(conn);
return false;
}
} catch (std::exception &e) {
cm->returnConnection(conn);
return false;
}
cm->returnConnection(conn);
} catch (std::exception &e) {
if (conn) {
cm->returnConnection(conn);
}
throw;
}
return true;
}
/*------------------------------------------------------------------------------
* Uninstall the PostgresqlPlayLog.
*----------------------------------------------------------------------------*/
void
PostgresqlPlayLog :: uninstall(void) throw (std::exception)
{
Ptr<Connection>::Ref conn;
try {
conn = cm->getConnection();
Ptr<Statement>::Ref stmt(conn->createStatement());
stmt->execute(dropStmt);
cm->returnConnection(conn);
} catch (std::exception &e) {
if (conn) {
cm->returnConnection(conn);
}
throw std::logic_error(e.what());
}
}
/*------------------------------------------------------------------------------
* Add a new play log entry
*----------------------------------------------------------------------------*/
@ -244,7 +134,7 @@ PostgresqlPlayLog :: addPlayLogEntry(
pstmt->setLong(1, id->getId());
pstmt->setLong(2, audioClipId->getId());
timestamp = Conversion::ptimeToTimestamp(clipTimestamp);
pstmt->setTimestamp(3, *timestamp);
@ -295,7 +185,7 @@ PostgresqlPlayLog :: getPlayLogEntries(
Ptr<UniqueId>::Ref audioClipId(new UniqueId(rs->getLong(2)));
*timestamp = rs->getTimestamp(3);
Ptr<ptime>::Ref clipTimestamp
Ptr<ptime>::Ref clipTimestamp
= Conversion::timestampToPtime(timestamp);
Ptr<PlayLogEntry>::Ref entry(new PlayLogEntry(id,

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -102,16 +102,6 @@ class PostgresqlPlayLog : public Configurable,
*/
static const std::string logCountStmt;
/**
* The SQL create statement used in the installation step.
*/
static const std::string createStmt;
/**
* The SQL drop statement used in the uninstallation step.
*/
static const std::string dropStmt;
/**
* The SQL statement for adding a play log entry.
*/
@ -160,7 +150,7 @@ class PostgresqlPlayLog : public Configurable,
/**
* 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
@ -185,36 +175,6 @@ class PostgresqlPlayLog : public Configurable,
throw (std::invalid_argument,
std::logic_error);
/**
* Install the component.
* This step involves creating the environment in which the component
* will run. This may be creation of coniguration files,
* database tables, etc.
*
* @exception std::exception on installation problems.
*/
virtual void
install(void) throw (std::exception);
/**
* Check to see if the component has already been installed.
*
* @return true if the component is properly installed,
* false otherwise
* @exception std::exception on generic problems
*/
virtual bool
isInstalled(void) throw (std::exception);
/**
* Uninstall the component.
* Removes all the resources created in the install step.
*
* @exception std::exception on unistallation problems.
*/
virtual void
uninstall(void) throw (std::exception);
/**
* Add a new entry to the play log.
*

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -75,9 +75,8 @@ PostgresqlPlayLogTest :: setUp(void) throw (CPPUNIT_NS::Exception)
Ptr<SchedulerDaemon>::Ref scheduler = SchedulerDaemon::getInstance();
try {
cm = scheduler->getConnectionManager();
playLog.reset(new PostgresqlPlayLog(cm));
playLog->install();
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
} catch (xmlpp::exception &e) {
@ -92,13 +91,6 @@ PostgresqlPlayLogTest :: setUp(void) throw (CPPUNIT_NS::Exception)
void
PostgresqlPlayLogTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
try {
playLog->uninstall();
} catch (std::exception &e) {
std::string eMsg = "cannot uninstall playlog:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
}
playLog.reset();
cm.reset();
}

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -90,26 +90,6 @@ const std::string PostgresqlSchedule::check1Stmt = "SELECT 1";
const std::string PostgresqlSchedule::scheduleCountStmt =
"SELECT COUNT(*) FROM schedule";
/*------------------------------------------------------------------------------
* The SQL create statement, used for installation.
*----------------------------------------------------------------------------*/
const std::string PostgresqlSchedule::createStmt =
"CREATE TABLE schedule\n"
"(\n"
" id BIGINT NOT NULL,\n"
" playlist BIGINT NOT NULL,\n"
" starts TIMESTAMP NOT NULL,\n"
" ends TIMESTAMP NOT NULL,\n"
"\n"
" PRIMARY KEY(id)\n"
");";
/*------------------------------------------------------------------------------
* The SQL create statement, used for installation.
*----------------------------------------------------------------------------*/
const std::string PostgresqlSchedule::dropStmt =
"DROP TABLE schedule;";
/*------------------------------------------------------------------------------
* The SQL statement for querying if a timeframe is available.
* The parameters for this call are: starts, starts, ends, ends, starts, ends,
@ -215,97 +195,6 @@ PostgresqlSchedule :: configure(const xmlpp::Element & element)
}
/*------------------------------------------------------------------------------
* Install the PostgresqlSchedule.
*----------------------------------------------------------------------------*/
void
PostgresqlSchedule :: install(void) throw (std::exception)
{
if (!isInstalled()) {
Ptr<Connection>::Ref conn;
try {
conn = cm->getConnection();
Ptr<Statement>::Ref stmt(conn->createStatement());
stmt->execute(createStmt);
cm->returnConnection(conn);
} catch (std::exception &e) {
if (conn) {
cm->returnConnection(conn);
}
throw;
}
}
}
/*------------------------------------------------------------------------------
* Check to see if the PostgresqlSchedule has already been installed.
*----------------------------------------------------------------------------*/
bool
PostgresqlSchedule :: isInstalled(void) throw (std::exception)
{
Ptr<Connection>::Ref conn;
try {
Ptr<Statement>::Ref stmt;
ResultSet * res;
conn = cm->getConnection();
// see if we can connect at all
stmt.reset(conn->createStatement());
stmt->execute(check1Stmt);
res = stmt->getResultSet();
if (!res->next() || (res->getInt(1) != 1)) {
throw std::runtime_error("Can't connect to database");
}
// see if the schedule table exists
try {
stmt.reset(conn->createStatement());
stmt->execute(scheduleCountStmt);
res = stmt->getResultSet();
if (!res->next() || (res->getInt(1) < 0)) {
cm->returnConnection(conn);
return false;
}
} catch (std::exception &e) {
cm->returnConnection(conn);
return false;
}
cm->returnConnection(conn);
} catch (std::exception &e) {
if (conn) {
cm->returnConnection(conn);
}
throw;
}
return true;
}
/*------------------------------------------------------------------------------
* Uninstall the PostgresqlSchedule.
*----------------------------------------------------------------------------*/
void
PostgresqlSchedule :: uninstall(void) throw (std::exception)
{
Ptr<Connection>::Ref conn;
try {
conn = cm->getConnection();
Ptr<Statement>::Ref stmt(conn->createStatement());
stmt->execute(dropStmt);
cm->returnConnection(conn);
} catch (std::exception &e) {
if (conn) {
cm->returnConnection(conn);
}
throw;
}
}
/*------------------------------------------------------------------------------
* Check if a timeframe is available.
*----------------------------------------------------------------------------*/
@ -369,8 +258,8 @@ PostgresqlSchedule :: schedulePlaylist(
id = UniqueId::generateId();
pstmt->setLong(1, id->getId());
pstmt->setLong(2, playlist->getId()->getId());
timestamp = Conversion::ptimeToTimestamp(playtime,
timestamp = Conversion::ptimeToTimestamp(playtime,
Conversion::roundNearest);
pstmt->setTimestamp(3, *timestamp);
@ -417,7 +306,7 @@ PostgresqlSchedule :: storeScheduleEntry(
pstmt->setLong(1, scheduleEntry->getId()->getId());
pstmt->setLong(2, scheduleEntry->getPlaylistId()->getId());
timestamp = Conversion::ptimeToTimestamp(scheduleEntry->getStartTime(),
Conversion::roundDown);
pstmt->setTimestamp(3, *timestamp);

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -117,16 +117,6 @@ class PostgresqlSchedule : public Configurable,
*/
static const std::string scheduleCountStmt;
/**
* The SQL create statement used in the installation step.
*/
static const std::string createStmt;
/**
* The SQL drop statement used in the uninstallation step.
*/
static const std::string dropStmt;
/**
* The SQL statement for querying if a time frame is available.
*/
@ -212,7 +202,7 @@ class PostgresqlSchedule : public Configurable,
/**
* 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
@ -237,36 +227,6 @@ class PostgresqlSchedule : public Configurable,
throw (std::invalid_argument,
std::logic_error);
/**
* Install the component.
* This step involves creating the environment in which the component
* will run. This may be creation of coniguration files,
* database tables, etc.
*
* @exception std::exception on installation problems.
*/
virtual void
install(void) throw (std::exception);
/**
* Check to see if the component has already been installed.
*
* @return true if the component is properly installed,
* false otherwise
* @exception std::exception on generic problems
*/
virtual bool
isInstalled(void) throw (std::exception);
/**
* Uninstall the component.
* Removes all the resources created in the install step.
*
* @exception std::exception on unistallation problems.
*/
virtual void
uninstall(void) throw (std::exception);
/**
* Check if a timeframe is available for scheduling.
*

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -77,9 +77,8 @@ PostgresqlScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
Ptr<SchedulerDaemon>::Ref scheduler = SchedulerDaemon::getInstance();
try {
cm = scheduler->getConnectionManager();
schedule.reset(new PostgresqlSchedule(cm));
schedule->install();
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
@ -95,7 +94,6 @@ PostgresqlScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
void
PostgresqlScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
schedule->uninstall();
schedule.reset();
cm.reset();
}

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -87,7 +87,6 @@ RemoveFromScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
storage->reset();
schedule = scheduler->getSchedule();
schedule->install();
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
@ -96,7 +95,7 @@ RemoveFromScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
} catch (std::exception &e) {
CPPUNIT_FAIL(e.what());
}
authentication = scheduler->getAuthentication();
try {
sessionId = authentication->login("root", "q");
@ -114,8 +113,6 @@ RemoveFromScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
void
RemoveFromScheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
schedule->uninstall();
authentication->logout(sessionId);
sessionId.reset();
authentication.reset();
@ -162,7 +159,7 @@ RemoveFromScheduleMethodTest :: firstTest(void)
CPPUNIT_FAIL(eMsg.str());
}
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
@ -251,7 +248,7 @@ RemoveFromScheduleMethodTest :: currentlyPlayingTest(void)
CPPUNIT_FAIL(eMsg.str());
}
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -85,7 +85,6 @@ RescheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
storage->reset();
schedule = scheduler->getSchedule();
schedule->install();
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
@ -94,7 +93,7 @@ RescheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
} catch (std::exception &e) {
CPPUNIT_FAIL(e.what());
}
authentication = scheduler->getAuthentication();
try {
sessionId = authentication->login("root", "q");
@ -112,8 +111,6 @@ RescheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
void
RescheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
schedule->uninstall();
authentication->logout(sessionId);
sessionId.reset();
authentication.reset();
@ -158,7 +155,7 @@ RescheduleMethodTest :: firstTest(void)
CPPUNIT_FAIL(eMsg.str());
}
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
@ -246,7 +243,7 @@ RescheduleMethodTest :: currentlyPlayingTest(void)
CPPUNIT_FAIL(eMsg.str());
}
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -97,8 +97,6 @@ RpcBackupTest :: setUp(void) throw (CPPUNIT_NS::Exception)
}
}
daemon->install();
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -129,10 +127,8 @@ void
RpcBackupTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->uninstall();
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -146,7 +142,7 @@ RpcBackupTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
xmlRpcClient.close();
remove(tempBackupTarFileName.c_str());
}
@ -159,7 +155,7 @@ RpcBackupTest :: createBackup(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -172,13 +168,13 @@ RpcBackupTest :: createBackup(void)
criteria->setLimit(10);
Ptr<ptime>::Ref from(new ptime(time_from_string("2004-07-23 10:00:00")));
Ptr<ptime>::Ref to(new ptime(time_from_string("2004-07-23 11:00:00")));
XmlRpcTools::sessionIdToXmlRpcValue(sessionId, parameters);
XmlRpcTools::searchCriteriaToXmlRpcValue(criteria, parameters);
XmlRpcTools::fromTimeToXmlRpcValue(from, parameters);
XmlRpcTools::toTimeToXmlRpcValue(to, parameters);
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupOpen",
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupOpen",
parameters,
result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
@ -196,11 +192,11 @@ RpcBackupTest :: createBackup(void)
std::cerr << "-/|\\"[iterations%4] << '\b';
sleep(1);
result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupCheck",
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupCheck",
parameters,
result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT_NO_THROW(
status = XmlRpcTools::extractBackupStatus(result);
);
@ -208,21 +204,21 @@ RpcBackupTest :: createBackup(void)
|| status == AsyncState::finishedState
|| status == AsyncState::failedState);
} while (--iterations && status == AsyncState::pendingState);
CPPUNIT_ASSERT_EQUAL(AsyncState::finishedState, status);
// TODO: test accessibility of the URL?
Ptr<const Glib::ustring>::Ref url;
Ptr<const Glib::ustring>::Ref path;
Ptr<const Glib::ustring>::Ref errorMessage;
CPPUNIT_ASSERT_NO_THROW(
url = XmlRpcTools::extractUrl(result);
);
CPPUNIT_ASSERT_NO_THROW(
path = XmlRpcTools::extractPath(result);
);
// copy the backup file
CPPUNIT_ASSERT_NO_THROW(
remove(tempBackupTarFileName.c_str());
@ -230,15 +226,15 @@ RpcBackupTest :: createBackup(void)
std::ofstream ofs(tempBackupTarFileName.c_str(), std::ios::binary);
ofs << ifs.rdbuf();
);
parameters.clear();
XmlRpcTools::tokenToXmlRpcValue(token, parameters);
result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupClose",
result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupClose",
parameters,
result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
xmlRpcClient.close();
}
@ -254,7 +250,7 @@ RpcBackupTest :: createBackupTest(void)
CPPUNIT_ASSERT_NO_THROW(
createBackup()
);
// Check the backup file.
bool exists;
std::string schedulerBackupInTarball = "meta-inf/scheduler.xml";
@ -263,24 +259,24 @@ RpcBackupTest :: createBackupTest(void)
schedulerBackupInTarball)
);
CPPUNIT_ASSERT(exists);
std::string extractedTempFileName = "tmp/scheduler.tmp.xml";
FILE * file;
remove(extractedTempFileName.c_str());
file = fopen(extractedTempFileName.c_str(), "r");
CPPUNIT_ASSERT(file == 0);
CPPUNIT_ASSERT_NO_THROW(
FileTools::extractFileFromTarball(tempBackupTarFileName,
schedulerBackupInTarball,
extractedTempFileName)
);
file = fopen(extractedTempFileName.c_str(), "r");
CPPUNIT_ASSERT(file != 0);
CPPUNIT_ASSERT(fclose(file) == 0);
CPPUNIT_ASSERT(remove(extractedTempFileName.c_str()) == 0);
file = fopen(extractedTempFileName.c_str(), "r");
CPPUNIT_ASSERT(file == 0);
@ -298,7 +294,7 @@ RpcBackupTest :: restoreBackupTest(void)
CPPUNIT_ASSERT_NO_THROW(
createBackup()
);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -306,19 +302,19 @@ RpcBackupTest :: restoreBackupTest(void)
getXmlRpcPort(),
"/RPC2",
false);
CPPUNIT_ASSERT(sessionId);
Ptr<const Glib::ustring>::Ref path(new const Glib::ustring(
tempBackupTarFileName));
XmlRpcTools::sessionIdToXmlRpcValue(sessionId, parameters);
XmlRpcTools::pathToXmlRpcValue(path, parameters);
CPPUNIT_ASSERT(xmlRpcClient.execute("restoreBackup",
CPPUNIT_ASSERT(xmlRpcClient.execute("restoreBackup",
parameters,
result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
xmlRpcClient.close();
// TODO: try this with a non-empty backup file, too
}

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -87,8 +87,6 @@ RpcDisplayScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
}
}
daemon->install();
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -119,10 +117,9 @@ void
RpcDisplayScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->uninstall();
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -147,7 +144,7 @@ RpcDisplayScheduleTest :: simpleTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpcValue parameters;
XmlRpcValue result;
struct tm time;
@ -192,7 +189,7 @@ RpcDisplayScheduleTest :: faultTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpcValue parameters;
XmlRpcValue result;

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -85,7 +85,6 @@ RpcGeneratePlayReportTest :: setUp(void) throw (CPPUNIT_NS::Exception)
}
}
daemon->install();
insertEntries();
XmlRpc::XmlRpcValue parameters;
@ -118,10 +117,9 @@ void
RpcGeneratePlayReportTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->uninstall();
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -171,7 +169,7 @@ RpcGeneratePlayReportTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
struct tm time;
@ -198,7 +196,7 @@ RpcGeneratePlayReportTest :: firstTest(void)
time.tm_sec = 1;
parameters["to"] = &time;
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
parameters, result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.size() == 0);
@ -215,7 +213,7 @@ RpcGeneratePlayReportTest :: intervalTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
struct tm time;
@ -242,20 +240,20 @@ RpcGeneratePlayReportTest :: intervalTest(void)
time.tm_sec = 0;
parameters["to"] = &time;
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
parameters, result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
// check the returned values
CPPUNIT_ASSERT(result.size() == 1);
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
UniqueId newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
== XmlRpc::XmlRpcValue::TypeDateTime);
time = result[0]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
@ -284,20 +282,20 @@ RpcGeneratePlayReportTest :: intervalTest(void)
parameters["to"] = &time;
result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
parameters, result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
// check the returned values
CPPUNIT_ASSERT(result.size() == 1);
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
== XmlRpc::XmlRpcValue::TypeDateTime);
time = result[0]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
@ -326,20 +324,20 @@ RpcGeneratePlayReportTest :: intervalTest(void)
parameters["to"] = &time;
result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
parameters, result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
// check the returned values
CPPUNIT_ASSERT(result.size() == 2);
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
CPPUNIT_ASSERT(newAudioClipId.getId() == 10017);
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
== XmlRpc::XmlRpcValue::TypeDateTime);
time = result[0]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
@ -350,13 +348,13 @@ RpcGeneratePlayReportTest :: intervalTest(void)
CPPUNIT_ASSERT(time.tm_sec == 0);
CPPUNIT_ASSERT(result[1].hasMember("audioClipId"));
CPPUNIT_ASSERT(result[1]["audioClipId"].getType()
CPPUNIT_ASSERT(result[1]["audioClipId"].getType()
== XmlRpc::XmlRpcValue::TypeString);
newAudioClipId = UniqueId(std::string(result[1]["audioClipId"]));
CPPUNIT_ASSERT(newAudioClipId.getId() == 10003);
CPPUNIT_ASSERT(result[1].hasMember("timestamp"));
CPPUNIT_ASSERT(result[1]["timestamp"].getType()
CPPUNIT_ASSERT(result[1]["timestamp"].getType()
== XmlRpc::XmlRpcValue::TypeDateTime);
time = result[1]["timestamp"];
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
@ -385,7 +383,7 @@ RpcGeneratePlayReportTest :: intervalTest(void)
parameters["to"] = &time;
result.clear();
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
parameters, result));
CPPUNIT_ASSERT(!xmlRpcClient.isFault());

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -83,7 +83,6 @@ RpcGetSchedulerTimeTest :: setUp(void) throw (CPPUNIT_NS::Exception)
}
}
daemon->install();
}
@ -94,7 +93,6 @@ void
RpcGetSchedulerTimeTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->uninstall();
}
@ -129,7 +127,7 @@ RpcGetSchedulerTimeTest :: simpleTest(void)
CPPUNIT_ASSERT(time1.tm_year == time2.tm_year);
// could fail on New Year's Eve, but we don't work on New Year's Eve
CPPUNIT_ASSERT(time1.tm_hour <= time2.tm_hour);
CPPUNIT_ASSERT(time1.tm_min <= time2.tm_min);
CPPUNIT_ASSERT(time1.tm_min + 1 >= time2.tm_min);

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -66,7 +66,6 @@ void
RpcGetVersionTest :: setUp(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->install();
}
@ -77,7 +76,6 @@ void
RpcGetVersionTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->uninstall();
}

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -63,7 +63,6 @@ void
RpcRemoveFromScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->install();
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -95,10 +94,9 @@ void
RpcRemoveFromScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->uninstall();
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -123,7 +121,7 @@ RpcRemoveFromScheduleTest :: simpleTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpcValue parameters;
XmlRpcValue result;
struct tm time;
@ -148,7 +146,7 @@ RpcRemoveFromScheduleTest :: simpleTest(void)
xmlRpcClient.execute("uploadPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpcValue::TypeString);
Ptr<UniqueId>::Ref entryId(new UniqueId(std::string(
result["scheduleEntryId"] )));
@ -170,7 +168,7 @@ RpcRemoveFromScheduleTest :: negativeTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpcValue parameters;
XmlRpcValue result;
@ -198,7 +196,7 @@ RpcRemoveFromScheduleTest :: currentlyPlayingTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpcValue parameters;
XmlRpcValue result;
Ptr<ptime>::Ref now;
@ -223,7 +221,7 @@ RpcRemoveFromScheduleTest :: currentlyPlayingTest(void)
xmlRpcClient.execute("uploadPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpcValue::TypeString);
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"] )));

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -84,8 +84,6 @@ RpcRescheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
}
}
daemon->install();
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -116,10 +114,9 @@ void
RpcRescheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->uninstall();
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -144,7 +141,7 @@ RpcRescheduleTest :: simpleTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
struct tm time;
@ -169,7 +166,7 @@ RpcRescheduleTest :: simpleTest(void)
xmlRpcClient.execute("uploadPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpcValue::TypeString);
Ptr<UniqueId>::Ref entryId(new UniqueId(std::string(
result["scheduleEntryId"] )));
@ -216,7 +213,7 @@ RpcRescheduleTest :: negativeTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -244,7 +241,7 @@ RpcRescheduleTest :: currentlyPlayingTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
Ptr<ptime>::Ref now;
@ -269,7 +266,7 @@ RpcRescheduleTest :: currentlyPlayingTest(void)
xmlRpcClient.execute("uploadPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
== XmlRpcValue::TypeString);
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"] )));

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision$
Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/branches/scheduler_export/livesupport/src/products/scheduler/src/RpcStopCurrentlyPlayingTest.cxx $
@ -84,8 +84,6 @@ RpcStopCurrentlyPlayingTest :: setUp(void) throw (CPPUNIT_NS::Exception)
}
}
daemon->install();
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -104,7 +102,7 @@ RpcStopCurrentlyPlayingTest :: setUp(void) throw (CPPUNIT_NS::Exception)
CPPUNIT_ASSERT(result.hasMember("sessionId"));
xmlRpcClient.close();
sessionId.reset(new SessionId(std::string(result["sessionId"])));
}
@ -116,10 +114,9 @@ void
RpcStopCurrentlyPlayingTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->uninstall();
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -144,16 +141,16 @@ RpcStopCurrentlyPlayingTest :: simpleTest(void)
throw (CPPUNIT_NS::Exception)
{
schedulePlaylistToPlayNow();
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
CPPUNIT_ASSERT(daemon);
Ptr<AudioPlayerInterface>::Ref audioPlayer = daemon->getAudioPlayer();
CPPUNIT_ASSERT(audioPlayer);
sleep(10);
CPPUNIT_ASSERT(audioPlayer->isOpen());
CPPUNIT_ASSERT(audioPlayer->isPlaying());
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -169,9 +166,9 @@ RpcStopCurrentlyPlayingTest :: simpleTest(void)
result.clear();
xmlRpcClient.execute("stopCurrentlyPlaying", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
xmlRpcClient.close();
CPPUNIT_ASSERT(!audioPlayer->isPlaying());
CPPUNIT_ASSERT(!audioPlayer->isOpen());
}
@ -185,7 +182,7 @@ RpcStopCurrentlyPlayingTest :: negativeTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -83,8 +83,6 @@ RpcUploadPlaylistTest :: setUp(void) throw (CPPUNIT_NS::Exception)
}
}
daemon->install();
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
@ -115,8 +113,7 @@ void
RpcUploadPlaylistTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
daemon->uninstall();
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
@ -143,7 +140,7 @@ RpcUploadPlaylistTest :: simpleTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
struct tm time;
@ -184,7 +181,7 @@ RpcUploadPlaylistTest :: postInitTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(sessionId);
XmlRpc::XmlRpcValue parameters;
XmlRpc::XmlRpcValue result;
struct tm time;

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -113,46 +113,3 @@ ScheduleFactory :: configure(const xmlpp::Element & element)
throw std::invalid_argument("no storage client factories to configure");
}
}
/*------------------------------------------------------------------------------
* Install the schedule factory.
*----------------------------------------------------------------------------*/
void
ScheduleFactory :: install(void) throw (std::exception)
{
if (!schedule) {
throw std::logic_error("ScheduleFactory not yet configured");
}
schedule->install();
}
/*------------------------------------------------------------------------------
* Check to see if the schedule factory has already been installed.
*----------------------------------------------------------------------------*/
bool
ScheduleFactory :: isInstalled(void) throw (std::exception)
{
if (!schedule) {
throw std::logic_error("ScheduleFactory not yet configured");
}
return schedule->isInstalled();
}
/*------------------------------------------------------------------------------
* Install the schedule factory.
*----------------------------------------------------------------------------*/
void
ScheduleFactory :: uninstall(void) throw (std::exception)
{
if (!schedule) {
throw std::logic_error("ScheduleFactory not yet configured");
}
schedule->uninstall();
}

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -43,7 +43,6 @@
#include <stdexcept>
#include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Core/Installable.h"
#include "ScheduleInterface.h"
@ -89,8 +88,7 @@ using namespace LiveSupport::Core;
* @version $Revision$
* @see PostgresqlSchedule
*/
class ScheduleFactory : virtual public Configurable,
virtual public Installable
class ScheduleFactory : virtual public Configurable
{
private:
/**
@ -128,7 +126,7 @@ class ScheduleFactory : virtual public Configurable,
/**
* 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
@ -159,38 +157,6 @@ class ScheduleFactory : virtual public Configurable,
throw (std::invalid_argument,
std::logic_error);
/**
* Install the component.
* This step involves creating the environment in which the component
* will run. This may be creation of coniguration files,
* database tables, etc.
*
* @exception std::exception on installation problems,
* especially if the ScheduleFactory was not yet configured.
*/
virtual void
install(void) throw (std::exception);
/**
* Check to see if the component has already been installed.
*
* @return true if the component is properly installed,
* false otherwise
* @exception std::exception on generic problems
*/
virtual bool
isInstalled(void) throw (std::exception);
/**
* Uninstall the component.
* Removes all the resources created in the install step.
*
* @exception std::exception on unistallation problems,
e especially if the ScheduleFactory was not yet configured.
*/
virtual void
uninstall(void) throw (std::exception);
/**
* Return a schedule.
*

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -44,7 +44,6 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/Installable.h"
#include "LiveSupport/Core/Playlist.h"
#include "LiveSupport/Core/ScheduleEntry.h"
@ -72,7 +71,7 @@ using namespace LiveSupport::Core;
* @author $Author$
* @version $Revision$
*/
class ScheduleInterface : virtual public Installable
class ScheduleInterface
{
public:
/**

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -275,7 +275,7 @@ SchedulerDaemon :: ~SchedulerDaemon(void) throw ()
}
}
/*------------------------------------------------------------------------------
* Register our XML-RPC methods
*----------------------------------------------------------------------------*/
@ -302,103 +302,12 @@ SchedulerDaemon :: registerXmlRpcFunctions(
}
/*------------------------------------------------------------------------------
* Install the scheduler daemon.
*----------------------------------------------------------------------------*/
void
SchedulerDaemon :: install(void) throw (std::exception)
{
if (!isInstalled()) {
// TODO: check if we have already been configured
Ptr<ScheduleFactory>::Ref sf = ScheduleFactory::getInstance();
sf->install();
Ptr<PlayLogFactory>::Ref plf = PlayLogFactory::getInstance();
plf->install();
Ptr<BackupFactory>::Ref bf = BackupFactory::getInstance();
bf->install();
}
}
/*------------------------------------------------------------------------------
* Check to see if the scheduler has been installed.
*----------------------------------------------------------------------------*/
bool
SchedulerDaemon :: isInstalled(void) throw (std::exception)
{
// TODO: check if we have already been configured
Ptr<ScheduleFactory>::Ref sf = ScheduleFactory::getInstance();
Ptr<PlayLogFactory>::Ref plf = PlayLogFactory::getInstance();
Ptr<BackupFactory>::Ref bf = BackupFactory::getInstance();
if (!sf || !plf || !bf) {
throw std::logic_error("couldn't initialize factories");
}
return sf->isInstalled() && plf->isInstalled() && bf->isInstalled();
}
/*------------------------------------------------------------------------------
* Install the scheduler daemon.
*----------------------------------------------------------------------------*/
void
SchedulerDaemon :: uninstall(void) throw (std::exception)
{
// TODO: check if we have already been configured
Ptr<BackupFactory>::Ref bf = BackupFactory::getInstance();
Ptr<PlayLogFactory>::Ref plf = PlayLogFactory::getInstance();
Ptr<ScheduleFactory>::Ref sf = ScheduleFactory::getInstance();
if (!bf || !plf || !sf) {
throw std::logic_error("couldn't initialize factories");
}
bool isOK = true;
std::stringstream errorMessage("error uninstalling factories:\n");
try {
bf->uninstall();
} catch (std::exception &e) {
isOK = false;
errorMessage << e.what() << std::endl;
}
try {
plf->uninstall();
} catch (std::exception &e) {
isOK = false;
errorMessage << e.what() << std::endl;
}
try {
sf->uninstall();
} catch (std::exception &e) {
isOK = false;
errorMessage << e.what() << std::endl;
}
if (!isOK) {
throw std::logic_error(errorMessage.str());
}
}
/*------------------------------------------------------------------------------
* Execute daemon startup functions.
*----------------------------------------------------------------------------*/
void
SchedulerDaemon :: startup (void) throw (std::logic_error)
{
try {
if (!isInstalled()) {
install();
}
} catch (std::exception &e) {
throw std::logic_error(std::string("database installation problem: ")
+ e.what());
}
try {
sessionId = authentication->login(login, password);
} catch (XmlRpcException &e) {

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -58,7 +58,6 @@
#include <XmlRpc.h>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/Installable.h"
#include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Core/SessionId.h"
#include "LiveSupport/Db/ConnectionManagerInterface.h"
@ -171,22 +170,11 @@ using namespace LiveSupport::PlaylistExecutor;
* @see ScheduleFactory
* @see XmlRpcDaemon
*/
class SchedulerDaemon : public Installable,
public Configurable,
class SchedulerDaemon : public Configurable,
public XmlRpcDaemon
{
private:
/**
* The SQL create statement used in the installation step.
*/
static const std::string createStmt;
/**
* The SQL drop statement used in the uninstallation step.
*/
static const std::string dropStmt;
/**
* A SQL statement to check if the database can be accessed.
*/
@ -447,36 +435,6 @@ class SchedulerDaemon : public Installable,
return audioPlayer;
}
/**
* Install the component.
* This step involves creating the environment in which the component
* will run. This may be creation of coniguration files,
* database tables, etc.
*
* @exception std::exception on installation problems.
*/
virtual void
install(void) throw (std::exception);
/**
* Check to see if the component has already been installed.
*
* @return true if the component is properly installed,
* false otherwise
* @exception std::exception on generic problems
*/
virtual bool
isInstalled(void) throw (std::exception);
/**
* Uninstall the component.
* Removes all the resources created in the install step.
*
* @exception std::exception on unistallation problems.
*/
virtual void
uninstall(void) throw (std::exception);
/**
* Shut down the daemon.
* This function is public only because the signal handler

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -84,7 +84,6 @@ UploadPlaylistMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
storage->reset();
schedule = scheduler->getSchedule();
schedule->install();
} catch (XmlRpcException &e) {
std::cerr << "caught XmlRpcException durng setUp" << std::endl
@ -96,7 +95,7 @@ UploadPlaylistMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
} catch (std::exception &e) {
std::cerr << e.what() << std::endl;
}
authentication = scheduler->getAuthentication();
try {
sessionId = authentication->login("root", "q");
@ -113,8 +112,6 @@ UploadPlaylistMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
void
UploadPlaylistMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
{
schedule->uninstall();
authentication->logout(sessionId);
sessionId.reset();
authentication.reset();
@ -145,7 +142,7 @@ UploadPlaylistMethodTest :: firstTest(void)
time.tm_min = 31;
time.tm_sec = 1;
parameters["playtime"] = &time;
rootParameter[0] = parameters;
rootParameter[0] = parameters;
result.clear();
try {
@ -184,7 +181,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
time.tm_min = 0;
time.tm_sec = 0;
parameters["playtime"] = &time;
rootParameter[0] = parameters;
rootParameter[0] = parameters;
result.clear();
try {
@ -208,7 +205,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
time.tm_min = 30;
time.tm_sec = 0;
parameters["playtime"] = &time;
rootParameter[0] = parameters;
rootParameter[0] = parameters;
result.clear();
try {
@ -228,7 +225,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
time.tm_min = 30;
time.tm_sec = 0;
parameters["playtime"] = &time;
rootParameter[0] = parameters;
rootParameter[0] = parameters;
result.clear();
try {
@ -251,7 +248,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
time.tm_min = 45;
time.tm_sec = 0;
parameters["playtime"] = &time;
rootParameter[0] = parameters;
rootParameter[0] = parameters;
result.clear();
try {

View File

@ -1,26 +1,26 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
@ -86,11 +86,6 @@ static const struct option longOptions[] = {
{ 0, 0, 0, 0 }
};
/**
* The start command: "install"
*/
static const std::string installCommand = "install";
/**
* The start command: "start"
*/
@ -106,11 +101,6 @@ static const std::string statusCommand = "status";
*/
static const std::string stopCommand = "stop";
/**
* The stop command: "uninstall"
*/
static const std::string uninstallCommand = "uninstall";
/* =============================================== local function prototypes */
@ -183,7 +173,7 @@ int main ( int argc,
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
try {
std::auto_ptr<xmlpp::DomParser>
std::auto_ptr<xmlpp::DomParser>
parser(new xmlpp::DomParser(configFileName, true));
const xmlpp::Document * document = parser->get_document();
daemon->configure(*(document->get_root_node()));
@ -200,9 +190,7 @@ int main ( int argc,
daemon->setBackground(!debugMode);
try {
if (installCommand == argv[optind]) {
daemon->install();
} else if (startCommand == argv[optind]) {
if (startCommand == argv[optind]) {
daemon->start();
} else if (statusCommand == argv[optind]) {
std::cout << "The Scheduler Daemon is "
@ -210,8 +198,6 @@ int main ( int argc,
<< "running" << std::endl;
} else if (stopCommand == argv[optind]) {
daemon->stop();
} else if (uninstallCommand == argv[optind]) {
daemon->uninstall();
} else {
printUsage(argv[0], std::cout);
exit(EXIT_FAILURE);
@ -248,7 +234,7 @@ printUsage ( const char invocation[],
<< std::endl
<< "Usage: " << invocation << " [OPTION] COMMAND"
<< std::endl
<< " COMMAND is one of: install, start, stop, status or uninstall"
<< " COMMAND is one of: start, stop, or status"
<< std::endl
<< std::endl
<< " mandatory options:" << std::endl