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:
parent
7911089b62
commit
219c8cc06f
|
@ -83,12 +83,12 @@ case "$mode" in
|
||||||
|
|
||||||
'install')
|
'install')
|
||||||
echo "Installing Campcaster scheduler database tables..."
|
echo "Installing Campcaster scheduler database tables..."
|
||||||
$scheduler_exe -c $config_file install
|
php install.php -c $config_file
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'uninstall')
|
'uninstall')
|
||||||
echo "Uninstalling Campcaster scheduler database tables..."
|
echo "Uninstalling Campcaster scheduler database tables..."
|
||||||
$scheduler_exe -c $config_file uninstall
|
php uninstall.php -c $config_file
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'kill')
|
'kill')
|
||||||
|
|
|
@ -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";
|
||||||
|
|
||||||
|
?>
|
|
@ -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);
|
||||||
|
|
||||||
|
?>
|
|
@ -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";
|
||||||
|
}
|
||||||
|
?>
|
|
@ -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";
|
||||||
|
|
||||||
|
?>
|
|
@ -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";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -96,7 +96,7 @@ BackupFactory :: configure(const xmlpp::Element & element)
|
||||||
cmf = ConnectionManagerFactory::getInstance();
|
cmf = ConnectionManagerFactory::getInstance();
|
||||||
Ptr<ConnectionManagerInterface>::Ref
|
Ptr<ConnectionManagerInterface>::Ref
|
||||||
connection = cmf->getConnectionManager();
|
connection = cmf->getConnectionManager();
|
||||||
|
|
||||||
Ptr<StorageClientFactory>::Ref
|
Ptr<StorageClientFactory>::Ref
|
||||||
scf = StorageClientFactory::getInstance();
|
scf = StorageClientFactory::getInstance();
|
||||||
Ptr<StorageClientInterface>::Ref
|
Ptr<StorageClientInterface>::Ref
|
||||||
|
@ -106,7 +106,7 @@ BackupFactory :: configure(const xmlpp::Element & element)
|
||||||
sf = ScheduleFactory::getInstance();
|
sf = ScheduleFactory::getInstance();
|
||||||
Ptr<ScheduleInterface>::Ref
|
Ptr<ScheduleInterface>::Ref
|
||||||
schedule = sf->getSchedule();
|
schedule = sf->getSchedule();
|
||||||
|
|
||||||
// try to look for a PostgresqlBackup configuration element
|
// try to look for a PostgresqlBackup configuration element
|
||||||
xmlpp::Node::NodeList nodes =
|
xmlpp::Node::NodeList nodes =
|
||||||
element.get_children(PostgresqlBackup::getConfigElementName());
|
element.get_children(PostgresqlBackup::getConfigElementName());
|
||||||
|
@ -124,46 +124,3 @@ BackupFactory :: configure(const xmlpp::Element & element)
|
||||||
throw std::invalid_argument("could not configure BackupFactory");
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "LiveSupport/Core/Configurable.h"
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
#include "LiveSupport/Core/Installable.h"
|
|
||||||
#include "BackupInterface.h"
|
#include "BackupInterface.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,8 +87,7 @@ using namespace LiveSupport::Core;
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @see PostgresqlBackup
|
* @see PostgresqlBackup
|
||||||
*/
|
*/
|
||||||
class BackupFactory : virtual public Configurable,
|
class BackupFactory : virtual public Configurable
|
||||||
virtual public Installable
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -127,7 +125,7 @@ class BackupFactory : virtual public Configurable,
|
||||||
/**
|
/**
|
||||||
* Return the name of the XML element this object expects
|
* Return the name of the XML element this object expects
|
||||||
* to be sent to a call to configure().
|
* to be sent to a call to configure().
|
||||||
*
|
*
|
||||||
* @return the name of the expected XML configuration element.
|
* @return the name of the expected XML configuration element.
|
||||||
*/
|
*/
|
||||||
static const std::string
|
static const std::string
|
||||||
|
@ -158,38 +156,6 @@ class BackupFactory : virtual public Configurable,
|
||||||
throw (std::invalid_argument,
|
throw (std::invalid_argument,
|
||||||
std::logic_error);
|
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.
|
* Return a backup.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -40,7 +40,6 @@
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
#include "LiveSupport/Core/Ptr.h"
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
#include "LiveSupport/Core/Installable.h"
|
|
||||||
#include "LiveSupport/Core/Playlist.h"
|
#include "LiveSupport/Core/Playlist.h"
|
||||||
#include "LiveSupport/Core/ScheduleEntry.h"
|
#include "LiveSupport/Core/ScheduleEntry.h"
|
||||||
#include "LiveSupport/StorageClient/StorageClientInterface.h"
|
#include "LiveSupport/StorageClient/StorageClientInterface.h"
|
||||||
|
@ -67,7 +66,7 @@ using namespace LiveSupport::StorageClient;
|
||||||
/**
|
/**
|
||||||
* The generic interface for creating and restoring schedule backups.
|
* 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.
|
* BackupFactory class.
|
||||||
*
|
*
|
||||||
* There are separate xxxxMethod classes which perform these
|
* There are separate xxxxMethod classes which perform these
|
||||||
|
@ -78,7 +77,7 @@ using namespace LiveSupport::StorageClient;
|
||||||
* @author $Author$
|
* @author $Author$
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
class BackupInterface : virtual public Installable
|
class BackupInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -93,7 +92,7 @@ class BackupInterface : virtual public Installable
|
||||||
* @param criteria the criteria to use for backing up the storage
|
* @param criteria the criteria to use for backing up the storage
|
||||||
* @param fromTime entries are included in the schedule export starting
|
* @param fromTime entries are included in the schedule export starting
|
||||||
* from this time.
|
* 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.
|
* up to but not including this time.
|
||||||
* @return a token, which can be used to query the backup process.
|
* @return a token, which can be used to query the backup process.
|
||||||
* @exception XmlRpcException on XML-RPC issues.
|
* @exception XmlRpcException on XML-RPC issues.
|
||||||
|
@ -113,7 +112,7 @@ class BackupInterface : virtual public Installable
|
||||||
*
|
*
|
||||||
* @param token the identifier of this backup task.
|
* @param token the identifier of this backup task.
|
||||||
* @param url return parameter;
|
* @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.
|
* URL of the created backup file.
|
||||||
* @param path return parameter;
|
* @param path return parameter;
|
||||||
* if the status is "success", it contains the
|
* if the status is "success", it contains the
|
||||||
|
@ -155,10 +154,10 @@ class BackupInterface : virtual public Installable
|
||||||
* Restore a schedule backup.
|
* Restore a schedule backup.
|
||||||
*
|
*
|
||||||
* All playlist IDs contained in the backup should already be in the
|
* 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
|
* schedule components, then restore this backup to the storage
|
||||||
* first, and then call this function.
|
* first, and then call this function.
|
||||||
*
|
*
|
||||||
* @param sessionId a valid session ID to identify the user.
|
* @param sessionId a valid session ID to identify the user.
|
||||||
* @param path the location of the archive to upload.
|
* @param path the location of the archive to upload.
|
||||||
* @exception XmlRpcException if there is an error.
|
* @exception XmlRpcException if there is an error.
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -88,7 +88,6 @@ DisplayScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
storage->reset();
|
storage->reset();
|
||||||
|
|
||||||
schedule = scheduler->getSchedule();
|
schedule = scheduler->getSchedule();
|
||||||
schedule->install();
|
|
||||||
|
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
CPPUNIT_FAIL("semantic error in configuration file");
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
|
@ -97,7 +96,7 @@ DisplayScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
authentication = scheduler->getAuthentication();
|
authentication = scheduler->getAuthentication();
|
||||||
try {
|
try {
|
||||||
sessionId = authentication->login("root", "q");
|
sessionId = authentication->login("root", "q");
|
||||||
|
@ -117,8 +116,6 @@ DisplayScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
void
|
void
|
||||||
DisplayScheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
DisplayScheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
schedule->uninstall();
|
|
||||||
|
|
||||||
authentication->logout(sessionId);
|
authentication->logout(sessionId);
|
||||||
sessionId.reset();
|
sessionId.reset();
|
||||||
authentication.reset();
|
authentication.reset();
|
||||||
|
@ -251,7 +248,7 @@ DisplayScheduleMethodTest :: insertEntries(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Look at some intervals and check against test data
|
* Look at some intervals and check against test data
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -297,7 +294,7 @@ DisplayScheduleMethodTest :: intervalTest(void)
|
||||||
// check the returned values
|
// check the returned values
|
||||||
CPPUNIT_ASSERT(result.size() == 1);
|
CPPUNIT_ASSERT(result.size() == 1);
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("playlistId"));
|
CPPUNIT_ASSERT(result[0].hasMember("playlistId"));
|
||||||
CPPUNIT_ASSERT(result[0]["playlistId"].getType()
|
CPPUNIT_ASSERT(result[0]["playlistId"].getType()
|
||||||
== XmlRpcValue::TypeString);
|
== XmlRpcValue::TypeString);
|
||||||
CPPUNIT_ASSERT(std::string(result[0]["playlistId"]) == "0000000000000001");
|
CPPUNIT_ASSERT(std::string(result[0]["playlistId"]) == "0000000000000001");
|
||||||
time = result[0]["start"];
|
time = result[0]["start"];
|
||||||
|
@ -346,7 +343,7 @@ DisplayScheduleMethodTest :: intervalTest(void)
|
||||||
// check the returned values
|
// check the returned values
|
||||||
CPPUNIT_ASSERT(result.size() == 2);
|
CPPUNIT_ASSERT(result.size() == 2);
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("playlistId"));
|
CPPUNIT_ASSERT(result[0].hasMember("playlistId"));
|
||||||
CPPUNIT_ASSERT(result[0]["playlistId"].getType()
|
CPPUNIT_ASSERT(result[0]["playlistId"].getType()
|
||||||
== XmlRpcValue::TypeString);
|
== XmlRpcValue::TypeString);
|
||||||
CPPUNIT_ASSERT(std::string(result[0]["playlistId"]) == "0000000000000001");
|
CPPUNIT_ASSERT(std::string(result[0]["playlistId"]) == "0000000000000001");
|
||||||
time = result[0]["start"];
|
time = result[0]["start"];
|
||||||
|
@ -365,7 +362,7 @@ DisplayScheduleMethodTest :: intervalTest(void)
|
||||||
CPPUNIT_ASSERT(time.tm_sec == 0);
|
CPPUNIT_ASSERT(time.tm_sec == 0);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[1].hasMember("playlistId"));
|
CPPUNIT_ASSERT(result[1].hasMember("playlistId"));
|
||||||
CPPUNIT_ASSERT(result[1]["playlistId"].getType()
|
CPPUNIT_ASSERT(result[1]["playlistId"].getType()
|
||||||
== XmlRpcValue::TypeString);
|
== XmlRpcValue::TypeString);
|
||||||
CPPUNIT_ASSERT(std::string(result[1]["playlistId"]) == "0000000000000001");
|
CPPUNIT_ASSERT(std::string(result[1]["playlistId"]) == "0000000000000001");
|
||||||
time = result[1]["start"];
|
time = result[1]["start"];
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -87,8 +87,6 @@ GeneratePlayReportMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
storage->reset();
|
storage->reset();
|
||||||
|
|
||||||
playLog = scheduler->getPlayLog();
|
playLog = scheduler->getPlayLog();
|
||||||
playLog->install();
|
|
||||||
|
|
||||||
insertEntries();
|
insertEntries();
|
||||||
|
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
|
@ -98,7 +96,7 @@ GeneratePlayReportMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
authentication = scheduler->getAuthentication();
|
authentication = scheduler->getAuthentication();
|
||||||
try {
|
try {
|
||||||
sessionId = authentication->login("root", "q");
|
sessionId = authentication->login("root", "q");
|
||||||
|
@ -116,8 +114,6 @@ GeneratePlayReportMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
void
|
void
|
||||||
GeneratePlayReportMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
GeneratePlayReportMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
playLog->uninstall();
|
|
||||||
|
|
||||||
authentication->logout(sessionId);
|
authentication->logout(sessionId);
|
||||||
sessionId.reset();
|
sessionId.reset();
|
||||||
authentication.reset();
|
authentication.reset();
|
||||||
|
@ -236,13 +232,13 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
||||||
// check the returned values
|
// check the returned values
|
||||||
CPPUNIT_ASSERT(result.size() == 1);
|
CPPUNIT_ASSERT(result.size() == 1);
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
||||||
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
UniqueId newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
UniqueId newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
||||||
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
||||||
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeDateTime);
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
time = result[0]["timestamp"];
|
time = result[0]["timestamp"];
|
||||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
@ -284,13 +280,13 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
||||||
// check the returned values
|
// check the returned values
|
||||||
CPPUNIT_ASSERT(result.size() == 1);
|
CPPUNIT_ASSERT(result.size() == 1);
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
||||||
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
||||||
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
||||||
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeDateTime);
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
time = result[0]["timestamp"];
|
time = result[0]["timestamp"];
|
||||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
@ -332,13 +328,13 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
||||||
// check the returned values
|
// check the returned values
|
||||||
CPPUNIT_ASSERT(result.size() == 2);
|
CPPUNIT_ASSERT(result.size() == 2);
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
||||||
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
||||||
CPPUNIT_ASSERT(newAudioClipId.getId() == 10017);
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10017);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
||||||
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeDateTime);
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
time = result[0]["timestamp"];
|
time = result[0]["timestamp"];
|
||||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
@ -349,13 +345,13 @@ GeneratePlayReportMethodTest :: intervalTest(void)
|
||||||
CPPUNIT_ASSERT(time.tm_sec == 0);
|
CPPUNIT_ASSERT(time.tm_sec == 0);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[1].hasMember("audioClipId"));
|
CPPUNIT_ASSERT(result[1].hasMember("audioClipId"));
|
||||||
CPPUNIT_ASSERT(result[1]["audioClipId"].getType()
|
CPPUNIT_ASSERT(result[1]["audioClipId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
newAudioClipId = UniqueId(std::string(result[1]["audioClipId"]));
|
newAudioClipId = UniqueId(std::string(result[1]["audioClipId"]));
|
||||||
CPPUNIT_ASSERT(newAudioClipId.getId() == 10003);
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10003);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[1].hasMember("timestamp"));
|
CPPUNIT_ASSERT(result[1].hasMember("timestamp"));
|
||||||
CPPUNIT_ASSERT(result[1]["timestamp"].getType()
|
CPPUNIT_ASSERT(result[1]["timestamp"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeDateTime);
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
time = result[1]["timestamp"];
|
time = result[1]["timestamp"];
|
||||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -43,7 +43,6 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "LiveSupport/Core/Configurable.h"
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
#include "LiveSupport/Core/Installable.h"
|
|
||||||
#include "PlayLogInterface.h"
|
#include "PlayLogInterface.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,8 +88,7 @@ using namespace LiveSupport::Core;
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @see PostgresqlPlayLog
|
* @see PostgresqlPlayLog
|
||||||
*/
|
*/
|
||||||
class PlayLogFactory : virtual public Configurable,
|
class PlayLogFactory : virtual public Configurable
|
||||||
virtual public Installable
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -128,7 +126,7 @@ class PlayLogFactory : virtual public Configurable,
|
||||||
/**
|
/**
|
||||||
* Return the name of the XML element this object expects
|
* Return the name of the XML element this object expects
|
||||||
* to be sent to a call to configure().
|
* to be sent to a call to configure().
|
||||||
*
|
*
|
||||||
* @return the name of the expected XML configuration element.
|
* @return the name of the expected XML configuration element.
|
||||||
*/
|
*/
|
||||||
static const std::string
|
static const std::string
|
||||||
|
@ -159,38 +157,6 @@ class PlayLogFactory : virtual public Configurable,
|
||||||
throw (std::invalid_argument,
|
throw (std::invalid_argument,
|
||||||
std::logic_error);
|
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.
|
* Return a play log.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -44,7 +44,6 @@
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
#include "LiveSupport/Core/Ptr.h"
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
#include "LiveSupport/Core/Installable.h"
|
|
||||||
#include "LiveSupport/Core/Playlist.h"
|
#include "LiveSupport/Core/Playlist.h"
|
||||||
#include "LiveSupport/Core/PlayLogEntry.h"
|
#include "LiveSupport/Core/PlayLogEntry.h"
|
||||||
|
|
||||||
|
@ -72,7 +71,7 @@ using namespace LiveSupport::Core;
|
||||||
* @author $Author$
|
* @author $Author$
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
class PlayLogInterface : virtual public Installable
|
class PlayLogInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -99,13 +99,6 @@ PlaylistEventContainerTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
CPPUNIT_FAIL("error parsing configuration file");
|
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();
|
audioPlayer->initialize();
|
||||||
|
|
||||||
if (!(sessionId = authentication->login("root", "q"))) {
|
if (!(sessionId = authentication->login("root", "q"))) {
|
||||||
|
@ -121,8 +114,6 @@ void
|
||||||
PlaylistEventContainerTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
PlaylistEventContainerTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
audioPlayer->deInitialize();
|
audioPlayer->deInitialize();
|
||||||
schedule->uninstall();
|
|
||||||
playLog->uninstall();
|
|
||||||
|
|
||||||
playLog.reset();
|
playLog.reset();
|
||||||
schedule.reset();
|
schedule.reset();
|
||||||
|
@ -172,7 +163,7 @@ PlaylistEventContainerTest :: scheduleTest(void)
|
||||||
|
|
||||||
// schedule playlist 1 at 10 seconds from now
|
// schedule playlist 1 at 10 seconds from now
|
||||||
Ptr<UniqueId>::Ref playlistId(new UniqueId(1));
|
Ptr<UniqueId>::Ref playlistId(new UniqueId(1));
|
||||||
Ptr<Playlist>::Ref playlist = storage->getPlaylist(sessionId,
|
Ptr<Playlist>::Ref playlist = storage->getPlaylist(sessionId,
|
||||||
playlistId);
|
playlistId);
|
||||||
CPPUNIT_ASSERT(playlist.get());
|
CPPUNIT_ASSERT(playlist.get());
|
||||||
Ptr<ptime>::Ref now = TimeConversion::now();
|
Ptr<ptime>::Ref now = TimeConversion::now();
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -97,7 +97,6 @@ PlaylistEventTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
}
|
}
|
||||||
|
|
||||||
audioPlayer->initialize();
|
audioPlayer->initialize();
|
||||||
playLog->install();
|
|
||||||
|
|
||||||
duration.reset(new time_duration(seconds(30)));
|
duration.reset(new time_duration(seconds(30)));
|
||||||
|
|
||||||
|
@ -113,7 +112,6 @@ PlaylistEventTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
void
|
void
|
||||||
PlaylistEventTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
PlaylistEventTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
playLog->uninstall();
|
|
||||||
audioPlayer->deInitialize();
|
audioPlayer->deInitialize();
|
||||||
|
|
||||||
duration.reset();
|
duration.reset();
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -109,26 +109,6 @@ const std::string scheduleExportFileName = "meta-inf/scheduler.xml";
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
const std::string check1Stmt = "SELECT 1";
|
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.
|
* 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.
|
* Start a backup process.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -364,7 +253,7 @@ PostgresqlBackup ::createBackupCheck(
|
||||||
Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
|
Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
|
||||||
if (rs->next()) {
|
if (rs->next()) {
|
||||||
status = stringToAsyncState(rs->getString(3));
|
status = stringToAsyncState(rs->getString(3));
|
||||||
|
|
||||||
timestamp.reset(new Timestamp(rs->getTimestamp(4)));
|
timestamp.reset(new Timestamp(rs->getTimestamp(4)));
|
||||||
fromTime = Conversion::timestampToPtime(timestamp);
|
fromTime = Conversion::timestampToPtime(timestamp);
|
||||||
|
|
||||||
|
@ -514,7 +403,7 @@ PostgresqlBackup :: restoreBackup(Ptr<SessionId>::Ref sessionId,
|
||||||
throw (XmlRpcException)
|
throw (XmlRpcException)
|
||||||
{
|
{
|
||||||
//TODO: check the session ID
|
//TODO: check the session ID
|
||||||
|
|
||||||
std::string tmpFileName = FileTools::tempnam();
|
std::string tmpFileName = FileTools::tempnam();
|
||||||
try {
|
try {
|
||||||
FileTools::extractFileFromTarball(*path,
|
FileTools::extractFileFromTarball(*path,
|
||||||
|
@ -526,7 +415,7 @@ PostgresqlBackup :: restoreBackup(Ptr<SessionId>::Ref sessionId,
|
||||||
errorMsg += e.what();
|
errorMsg += e.what();
|
||||||
throw XmlRpcIOException(errorMsg);
|
throw XmlRpcIOException(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<DomParser>::Ref parser(new DomParser(tmpFileName,
|
Ptr<DomParser>::Ref parser(new DomParser(tmpFileName,
|
||||||
false /* do not expect a DTD */));
|
false /* do not expect a DTD */));
|
||||||
const Document * document = parser->get_document();
|
const Document * document = parser->get_document();
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -105,12 +105,12 @@ class PostgresqlBackup : public Configurable,
|
||||||
* The storage client to use for connecting to the storage server.
|
* The storage client to use for connecting to the storage server.
|
||||||
*/
|
*/
|
||||||
Ptr<StorageClientInterface>::Ref storage;
|
Ptr<StorageClientInterface>::Ref storage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The schedule to use for reading the schedule entries from.
|
* The schedule to use for reading the schedule entries from.
|
||||||
*/
|
*/
|
||||||
Ptr<ScheduleInterface>::Ref schedule;
|
Ptr<ScheduleInterface>::Ref schedule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default constructor.
|
* The default constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -132,7 +132,7 @@ class PostgresqlBackup : public Configurable,
|
||||||
Ptr<ptime>::Ref fromTime,
|
Ptr<ptime>::Ref fromTime,
|
||||||
Ptr<ptime>::Ref toTime)
|
Ptr<ptime>::Ref toTime)
|
||||||
throw (std::runtime_error);
|
throw (std::runtime_error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a string status to an AsyncState.
|
* Convert a string status to an AsyncState.
|
||||||
* It converts
|
* It converts
|
||||||
|
@ -145,7 +145,7 @@ class PostgresqlBackup : public Configurable,
|
||||||
*/
|
*/
|
||||||
AsyncState
|
AsyncState
|
||||||
stringToAsyncState(const std::string & statusString) throw ();
|
stringToAsyncState(const std::string & statusString) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert an AsyncState to a string.
|
* Convert an AsyncState to a string.
|
||||||
* It converts
|
* It converts
|
||||||
|
@ -190,7 +190,7 @@ class PostgresqlBackup : public Configurable,
|
||||||
/**
|
/**
|
||||||
* Return the name of the XML element this object expects
|
* Return the name of the XML element this object expects
|
||||||
* to be sent to a call to configure().
|
* to be sent to a call to configure().
|
||||||
*
|
*
|
||||||
* @return the name of the expected XML configuration element.
|
* @return the name of the expected XML configuration element.
|
||||||
*/
|
*/
|
||||||
static const std::string
|
static const std::string
|
||||||
|
@ -215,36 +215,6 @@ class PostgresqlBackup : public Configurable,
|
||||||
throw (std::invalid_argument,
|
throw (std::invalid_argument,
|
||||||
std::logic_error);
|
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
|
* Start to create a backup by calling the storage, and also
|
||||||
* adding a backup of the schedule.
|
* 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 criteria the criteria to use for backing up the storage
|
||||||
* @param fromTime entries are included in the schedule export starting
|
* @param fromTime entries are included in the schedule export starting
|
||||||
* from this time.
|
* 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.
|
* up to but not including this time.
|
||||||
* @return a token, which can be used to query the backup process.
|
* @return a token, which can be used to query the backup process.
|
||||||
* @exception XmlRpcException on XML-RPC issues.
|
* @exception XmlRpcException on XML-RPC issues.
|
||||||
|
@ -276,7 +246,7 @@ class PostgresqlBackup : public Configurable,
|
||||||
*
|
*
|
||||||
* @param token the identifier of this backup task.
|
* @param token the identifier of this backup task.
|
||||||
* @param url return parameter;
|
* @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.
|
* URL of the created backup file.
|
||||||
* @param path return parameter;
|
* @param path return parameter;
|
||||||
* if the status is "success", it contains the
|
* if the status is "success", it contains the
|
||||||
|
@ -316,10 +286,10 @@ class PostgresqlBackup : public Configurable,
|
||||||
* Restore a schedule backup.
|
* Restore a schedule backup.
|
||||||
*
|
*
|
||||||
* All playlist IDs contained in the backup should already be in the
|
* 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
|
* schedule components, then restore this backup to the storage
|
||||||
* first, and then call this function.
|
* first, and then call this function.
|
||||||
*
|
*
|
||||||
* @param sessionId a valid session ID to identify the user.
|
* @param sessionId a valid session ID to identify the user.
|
||||||
* @param path the location of the archive to upload.
|
* @param path the location of the archive to upload.
|
||||||
* @exception XmlRpcException if there is an error.
|
* @exception XmlRpcException if there is an error.
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -83,21 +83,20 @@ PostgresqlBackupTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
Ptr<ConnectionManagerInterface>::Ref connectionManager;
|
Ptr<ConnectionManagerInterface>::Ref connectionManager;
|
||||||
Ptr<StorageClientInterface>::Ref storage;
|
Ptr<StorageClientInterface>::Ref storage;
|
||||||
Ptr<ScheduleInterface>::Ref schedule;
|
Ptr<ScheduleInterface>::Ref schedule;
|
||||||
|
|
||||||
connectionManager = daemon->getConnectionManager();
|
connectionManager = daemon->getConnectionManager();
|
||||||
storage = daemon->getStorage();
|
storage = daemon->getStorage();
|
||||||
schedule = daemon->getSchedule();
|
schedule = daemon->getSchedule();
|
||||||
|
|
||||||
backup.reset(new PostgresqlBackup(connectionManager,
|
backup.reset(new PostgresqlBackup(connectionManager,
|
||||||
storage,
|
storage,
|
||||||
schedule));
|
schedule));
|
||||||
backup->install();
|
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
CPPUNIT_FAIL("semantic error in configuration file");
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
} catch (xmlpp::exception &e) {
|
} catch (xmlpp::exception &e) {
|
||||||
CPPUNIT_FAIL("error parsing configuration file");
|
CPPUNIT_FAIL("error parsing configuration file");
|
||||||
}
|
}
|
||||||
|
|
||||||
authentication = daemon->getAuthentication();
|
authentication = daemon->getAuthentication();
|
||||||
try {
|
try {
|
||||||
sessionId = authentication->login("root", "q");
|
sessionId = authentication->login("root", "q");
|
||||||
|
@ -118,10 +117,7 @@ PostgresqlBackupTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
authentication->logout(sessionId);
|
authentication->logout(sessionId);
|
||||||
);
|
);
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
|
||||||
backup->uninstall();
|
|
||||||
);
|
|
||||||
|
|
||||||
remove(tempBackupTarFileName.c_str());
|
remove(tempBackupTarFileName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,11 +155,11 @@ PostgresqlBackupTest :: createBackup(void)
|
||||||
|| status == AsyncState::finishedState
|
|| status == AsyncState::finishedState
|
||||||
|| status == AsyncState::failedState);
|
|| status == AsyncState::failedState);
|
||||||
} while (--iterations && status == AsyncState::pendingState);
|
} while (--iterations && status == AsyncState::pendingState);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(AsyncState::finishedState, status);
|
CPPUNIT_ASSERT_EQUAL(AsyncState::finishedState, status);
|
||||||
CPPUNIT_ASSERT(url);
|
CPPUNIT_ASSERT(url);
|
||||||
CPPUNIT_ASSERT(path);
|
CPPUNIT_ASSERT(path);
|
||||||
|
|
||||||
// copy the backup file
|
// copy the backup file
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
remove(tempBackupTarFileName.c_str());
|
remove(tempBackupTarFileName.c_str());
|
||||||
|
@ -171,7 +167,7 @@ PostgresqlBackupTest :: createBackup(void)
|
||||||
std::ofstream ofs(tempBackupTarFileName.c_str(), std::ios::binary);
|
std::ofstream ofs(tempBackupTarFileName.c_str(), std::ios::binary);
|
||||||
ofs << ifs.rdbuf();
|
ofs << ifs.rdbuf();
|
||||||
);
|
);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
backup->createBackupClose(*token);
|
backup->createBackupClose(*token);
|
||||||
);
|
);
|
||||||
|
@ -188,7 +184,7 @@ PostgresqlBackupTest :: createBackupTest(void)
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
createBackup()
|
createBackup()
|
||||||
);
|
);
|
||||||
|
|
||||||
bool exists;
|
bool exists;
|
||||||
std::string schedulerBackupInTarball = "meta-inf/scheduler.xml";
|
std::string schedulerBackupInTarball = "meta-inf/scheduler.xml";
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
|
@ -196,24 +192,24 @@ PostgresqlBackupTest :: createBackupTest(void)
|
||||||
schedulerBackupInTarball)
|
schedulerBackupInTarball)
|
||||||
);
|
);
|
||||||
CPPUNIT_ASSERT(exists);
|
CPPUNIT_ASSERT(exists);
|
||||||
|
|
||||||
std::string extractedTempFileName = "tmp/scheduler.tmp.xml";
|
std::string extractedTempFileName = "tmp/scheduler.tmp.xml";
|
||||||
FILE * file;
|
FILE * file;
|
||||||
|
|
||||||
remove(extractedTempFileName.c_str());
|
remove(extractedTempFileName.c_str());
|
||||||
file = fopen(extractedTempFileName.c_str(), "r");
|
file = fopen(extractedTempFileName.c_str(), "r");
|
||||||
CPPUNIT_ASSERT(file == 0);
|
CPPUNIT_ASSERT(file == 0);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
FileTools::extractFileFromTarball(tempBackupTarFileName,
|
FileTools::extractFileFromTarball(tempBackupTarFileName,
|
||||||
schedulerBackupInTarball,
|
schedulerBackupInTarball,
|
||||||
extractedTempFileName)
|
extractedTempFileName)
|
||||||
);
|
);
|
||||||
|
|
||||||
file = fopen(extractedTempFileName.c_str(), "r");
|
file = fopen(extractedTempFileName.c_str(), "r");
|
||||||
CPPUNIT_ASSERT(file != 0);
|
CPPUNIT_ASSERT(file != 0);
|
||||||
CPPUNIT_ASSERT(fclose(file) == 0);
|
CPPUNIT_ASSERT(fclose(file) == 0);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(remove(extractedTempFileName.c_str()) == 0);
|
CPPUNIT_ASSERT(remove(extractedTempFileName.c_str()) == 0);
|
||||||
file = fopen(extractedTempFileName.c_str(), "r");
|
file = fopen(extractedTempFileName.c_str(), "r");
|
||||||
CPPUNIT_ASSERT(file == 0);
|
CPPUNIT_ASSERT(file == 0);
|
||||||
|
@ -230,7 +226,7 @@ PostgresqlBackupTest :: restoreBackupTest(void)
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
createBackup()
|
createBackup()
|
||||||
);
|
);
|
||||||
|
|
||||||
Ptr<const Glib::ustring>::Ref backupFile(new const Glib::ustring(
|
Ptr<const Glib::ustring>::Ref backupFile(new const Glib::ustring(
|
||||||
tempBackupTarFileName));
|
tempBackupTarFileName));
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -68,25 +68,6 @@ const std::string PostgresqlPlayLog::check1Stmt = "SELECT 1";
|
||||||
const std::string PostgresqlPlayLog::logCountStmt =
|
const std::string PostgresqlPlayLog::logCountStmt =
|
||||||
"SELECT COUNT(*) FROM playLog";
|
"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.
|
* The SQL statement for adding a play log entry.
|
||||||
* It's a simple insert.
|
* 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
|
* Add a new play log entry
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -244,7 +134,7 @@ PostgresqlPlayLog :: addPlayLogEntry(
|
||||||
pstmt->setLong(1, id->getId());
|
pstmt->setLong(1, id->getId());
|
||||||
|
|
||||||
pstmt->setLong(2, audioClipId->getId());
|
pstmt->setLong(2, audioClipId->getId());
|
||||||
|
|
||||||
timestamp = Conversion::ptimeToTimestamp(clipTimestamp);
|
timestamp = Conversion::ptimeToTimestamp(clipTimestamp);
|
||||||
pstmt->setTimestamp(3, *timestamp);
|
pstmt->setTimestamp(3, *timestamp);
|
||||||
|
|
||||||
|
@ -295,7 +185,7 @@ PostgresqlPlayLog :: getPlayLogEntries(
|
||||||
Ptr<UniqueId>::Ref audioClipId(new UniqueId(rs->getLong(2)));
|
Ptr<UniqueId>::Ref audioClipId(new UniqueId(rs->getLong(2)));
|
||||||
|
|
||||||
*timestamp = rs->getTimestamp(3);
|
*timestamp = rs->getTimestamp(3);
|
||||||
Ptr<ptime>::Ref clipTimestamp
|
Ptr<ptime>::Ref clipTimestamp
|
||||||
= Conversion::timestampToPtime(timestamp);
|
= Conversion::timestampToPtime(timestamp);
|
||||||
|
|
||||||
Ptr<PlayLogEntry>::Ref entry(new PlayLogEntry(id,
|
Ptr<PlayLogEntry>::Ref entry(new PlayLogEntry(id,
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -102,16 +102,6 @@ class PostgresqlPlayLog : public Configurable,
|
||||||
*/
|
*/
|
||||||
static const std::string logCountStmt;
|
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.
|
* 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
|
* Return the name of the XML element this object expects
|
||||||
* to be sent to a call to configure().
|
* to be sent to a call to configure().
|
||||||
*
|
*
|
||||||
* @return the name of the expected XML configuration element.
|
* @return the name of the expected XML configuration element.
|
||||||
*/
|
*/
|
||||||
static const std::string
|
static const std::string
|
||||||
|
@ -185,36 +175,6 @@ class PostgresqlPlayLog : public Configurable,
|
||||||
throw (std::invalid_argument,
|
throw (std::invalid_argument,
|
||||||
std::logic_error);
|
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.
|
* Add a new entry to the play log.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -75,9 +75,8 @@ PostgresqlPlayLogTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
Ptr<SchedulerDaemon>::Ref scheduler = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref scheduler = SchedulerDaemon::getInstance();
|
||||||
try {
|
try {
|
||||||
cm = scheduler->getConnectionManager();
|
cm = scheduler->getConnectionManager();
|
||||||
|
|
||||||
playLog.reset(new PostgresqlPlayLog(cm));
|
playLog.reset(new PostgresqlPlayLog(cm));
|
||||||
playLog->install();
|
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
CPPUNIT_FAIL("semantic error in configuration file");
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
} catch (xmlpp::exception &e) {
|
} catch (xmlpp::exception &e) {
|
||||||
|
@ -92,13 +91,6 @@ PostgresqlPlayLogTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
void
|
void
|
||||||
PostgresqlPlayLogTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
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();
|
playLog.reset();
|
||||||
cm.reset();
|
cm.reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -90,26 +90,6 @@ const std::string PostgresqlSchedule::check1Stmt = "SELECT 1";
|
||||||
const std::string PostgresqlSchedule::scheduleCountStmt =
|
const std::string PostgresqlSchedule::scheduleCountStmt =
|
||||||
"SELECT COUNT(*) FROM schedule";
|
"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 SQL statement for querying if a timeframe is available.
|
||||||
* The parameters for this call are: starts, starts, ends, ends, starts, ends,
|
* 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.
|
* Check if a timeframe is available.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -369,8 +258,8 @@ PostgresqlSchedule :: schedulePlaylist(
|
||||||
id = UniqueId::generateId();
|
id = UniqueId::generateId();
|
||||||
pstmt->setLong(1, id->getId());
|
pstmt->setLong(1, id->getId());
|
||||||
pstmt->setLong(2, playlist->getId()->getId());
|
pstmt->setLong(2, playlist->getId()->getId());
|
||||||
|
|
||||||
timestamp = Conversion::ptimeToTimestamp(playtime,
|
timestamp = Conversion::ptimeToTimestamp(playtime,
|
||||||
Conversion::roundNearest);
|
Conversion::roundNearest);
|
||||||
pstmt->setTimestamp(3, *timestamp);
|
pstmt->setTimestamp(3, *timestamp);
|
||||||
|
|
||||||
|
@ -417,7 +306,7 @@ PostgresqlSchedule :: storeScheduleEntry(
|
||||||
|
|
||||||
pstmt->setLong(1, scheduleEntry->getId()->getId());
|
pstmt->setLong(1, scheduleEntry->getId()->getId());
|
||||||
pstmt->setLong(2, scheduleEntry->getPlaylistId()->getId());
|
pstmt->setLong(2, scheduleEntry->getPlaylistId()->getId());
|
||||||
|
|
||||||
timestamp = Conversion::ptimeToTimestamp(scheduleEntry->getStartTime(),
|
timestamp = Conversion::ptimeToTimestamp(scheduleEntry->getStartTime(),
|
||||||
Conversion::roundDown);
|
Conversion::roundDown);
|
||||||
pstmt->setTimestamp(3, *timestamp);
|
pstmt->setTimestamp(3, *timestamp);
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -117,16 +117,6 @@ class PostgresqlSchedule : public Configurable,
|
||||||
*/
|
*/
|
||||||
static const std::string scheduleCountStmt;
|
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.
|
* 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
|
* Return the name of the XML element this object expects
|
||||||
* to be sent to a call to configure().
|
* to be sent to a call to configure().
|
||||||
*
|
*
|
||||||
* @return the name of the expected XML configuration element.
|
* @return the name of the expected XML configuration element.
|
||||||
*/
|
*/
|
||||||
static const std::string
|
static const std::string
|
||||||
|
@ -237,36 +227,6 @@ class PostgresqlSchedule : public Configurable,
|
||||||
throw (std::invalid_argument,
|
throw (std::invalid_argument,
|
||||||
std::logic_error);
|
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.
|
* Check if a timeframe is available for scheduling.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -77,9 +77,8 @@ PostgresqlScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
Ptr<SchedulerDaemon>::Ref scheduler = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref scheduler = SchedulerDaemon::getInstance();
|
||||||
try {
|
try {
|
||||||
cm = scheduler->getConnectionManager();
|
cm = scheduler->getConnectionManager();
|
||||||
|
|
||||||
schedule.reset(new PostgresqlSchedule(cm));
|
schedule.reset(new PostgresqlSchedule(cm));
|
||||||
schedule->install();
|
|
||||||
|
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
CPPUNIT_FAIL("semantic error in configuration file");
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
|
@ -95,7 +94,6 @@ PostgresqlScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
void
|
void
|
||||||
PostgresqlScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
PostgresqlScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
schedule->uninstall();
|
|
||||||
schedule.reset();
|
schedule.reset();
|
||||||
cm.reset();
|
cm.reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -87,7 +87,6 @@ RemoveFromScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
storage->reset();
|
storage->reset();
|
||||||
|
|
||||||
schedule = scheduler->getSchedule();
|
schedule = scheduler->getSchedule();
|
||||||
schedule->install();
|
|
||||||
|
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
CPPUNIT_FAIL("semantic error in configuration file");
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
|
@ -96,7 +95,7 @@ RemoveFromScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
authentication = scheduler->getAuthentication();
|
authentication = scheduler->getAuthentication();
|
||||||
try {
|
try {
|
||||||
sessionId = authentication->login("root", "q");
|
sessionId = authentication->login("root", "q");
|
||||||
|
@ -114,8 +113,6 @@ RemoveFromScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
void
|
void
|
||||||
RemoveFromScheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
RemoveFromScheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
schedule->uninstall();
|
|
||||||
|
|
||||||
authentication->logout(sessionId);
|
authentication->logout(sessionId);
|
||||||
sessionId.reset();
|
sessionId.reset();
|
||||||
authentication.reset();
|
authentication.reset();
|
||||||
|
@ -162,7 +159,7 @@ RemoveFromScheduleMethodTest :: firstTest(void)
|
||||||
CPPUNIT_FAIL(eMsg.str());
|
CPPUNIT_FAIL(eMsg.str());
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
||||||
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
|
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
|
||||||
|
|
||||||
|
@ -251,7 +248,7 @@ RemoveFromScheduleMethodTest :: currentlyPlayingTest(void)
|
||||||
CPPUNIT_FAIL(eMsg.str());
|
CPPUNIT_FAIL(eMsg.str());
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
||||||
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
|
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -85,7 +85,6 @@ RescheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
storage->reset();
|
storage->reset();
|
||||||
|
|
||||||
schedule = scheduler->getSchedule();
|
schedule = scheduler->getSchedule();
|
||||||
schedule->install();
|
|
||||||
|
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
CPPUNIT_FAIL("semantic error in configuration file");
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
|
@ -94,7 +93,7 @@ RescheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
authentication = scheduler->getAuthentication();
|
authentication = scheduler->getAuthentication();
|
||||||
try {
|
try {
|
||||||
sessionId = authentication->login("root", "q");
|
sessionId = authentication->login("root", "q");
|
||||||
|
@ -112,8 +111,6 @@ RescheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
void
|
void
|
||||||
RescheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
RescheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
schedule->uninstall();
|
|
||||||
|
|
||||||
authentication->logout(sessionId);
|
authentication->logout(sessionId);
|
||||||
sessionId.reset();
|
sessionId.reset();
|
||||||
authentication.reset();
|
authentication.reset();
|
||||||
|
@ -158,7 +155,7 @@ RescheduleMethodTest :: firstTest(void)
|
||||||
CPPUNIT_FAIL(eMsg.str());
|
CPPUNIT_FAIL(eMsg.str());
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
||||||
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
|
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
|
||||||
|
|
||||||
|
@ -246,7 +243,7 @@ RescheduleMethodTest :: currentlyPlayingTest(void)
|
||||||
CPPUNIT_FAIL(eMsg.str());
|
CPPUNIT_FAIL(eMsg.str());
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
||||||
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
|
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"])));
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -97,8 +97,6 @@ RpcBackupTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
daemon->install();
|
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -129,10 +127,8 @@ void
|
||||||
RpcBackupTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
RpcBackupTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->uninstall();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -146,7 +142,7 @@ RpcBackupTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
xmlRpcClient.close();
|
xmlRpcClient.close();
|
||||||
|
|
||||||
remove(tempBackupTarFileName.c_str());
|
remove(tempBackupTarFileName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +155,7 @@ RpcBackupTest :: createBackup(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -172,13 +168,13 @@ RpcBackupTest :: createBackup(void)
|
||||||
criteria->setLimit(10);
|
criteria->setLimit(10);
|
||||||
Ptr<ptime>::Ref from(new ptime(time_from_string("2004-07-23 10:00:00")));
|
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")));
|
Ptr<ptime>::Ref to(new ptime(time_from_string("2004-07-23 11:00:00")));
|
||||||
|
|
||||||
XmlRpcTools::sessionIdToXmlRpcValue(sessionId, parameters);
|
XmlRpcTools::sessionIdToXmlRpcValue(sessionId, parameters);
|
||||||
XmlRpcTools::searchCriteriaToXmlRpcValue(criteria, parameters);
|
XmlRpcTools::searchCriteriaToXmlRpcValue(criteria, parameters);
|
||||||
XmlRpcTools::fromTimeToXmlRpcValue(from, parameters);
|
XmlRpcTools::fromTimeToXmlRpcValue(from, parameters);
|
||||||
XmlRpcTools::toTimeToXmlRpcValue(to, parameters);
|
XmlRpcTools::toTimeToXmlRpcValue(to, parameters);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupOpen",
|
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupOpen",
|
||||||
parameters,
|
parameters,
|
||||||
result));
|
result));
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
@ -196,11 +192,11 @@ RpcBackupTest :: createBackup(void)
|
||||||
std::cerr << "-/|\\"[iterations%4] << '\b';
|
std::cerr << "-/|\\"[iterations%4] << '\b';
|
||||||
sleep(1);
|
sleep(1);
|
||||||
result.clear();
|
result.clear();
|
||||||
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupCheck",
|
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupCheck",
|
||||||
parameters,
|
parameters,
|
||||||
result));
|
result));
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
status = XmlRpcTools::extractBackupStatus(result);
|
status = XmlRpcTools::extractBackupStatus(result);
|
||||||
);
|
);
|
||||||
|
@ -208,21 +204,21 @@ RpcBackupTest :: createBackup(void)
|
||||||
|| status == AsyncState::finishedState
|
|| status == AsyncState::finishedState
|
||||||
|| status == AsyncState::failedState);
|
|| status == AsyncState::failedState);
|
||||||
} while (--iterations && status == AsyncState::pendingState);
|
} while (--iterations && status == AsyncState::pendingState);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(AsyncState::finishedState, status);
|
CPPUNIT_ASSERT_EQUAL(AsyncState::finishedState, status);
|
||||||
// TODO: test accessibility of the URL?
|
// TODO: test accessibility of the URL?
|
||||||
|
|
||||||
Ptr<const Glib::ustring>::Ref url;
|
Ptr<const Glib::ustring>::Ref url;
|
||||||
Ptr<const Glib::ustring>::Ref path;
|
Ptr<const Glib::ustring>::Ref path;
|
||||||
Ptr<const Glib::ustring>::Ref errorMessage;
|
Ptr<const Glib::ustring>::Ref errorMessage;
|
||||||
|
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
url = XmlRpcTools::extractUrl(result);
|
url = XmlRpcTools::extractUrl(result);
|
||||||
);
|
);
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
path = XmlRpcTools::extractPath(result);
|
path = XmlRpcTools::extractPath(result);
|
||||||
);
|
);
|
||||||
|
|
||||||
// copy the backup file
|
// copy the backup file
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
remove(tempBackupTarFileName.c_str());
|
remove(tempBackupTarFileName.c_str());
|
||||||
|
@ -230,15 +226,15 @@ RpcBackupTest :: createBackup(void)
|
||||||
std::ofstream ofs(tempBackupTarFileName.c_str(), std::ios::binary);
|
std::ofstream ofs(tempBackupTarFileName.c_str(), std::ios::binary);
|
||||||
ofs << ifs.rdbuf();
|
ofs << ifs.rdbuf();
|
||||||
);
|
);
|
||||||
|
|
||||||
parameters.clear();
|
parameters.clear();
|
||||||
XmlRpcTools::tokenToXmlRpcValue(token, parameters);
|
XmlRpcTools::tokenToXmlRpcValue(token, parameters);
|
||||||
result.clear();
|
result.clear();
|
||||||
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupClose",
|
CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupClose",
|
||||||
parameters,
|
parameters,
|
||||||
result));
|
result));
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
xmlRpcClient.close();
|
xmlRpcClient.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +250,7 @@ RpcBackupTest :: createBackupTest(void)
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
createBackup()
|
createBackup()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check the backup file.
|
// Check the backup file.
|
||||||
bool exists;
|
bool exists;
|
||||||
std::string schedulerBackupInTarball = "meta-inf/scheduler.xml";
|
std::string schedulerBackupInTarball = "meta-inf/scheduler.xml";
|
||||||
|
@ -263,24 +259,24 @@ RpcBackupTest :: createBackupTest(void)
|
||||||
schedulerBackupInTarball)
|
schedulerBackupInTarball)
|
||||||
);
|
);
|
||||||
CPPUNIT_ASSERT(exists);
|
CPPUNIT_ASSERT(exists);
|
||||||
|
|
||||||
std::string extractedTempFileName = "tmp/scheduler.tmp.xml";
|
std::string extractedTempFileName = "tmp/scheduler.tmp.xml";
|
||||||
FILE * file;
|
FILE * file;
|
||||||
|
|
||||||
remove(extractedTempFileName.c_str());
|
remove(extractedTempFileName.c_str());
|
||||||
file = fopen(extractedTempFileName.c_str(), "r");
|
file = fopen(extractedTempFileName.c_str(), "r");
|
||||||
CPPUNIT_ASSERT(file == 0);
|
CPPUNIT_ASSERT(file == 0);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
FileTools::extractFileFromTarball(tempBackupTarFileName,
|
FileTools::extractFileFromTarball(tempBackupTarFileName,
|
||||||
schedulerBackupInTarball,
|
schedulerBackupInTarball,
|
||||||
extractedTempFileName)
|
extractedTempFileName)
|
||||||
);
|
);
|
||||||
|
|
||||||
file = fopen(extractedTempFileName.c_str(), "r");
|
file = fopen(extractedTempFileName.c_str(), "r");
|
||||||
CPPUNIT_ASSERT(file != 0);
|
CPPUNIT_ASSERT(file != 0);
|
||||||
CPPUNIT_ASSERT(fclose(file) == 0);
|
CPPUNIT_ASSERT(fclose(file) == 0);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(remove(extractedTempFileName.c_str()) == 0);
|
CPPUNIT_ASSERT(remove(extractedTempFileName.c_str()) == 0);
|
||||||
file = fopen(extractedTempFileName.c_str(), "r");
|
file = fopen(extractedTempFileName.c_str(), "r");
|
||||||
CPPUNIT_ASSERT(file == 0);
|
CPPUNIT_ASSERT(file == 0);
|
||||||
|
@ -298,7 +294,7 @@ RpcBackupTest :: restoreBackupTest(void)
|
||||||
CPPUNIT_ASSERT_NO_THROW(
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
createBackup()
|
createBackup()
|
||||||
);
|
);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -306,19 +302,19 @@ RpcBackupTest :: restoreBackupTest(void)
|
||||||
getXmlRpcPort(),
|
getXmlRpcPort(),
|
||||||
"/RPC2",
|
"/RPC2",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
Ptr<const Glib::ustring>::Ref path(new const Glib::ustring(
|
Ptr<const Glib::ustring>::Ref path(new const Glib::ustring(
|
||||||
tempBackupTarFileName));
|
tempBackupTarFileName));
|
||||||
|
|
||||||
XmlRpcTools::sessionIdToXmlRpcValue(sessionId, parameters);
|
XmlRpcTools::sessionIdToXmlRpcValue(sessionId, parameters);
|
||||||
XmlRpcTools::pathToXmlRpcValue(path, parameters);
|
XmlRpcTools::pathToXmlRpcValue(path, parameters);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(xmlRpcClient.execute("restoreBackup",
|
CPPUNIT_ASSERT(xmlRpcClient.execute("restoreBackup",
|
||||||
parameters,
|
parameters,
|
||||||
result));
|
result));
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
xmlRpcClient.close();
|
xmlRpcClient.close();
|
||||||
// TODO: try this with a non-empty backup file, too
|
// TODO: try this with a non-empty backup file, too
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -87,8 +87,6 @@ RpcDisplayScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
daemon->install();
|
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -119,10 +117,9 @@ void
|
||||||
RpcDisplayScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
RpcDisplayScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->uninstall();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -147,7 +144,7 @@ RpcDisplayScheduleTest :: simpleTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpcValue parameters;
|
XmlRpcValue parameters;
|
||||||
XmlRpcValue result;
|
XmlRpcValue result;
|
||||||
struct tm time;
|
struct tm time;
|
||||||
|
@ -192,7 +189,7 @@ RpcDisplayScheduleTest :: faultTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpcValue parameters;
|
XmlRpcValue parameters;
|
||||||
XmlRpcValue result;
|
XmlRpcValue result;
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -85,7 +85,6 @@ RpcGeneratePlayReportTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
daemon->install();
|
|
||||||
insertEntries();
|
insertEntries();
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
@ -118,10 +117,9 @@ void
|
||||||
RpcGeneratePlayReportTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
RpcGeneratePlayReportTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->uninstall();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -171,7 +169,7 @@ RpcGeneratePlayReportTest :: firstTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
struct tm time;
|
struct tm time;
|
||||||
|
@ -198,7 +196,7 @@ RpcGeneratePlayReportTest :: firstTest(void)
|
||||||
time.tm_sec = 1;
|
time.tm_sec = 1;
|
||||||
parameters["to"] = &time;
|
parameters["to"] = &time;
|
||||||
|
|
||||||
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
||||||
parameters, result));
|
parameters, result));
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
CPPUNIT_ASSERT(result.size() == 0);
|
CPPUNIT_ASSERT(result.size() == 0);
|
||||||
|
@ -215,7 +213,7 @@ RpcGeneratePlayReportTest :: intervalTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
struct tm time;
|
struct tm time;
|
||||||
|
@ -242,20 +240,20 @@ RpcGeneratePlayReportTest :: intervalTest(void)
|
||||||
time.tm_sec = 0;
|
time.tm_sec = 0;
|
||||||
parameters["to"] = &time;
|
parameters["to"] = &time;
|
||||||
|
|
||||||
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
||||||
parameters, result));
|
parameters, result));
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
// check the returned values
|
// check the returned values
|
||||||
CPPUNIT_ASSERT(result.size() == 1);
|
CPPUNIT_ASSERT(result.size() == 1);
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
||||||
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
UniqueId newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
UniqueId newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
||||||
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
||||||
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeDateTime);
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
time = result[0]["timestamp"];
|
time = result[0]["timestamp"];
|
||||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
@ -284,20 +282,20 @@ RpcGeneratePlayReportTest :: intervalTest(void)
|
||||||
parameters["to"] = &time;
|
parameters["to"] = &time;
|
||||||
|
|
||||||
result.clear();
|
result.clear();
|
||||||
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
||||||
parameters, result));
|
parameters, result));
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
// check the returned values
|
// check the returned values
|
||||||
CPPUNIT_ASSERT(result.size() == 1);
|
CPPUNIT_ASSERT(result.size() == 1);
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
||||||
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
||||||
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10001);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
||||||
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeDateTime);
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
time = result[0]["timestamp"];
|
time = result[0]["timestamp"];
|
||||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
@ -326,20 +324,20 @@ RpcGeneratePlayReportTest :: intervalTest(void)
|
||||||
parameters["to"] = &time;
|
parameters["to"] = &time;
|
||||||
|
|
||||||
result.clear();
|
result.clear();
|
||||||
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
||||||
parameters, result));
|
parameters, result));
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
// check the returned values
|
// check the returned values
|
||||||
CPPUNIT_ASSERT(result.size() == 2);
|
CPPUNIT_ASSERT(result.size() == 2);
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
CPPUNIT_ASSERT(result[0].hasMember("audioClipId"));
|
||||||
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
CPPUNIT_ASSERT(result[0]["audioClipId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
newAudioClipId = UniqueId(std::string(result[0]["audioClipId"]));
|
||||||
CPPUNIT_ASSERT(newAudioClipId.getId() == 10017);
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10017);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
CPPUNIT_ASSERT(result[0].hasMember("timestamp"));
|
||||||
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
CPPUNIT_ASSERT(result[0]["timestamp"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeDateTime);
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
time = result[0]["timestamp"];
|
time = result[0]["timestamp"];
|
||||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
@ -350,13 +348,13 @@ RpcGeneratePlayReportTest :: intervalTest(void)
|
||||||
CPPUNIT_ASSERT(time.tm_sec == 0);
|
CPPUNIT_ASSERT(time.tm_sec == 0);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[1].hasMember("audioClipId"));
|
CPPUNIT_ASSERT(result[1].hasMember("audioClipId"));
|
||||||
CPPUNIT_ASSERT(result[1]["audioClipId"].getType()
|
CPPUNIT_ASSERT(result[1]["audioClipId"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeString);
|
== XmlRpc::XmlRpcValue::TypeString);
|
||||||
newAudioClipId = UniqueId(std::string(result[1]["audioClipId"]));
|
newAudioClipId = UniqueId(std::string(result[1]["audioClipId"]));
|
||||||
CPPUNIT_ASSERT(newAudioClipId.getId() == 10003);
|
CPPUNIT_ASSERT(newAudioClipId.getId() == 10003);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(result[1].hasMember("timestamp"));
|
CPPUNIT_ASSERT(result[1].hasMember("timestamp"));
|
||||||
CPPUNIT_ASSERT(result[1]["timestamp"].getType()
|
CPPUNIT_ASSERT(result[1]["timestamp"].getType()
|
||||||
== XmlRpc::XmlRpcValue::TypeDateTime);
|
== XmlRpc::XmlRpcValue::TypeDateTime);
|
||||||
time = result[1]["timestamp"];
|
time = result[1]["timestamp"];
|
||||||
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
CPPUNIT_ASSERT(time.tm_year == 104); // 2004
|
||||||
|
@ -385,7 +383,7 @@ RpcGeneratePlayReportTest :: intervalTest(void)
|
||||||
parameters["to"] = &time;
|
parameters["to"] = &time;
|
||||||
|
|
||||||
result.clear();
|
result.clear();
|
||||||
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport",
|
||||||
parameters, result));
|
parameters, result));
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
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)
|
RpcGetSchedulerTimeTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->uninstall();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,7 +127,7 @@ RpcGetSchedulerTimeTest :: simpleTest(void)
|
||||||
|
|
||||||
CPPUNIT_ASSERT(time1.tm_year == time2.tm_year);
|
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
|
// 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_hour <= time2.tm_hour);
|
||||||
CPPUNIT_ASSERT(time1.tm_min <= time2.tm_min);
|
CPPUNIT_ASSERT(time1.tm_min <= time2.tm_min);
|
||||||
CPPUNIT_ASSERT(time1.tm_min + 1 >= time2.tm_min);
|
CPPUNIT_ASSERT(time1.tm_min + 1 >= time2.tm_min);
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -66,7 +66,6 @@ void
|
||||||
RpcGetVersionTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
RpcGetVersionTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->install();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +76,6 @@ void
|
||||||
RpcGetVersionTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
RpcGetVersionTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->uninstall();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -63,7 +63,6 @@ void
|
||||||
RpcRemoveFromScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
RpcRemoveFromScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->install();
|
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
@ -95,10 +94,9 @@ void
|
||||||
RpcRemoveFromScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
RpcRemoveFromScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->uninstall();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -123,7 +121,7 @@ RpcRemoveFromScheduleTest :: simpleTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpcValue parameters;
|
XmlRpcValue parameters;
|
||||||
XmlRpcValue result;
|
XmlRpcValue result;
|
||||||
struct tm time;
|
struct tm time;
|
||||||
|
@ -148,7 +146,7 @@ RpcRemoveFromScheduleTest :: simpleTest(void)
|
||||||
xmlRpcClient.execute("uploadPlaylist", parameters, result);
|
xmlRpcClient.execute("uploadPlaylist", parameters, result);
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
||||||
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
||||||
== XmlRpcValue::TypeString);
|
== XmlRpcValue::TypeString);
|
||||||
Ptr<UniqueId>::Ref entryId(new UniqueId(std::string(
|
Ptr<UniqueId>::Ref entryId(new UniqueId(std::string(
|
||||||
result["scheduleEntryId"] )));
|
result["scheduleEntryId"] )));
|
||||||
|
@ -170,7 +168,7 @@ RpcRemoveFromScheduleTest :: negativeTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpcValue parameters;
|
XmlRpcValue parameters;
|
||||||
XmlRpcValue result;
|
XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -198,7 +196,7 @@ RpcRemoveFromScheduleTest :: currentlyPlayingTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpcValue parameters;
|
XmlRpcValue parameters;
|
||||||
XmlRpcValue result;
|
XmlRpcValue result;
|
||||||
Ptr<ptime>::Ref now;
|
Ptr<ptime>::Ref now;
|
||||||
|
@ -223,7 +221,7 @@ RpcRemoveFromScheduleTest :: currentlyPlayingTest(void)
|
||||||
xmlRpcClient.execute("uploadPlaylist", parameters, result);
|
xmlRpcClient.execute("uploadPlaylist", parameters, result);
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
||||||
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
||||||
== XmlRpcValue::TypeString);
|
== XmlRpcValue::TypeString);
|
||||||
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"] )));
|
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"] )));
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -84,8 +84,6 @@ RpcRescheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
daemon->install();
|
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -116,10 +114,9 @@ void
|
||||||
RpcRescheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
RpcRescheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->uninstall();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -144,7 +141,7 @@ RpcRescheduleTest :: simpleTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
struct tm time;
|
struct tm time;
|
||||||
|
@ -169,7 +166,7 @@ RpcRescheduleTest :: simpleTest(void)
|
||||||
xmlRpcClient.execute("uploadPlaylist", parameters, result);
|
xmlRpcClient.execute("uploadPlaylist", parameters, result);
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
||||||
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
||||||
== XmlRpcValue::TypeString);
|
== XmlRpcValue::TypeString);
|
||||||
Ptr<UniqueId>::Ref entryId(new UniqueId(std::string(
|
Ptr<UniqueId>::Ref entryId(new UniqueId(std::string(
|
||||||
result["scheduleEntryId"] )));
|
result["scheduleEntryId"] )));
|
||||||
|
@ -216,7 +213,7 @@ RpcRescheduleTest :: negativeTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -244,7 +241,7 @@ RpcRescheduleTest :: currentlyPlayingTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
Ptr<ptime>::Ref now;
|
Ptr<ptime>::Ref now;
|
||||||
|
@ -269,7 +266,7 @@ RpcRescheduleTest :: currentlyPlayingTest(void)
|
||||||
xmlRpcClient.execute("uploadPlaylist", parameters, result);
|
xmlRpcClient.execute("uploadPlaylist", parameters, result);
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
CPPUNIT_ASSERT(result.hasMember("scheduleEntryId"));
|
||||||
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
CPPUNIT_ASSERT(result["scheduleEntryId"].getType()
|
||||||
== XmlRpcValue::TypeString);
|
== XmlRpcValue::TypeString);
|
||||||
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"] )));
|
entryId.reset(new UniqueId(std::string(result["scheduleEntryId"] )));
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/branches/scheduler_export/livesupport/src/products/scheduler/src/RpcStopCurrentlyPlayingTest.cxx $
|
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 parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -104,7 +102,7 @@ RpcStopCurrentlyPlayingTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
CPPUNIT_ASSERT(result.hasMember("sessionId"));
|
CPPUNIT_ASSERT(result.hasMember("sessionId"));
|
||||||
|
|
||||||
xmlRpcClient.close();
|
xmlRpcClient.close();
|
||||||
|
|
||||||
sessionId.reset(new SessionId(std::string(result["sessionId"])));
|
sessionId.reset(new SessionId(std::string(result["sessionId"])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,10 +114,9 @@ void
|
||||||
RpcStopCurrentlyPlayingTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
RpcStopCurrentlyPlayingTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->uninstall();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -144,16 +141,16 @@ RpcStopCurrentlyPlayingTest :: simpleTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
schedulePlaylistToPlayNow();
|
schedulePlaylistToPlayNow();
|
||||||
|
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
CPPUNIT_ASSERT(daemon);
|
CPPUNIT_ASSERT(daemon);
|
||||||
Ptr<AudioPlayerInterface>::Ref audioPlayer = daemon->getAudioPlayer();
|
Ptr<AudioPlayerInterface>::Ref audioPlayer = daemon->getAudioPlayer();
|
||||||
CPPUNIT_ASSERT(audioPlayer);
|
CPPUNIT_ASSERT(audioPlayer);
|
||||||
|
|
||||||
sleep(10);
|
sleep(10);
|
||||||
CPPUNIT_ASSERT(audioPlayer->isOpen());
|
CPPUNIT_ASSERT(audioPlayer->isOpen());
|
||||||
CPPUNIT_ASSERT(audioPlayer->isPlaying());
|
CPPUNIT_ASSERT(audioPlayer->isPlaying());
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -169,9 +166,9 @@ RpcStopCurrentlyPlayingTest :: simpleTest(void)
|
||||||
result.clear();
|
result.clear();
|
||||||
xmlRpcClient.execute("stopCurrentlyPlaying", parameters, result);
|
xmlRpcClient.execute("stopCurrentlyPlaying", parameters, result);
|
||||||
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
|
||||||
|
|
||||||
xmlRpcClient.close();
|
xmlRpcClient.close();
|
||||||
|
|
||||||
CPPUNIT_ASSERT(!audioPlayer->isPlaying());
|
CPPUNIT_ASSERT(!audioPlayer->isPlaying());
|
||||||
CPPUNIT_ASSERT(!audioPlayer->isOpen());
|
CPPUNIT_ASSERT(!audioPlayer->isOpen());
|
||||||
}
|
}
|
||||||
|
@ -185,7 +182,7 @@ RpcStopCurrentlyPlayingTest :: negativeTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -83,8 +83,6 @@ RpcUploadPlaylistTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
daemon->install();
|
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
@ -115,8 +113,7 @@ void
|
||||||
RpcUploadPlaylistTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
RpcUploadPlaylistTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
daemon->uninstall();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
@ -143,7 +140,7 @@ RpcUploadPlaylistTest :: simpleTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
struct tm time;
|
struct tm time;
|
||||||
|
@ -184,7 +181,7 @@ RpcUploadPlaylistTest :: postInitTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(sessionId);
|
CPPUNIT_ASSERT(sessionId);
|
||||||
|
|
||||||
XmlRpc::XmlRpcValue parameters;
|
XmlRpc::XmlRpcValue parameters;
|
||||||
XmlRpc::XmlRpcValue result;
|
XmlRpc::XmlRpcValue result;
|
||||||
struct tm time;
|
struct tm time;
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -113,46 +113,3 @@ ScheduleFactory :: configure(const xmlpp::Element & element)
|
||||||
throw std::invalid_argument("no storage client factories to configure");
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -43,7 +43,6 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "LiveSupport/Core/Configurable.h"
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
#include "LiveSupport/Core/Installable.h"
|
|
||||||
#include "ScheduleInterface.h"
|
#include "ScheduleInterface.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,8 +88,7 @@ using namespace LiveSupport::Core;
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @see PostgresqlSchedule
|
* @see PostgresqlSchedule
|
||||||
*/
|
*/
|
||||||
class ScheduleFactory : virtual public Configurable,
|
class ScheduleFactory : virtual public Configurable
|
||||||
virtual public Installable
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -128,7 +126,7 @@ class ScheduleFactory : virtual public Configurable,
|
||||||
/**
|
/**
|
||||||
* Return the name of the XML element this object expects
|
* Return the name of the XML element this object expects
|
||||||
* to be sent to a call to configure().
|
* to be sent to a call to configure().
|
||||||
*
|
*
|
||||||
* @return the name of the expected XML configuration element.
|
* @return the name of the expected XML configuration element.
|
||||||
*/
|
*/
|
||||||
static const std::string
|
static const std::string
|
||||||
|
@ -159,38 +157,6 @@ class ScheduleFactory : virtual public Configurable,
|
||||||
throw (std::invalid_argument,
|
throw (std::invalid_argument,
|
||||||
std::logic_error);
|
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.
|
* Return a schedule.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -44,7 +44,6 @@
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
#include "LiveSupport/Core/Ptr.h"
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
#include "LiveSupport/Core/Installable.h"
|
|
||||||
#include "LiveSupport/Core/Playlist.h"
|
#include "LiveSupport/Core/Playlist.h"
|
||||||
#include "LiveSupport/Core/ScheduleEntry.h"
|
#include "LiveSupport/Core/ScheduleEntry.h"
|
||||||
|
|
||||||
|
@ -72,7 +71,7 @@ using namespace LiveSupport::Core;
|
||||||
* @author $Author$
|
* @author $Author$
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
class ScheduleInterface : virtual public Installable
|
class ScheduleInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -275,7 +275,7 @@ SchedulerDaemon :: ~SchedulerDaemon(void) throw ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Register our XML-RPC methods
|
* 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.
|
* Execute daemon startup functions.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
SchedulerDaemon :: startup (void) throw (std::logic_error)
|
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 {
|
try {
|
||||||
sessionId = authentication->login(login, password);
|
sessionId = authentication->login(login, password);
|
||||||
} catch (XmlRpcException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -58,7 +58,6 @@
|
||||||
#include <XmlRpc.h>
|
#include <XmlRpc.h>
|
||||||
|
|
||||||
#include "LiveSupport/Core/Ptr.h"
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
#include "LiveSupport/Core/Installable.h"
|
|
||||||
#include "LiveSupport/Core/Configurable.h"
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
#include "LiveSupport/Core/SessionId.h"
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
#include "LiveSupport/Db/ConnectionManagerInterface.h"
|
#include "LiveSupport/Db/ConnectionManagerInterface.h"
|
||||||
|
@ -171,22 +170,11 @@ using namespace LiveSupport::PlaylistExecutor;
|
||||||
* @see ScheduleFactory
|
* @see ScheduleFactory
|
||||||
* @see XmlRpcDaemon
|
* @see XmlRpcDaemon
|
||||||
*/
|
*/
|
||||||
class SchedulerDaemon : public Installable,
|
class SchedulerDaemon : public Configurable,
|
||||||
public Configurable,
|
|
||||||
public XmlRpcDaemon
|
public XmlRpcDaemon
|
||||||
{
|
{
|
||||||
private:
|
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.
|
* A SQL statement to check if the database can be accessed.
|
||||||
*/
|
*/
|
||||||
|
@ -447,36 +435,6 @@ class SchedulerDaemon : public Installable,
|
||||||
return audioPlayer;
|
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.
|
* Shut down the daemon.
|
||||||
* This function is public only because the signal handler
|
* This function is public only because the signal handler
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -84,7 +84,6 @@ UploadPlaylistMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
storage->reset();
|
storage->reset();
|
||||||
|
|
||||||
schedule = scheduler->getSchedule();
|
schedule = scheduler->getSchedule();
|
||||||
schedule->install();
|
|
||||||
|
|
||||||
} catch (XmlRpcException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
std::cerr << "caught XmlRpcException durng setUp" << std::endl
|
std::cerr << "caught XmlRpcException durng setUp" << std::endl
|
||||||
|
@ -96,7 +95,7 @@ UploadPlaylistMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
authentication = scheduler->getAuthentication();
|
authentication = scheduler->getAuthentication();
|
||||||
try {
|
try {
|
||||||
sessionId = authentication->login("root", "q");
|
sessionId = authentication->login("root", "q");
|
||||||
|
@ -113,8 +112,6 @@ UploadPlaylistMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
void
|
void
|
||||||
UploadPlaylistMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
UploadPlaylistMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
schedule->uninstall();
|
|
||||||
|
|
||||||
authentication->logout(sessionId);
|
authentication->logout(sessionId);
|
||||||
sessionId.reset();
|
sessionId.reset();
|
||||||
authentication.reset();
|
authentication.reset();
|
||||||
|
@ -145,7 +142,7 @@ UploadPlaylistMethodTest :: firstTest(void)
|
||||||
time.tm_min = 31;
|
time.tm_min = 31;
|
||||||
time.tm_sec = 1;
|
time.tm_sec = 1;
|
||||||
parameters["playtime"] = &time;
|
parameters["playtime"] = &time;
|
||||||
rootParameter[0] = parameters;
|
rootParameter[0] = parameters;
|
||||||
|
|
||||||
result.clear();
|
result.clear();
|
||||||
try {
|
try {
|
||||||
|
@ -184,7 +181,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
|
||||||
time.tm_min = 0;
|
time.tm_min = 0;
|
||||||
time.tm_sec = 0;
|
time.tm_sec = 0;
|
||||||
parameters["playtime"] = &time;
|
parameters["playtime"] = &time;
|
||||||
rootParameter[0] = parameters;
|
rootParameter[0] = parameters;
|
||||||
|
|
||||||
result.clear();
|
result.clear();
|
||||||
try {
|
try {
|
||||||
|
@ -208,7 +205,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
|
||||||
time.tm_min = 30;
|
time.tm_min = 30;
|
||||||
time.tm_sec = 0;
|
time.tm_sec = 0;
|
||||||
parameters["playtime"] = &time;
|
parameters["playtime"] = &time;
|
||||||
rootParameter[0] = parameters;
|
rootParameter[0] = parameters;
|
||||||
|
|
||||||
result.clear();
|
result.clear();
|
||||||
try {
|
try {
|
||||||
|
@ -228,7 +225,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
|
||||||
time.tm_min = 30;
|
time.tm_min = 30;
|
||||||
time.tm_sec = 0;
|
time.tm_sec = 0;
|
||||||
parameters["playtime"] = &time;
|
parameters["playtime"] = &time;
|
||||||
rootParameter[0] = parameters;
|
rootParameter[0] = parameters;
|
||||||
|
|
||||||
result.clear();
|
result.clear();
|
||||||
try {
|
try {
|
||||||
|
@ -251,7 +248,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void)
|
||||||
time.tm_min = 45;
|
time.tm_min = 45;
|
||||||
time.tm_sec = 0;
|
time.tm_sec = 0;
|
||||||
parameters["playtime"] = &time;
|
parameters["playtime"] = &time;
|
||||||
rootParameter[0] = parameters;
|
rootParameter[0] = parameters;
|
||||||
|
|
||||||
result.clear();
|
result.clear();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
This file is part of the Campcaster project.
|
||||||
http://campcaster.campware.org/
|
http://campcaster.campware.org/
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Campcaster; if not, write to the Free Software
|
along with Campcaster; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Version : $Revision$
|
Version : $Revision$
|
||||||
Location : $URL$
|
Location : $URL$
|
||||||
|
@ -86,11 +86,6 @@ static const struct option longOptions[] = {
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* The start command: "install"
|
|
||||||
*/
|
|
||||||
static const std::string installCommand = "install";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The start command: "start"
|
* The start command: "start"
|
||||||
*/
|
*/
|
||||||
|
@ -106,11 +101,6 @@ static const std::string statusCommand = "status";
|
||||||
*/
|
*/
|
||||||
static const std::string stopCommand = "stop";
|
static const std::string stopCommand = "stop";
|
||||||
|
|
||||||
/**
|
|
||||||
* The stop command: "uninstall"
|
|
||||||
*/
|
|
||||||
static const std::string uninstallCommand = "uninstall";
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
@ -183,7 +173,7 @@ int main ( int argc,
|
||||||
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
Ptr<SchedulerDaemon>::Ref daemon = SchedulerDaemon::getInstance();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::auto_ptr<xmlpp::DomParser>
|
std::auto_ptr<xmlpp::DomParser>
|
||||||
parser(new xmlpp::DomParser(configFileName, true));
|
parser(new xmlpp::DomParser(configFileName, true));
|
||||||
const xmlpp::Document * document = parser->get_document();
|
const xmlpp::Document * document = parser->get_document();
|
||||||
daemon->configure(*(document->get_root_node()));
|
daemon->configure(*(document->get_root_node()));
|
||||||
|
@ -200,9 +190,7 @@ int main ( int argc,
|
||||||
daemon->setBackground(!debugMode);
|
daemon->setBackground(!debugMode);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (installCommand == argv[optind]) {
|
if (startCommand == argv[optind]) {
|
||||||
daemon->install();
|
|
||||||
} else if (startCommand == argv[optind]) {
|
|
||||||
daemon->start();
|
daemon->start();
|
||||||
} else if (statusCommand == argv[optind]) {
|
} else if (statusCommand == argv[optind]) {
|
||||||
std::cout << "The Scheduler Daemon is "
|
std::cout << "The Scheduler Daemon is "
|
||||||
|
@ -210,8 +198,6 @@ int main ( int argc,
|
||||||
<< "running" << std::endl;
|
<< "running" << std::endl;
|
||||||
} else if (stopCommand == argv[optind]) {
|
} else if (stopCommand == argv[optind]) {
|
||||||
daemon->stop();
|
daemon->stop();
|
||||||
} else if (uninstallCommand == argv[optind]) {
|
|
||||||
daemon->uninstall();
|
|
||||||
} else {
|
} else {
|
||||||
printUsage(argv[0], std::cout);
|
printUsage(argv[0], std::cout);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -248,7 +234,7 @@ printUsage ( const char invocation[],
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< "Usage: " << invocation << " [OPTION] COMMAND"
|
<< "Usage: " << invocation << " [OPTION] COMMAND"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " COMMAND is one of: install, start, stop, status or uninstall"
|
<< " COMMAND is one of: start, stop, or status"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " mandatory options:" << std::endl
|
<< " mandatory options:" << std::endl
|
||||||
|
|
Loading…
Reference in New Issue