]> git.mxchange.org Git - hub.git/commitdiff
Introduced a test-unit producer task (unfinished work)
authorRoland Häder <roland@mxchange.org>
Tue, 15 Mar 2011 22:06:41 +0000 (22:06 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 15 Mar 2011 22:06:41 +0000 (22:06 +0000)
.gitattributes
application/hub/config.php
application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php
application/hub/main/tasks/cruncher/class_CruncherTestUnitProducerTask.php [new file with mode: 0644]

index 1d40663b085abcdc2715d964ce48c19d63015db3..e6f5c57445a187b8a31435efdb74059ad3ae37f6 100644 (file)
@@ -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
index 64c34f7458bd01286ebd69bcc457b292b8439af6..8ae5ca096fb137a35bc7eeda00fb856b821d1647 100644 (file)
@@ -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');
 
index 15152b2e7eeedd127853ddce6919a041771bd147..9091574d6675c481ca02917b48c28a44b90aadfa 100644 (file)
@@ -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 (file)
index 0000000..f6dabce
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * A TestUnitProducer task for crunchers
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>