]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php
Updated 'core'.
[hub.git] / application / hub / main / producer / cruncher / work_units / class_CruncherTestUnitProducer.php
index 638c4c569fc1093022b799625c25a6e9c32267fd..4014b5f79f9a369d59901b66c2531be13d9f4519 100644 (file)
@@ -2,11 +2,11 @@
 /**
  * A CruncherTestUnit producer class
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2011 - 2012 Cruncher Developer Team
+ * @copyright  Copyright (c) 2011 - 2014 Cruncher Developer Team
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.shipsimu.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
@@ -78,23 +78,12 @@ class CruncherTestUnitProducer extends BaseUnitProducer implements UnitProducer,
         * @return      void
         * @todo        ~60% done
         */
-       public function prepareUnitProduction (Stateable $stateInstance) {
+       public function initUnitProduction (Stateable $stateInstance) {
                // First get a database wrapper because we want to permanently store test units
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('cruncher_unit_db_wrapper_class');
-
-               // Now get a search instance
-               $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
-               // Add criteria for looking up already created and available test units
-               $searchInstance->addCriteria(CruncherUnitDatabaseWrapper::DB_COLUMN_UNIT_TYPE  , BaseUnitProducer::UNIT_TYPE_TEST_UNIT);
-               $searchInstance->addCriteria(CruncherUnitDatabaseWrapper::DB_COLUMN_UNIT_STATUS, BaseUnitProducer::UNIT_STATUS_AVAILABLE);
-               $searchInstance->setConfiguredLimit('cruncher_test_unit_max_count');
-
-               // Search for our units
-               $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance);
+               $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('cruncher_unit_db_wrapper_class');
 
                // Do we have some entries?
-               if ($resultInstance->next()) {
+               if ($wrapperInstance->isTestUnitProduced()) {
                        // Entries found
                        // @TODO Unfinished work here
                        $this->debugInstance();
@@ -115,6 +104,16 @@ class CruncherTestUnitProducer extends BaseUnitProducer implements UnitProducer,
                        $stateInstance->encryptedMessageGenerated();
                }
        }
+
+       /**
+        * Initializes the executor, whatever it does.
+        *
+        * @return      void
+        * @todo        Maybe unfinished
+        */
+       public function initExecutor (Stateable $stateInstance) {
+               $this->partialStub('Maybe implement this method?');
+       }
 }
 
 // [EOF]