From: Roland Häder Date: Tue, 15 Mar 2011 22:06:41 +0000 (+0000) Subject: Introduced a test-unit producer task (unfinished work) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7a24172126f93445f8aec12e4299d7a5efaecf6f;p=hub.git Introduced a test-unit producer task (unfinished work) --- diff --git a/.gitattributes b/.gitattributes index 1d40663b0..e6f5c5744 100644 --- a/.gitattributes +++ b/.gitattributes @@ -406,6 +406,7 @@ application/hub/main/tasks/class_ -text svneol=unset#text/plain application/hub/main/tasks/class_BaseTask.php -text svneol=unset#text/plain application/hub/main/tasks/cruncher/.htaccess svneol=native#text/plain application/hub/main/tasks/cruncher/class_ -text +application/hub/main/tasks/cruncher/class_CruncherTestUnitProducerTask.php svneol=native#text/plain application/hub/main/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php svneol=native#text/plain application/hub/main/tasks/hub/.htaccess -text svneol=unset#text/plain application/hub/main/tasks/hub/announcement/.htaccess -text svneol=unset#text/plain diff --git a/application/hub/config.php b/application/hub/config.php index 64c34f745..8ae5ca096 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -396,6 +396,9 @@ $cfg->setConfigEntry('hub_package_writer_task_class', 'NetworkPackageWriterTask' // CFG: CRUNCHER-WORK-UNIT-FETCHER-TASK-CLASS $cfg->setConfigEntry('cruncher_work_unit_fetcher_task_class', 'CruncherWorkUnitFetcherTask'); +// CFG: CRUNCHER-TEST-UNIT-PRODUCER-TASK-CLASS +$cfg->setConfigEntry('cruncher_test_unit_producer_task_class', 'CruncherTestUnitProducerTask'); + // CFG: TASK-NETWORK-PACKAGE-WRITER-STARTUP-DELAY $cfg->setConfigEntry('task_network_package_writer_startup_delay', 2500); @@ -414,6 +417,15 @@ $cfg->setConfigEntry('task_cruncher_work_unit_fetcher_interval_delay', 10); // CFG: TASK-CRUNCHER-WORK-UNIT-FETCHER-MAX-RUNS $cfg->setConfigEntry('task_cruncher_work_unit_fetcher_max_runs', 0); +// CFG: TASK-CRUNCHER-TEST-UNIT-PRODUCER-STARTUP-DELAY +$cfg->setConfigEntry('task_cruncher_test_unit_producer_startup_delay', 500); + +// CFG: TASK-CRUNCHER-TEST-UNIT-PRODUCER-INTERVAL-DELAY +$cfg->setConfigEntry('task_cruncher_test_unit_producer_interval_delay', 1000*60*60); + +// CFG: TASK-CRUNCHER-TEST-UNIT-PRODUCER-MAX-RUNS +$cfg->setConfigEntry('task_cruncher_test_unit_producer_max_runs', 0); + // CFG: TASK-LIST-CLASS $cfg->setConfigEntry('task_list_class', 'TaskList'); diff --git a/application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php b/application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php index 15152b2e7..9091574d6 100644 --- a/application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php +++ b/application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php @@ -62,10 +62,18 @@ class CruncherTaskHandlerInitializerFilter extends BaseFilter implements Filtera $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); // Register all tasks: - // 1) A task for fetching WUs (work units) + // 1) A task for fetching WUs (work units) or test units $taskInstance = ObjectFactory::createObjectByConfiguredName('cruncher_work_unit_fetcher_task_class'); $handlerInstance->registerTask('cruncher_work_unit_fetcher', $taskInstance); + /* + * 2) A task for generating test units, a if() block could be placed + * around this but that would make this method look a little ugly and + * even more when more "temporary" tasks should be registered. + */ + $taskInstance = ObjectFactory::createObjectByConfiguredName('cruncher_test_unit_producer_task_class'); + $handlerInstance->registerTask('cruncher_test_unit_producer', $taskInstance); + // Put the task handler in registry Registry::getRegistry()->addInstance('task', $handlerInstance); } diff --git a/application/hub/main/tasks/cruncher/class_CruncherTestUnitProducerTask.php b/application/hub/main/tasks/cruncher/class_CruncherTestUnitProducerTask.php new file mode 100644 index 000000000..f6dabce6b --- /dev/null +++ b/application/hub/main/tasks/cruncher/class_CruncherTestUnitProducerTask.php @@ -0,0 +1,72 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * This program 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 this program. If not, see . + */ +class CruncherTestUnitProducerTask extends BaseTask implements Taskable, Visitable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $taskInstance An instance of a Visitable class + */ + public final static function createCruncherTestUnitProducerTask () { + // Get new instance + $taskInstance = new CruncherTestUnitProducerTask(); + + // Return the prepared instance + return $taskInstance; + } + + /** + * Accepts the visitor to process the visit "request" + * + * @param $visitorInstance An instance of a Visitor class + * @return void + * @todo Maybe visit some sub-objects + */ + public function accept (Visitor $visitorInstance) { + // Visit this task + $visitorInstance->visitTask($this); + } + + /** + * Executes the task + * + * @return void + * @todo 0% + */ + public function executeTask () { + $this->partialStub('Unimplemented task.'); + } +} + +// [EOF] +?>