diff --git a/campcaster/src/products/scheduler/bin/campcaster-scheduler.sh b/campcaster/src/products/scheduler/bin/campcaster-scheduler.sh index de98e1593..03ca68dfb 100755 --- a/campcaster/src/products/scheduler/bin/campcaster-scheduler.sh +++ b/campcaster/src/products/scheduler/bin/campcaster-scheduler.sh @@ -83,12 +83,12 @@ case "$mode" in 'install') echo "Installing Campcaster scheduler database tables..." - $scheduler_exe -c $config_file install + php install.php -c $config_file ;; 'uninstall') echo "Uninstalling Campcaster scheduler database tables..." - $scheduler_exe -c $config_file uninstall + php uninstall.php -c $config_file ;; 'kill') diff --git a/campcaster/src/products/scheduler/bin/install.php b/campcaster/src/products/scheduler/bin/install.php new file mode 100644 index 000000000..bd11a1ebd --- /dev/null +++ b/campcaster/src/products/scheduler/bin/install.php @@ -0,0 +1,27 @@ + + * @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"; + +?> \ No newline at end of file diff --git a/campcaster/src/products/scheduler/bin/installInit.php b/campcaster/src/products/scheduler/bin/installInit.php new file mode 100644 index 000000000..d7ab7421c --- /dev/null +++ b/campcaster/src/products/scheduler/bin/installInit.php @@ -0,0 +1,80 @@ +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); + +?> \ No newline at end of file diff --git a/campcaster/src/products/scheduler/bin/installScheduler.php b/campcaster/src/products/scheduler/bin/installScheduler.php new file mode 100644 index 000000000..cfdc70b39 --- /dev/null +++ b/campcaster/src/products/scheduler/bin/installScheduler.php @@ -0,0 +1,51 @@ + \ No newline at end of file diff --git a/campcaster/src/products/scheduler/bin/uninstall.php b/campcaster/src/products/scheduler/bin/uninstall.php new file mode 100644 index 000000000..173ec230d --- /dev/null +++ b/campcaster/src/products/scheduler/bin/uninstall.php @@ -0,0 +1,27 @@ + + * @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"; + +?> \ No newline at end of file diff --git a/campcaster/src/products/scheduler/bin/uninstallScheduler.php b/campcaster/src/products/scheduler/bin/uninstallScheduler.php new file mode 100644 index 000000000..e395335c3 --- /dev/null +++ b/campcaster/src/products/scheduler/bin/uninstallScheduler.php @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/campcaster/src/products/scheduler/src/BackupFactory.cxx b/campcaster/src/products/scheduler/src/BackupFactory.cxx index 5e0dd859f..6808b05e9 100644 --- a/campcaster/src/products/scheduler/src/BackupFactory.cxx +++ b/campcaster/src/products/scheduler/src/BackupFactory.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -96,7 +96,7 @@ BackupFactory :: configure(const xmlpp::Element & element) cmf = ConnectionManagerFactory::getInstance(); Ptr::Ref connection = cmf->getConnectionManager(); - + Ptr::Ref scf = StorageClientFactory::getInstance(); Ptr::Ref @@ -106,7 +106,7 @@ BackupFactory :: configure(const xmlpp::Element & element) sf = ScheduleFactory::getInstance(); Ptr::Ref schedule = sf->getSchedule(); - + // try to look for a PostgresqlBackup configuration element xmlpp::Node::NodeList nodes = element.get_children(PostgresqlBackup::getConfigElementName()); @@ -124,46 +124,3 @@ BackupFactory :: configure(const xmlpp::Element & element) throw std::invalid_argument("could not configure BackupFactory"); } } - - -/*------------------------------------------------------------------------------ - * Install the backup factory. - *----------------------------------------------------------------------------*/ -void -BackupFactory :: install(void) throw (std::exception) -{ - if (!backup) { - throw std::logic_error("BackupFactory not yet configured"); - } - - backup->install(); -} - - -/*------------------------------------------------------------------------------ - * Check to see if the backup factory has already been installed. - *----------------------------------------------------------------------------*/ -bool -BackupFactory :: isInstalled(void) throw (std::exception) -{ - if (!backup) { - throw std::logic_error("BackupFactory not yet configured"); - } - - return backup->isInstalled(); -} - - -/*------------------------------------------------------------------------------ - * Install the backup factory. - *----------------------------------------------------------------------------*/ -void -BackupFactory :: uninstall(void) throw (std::exception) -{ - if (!backup) { - throw std::logic_error("BackupFactory not yet configured"); - } - - backup->uninstall(); -} - diff --git a/campcaster/src/products/scheduler/src/BackupFactory.h b/campcaster/src/products/scheduler/src/BackupFactory.h index fe4cfc3ec..14b6111f0 100644 --- a/campcaster/src/products/scheduler/src/BackupFactory.h +++ b/campcaster/src/products/scheduler/src/BackupFactory.h @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -39,7 +39,6 @@ #include #include "LiveSupport/Core/Configurable.h" -#include "LiveSupport/Core/Installable.h" #include "BackupInterface.h" @@ -88,8 +87,7 @@ using namespace LiveSupport::Core; * @version $Revision$ * @see PostgresqlBackup */ -class BackupFactory : virtual public Configurable, - virtual public Installable +class BackupFactory : virtual public Configurable { private: /** @@ -127,7 +125,7 @@ class BackupFactory : virtual public Configurable, /** * Return the name of the XML element this object expects * to be sent to a call to configure(). - * + * * @return the name of the expected XML configuration element. */ static const std::string @@ -158,38 +156,6 @@ class BackupFactory : virtual public Configurable, throw (std::invalid_argument, std::logic_error); - /** - * Install the component. - * This step involves creating the environment in which the component - * will run. This may be creation of coniguration files, - * database tables, etc. - * - * @exception std::exception on installation problems, - * especially if the BackupFactory was not yet configured. - */ - virtual void - install(void) throw (std::exception); - - /** - * Check to see if the component has already been installed. - * - * @return true if the component is properly installed, - * false otherwise - * @exception std::exception on generic problems - */ - virtual bool - isInstalled(void) throw (std::exception); - - /** - * Uninstall the component. - * Removes all the resources created in the install step. - * - * @exception std::exception on unistallation problems, - e especially if the BackupFactory was not yet configured. - */ - virtual void - uninstall(void) throw (std::exception); - /** * Return a backup. * diff --git a/campcaster/src/products/scheduler/src/BackupInterface.h b/campcaster/src/products/scheduler/src/BackupInterface.h index 95e5791bf..2e1a7691c 100644 --- a/campcaster/src/products/scheduler/src/BackupInterface.h +++ b/campcaster/src/products/scheduler/src/BackupInterface.h @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -40,7 +40,6 @@ #include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/Installable.h" #include "LiveSupport/Core/Playlist.h" #include "LiveSupport/Core/ScheduleEntry.h" #include "LiveSupport/StorageClient/StorageClientInterface.h" @@ -67,7 +66,7 @@ using namespace LiveSupport::StorageClient; /** * The generic interface for creating and restoring schedule backups. * - * There is a singleton instance of this type, which is manufactured by the + * There is a singleton instance of this type, which is manufactured by the * BackupFactory class. * * There are separate xxxxMethod classes which perform these @@ -78,7 +77,7 @@ using namespace LiveSupport::StorageClient; * @author $Author$ * @version $Revision$ */ -class BackupInterface : virtual public Installable +class BackupInterface { public: /** @@ -93,7 +92,7 @@ class BackupInterface : virtual public Installable * @param criteria the criteria to use for backing up the storage * @param fromTime entries are included in the schedule export starting * from this time. - * @param toTime entries as included in the schedule export + * @param toTime entries as included in the schedule export * up to but not including this time. * @return a token, which can be used to query the backup process. * @exception XmlRpcException on XML-RPC issues. @@ -113,7 +112,7 @@ class BackupInterface : virtual public Installable * * @param token the identifier of this backup task. * @param url return parameter; - * if the status is "success", it contains the + * if the status is "success", it contains the * URL of the created backup file. * @param path return parameter; * if the status is "success", it contains the @@ -155,10 +154,10 @@ class BackupInterface : virtual public Installable * Restore a schedule backup. * * All playlist IDs contained in the backup should already be in the - * storage. If this is a combined backup, with both storage and + * storage. If this is a combined backup, with both storage and * schedule components, then restore this backup to the storage * first, and then call this function. - * + * * @param sessionId a valid session ID to identify the user. * @param path the location of the archive to upload. * @exception XmlRpcException if there is an error. diff --git a/campcaster/src/products/scheduler/src/DisplayScheduleMethodTest.cxx b/campcaster/src/products/scheduler/src/DisplayScheduleMethodTest.cxx index 9243b6776..84d001d94 100644 --- a/campcaster/src/products/scheduler/src/DisplayScheduleMethodTest.cxx +++ b/campcaster/src/products/scheduler/src/DisplayScheduleMethodTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -88,7 +88,6 @@ DisplayScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) storage->reset(); schedule = scheduler->getSchedule(); - schedule->install(); } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); @@ -97,7 +96,7 @@ DisplayScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) } catch (std::exception &e) { CPPUNIT_FAIL(e.what()); } - + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); @@ -117,8 +116,6 @@ DisplayScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) void DisplayScheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { - schedule->uninstall(); - authentication->logout(sessionId); sessionId.reset(); authentication.reset(); @@ -251,7 +248,7 @@ DisplayScheduleMethodTest :: insertEntries(void) } } - + /*------------------------------------------------------------------------------ * Look at some intervals and check against test data *----------------------------------------------------------------------------*/ @@ -297,7 +294,7 @@ DisplayScheduleMethodTest :: intervalTest(void) // check the returned values CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result[0].hasMember("playlistId")); - CPPUNIT_ASSERT(result[0]["playlistId"].getType() + CPPUNIT_ASSERT(result[0]["playlistId"].getType() == XmlRpcValue::TypeString); CPPUNIT_ASSERT(std::string(result[0]["playlistId"]) == "0000000000000001"); time = result[0]["start"]; @@ -346,7 +343,7 @@ DisplayScheduleMethodTest :: intervalTest(void) // check the returned values CPPUNIT_ASSERT(result.size() == 2); CPPUNIT_ASSERT(result[0].hasMember("playlistId")); - CPPUNIT_ASSERT(result[0]["playlistId"].getType() + CPPUNIT_ASSERT(result[0]["playlistId"].getType() == XmlRpcValue::TypeString); CPPUNIT_ASSERT(std::string(result[0]["playlistId"]) == "0000000000000001"); time = result[0]["start"]; @@ -365,7 +362,7 @@ DisplayScheduleMethodTest :: intervalTest(void) CPPUNIT_ASSERT(time.tm_sec == 0); CPPUNIT_ASSERT(result[1].hasMember("playlistId")); - CPPUNIT_ASSERT(result[1]["playlistId"].getType() + CPPUNIT_ASSERT(result[1]["playlistId"].getType() == XmlRpcValue::TypeString); CPPUNIT_ASSERT(std::string(result[1]["playlistId"]) == "0000000000000001"); time = result[1]["start"]; diff --git a/campcaster/src/products/scheduler/src/GeneratePlayReportMethodTest.cxx b/campcaster/src/products/scheduler/src/GeneratePlayReportMethodTest.cxx index 989f7656c..1f45aa54f 100644 --- a/campcaster/src/products/scheduler/src/GeneratePlayReportMethodTest.cxx +++ b/campcaster/src/products/scheduler/src/GeneratePlayReportMethodTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -87,8 +87,6 @@ GeneratePlayReportMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) storage->reset(); playLog = scheduler->getPlayLog(); - playLog->install(); - insertEntries(); } catch (std::invalid_argument &e) { @@ -98,7 +96,7 @@ GeneratePlayReportMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) } catch (std::exception &e) { CPPUNIT_FAIL(e.what()); } - + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); @@ -116,8 +114,6 @@ GeneratePlayReportMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) void GeneratePlayReportMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { - playLog->uninstall(); - authentication->logout(sessionId); sessionId.reset(); authentication.reset(); @@ -236,13 +232,13 @@ GeneratePlayReportMethodTest :: intervalTest(void) // check the returned values CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result[0].hasMember("audioClipId")); - CPPUNIT_ASSERT(result[0]["audioClipId"].getType() + CPPUNIT_ASSERT(result[0]["audioClipId"].getType() == XmlRpc::XmlRpcValue::TypeString); UniqueId newAudioClipId = UniqueId(std::string(result[0]["audioClipId"])); CPPUNIT_ASSERT(newAudioClipId.getId() == 10001); CPPUNIT_ASSERT(result[0].hasMember("timestamp")); - CPPUNIT_ASSERT(result[0]["timestamp"].getType() + CPPUNIT_ASSERT(result[0]["timestamp"].getType() == XmlRpc::XmlRpcValue::TypeDateTime); time = result[0]["timestamp"]; CPPUNIT_ASSERT(time.tm_year == 104); // 2004 @@ -284,13 +280,13 @@ GeneratePlayReportMethodTest :: intervalTest(void) // check the returned values CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result[0].hasMember("audioClipId")); - CPPUNIT_ASSERT(result[0]["audioClipId"].getType() + CPPUNIT_ASSERT(result[0]["audioClipId"].getType() == XmlRpc::XmlRpcValue::TypeString); newAudioClipId = UniqueId(std::string(result[0]["audioClipId"])); CPPUNIT_ASSERT(newAudioClipId.getId() == 10001); CPPUNIT_ASSERT(result[0].hasMember("timestamp")); - CPPUNIT_ASSERT(result[0]["timestamp"].getType() + CPPUNIT_ASSERT(result[0]["timestamp"].getType() == XmlRpc::XmlRpcValue::TypeDateTime); time = result[0]["timestamp"]; CPPUNIT_ASSERT(time.tm_year == 104); // 2004 @@ -332,13 +328,13 @@ GeneratePlayReportMethodTest :: intervalTest(void) // check the returned values CPPUNIT_ASSERT(result.size() == 2); CPPUNIT_ASSERT(result[0].hasMember("audioClipId")); - CPPUNIT_ASSERT(result[0]["audioClipId"].getType() + CPPUNIT_ASSERT(result[0]["audioClipId"].getType() == XmlRpc::XmlRpcValue::TypeString); newAudioClipId = UniqueId(std::string(result[0]["audioClipId"])); CPPUNIT_ASSERT(newAudioClipId.getId() == 10017); CPPUNIT_ASSERT(result[0].hasMember("timestamp")); - CPPUNIT_ASSERT(result[0]["timestamp"].getType() + CPPUNIT_ASSERT(result[0]["timestamp"].getType() == XmlRpc::XmlRpcValue::TypeDateTime); time = result[0]["timestamp"]; CPPUNIT_ASSERT(time.tm_year == 104); // 2004 @@ -349,13 +345,13 @@ GeneratePlayReportMethodTest :: intervalTest(void) CPPUNIT_ASSERT(time.tm_sec == 0); CPPUNIT_ASSERT(result[1].hasMember("audioClipId")); - CPPUNIT_ASSERT(result[1]["audioClipId"].getType() + CPPUNIT_ASSERT(result[1]["audioClipId"].getType() == XmlRpc::XmlRpcValue::TypeString); newAudioClipId = UniqueId(std::string(result[1]["audioClipId"])); CPPUNIT_ASSERT(newAudioClipId.getId() == 10003); CPPUNIT_ASSERT(result[1].hasMember("timestamp")); - CPPUNIT_ASSERT(result[1]["timestamp"].getType() + CPPUNIT_ASSERT(result[1]["timestamp"].getType() == XmlRpc::XmlRpcValue::TypeDateTime); time = result[1]["timestamp"]; CPPUNIT_ASSERT(time.tm_year == 104); // 2004 diff --git a/campcaster/src/products/scheduler/src/PlayLogFactory.cxx b/campcaster/src/products/scheduler/src/PlayLogFactory.cxx index 92cab20ec..f6e3dbf6a 100644 --- a/campcaster/src/products/scheduler/src/PlayLogFactory.cxx +++ b/campcaster/src/products/scheduler/src/PlayLogFactory.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -114,45 +114,3 @@ PlayLogFactory :: configure(const xmlpp::Element & element) } } - -/*------------------------------------------------------------------------------ - * Install the play log factory. - *----------------------------------------------------------------------------*/ -void -PlayLogFactory :: install(void) throw (std::exception) -{ - if (!playLog) { - throw std::logic_error("PlayLogFactory not yet configured"); - } - - playLog->install(); -} - - -/*------------------------------------------------------------------------------ - * Check to see if the factory has already been installed. - *----------------------------------------------------------------------------*/ -bool -PlayLogFactory :: isInstalled(void) throw (std::exception) -{ - if (!playLog) { - throw std::logic_error("PlayLogFactory not yet configured"); - } - - return playLog->isInstalled(); -} - - -/*------------------------------------------------------------------------------ - * Uninstall the play log factory. - *----------------------------------------------------------------------------*/ -void -PlayLogFactory :: uninstall(void) throw (std::exception) -{ - if (!playLog) { - throw std::logic_error("PlayLogFactory not yet configured"); - } - - playLog->uninstall(); -} - diff --git a/campcaster/src/products/scheduler/src/PlayLogFactory.h b/campcaster/src/products/scheduler/src/PlayLogFactory.h index bbbd97e41..f5b2b9eb1 100644 --- a/campcaster/src/products/scheduler/src/PlayLogFactory.h +++ b/campcaster/src/products/scheduler/src/PlayLogFactory.h @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -43,7 +43,6 @@ #include #include "LiveSupport/Core/Configurable.h" -#include "LiveSupport/Core/Installable.h" #include "PlayLogInterface.h" @@ -89,8 +88,7 @@ using namespace LiveSupport::Core; * @version $Revision$ * @see PostgresqlPlayLog */ -class PlayLogFactory : virtual public Configurable, - virtual public Installable +class PlayLogFactory : virtual public Configurable { private: /** @@ -128,7 +126,7 @@ class PlayLogFactory : virtual public Configurable, /** * Return the name of the XML element this object expects * to be sent to a call to configure(). - * + * * @return the name of the expected XML configuration element. */ static const std::string @@ -159,38 +157,6 @@ class PlayLogFactory : virtual public Configurable, throw (std::invalid_argument, std::logic_error); - /** - * Install the component. - * This step involves creating the environment in which the component - * will run. This may be creation of coniguration files, - * database tables, etc. - * - * @exception std::exception on installation problems, - * especially if the PlayLogFactory was not yet configured. - */ - virtual void - install(void) throw (std::exception); - - /** - * Check to see if the component has already been installed. - * - * @return true if the component is properly installed, - * false otherwise - * @exception std::exception on generic problems - */ - virtual bool - isInstalled(void) throw (std::exception); - - /** - * Uninstall the component. - * Removes all the resources created in the install step. - * - * @exception std::exception on unistallation problems, - e especially if the PlayLogFactory was not yet configured. - */ - virtual void - uninstall(void) throw (std::exception); - /** * Return a play log. * diff --git a/campcaster/src/products/scheduler/src/PlayLogInterface.h b/campcaster/src/products/scheduler/src/PlayLogInterface.h index e073a467e..ffea1cadf 100644 --- a/campcaster/src/products/scheduler/src/PlayLogInterface.h +++ b/campcaster/src/products/scheduler/src/PlayLogInterface.h @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -44,7 +44,6 @@ #include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/Installable.h" #include "LiveSupport/Core/Playlist.h" #include "LiveSupport/Core/PlayLogEntry.h" @@ -72,7 +71,7 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class PlayLogInterface : virtual public Installable +class PlayLogInterface { public: /** diff --git a/campcaster/src/products/scheduler/src/PlaylistEventContainerTest.cxx b/campcaster/src/products/scheduler/src/PlaylistEventContainerTest.cxx index 6d08c6619..42a6c675d 100644 --- a/campcaster/src/products/scheduler/src/PlaylistEventContainerTest.cxx +++ b/campcaster/src/products/scheduler/src/PlaylistEventContainerTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -99,13 +99,6 @@ PlaylistEventContainerTest :: setUp(void) throw (CPPUNIT_NS::Exception) std::cerr << e.what() << std::endl; CPPUNIT_FAIL("error parsing configuration file"); } - try { - schedule->install(); - playLog->install(); - } catch (std::exception &e) { - std::cerr << e.what() << std::endl; - CPPUNIT_FAIL("can't install schedule factory"); - } audioPlayer->initialize(); if (!(sessionId = authentication->login("root", "q"))) { @@ -121,8 +114,6 @@ void PlaylistEventContainerTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { audioPlayer->deInitialize(); - schedule->uninstall(); - playLog->uninstall(); playLog.reset(); schedule.reset(); @@ -172,7 +163,7 @@ PlaylistEventContainerTest :: scheduleTest(void) // schedule playlist 1 at 10 seconds from now Ptr::Ref playlistId(new UniqueId(1)); - Ptr::Ref playlist = storage->getPlaylist(sessionId, + Ptr::Ref playlist = storage->getPlaylist(sessionId, playlistId); CPPUNIT_ASSERT(playlist.get()); Ptr::Ref now = TimeConversion::now(); diff --git a/campcaster/src/products/scheduler/src/PlaylistEventTest.cxx b/campcaster/src/products/scheduler/src/PlaylistEventTest.cxx index bc81a44e1..1015347a0 100644 --- a/campcaster/src/products/scheduler/src/PlaylistEventTest.cxx +++ b/campcaster/src/products/scheduler/src/PlaylistEventTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -97,7 +97,6 @@ PlaylistEventTest :: setUp(void) throw (CPPUNIT_NS::Exception) } audioPlayer->initialize(); - playLog->install(); duration.reset(new time_duration(seconds(30))); @@ -113,7 +112,6 @@ PlaylistEventTest :: setUp(void) throw (CPPUNIT_NS::Exception) void PlaylistEventTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { - playLog->uninstall(); audioPlayer->deInitialize(); duration.reset(); diff --git a/campcaster/src/products/scheduler/src/PostgresqlBackup.cxx b/campcaster/src/products/scheduler/src/PostgresqlBackup.cxx index 3e24e52a2..f976ba79f 100644 --- a/campcaster/src/products/scheduler/src/PostgresqlBackup.cxx +++ b/campcaster/src/products/scheduler/src/PostgresqlBackup.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -109,26 +109,6 @@ const std::string scheduleExportFileName = "meta-inf/scheduler.xml"; *----------------------------------------------------------------------------*/ const std::string check1Stmt = "SELECT 1"; -/*------------------------------------------------------------------------------ - * The SQL create statement, used for installation. - *----------------------------------------------------------------------------*/ -const std::string createStmt = - "CREATE TABLE backup\n" - "(\n" - " token VARCHAR(64) NOT NULL,\n" - " sessionId VARCHAR(64) NOT NULL,\n" - " status VARCHAR(32) NOT NULL,\n" - " fromTime TIMESTAMP NOT NULL,\n" - " toTime TIMESTAMP NOT NULL,\n" - "\n" - " PRIMARY KEY(token)\n" - ");"; - -/*------------------------------------------------------------------------------ - * The SQL create statement, used for installation. - *----------------------------------------------------------------------------*/ -const std::string dropStmt = "DROP TABLE backup;"; - /*------------------------------------------------------------------------------ * A statement to check if the backup table exists. *----------------------------------------------------------------------------*/ @@ -192,97 +172,6 @@ PostgresqlBackup :: configure(const xmlpp::Element & element) } -/*------------------------------------------------------------------------------ - * Install the PostgresqlBackup. - *----------------------------------------------------------------------------*/ -void -PostgresqlBackup :: install(void) throw (std::exception) -{ - if (!isInstalled()) { - Ptr::Ref conn; - try { - conn = connectionManager->getConnection(); - Ptr::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::Ref conn; - try { - Ptr::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::Ref conn; - try { - conn = connectionManager->getConnection(); - Ptr::Ref stmt(conn->createStatement()); - stmt->execute(dropStmt); - connectionManager->returnConnection(conn); - } catch (std::exception &e) { - if (conn) { - connectionManager->returnConnection(conn); - } - throw; - } -} - - /*------------------------------------------------------------------------------ * Start a backup process. *----------------------------------------------------------------------------*/ @@ -364,7 +253,7 @@ PostgresqlBackup ::createBackupCheck( Ptr::Ref rs(pstmt->executeQuery()); if (rs->next()) { status = stringToAsyncState(rs->getString(3)); - + timestamp.reset(new Timestamp(rs->getTimestamp(4))); fromTime = Conversion::timestampToPtime(timestamp); @@ -514,7 +403,7 @@ PostgresqlBackup :: restoreBackup(Ptr::Ref sessionId, throw (XmlRpcException) { //TODO: check the session ID - + std::string tmpFileName = FileTools::tempnam(); try { FileTools::extractFileFromTarball(*path, @@ -526,7 +415,7 @@ PostgresqlBackup :: restoreBackup(Ptr::Ref sessionId, errorMsg += e.what(); throw XmlRpcIOException(errorMsg); } - + Ptr::Ref parser(new DomParser(tmpFileName, false /* do not expect a DTD */)); const Document * document = parser->get_document(); diff --git a/campcaster/src/products/scheduler/src/PostgresqlBackup.h b/campcaster/src/products/scheduler/src/PostgresqlBackup.h index 36a201420..640637612 100644 --- a/campcaster/src/products/scheduler/src/PostgresqlBackup.h +++ b/campcaster/src/products/scheduler/src/PostgresqlBackup.h @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -105,12 +105,12 @@ class PostgresqlBackup : public Configurable, * The storage client to use for connecting to the storage server. */ Ptr::Ref storage; - + /** * The schedule to use for reading the schedule entries from. */ Ptr::Ref schedule; - + /** * The default constructor. */ @@ -132,7 +132,7 @@ class PostgresqlBackup : public Configurable, Ptr::Ref fromTime, Ptr::Ref toTime) throw (std::runtime_error); - + /** * Convert a string status to an AsyncState. * It converts @@ -145,7 +145,7 @@ class PostgresqlBackup : public Configurable, */ AsyncState stringToAsyncState(const std::string & statusString) throw (); - + /** * Convert an AsyncState to a string. * It converts @@ -190,7 +190,7 @@ class PostgresqlBackup : public Configurable, /** * Return the name of the XML element this object expects * to be sent to a call to configure(). - * + * * @return the name of the expected XML configuration element. */ static const std::string @@ -215,36 +215,6 @@ class PostgresqlBackup : public Configurable, throw (std::invalid_argument, std::logic_error); - /** - * Install the component. - * This step involves creating the environment in which the component - * will run. This may be creation of coniguration files, - * database tables, etc. - * - * @exception std::exception on installation problems. - */ - virtual void - install(void) throw (std::exception); - - /** - * Check to see if the component has already been installed. - * - * @return true if the component is properly installed, - * false otherwise - * @exception std::exception on generic problems - */ - virtual bool - isInstalled(void) throw (std::exception); - - /** - * Uninstall the component. - * Removes all the resources created in the install step. - * - * @exception std::exception on unistallation problems. - */ - virtual void - uninstall(void) throw (std::exception); - /** * Start to create a backup by calling the storage, and also * adding a backup of the schedule. @@ -257,7 +227,7 @@ class PostgresqlBackup : public Configurable, * @param criteria the criteria to use for backing up the storage * @param fromTime entries are included in the schedule export starting * from this time. - * @param toTime entries as included in the schedule export + * @param toTime entries as included in the schedule export * up to but not including this time. * @return a token, which can be used to query the backup process. * @exception XmlRpcException on XML-RPC issues. @@ -276,7 +246,7 @@ class PostgresqlBackup : public Configurable, * * @param token the identifier of this backup task. * @param url return parameter; - * if the status is "success", it contains the + * if the status is "success", it contains the * URL of the created backup file. * @param path return parameter; * if the status is "success", it contains the @@ -316,10 +286,10 @@ class PostgresqlBackup : public Configurable, * Restore a schedule backup. * * All playlist IDs contained in the backup should already be in the - * storage. If this is a combined backup, with both storage and + * storage. If this is a combined backup, with both storage and * schedule components, then restore this backup to the storage * first, and then call this function. - * + * * @param sessionId a valid session ID to identify the user. * @param path the location of the archive to upload. * @exception XmlRpcException if there is an error. diff --git a/campcaster/src/products/scheduler/src/PostgresqlBackupTest.cxx b/campcaster/src/products/scheduler/src/PostgresqlBackupTest.cxx index 9de89d20e..0f00fb505 100644 --- a/campcaster/src/products/scheduler/src/PostgresqlBackupTest.cxx +++ b/campcaster/src/products/scheduler/src/PostgresqlBackupTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -83,21 +83,20 @@ PostgresqlBackupTest :: setUp(void) throw (CPPUNIT_NS::Exception) Ptr::Ref connectionManager; Ptr::Ref storage; Ptr::Ref schedule; - + connectionManager = daemon->getConnectionManager(); storage = daemon->getStorage(); schedule = daemon->getSchedule(); - + backup.reset(new PostgresqlBackup(connectionManager, storage, schedule)); - backup->install(); } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { CPPUNIT_FAIL("error parsing configuration file"); } - + authentication = daemon->getAuthentication(); try { sessionId = authentication->login("root", "q"); @@ -118,10 +117,7 @@ PostgresqlBackupTest :: tearDown(void) throw (CPPUNIT_NS::Exception) CPPUNIT_ASSERT_NO_THROW( authentication->logout(sessionId); ); - CPPUNIT_ASSERT_NO_THROW( - backup->uninstall(); - ); - + remove(tempBackupTarFileName.c_str()); } @@ -159,11 +155,11 @@ PostgresqlBackupTest :: createBackup(void) || status == AsyncState::finishedState || status == AsyncState::failedState); } while (--iterations && status == AsyncState::pendingState); - + CPPUNIT_ASSERT_EQUAL(AsyncState::finishedState, status); CPPUNIT_ASSERT(url); CPPUNIT_ASSERT(path); - + // copy the backup file CPPUNIT_ASSERT_NO_THROW( remove(tempBackupTarFileName.c_str()); @@ -171,7 +167,7 @@ PostgresqlBackupTest :: createBackup(void) std::ofstream ofs(tempBackupTarFileName.c_str(), std::ios::binary); ofs << ifs.rdbuf(); ); - + CPPUNIT_ASSERT_NO_THROW( backup->createBackupClose(*token); ); @@ -188,7 +184,7 @@ PostgresqlBackupTest :: createBackupTest(void) CPPUNIT_ASSERT_NO_THROW( createBackup() ); - + bool exists; std::string schedulerBackupInTarball = "meta-inf/scheduler.xml"; CPPUNIT_ASSERT_NO_THROW( @@ -196,24 +192,24 @@ PostgresqlBackupTest :: createBackupTest(void) schedulerBackupInTarball) ); CPPUNIT_ASSERT(exists); - + std::string extractedTempFileName = "tmp/scheduler.tmp.xml"; FILE * file; - + remove(extractedTempFileName.c_str()); file = fopen(extractedTempFileName.c_str(), "r"); CPPUNIT_ASSERT(file == 0); - + CPPUNIT_ASSERT_NO_THROW( FileTools::extractFileFromTarball(tempBackupTarFileName, schedulerBackupInTarball, extractedTempFileName) ); - + file = fopen(extractedTempFileName.c_str(), "r"); CPPUNIT_ASSERT(file != 0); CPPUNIT_ASSERT(fclose(file) == 0); - + CPPUNIT_ASSERT(remove(extractedTempFileName.c_str()) == 0); file = fopen(extractedTempFileName.c_str(), "r"); CPPUNIT_ASSERT(file == 0); @@ -230,7 +226,7 @@ PostgresqlBackupTest :: restoreBackupTest(void) CPPUNIT_ASSERT_NO_THROW( createBackup() ); - + Ptr::Ref backupFile(new const Glib::ustring( tempBackupTarFileName)); CPPUNIT_ASSERT_NO_THROW( diff --git a/campcaster/src/products/scheduler/src/PostgresqlPlayLog.cxx b/campcaster/src/products/scheduler/src/PostgresqlPlayLog.cxx index 03a9ce393..76860f886 100644 --- a/campcaster/src/products/scheduler/src/PostgresqlPlayLog.cxx +++ b/campcaster/src/products/scheduler/src/PostgresqlPlayLog.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -68,25 +68,6 @@ const std::string PostgresqlPlayLog::check1Stmt = "SELECT 1"; const std::string PostgresqlPlayLog::logCountStmt = "SELECT COUNT(*) FROM playLog"; -/*------------------------------------------------------------------------------ - * The SQL create statement, used for installation. - *----------------------------------------------------------------------------*/ -const std::string PostgresqlPlayLog::createStmt = - "CREATE TABLE playLog\n" - "(\n" - " id BIGINT NOT NULL,\n" - " audioClipId BIGINT NOT NULL,\n" - " timestamp TIMESTAMP NOT NULL,\n" - "\n" - " PRIMARY KEY(id)\n" - ");"; - -/*------------------------------------------------------------------------------ - * The SQL create statement, used for installation. - *----------------------------------------------------------------------------*/ -const std::string PostgresqlPlayLog::dropStmt = - "DROP TABLE playLog;"; - /*------------------------------------------------------------------------------ * The SQL statement for adding a play log entry. * It's a simple insert. @@ -131,97 +112,6 @@ PostgresqlPlayLog :: configure(const xmlpp::Element & element) } -/*------------------------------------------------------------------------------ - * Install the PostgresqlPlayLog. - *----------------------------------------------------------------------------*/ -void -PostgresqlPlayLog :: install(void) throw (std::exception) -{ - if (!isInstalled()) { - Ptr::Ref conn; - try { - conn = cm->getConnection(); - Ptr::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::Ref conn; - try { - Ptr::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::Ref conn; - try { - conn = cm->getConnection(); - Ptr::Ref stmt(conn->createStatement()); - stmt->execute(dropStmt); - cm->returnConnection(conn); - } catch (std::exception &e) { - if (conn) { - cm->returnConnection(conn); - } - throw std::logic_error(e.what()); - } -} - - /*------------------------------------------------------------------------------ * Add a new play log entry *----------------------------------------------------------------------------*/ @@ -244,7 +134,7 @@ PostgresqlPlayLog :: addPlayLogEntry( pstmt->setLong(1, id->getId()); pstmt->setLong(2, audioClipId->getId()); - + timestamp = Conversion::ptimeToTimestamp(clipTimestamp); pstmt->setTimestamp(3, *timestamp); @@ -295,7 +185,7 @@ PostgresqlPlayLog :: getPlayLogEntries( Ptr::Ref audioClipId(new UniqueId(rs->getLong(2))); *timestamp = rs->getTimestamp(3); - Ptr::Ref clipTimestamp + Ptr::Ref clipTimestamp = Conversion::timestampToPtime(timestamp); Ptr::Ref entry(new PlayLogEntry(id, diff --git a/campcaster/src/products/scheduler/src/PostgresqlPlayLog.h b/campcaster/src/products/scheduler/src/PostgresqlPlayLog.h index 0639112f2..43f601597 100644 --- a/campcaster/src/products/scheduler/src/PostgresqlPlayLog.h +++ b/campcaster/src/products/scheduler/src/PostgresqlPlayLog.h @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -102,16 +102,6 @@ class PostgresqlPlayLog : public Configurable, */ static const std::string logCountStmt; - /** - * The SQL create statement used in the installation step. - */ - static const std::string createStmt; - - /** - * The SQL drop statement used in the uninstallation step. - */ - static const std::string dropStmt; - /** * The SQL statement for adding a play log entry. */ @@ -160,7 +150,7 @@ class PostgresqlPlayLog : public Configurable, /** * Return the name of the XML element this object expects * to be sent to a call to configure(). - * + * * @return the name of the expected XML configuration element. */ static const std::string @@ -185,36 +175,6 @@ class PostgresqlPlayLog : public Configurable, throw (std::invalid_argument, std::logic_error); - /** - * Install the component. - * This step involves creating the environment in which the component - * will run. This may be creation of coniguration files, - * database tables, etc. - * - * @exception std::exception on installation problems. - */ - virtual void - install(void) throw (std::exception); - - /** - * Check to see if the component has already been installed. - * - * @return true if the component is properly installed, - * false otherwise - * @exception std::exception on generic problems - */ - virtual bool - isInstalled(void) throw (std::exception); - - /** - * Uninstall the component. - * Removes all the resources created in the install step. - * - * @exception std::exception on unistallation problems. - */ - virtual void - uninstall(void) throw (std::exception); - /** * Add a new entry to the play log. * diff --git a/campcaster/src/products/scheduler/src/PostgresqlPlayLogTest.cxx b/campcaster/src/products/scheduler/src/PostgresqlPlayLogTest.cxx index 4a8bfc1e4..823609f62 100644 --- a/campcaster/src/products/scheduler/src/PostgresqlPlayLogTest.cxx +++ b/campcaster/src/products/scheduler/src/PostgresqlPlayLogTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -75,9 +75,8 @@ PostgresqlPlayLogTest :: setUp(void) throw (CPPUNIT_NS::Exception) Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { cm = scheduler->getConnectionManager(); - + playLog.reset(new PostgresqlPlayLog(cm)); - playLog->install(); } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -92,13 +91,6 @@ PostgresqlPlayLogTest :: setUp(void) throw (CPPUNIT_NS::Exception) void PostgresqlPlayLogTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { - try { - playLog->uninstall(); - } catch (std::exception &e) { - std::string eMsg = "cannot uninstall playlog:\n"; - eMsg += e.what(); - CPPUNIT_FAIL(eMsg); - } playLog.reset(); cm.reset(); } diff --git a/campcaster/src/products/scheduler/src/PostgresqlSchedule.cxx b/campcaster/src/products/scheduler/src/PostgresqlSchedule.cxx index 71b8a742f..3a7aa91c2 100644 --- a/campcaster/src/products/scheduler/src/PostgresqlSchedule.cxx +++ b/campcaster/src/products/scheduler/src/PostgresqlSchedule.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -90,26 +90,6 @@ const std::string PostgresqlSchedule::check1Stmt = "SELECT 1"; const std::string PostgresqlSchedule::scheduleCountStmt = "SELECT COUNT(*) FROM schedule"; -/*------------------------------------------------------------------------------ - * The SQL create statement, used for installation. - *----------------------------------------------------------------------------*/ -const std::string PostgresqlSchedule::createStmt = - "CREATE TABLE schedule\n" - "(\n" - " id BIGINT NOT NULL,\n" - " playlist BIGINT NOT NULL,\n" - " starts TIMESTAMP NOT NULL,\n" - " ends TIMESTAMP NOT NULL,\n" - "\n" - " PRIMARY KEY(id)\n" - ");"; - -/*------------------------------------------------------------------------------ - * The SQL create statement, used for installation. - *----------------------------------------------------------------------------*/ -const std::string PostgresqlSchedule::dropStmt = - "DROP TABLE schedule;"; - /*------------------------------------------------------------------------------ * The SQL statement for querying if a timeframe is available. * The parameters for this call are: starts, starts, ends, ends, starts, ends, @@ -215,97 +195,6 @@ PostgresqlSchedule :: configure(const xmlpp::Element & element) } -/*------------------------------------------------------------------------------ - * Install the PostgresqlSchedule. - *----------------------------------------------------------------------------*/ -void -PostgresqlSchedule :: install(void) throw (std::exception) -{ - if (!isInstalled()) { - Ptr::Ref conn; - try { - conn = cm->getConnection(); - Ptr::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::Ref conn; - try { - Ptr::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::Ref conn; - try { - conn = cm->getConnection(); - Ptr::Ref stmt(conn->createStatement()); - stmt->execute(dropStmt); - cm->returnConnection(conn); - } catch (std::exception &e) { - if (conn) { - cm->returnConnection(conn); - } - throw; - } -} - - /*------------------------------------------------------------------------------ * Check if a timeframe is available. *----------------------------------------------------------------------------*/ @@ -369,8 +258,8 @@ PostgresqlSchedule :: schedulePlaylist( id = UniqueId::generateId(); pstmt->setLong(1, id->getId()); pstmt->setLong(2, playlist->getId()->getId()); - - timestamp = Conversion::ptimeToTimestamp(playtime, + + timestamp = Conversion::ptimeToTimestamp(playtime, Conversion::roundNearest); pstmt->setTimestamp(3, *timestamp); @@ -417,7 +306,7 @@ PostgresqlSchedule :: storeScheduleEntry( pstmt->setLong(1, scheduleEntry->getId()->getId()); pstmt->setLong(2, scheduleEntry->getPlaylistId()->getId()); - + timestamp = Conversion::ptimeToTimestamp(scheduleEntry->getStartTime(), Conversion::roundDown); pstmt->setTimestamp(3, *timestamp); diff --git a/campcaster/src/products/scheduler/src/PostgresqlSchedule.h b/campcaster/src/products/scheduler/src/PostgresqlSchedule.h index 54dcbc480..40ebf5147 100644 --- a/campcaster/src/products/scheduler/src/PostgresqlSchedule.h +++ b/campcaster/src/products/scheduler/src/PostgresqlSchedule.h @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -117,16 +117,6 @@ class PostgresqlSchedule : public Configurable, */ static const std::string scheduleCountStmt; - /** - * The SQL create statement used in the installation step. - */ - static const std::string createStmt; - - /** - * The SQL drop statement used in the uninstallation step. - */ - static const std::string dropStmt; - /** * The SQL statement for querying if a time frame is available. */ @@ -212,7 +202,7 @@ class PostgresqlSchedule : public Configurable, /** * Return the name of the XML element this object expects * to be sent to a call to configure(). - * + * * @return the name of the expected XML configuration element. */ static const std::string @@ -237,36 +227,6 @@ class PostgresqlSchedule : public Configurable, throw (std::invalid_argument, std::logic_error); - /** - * Install the component. - * This step involves creating the environment in which the component - * will run. This may be creation of coniguration files, - * database tables, etc. - * - * @exception std::exception on installation problems. - */ - virtual void - install(void) throw (std::exception); - - /** - * Check to see if the component has already been installed. - * - * @return true if the component is properly installed, - * false otherwise - * @exception std::exception on generic problems - */ - virtual bool - isInstalled(void) throw (std::exception); - - /** - * Uninstall the component. - * Removes all the resources created in the install step. - * - * @exception std::exception on unistallation problems. - */ - virtual void - uninstall(void) throw (std::exception); - /** * Check if a timeframe is available for scheduling. * diff --git a/campcaster/src/products/scheduler/src/PostgresqlScheduleTest.cxx b/campcaster/src/products/scheduler/src/PostgresqlScheduleTest.cxx index 596fc5b78..da883682b 100644 --- a/campcaster/src/products/scheduler/src/PostgresqlScheduleTest.cxx +++ b/campcaster/src/products/scheduler/src/PostgresqlScheduleTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -77,9 +77,8 @@ PostgresqlScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception) Ptr::Ref scheduler = SchedulerDaemon::getInstance(); try { cm = scheduler->getConnectionManager(); - + schedule.reset(new PostgresqlSchedule(cm)); - schedule->install(); } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); @@ -95,7 +94,6 @@ PostgresqlScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception) void PostgresqlScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { - schedule->uninstall(); schedule.reset(); cm.reset(); } diff --git a/campcaster/src/products/scheduler/src/RemoveFromScheduleMethodTest.cxx b/campcaster/src/products/scheduler/src/RemoveFromScheduleMethodTest.cxx index c9e91ac9d..4a751c8b1 100644 --- a/campcaster/src/products/scheduler/src/RemoveFromScheduleMethodTest.cxx +++ b/campcaster/src/products/scheduler/src/RemoveFromScheduleMethodTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -87,7 +87,6 @@ RemoveFromScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) storage->reset(); schedule = scheduler->getSchedule(); - schedule->install(); } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); @@ -96,7 +95,7 @@ RemoveFromScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) } catch (std::exception &e) { CPPUNIT_FAIL(e.what()); } - + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); @@ -114,8 +113,6 @@ RemoveFromScheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) void RemoveFromScheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { - schedule->uninstall(); - authentication->logout(sessionId); sessionId.reset(); authentication.reset(); @@ -162,7 +159,7 @@ RemoveFromScheduleMethodTest :: firstTest(void) CPPUNIT_FAIL(eMsg.str()); } CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); - CPPUNIT_ASSERT(result["scheduleEntryId"].getType() + CPPUNIT_ASSERT(result["scheduleEntryId"].getType() == XmlRpc::XmlRpcValue::TypeString); entryId.reset(new UniqueId(std::string(result["scheduleEntryId"]))); @@ -251,7 +248,7 @@ RemoveFromScheduleMethodTest :: currentlyPlayingTest(void) CPPUNIT_FAIL(eMsg.str()); } CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); - CPPUNIT_ASSERT(result["scheduleEntryId"].getType() + CPPUNIT_ASSERT(result["scheduleEntryId"].getType() == XmlRpc::XmlRpcValue::TypeString); entryId.reset(new UniqueId(std::string(result["scheduleEntryId"]))); diff --git a/campcaster/src/products/scheduler/src/RescheduleMethodTest.cxx b/campcaster/src/products/scheduler/src/RescheduleMethodTest.cxx index bf0ebd566..7373d5400 100644 --- a/campcaster/src/products/scheduler/src/RescheduleMethodTest.cxx +++ b/campcaster/src/products/scheduler/src/RescheduleMethodTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -85,7 +85,6 @@ RescheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) storage->reset(); schedule = scheduler->getSchedule(); - schedule->install(); } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); @@ -94,7 +93,7 @@ RescheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) } catch (std::exception &e) { CPPUNIT_FAIL(e.what()); } - + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); @@ -112,8 +111,6 @@ RescheduleMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) void RescheduleMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { - schedule->uninstall(); - authentication->logout(sessionId); sessionId.reset(); authentication.reset(); @@ -158,7 +155,7 @@ RescheduleMethodTest :: firstTest(void) CPPUNIT_FAIL(eMsg.str()); } CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); - CPPUNIT_ASSERT(result["scheduleEntryId"].getType() + CPPUNIT_ASSERT(result["scheduleEntryId"].getType() == XmlRpc::XmlRpcValue::TypeString); entryId.reset(new UniqueId(std::string(result["scheduleEntryId"]))); @@ -246,7 +243,7 @@ RescheduleMethodTest :: currentlyPlayingTest(void) CPPUNIT_FAIL(eMsg.str()); } CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); - CPPUNIT_ASSERT(result["scheduleEntryId"].getType() + CPPUNIT_ASSERT(result["scheduleEntryId"].getType() == XmlRpc::XmlRpcValue::TypeString); entryId.reset(new UniqueId(std::string(result["scheduleEntryId"]))); diff --git a/campcaster/src/products/scheduler/src/RpcBackupTest.cxx b/campcaster/src/products/scheduler/src/RpcBackupTest.cxx index d5187c041..6547aa006 100644 --- a/campcaster/src/products/scheduler/src/RpcBackupTest.cxx +++ b/campcaster/src/products/scheduler/src/RpcBackupTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -97,8 +97,6 @@ RpcBackupTest :: setUp(void) throw (CPPUNIT_NS::Exception) } } - daemon->install(); - XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -129,10 +127,8 @@ void RpcBackupTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->uninstall(); - CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -146,7 +142,7 @@ RpcBackupTest :: tearDown(void) throw (CPPUNIT_NS::Exception) CPPUNIT_ASSERT(!xmlRpcClient.isFault()); xmlRpcClient.close(); - + remove(tempBackupTarFileName.c_str()); } @@ -159,7 +155,7 @@ RpcBackupTest :: createBackup(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -172,13 +168,13 @@ RpcBackupTest :: createBackup(void) criteria->setLimit(10); Ptr::Ref from(new ptime(time_from_string("2004-07-23 10:00:00"))); Ptr::Ref to(new ptime(time_from_string("2004-07-23 11:00:00"))); - + XmlRpcTools::sessionIdToXmlRpcValue(sessionId, parameters); XmlRpcTools::searchCriteriaToXmlRpcValue(criteria, parameters); XmlRpcTools::fromTimeToXmlRpcValue(from, parameters); XmlRpcTools::toTimeToXmlRpcValue(to, parameters); - - CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupOpen", + + CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupOpen", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); @@ -196,11 +192,11 @@ RpcBackupTest :: createBackup(void) std::cerr << "-/|\\"[iterations%4] << '\b'; sleep(1); result.clear(); - CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupCheck", + CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupCheck", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); - + CPPUNIT_ASSERT_NO_THROW( status = XmlRpcTools::extractBackupStatus(result); ); @@ -208,21 +204,21 @@ RpcBackupTest :: createBackup(void) || status == AsyncState::finishedState || status == AsyncState::failedState); } while (--iterations && status == AsyncState::pendingState); - + CPPUNIT_ASSERT_EQUAL(AsyncState::finishedState, status); // TODO: test accessibility of the URL? - + Ptr::Ref url; Ptr::Ref path; Ptr::Ref errorMessage; - + CPPUNIT_ASSERT_NO_THROW( url = XmlRpcTools::extractUrl(result); ); CPPUNIT_ASSERT_NO_THROW( path = XmlRpcTools::extractPath(result); ); - + // copy the backup file CPPUNIT_ASSERT_NO_THROW( remove(tempBackupTarFileName.c_str()); @@ -230,15 +226,15 @@ RpcBackupTest :: createBackup(void) std::ofstream ofs(tempBackupTarFileName.c_str(), std::ios::binary); ofs << ifs.rdbuf(); ); - + parameters.clear(); XmlRpcTools::tokenToXmlRpcValue(token, parameters); - result.clear(); - CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupClose", + result.clear(); + CPPUNIT_ASSERT(xmlRpcClient.execute("createBackupClose", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); - + xmlRpcClient.close(); } @@ -254,7 +250,7 @@ RpcBackupTest :: createBackupTest(void) CPPUNIT_ASSERT_NO_THROW( createBackup() ); - + // Check the backup file. bool exists; std::string schedulerBackupInTarball = "meta-inf/scheduler.xml"; @@ -263,24 +259,24 @@ RpcBackupTest :: createBackupTest(void) schedulerBackupInTarball) ); CPPUNIT_ASSERT(exists); - + std::string extractedTempFileName = "tmp/scheduler.tmp.xml"; FILE * file; - + remove(extractedTempFileName.c_str()); file = fopen(extractedTempFileName.c_str(), "r"); CPPUNIT_ASSERT(file == 0); - + CPPUNIT_ASSERT_NO_THROW( FileTools::extractFileFromTarball(tempBackupTarFileName, schedulerBackupInTarball, extractedTempFileName) ); - + file = fopen(extractedTempFileName.c_str(), "r"); CPPUNIT_ASSERT(file != 0); CPPUNIT_ASSERT(fclose(file) == 0); - + CPPUNIT_ASSERT(remove(extractedTempFileName.c_str()) == 0); file = fopen(extractedTempFileName.c_str(), "r"); CPPUNIT_ASSERT(file == 0); @@ -298,7 +294,7 @@ RpcBackupTest :: restoreBackupTest(void) CPPUNIT_ASSERT_NO_THROW( createBackup() ); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -306,19 +302,19 @@ RpcBackupTest :: restoreBackupTest(void) getXmlRpcPort(), "/RPC2", false); - + CPPUNIT_ASSERT(sessionId); Ptr::Ref path(new const Glib::ustring( tempBackupTarFileName)); - + XmlRpcTools::sessionIdToXmlRpcValue(sessionId, parameters); XmlRpcTools::pathToXmlRpcValue(path, parameters); - - CPPUNIT_ASSERT(xmlRpcClient.execute("restoreBackup", + + CPPUNIT_ASSERT(xmlRpcClient.execute("restoreBackup", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); - + xmlRpcClient.close(); // TODO: try this with a non-empty backup file, too } diff --git a/campcaster/src/products/scheduler/src/RpcDisplayScheduleTest.cxx b/campcaster/src/products/scheduler/src/RpcDisplayScheduleTest.cxx index 0e732c7ae..ad8010e19 100644 --- a/campcaster/src/products/scheduler/src/RpcDisplayScheduleTest.cxx +++ b/campcaster/src/products/scheduler/src/RpcDisplayScheduleTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -87,8 +87,6 @@ RpcDisplayScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception) } } - daemon->install(); - XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -119,10 +117,9 @@ void RpcDisplayScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->uninstall(); - + CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -147,7 +144,7 @@ RpcDisplayScheduleTest :: simpleTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpcValue parameters; XmlRpcValue result; struct tm time; @@ -192,7 +189,7 @@ RpcDisplayScheduleTest :: faultTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpcValue parameters; XmlRpcValue result; diff --git a/campcaster/src/products/scheduler/src/RpcGeneratePlayReportTest.cxx b/campcaster/src/products/scheduler/src/RpcGeneratePlayReportTest.cxx index 1996f65d4..9c8638009 100644 --- a/campcaster/src/products/scheduler/src/RpcGeneratePlayReportTest.cxx +++ b/campcaster/src/products/scheduler/src/RpcGeneratePlayReportTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -85,7 +85,6 @@ RpcGeneratePlayReportTest :: setUp(void) throw (CPPUNIT_NS::Exception) } } - daemon->install(); insertEntries(); XmlRpc::XmlRpcValue parameters; @@ -118,10 +117,9 @@ void RpcGeneratePlayReportTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->uninstall(); - + CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -171,7 +169,7 @@ RpcGeneratePlayReportTest :: firstTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; struct tm time; @@ -198,7 +196,7 @@ RpcGeneratePlayReportTest :: firstTest(void) time.tm_sec = 1; parameters["to"] = &time; - CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport", + CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(result.size() == 0); @@ -215,7 +213,7 @@ RpcGeneratePlayReportTest :: intervalTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; struct tm time; @@ -242,20 +240,20 @@ RpcGeneratePlayReportTest :: intervalTest(void) time.tm_sec = 0; parameters["to"] = &time; - CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport", + CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); // check the returned values CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result[0].hasMember("audioClipId")); - CPPUNIT_ASSERT(result[0]["audioClipId"].getType() + CPPUNIT_ASSERT(result[0]["audioClipId"].getType() == XmlRpc::XmlRpcValue::TypeString); UniqueId newAudioClipId = UniqueId(std::string(result[0]["audioClipId"])); CPPUNIT_ASSERT(newAudioClipId.getId() == 10001); CPPUNIT_ASSERT(result[0].hasMember("timestamp")); - CPPUNIT_ASSERT(result[0]["timestamp"].getType() + CPPUNIT_ASSERT(result[0]["timestamp"].getType() == XmlRpc::XmlRpcValue::TypeDateTime); time = result[0]["timestamp"]; CPPUNIT_ASSERT(time.tm_year == 104); // 2004 @@ -284,20 +282,20 @@ RpcGeneratePlayReportTest :: intervalTest(void) parameters["to"] = &time; result.clear(); - CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport", + CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); // check the returned values CPPUNIT_ASSERT(result.size() == 1); CPPUNIT_ASSERT(result[0].hasMember("audioClipId")); - CPPUNIT_ASSERT(result[0]["audioClipId"].getType() + CPPUNIT_ASSERT(result[0]["audioClipId"].getType() == XmlRpc::XmlRpcValue::TypeString); newAudioClipId = UniqueId(std::string(result[0]["audioClipId"])); CPPUNIT_ASSERT(newAudioClipId.getId() == 10001); CPPUNIT_ASSERT(result[0].hasMember("timestamp")); - CPPUNIT_ASSERT(result[0]["timestamp"].getType() + CPPUNIT_ASSERT(result[0]["timestamp"].getType() == XmlRpc::XmlRpcValue::TypeDateTime); time = result[0]["timestamp"]; CPPUNIT_ASSERT(time.tm_year == 104); // 2004 @@ -326,20 +324,20 @@ RpcGeneratePlayReportTest :: intervalTest(void) parameters["to"] = &time; result.clear(); - CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport", + CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); // check the returned values CPPUNIT_ASSERT(result.size() == 2); CPPUNIT_ASSERT(result[0].hasMember("audioClipId")); - CPPUNIT_ASSERT(result[0]["audioClipId"].getType() + CPPUNIT_ASSERT(result[0]["audioClipId"].getType() == XmlRpc::XmlRpcValue::TypeString); newAudioClipId = UniqueId(std::string(result[0]["audioClipId"])); CPPUNIT_ASSERT(newAudioClipId.getId() == 10017); CPPUNIT_ASSERT(result[0].hasMember("timestamp")); - CPPUNIT_ASSERT(result[0]["timestamp"].getType() + CPPUNIT_ASSERT(result[0]["timestamp"].getType() == XmlRpc::XmlRpcValue::TypeDateTime); time = result[0]["timestamp"]; CPPUNIT_ASSERT(time.tm_year == 104); // 2004 @@ -350,13 +348,13 @@ RpcGeneratePlayReportTest :: intervalTest(void) CPPUNIT_ASSERT(time.tm_sec == 0); CPPUNIT_ASSERT(result[1].hasMember("audioClipId")); - CPPUNIT_ASSERT(result[1]["audioClipId"].getType() + CPPUNIT_ASSERT(result[1]["audioClipId"].getType() == XmlRpc::XmlRpcValue::TypeString); newAudioClipId = UniqueId(std::string(result[1]["audioClipId"])); CPPUNIT_ASSERT(newAudioClipId.getId() == 10003); CPPUNIT_ASSERT(result[1].hasMember("timestamp")); - CPPUNIT_ASSERT(result[1]["timestamp"].getType() + CPPUNIT_ASSERT(result[1]["timestamp"].getType() == XmlRpc::XmlRpcValue::TypeDateTime); time = result[1]["timestamp"]; CPPUNIT_ASSERT(time.tm_year == 104); // 2004 @@ -385,7 +383,7 @@ RpcGeneratePlayReportTest :: intervalTest(void) parameters["to"] = &time; result.clear(); - CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport", + CPPUNIT_ASSERT(xmlRpcClient.execute("generatePlayReport", parameters, result)); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); diff --git a/campcaster/src/products/scheduler/src/RpcGetSchedulerTimeTest.cxx b/campcaster/src/products/scheduler/src/RpcGetSchedulerTimeTest.cxx index 263232633..52de66ecf 100644 --- a/campcaster/src/products/scheduler/src/RpcGetSchedulerTimeTest.cxx +++ b/campcaster/src/products/scheduler/src/RpcGetSchedulerTimeTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -83,7 +83,6 @@ RpcGetSchedulerTimeTest :: setUp(void) throw (CPPUNIT_NS::Exception) } } - daemon->install(); } @@ -94,7 +93,6 @@ void RpcGetSchedulerTimeTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->uninstall(); } @@ -129,7 +127,7 @@ RpcGetSchedulerTimeTest :: simpleTest(void) CPPUNIT_ASSERT(time1.tm_year == time2.tm_year); // could fail on New Year's Eve, but we don't work on New Year's Eve - + CPPUNIT_ASSERT(time1.tm_hour <= time2.tm_hour); CPPUNIT_ASSERT(time1.tm_min <= time2.tm_min); CPPUNIT_ASSERT(time1.tm_min + 1 >= time2.tm_min); diff --git a/campcaster/src/products/scheduler/src/RpcGetVersionTest.cxx b/campcaster/src/products/scheduler/src/RpcGetVersionTest.cxx index a7dcd0714..eb813d0af 100644 --- a/campcaster/src/products/scheduler/src/RpcGetVersionTest.cxx +++ b/campcaster/src/products/scheduler/src/RpcGetVersionTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -66,7 +66,6 @@ void RpcGetVersionTest :: setUp(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->install(); } @@ -77,7 +76,6 @@ void RpcGetVersionTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->uninstall(); } diff --git a/campcaster/src/products/scheduler/src/RpcRemoveFromScheduleTest.cxx b/campcaster/src/products/scheduler/src/RpcRemoveFromScheduleTest.cxx index d96a21578..e96bf77d0 100644 --- a/campcaster/src/products/scheduler/src/RpcRemoveFromScheduleTest.cxx +++ b/campcaster/src/products/scheduler/src/RpcRemoveFromScheduleTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -63,7 +63,6 @@ void RpcRemoveFromScheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->install(); XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -95,10 +94,9 @@ void RpcRemoveFromScheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->uninstall(); - + CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -123,7 +121,7 @@ RpcRemoveFromScheduleTest :: simpleTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpcValue parameters; XmlRpcValue result; struct tm time; @@ -148,7 +146,7 @@ RpcRemoveFromScheduleTest :: simpleTest(void) xmlRpcClient.execute("uploadPlaylist", parameters, result); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); - CPPUNIT_ASSERT(result["scheduleEntryId"].getType() + CPPUNIT_ASSERT(result["scheduleEntryId"].getType() == XmlRpcValue::TypeString); Ptr::Ref entryId(new UniqueId(std::string( result["scheduleEntryId"] ))); @@ -170,7 +168,7 @@ RpcRemoveFromScheduleTest :: negativeTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpcValue parameters; XmlRpcValue result; @@ -198,7 +196,7 @@ RpcRemoveFromScheduleTest :: currentlyPlayingTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpcValue parameters; XmlRpcValue result; Ptr::Ref now; @@ -223,7 +221,7 @@ RpcRemoveFromScheduleTest :: currentlyPlayingTest(void) xmlRpcClient.execute("uploadPlaylist", parameters, result); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); - CPPUNIT_ASSERT(result["scheduleEntryId"].getType() + CPPUNIT_ASSERT(result["scheduleEntryId"].getType() == XmlRpcValue::TypeString); entryId.reset(new UniqueId(std::string(result["scheduleEntryId"] ))); diff --git a/campcaster/src/products/scheduler/src/RpcRescheduleTest.cxx b/campcaster/src/products/scheduler/src/RpcRescheduleTest.cxx index 453b49ae8..fcadd27d5 100644 --- a/campcaster/src/products/scheduler/src/RpcRescheduleTest.cxx +++ b/campcaster/src/products/scheduler/src/RpcRescheduleTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -84,8 +84,6 @@ RpcRescheduleTest :: setUp(void) throw (CPPUNIT_NS::Exception) } } - daemon->install(); - XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -116,10 +114,9 @@ void RpcRescheduleTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->uninstall(); - + CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -144,7 +141,7 @@ RpcRescheduleTest :: simpleTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; struct tm time; @@ -169,7 +166,7 @@ RpcRescheduleTest :: simpleTest(void) xmlRpcClient.execute("uploadPlaylist", parameters, result); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); - CPPUNIT_ASSERT(result["scheduleEntryId"].getType() + CPPUNIT_ASSERT(result["scheduleEntryId"].getType() == XmlRpcValue::TypeString); Ptr::Ref entryId(new UniqueId(std::string( result["scheduleEntryId"] ))); @@ -216,7 +213,7 @@ RpcRescheduleTest :: negativeTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -244,7 +241,7 @@ RpcRescheduleTest :: currentlyPlayingTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; Ptr::Ref now; @@ -269,7 +266,7 @@ RpcRescheduleTest :: currentlyPlayingTest(void) xmlRpcClient.execute("uploadPlaylist", parameters, result); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); CPPUNIT_ASSERT(result.hasMember("scheduleEntryId")); - CPPUNIT_ASSERT(result["scheduleEntryId"].getType() + CPPUNIT_ASSERT(result["scheduleEntryId"].getType() == XmlRpcValue::TypeString); entryId.reset(new UniqueId(std::string(result["scheduleEntryId"] ))); diff --git a/campcaster/src/products/scheduler/src/RpcStopCurrentlyPlayingTest.cxx b/campcaster/src/products/scheduler/src/RpcStopCurrentlyPlayingTest.cxx index b8b0443cb..f4d1c5b20 100644 --- a/campcaster/src/products/scheduler/src/RpcStopCurrentlyPlayingTest.cxx +++ b/campcaster/src/products/scheduler/src/RpcStopCurrentlyPlayingTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author: fgerlits $ Version : $Revision$ Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/branches/scheduler_export/livesupport/src/products/scheduler/src/RpcStopCurrentlyPlayingTest.cxx $ @@ -84,8 +84,6 @@ RpcStopCurrentlyPlayingTest :: setUp(void) throw (CPPUNIT_NS::Exception) } } - daemon->install(); - XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -104,7 +102,7 @@ RpcStopCurrentlyPlayingTest :: setUp(void) throw (CPPUNIT_NS::Exception) CPPUNIT_ASSERT(result.hasMember("sessionId")); xmlRpcClient.close(); - + sessionId.reset(new SessionId(std::string(result["sessionId"]))); } @@ -116,10 +114,9 @@ void RpcStopCurrentlyPlayingTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->uninstall(); - + CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -144,16 +141,16 @@ RpcStopCurrentlyPlayingTest :: simpleTest(void) throw (CPPUNIT_NS::Exception) { schedulePlaylistToPlayNow(); - + Ptr::Ref daemon = SchedulerDaemon::getInstance(); CPPUNIT_ASSERT(daemon); Ptr::Ref audioPlayer = daemon->getAudioPlayer(); CPPUNIT_ASSERT(audioPlayer); - + sleep(10); CPPUNIT_ASSERT(audioPlayer->isOpen()); CPPUNIT_ASSERT(audioPlayer->isPlaying()); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -169,9 +166,9 @@ RpcStopCurrentlyPlayingTest :: simpleTest(void) result.clear(); xmlRpcClient.execute("stopCurrentlyPlaying", parameters, result); CPPUNIT_ASSERT(!xmlRpcClient.isFault()); - + xmlRpcClient.close(); - + CPPUNIT_ASSERT(!audioPlayer->isPlaying()); CPPUNIT_ASSERT(!audioPlayer->isOpen()); } @@ -185,7 +182,7 @@ RpcStopCurrentlyPlayingTest :: negativeTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; diff --git a/campcaster/src/products/scheduler/src/RpcUploadPlaylistTest.cxx b/campcaster/src/products/scheduler/src/RpcUploadPlaylistTest.cxx index a0bf04d8f..cae51bce0 100644 --- a/campcaster/src/products/scheduler/src/RpcUploadPlaylistTest.cxx +++ b/campcaster/src/products/scheduler/src/RpcUploadPlaylistTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -83,8 +83,6 @@ RpcUploadPlaylistTest :: setUp(void) throw (CPPUNIT_NS::Exception) } } - daemon->install(); - XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; @@ -115,8 +113,7 @@ void RpcUploadPlaylistTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref daemon = SchedulerDaemon::getInstance(); - daemon->uninstall(); - + CPPUNIT_ASSERT(sessionId); XmlRpc::XmlRpcValue parameters; @@ -143,7 +140,7 @@ RpcUploadPlaylistTest :: simpleTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; struct tm time; @@ -184,7 +181,7 @@ RpcUploadPlaylistTest :: postInitTest(void) throw (CPPUNIT_NS::Exception) { CPPUNIT_ASSERT(sessionId); - + XmlRpc::XmlRpcValue parameters; XmlRpc::XmlRpcValue result; struct tm time; diff --git a/campcaster/src/products/scheduler/src/ScheduleFactory.cxx b/campcaster/src/products/scheduler/src/ScheduleFactory.cxx index 5b287f264..54cd0df95 100644 --- a/campcaster/src/products/scheduler/src/ScheduleFactory.cxx +++ b/campcaster/src/products/scheduler/src/ScheduleFactory.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -113,46 +113,3 @@ ScheduleFactory :: configure(const xmlpp::Element & element) throw std::invalid_argument("no storage client factories to configure"); } } - - -/*------------------------------------------------------------------------------ - * Install the schedule factory. - *----------------------------------------------------------------------------*/ -void -ScheduleFactory :: install(void) throw (std::exception) -{ - if (!schedule) { - throw std::logic_error("ScheduleFactory not yet configured"); - } - - schedule->install(); -} - - -/*------------------------------------------------------------------------------ - * Check to see if the schedule factory has already been installed. - *----------------------------------------------------------------------------*/ -bool -ScheduleFactory :: isInstalled(void) throw (std::exception) -{ - if (!schedule) { - throw std::logic_error("ScheduleFactory not yet configured"); - } - - return schedule->isInstalled(); -} - - -/*------------------------------------------------------------------------------ - * Install the schedule factory. - *----------------------------------------------------------------------------*/ -void -ScheduleFactory :: uninstall(void) throw (std::exception) -{ - if (!schedule) { - throw std::logic_error("ScheduleFactory not yet configured"); - } - - schedule->uninstall(); -} - diff --git a/campcaster/src/products/scheduler/src/ScheduleFactory.h b/campcaster/src/products/scheduler/src/ScheduleFactory.h index 9bc253a2d..d1b1fa6ae 100644 --- a/campcaster/src/products/scheduler/src/ScheduleFactory.h +++ b/campcaster/src/products/scheduler/src/ScheduleFactory.h @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -43,7 +43,6 @@ #include #include "LiveSupport/Core/Configurable.h" -#include "LiveSupport/Core/Installable.h" #include "ScheduleInterface.h" @@ -89,8 +88,7 @@ using namespace LiveSupport::Core; * @version $Revision$ * @see PostgresqlSchedule */ -class ScheduleFactory : virtual public Configurable, - virtual public Installable +class ScheduleFactory : virtual public Configurable { private: /** @@ -128,7 +126,7 @@ class ScheduleFactory : virtual public Configurable, /** * Return the name of the XML element this object expects * to be sent to a call to configure(). - * + * * @return the name of the expected XML configuration element. */ static const std::string @@ -159,38 +157,6 @@ class ScheduleFactory : virtual public Configurable, throw (std::invalid_argument, std::logic_error); - /** - * Install the component. - * This step involves creating the environment in which the component - * will run. This may be creation of coniguration files, - * database tables, etc. - * - * @exception std::exception on installation problems, - * especially if the ScheduleFactory was not yet configured. - */ - virtual void - install(void) throw (std::exception); - - /** - * Check to see if the component has already been installed. - * - * @return true if the component is properly installed, - * false otherwise - * @exception std::exception on generic problems - */ - virtual bool - isInstalled(void) throw (std::exception); - - /** - * Uninstall the component. - * Removes all the resources created in the install step. - * - * @exception std::exception on unistallation problems, - e especially if the ScheduleFactory was not yet configured. - */ - virtual void - uninstall(void) throw (std::exception); - /** * Return a schedule. * diff --git a/campcaster/src/products/scheduler/src/ScheduleInterface.h b/campcaster/src/products/scheduler/src/ScheduleInterface.h index e9985ef3c..5f5ee644d 100644 --- a/campcaster/src/products/scheduler/src/ScheduleInterface.h +++ b/campcaster/src/products/scheduler/src/ScheduleInterface.h @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -44,7 +44,6 @@ #include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/Installable.h" #include "LiveSupport/Core/Playlist.h" #include "LiveSupport/Core/ScheduleEntry.h" @@ -72,7 +71,7 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class ScheduleInterface : virtual public Installable +class ScheduleInterface { public: /** diff --git a/campcaster/src/products/scheduler/src/SchedulerDaemon.cxx b/campcaster/src/products/scheduler/src/SchedulerDaemon.cxx index 20490264d..458541803 100644 --- a/campcaster/src/products/scheduler/src/SchedulerDaemon.cxx +++ b/campcaster/src/products/scheduler/src/SchedulerDaemon.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -275,7 +275,7 @@ SchedulerDaemon :: ~SchedulerDaemon(void) throw () } } - + /*------------------------------------------------------------------------------ * Register our XML-RPC methods *----------------------------------------------------------------------------*/ @@ -302,103 +302,12 @@ SchedulerDaemon :: registerXmlRpcFunctions( } -/*------------------------------------------------------------------------------ - * Install the scheduler daemon. - *----------------------------------------------------------------------------*/ -void -SchedulerDaemon :: install(void) throw (std::exception) -{ - if (!isInstalled()) { - // TODO: check if we have already been configured - Ptr::Ref sf = ScheduleFactory::getInstance(); - sf->install(); - Ptr::Ref plf = PlayLogFactory::getInstance(); - plf->install(); - Ptr::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::Ref sf = ScheduleFactory::getInstance(); - Ptr::Ref plf = PlayLogFactory::getInstance(); - Ptr::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::Ref bf = BackupFactory::getInstance(); - Ptr::Ref plf = PlayLogFactory::getInstance(); - Ptr::Ref sf = ScheduleFactory::getInstance(); - - if (!bf || !plf || !sf) { - throw std::logic_error("couldn't initialize factories"); - } - - bool isOK = true; - std::stringstream errorMessage("error uninstalling factories:\n"); - - try { - bf->uninstall(); - } catch (std::exception &e) { - isOK = false; - errorMessage << e.what() << std::endl; - } - - try { - plf->uninstall(); - } catch (std::exception &e) { - isOK = false; - errorMessage << e.what() << std::endl; - } - - try { - sf->uninstall(); - } catch (std::exception &e) { - isOK = false; - errorMessage << e.what() << std::endl; - } - - if (!isOK) { - throw std::logic_error(errorMessage.str()); - } -} - - /*------------------------------------------------------------------------------ * Execute daemon startup functions. *----------------------------------------------------------------------------*/ void SchedulerDaemon :: startup (void) throw (std::logic_error) { - try { - if (!isInstalled()) { - install(); - } - } catch (std::exception &e) { - throw std::logic_error(std::string("database installation problem: ") - + e.what()); - } - try { sessionId = authentication->login(login, password); } catch (XmlRpcException &e) { diff --git a/campcaster/src/products/scheduler/src/SchedulerDaemon.h b/campcaster/src/products/scheduler/src/SchedulerDaemon.h index dd8d06ea6..87d9764ef 100644 --- a/campcaster/src/products/scheduler/src/SchedulerDaemon.h +++ b/campcaster/src/products/scheduler/src/SchedulerDaemon.h @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -58,7 +58,6 @@ #include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/Installable.h" #include "LiveSupport/Core/Configurable.h" #include "LiveSupport/Core/SessionId.h" #include "LiveSupport/Db/ConnectionManagerInterface.h" @@ -171,22 +170,11 @@ using namespace LiveSupport::PlaylistExecutor; * @see ScheduleFactory * @see XmlRpcDaemon */ -class SchedulerDaemon : public Installable, - public Configurable, +class SchedulerDaemon : public Configurable, public XmlRpcDaemon { private: - /** - * The SQL create statement used in the installation step. - */ - static const std::string createStmt; - - /** - * The SQL drop statement used in the uninstallation step. - */ - static const std::string dropStmt; - /** * A SQL statement to check if the database can be accessed. */ @@ -447,36 +435,6 @@ class SchedulerDaemon : public Installable, return audioPlayer; } - /** - * Install the component. - * This step involves creating the environment in which the component - * will run. This may be creation of coniguration files, - * database tables, etc. - * - * @exception std::exception on installation problems. - */ - virtual void - install(void) throw (std::exception); - - /** - * Check to see if the component has already been installed. - * - * @return true if the component is properly installed, - * false otherwise - * @exception std::exception on generic problems - */ - virtual bool - isInstalled(void) throw (std::exception); - - /** - * Uninstall the component. - * Removes all the resources created in the install step. - * - * @exception std::exception on unistallation problems. - */ - virtual void - uninstall(void) throw (std::exception); - /** * Shut down the daemon. * This function is public only because the signal handler diff --git a/campcaster/src/products/scheduler/src/UploadPlaylistMethodTest.cxx b/campcaster/src/products/scheduler/src/UploadPlaylistMethodTest.cxx index 85929bd34..d0b0cdfbd 100644 --- a/campcaster/src/products/scheduler/src/UploadPlaylistMethodTest.cxx +++ b/campcaster/src/products/scheduler/src/UploadPlaylistMethodTest.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -84,7 +84,6 @@ UploadPlaylistMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) storage->reset(); schedule = scheduler->getSchedule(); - schedule->install(); } catch (XmlRpcException &e) { std::cerr << "caught XmlRpcException durng setUp" << std::endl @@ -96,7 +95,7 @@ UploadPlaylistMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) } catch (std::exception &e) { std::cerr << e.what() << std::endl; } - + authentication = scheduler->getAuthentication(); try { sessionId = authentication->login("root", "q"); @@ -113,8 +112,6 @@ UploadPlaylistMethodTest :: setUp(void) throw (CPPUNIT_NS::Exception) void UploadPlaylistMethodTest :: tearDown(void) throw (CPPUNIT_NS::Exception) { - schedule->uninstall(); - authentication->logout(sessionId); sessionId.reset(); authentication.reset(); @@ -145,7 +142,7 @@ UploadPlaylistMethodTest :: firstTest(void) time.tm_min = 31; time.tm_sec = 1; parameters["playtime"] = &time; - rootParameter[0] = parameters; + rootParameter[0] = parameters; result.clear(); try { @@ -184,7 +181,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void) time.tm_min = 0; time.tm_sec = 0; parameters["playtime"] = &time; - rootParameter[0] = parameters; + rootParameter[0] = parameters; result.clear(); try { @@ -208,7 +205,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void) time.tm_min = 30; time.tm_sec = 0; parameters["playtime"] = &time; - rootParameter[0] = parameters; + rootParameter[0] = parameters; result.clear(); try { @@ -228,7 +225,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void) time.tm_min = 30; time.tm_sec = 0; parameters["playtime"] = &time; - rootParameter[0] = parameters; + rootParameter[0] = parameters; result.clear(); try { @@ -251,7 +248,7 @@ UploadPlaylistMethodTest :: overlappingPlaylists(void) time.tm_min = 45; time.tm_sec = 0; parameters["playtime"] = &time; - rootParameter[0] = parameters; + rootParameter[0] = parameters; result.clear(); try { diff --git a/campcaster/src/products/scheduler/src/main.cxx b/campcaster/src/products/scheduler/src/main.cxx index 23706617a..c69259025 100644 --- a/campcaster/src/products/scheduler/src/main.cxx +++ b/campcaster/src/products/scheduler/src/main.cxx @@ -1,26 +1,26 @@ /*------------------------------------------------------------------------------ Copyright (c) 2004 Media Development Loan Fund - + This file is part of the Campcaster project. http://campcaster.campware.org/ To report bugs, send an e-mail to bugs@campware.org - + Campcaster is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + Campcaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Campcaster; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - + + Author : $Author$ Version : $Revision$ Location : $URL$ @@ -86,11 +86,6 @@ static const struct option longOptions[] = { { 0, 0, 0, 0 } }; -/** - * The start command: "install" - */ -static const std::string installCommand = "install"; - /** * The start command: "start" */ @@ -106,11 +101,6 @@ static const std::string statusCommand = "status"; */ static const std::string stopCommand = "stop"; -/** - * The stop command: "uninstall" - */ -static const std::string uninstallCommand = "uninstall"; - /* =============================================== local function prototypes */ @@ -183,7 +173,7 @@ int main ( int argc, Ptr::Ref daemon = SchedulerDaemon::getInstance(); try { - std::auto_ptr + std::auto_ptr parser(new xmlpp::DomParser(configFileName, true)); const xmlpp::Document * document = parser->get_document(); daemon->configure(*(document->get_root_node())); @@ -200,9 +190,7 @@ int main ( int argc, daemon->setBackground(!debugMode); try { - if (installCommand == argv[optind]) { - daemon->install(); - } else if (startCommand == argv[optind]) { + if (startCommand == argv[optind]) { daemon->start(); } else if (statusCommand == argv[optind]) { std::cout << "The Scheduler Daemon is " @@ -210,8 +198,6 @@ int main ( int argc, << "running" << std::endl; } else if (stopCommand == argv[optind]) { daemon->stop(); - } else if (uninstallCommand == argv[optind]) { - daemon->uninstall(); } else { printUsage(argv[0], std::cout); exit(EXIT_FAILURE); @@ -248,7 +234,7 @@ printUsage ( const char invocation[], << std::endl << "Usage: " << invocation << " [OPTION] COMMAND" << std::endl - << " COMMAND is one of: install, start, stop, status or uninstall" + << " COMMAND is one of: start, stop, or status" << std::endl << std::endl << " mandatory options:" << std::endl