*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @copyright Copyright (c) 2011 - 2012 Cruncher Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
$templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('cruncher_test_unit_producer_template_class');
// Load the template
- $templateInstance->loadCruncherTestUnitTemplate('test_unit');
+ $templateInstance->loadXmlTemplate();
// Render the XML content
$templateInstance->renderXmlContent();
}
/**
- * Produces some test units and pushes them onto the queue
+ * Prepares the produces of some test units and pushes them onto the queue
*
+ * @param $stateInstance An instance of a Stateable instance
* @return void
- * @todo ~30% done
+ * @todo ~60% done
*/
- public function produceUnits () {
+ public function prepareUnitProduction (Stateable $stateInstance) {
// First get a database wrapper because we want to permanently store test units
$wrapperInstance = ObjectFactory::createObjectByConfiguredName('cruncher_unit_db_wrapper_class');
// Entries found
// @TODO Unfinished work here
$this->debugInstance();
+
+ // The state must be changed because ...
+ $stateInstance->someFooStateChange();
} else {
// Get an encrypted, random message from our source
$encryptedMessage = $this->getHelperInstance()->generateRandomMessage();
// Debug message
- $this->debugOutput('PRODUCER: An encrypted, random message has been generated. Generating keys ...');
+ self::createDebugInstance(__CLASS__)->debugOutput('PRODUCER: An encrypted, random message has been generated. Generating keys ...');
// Set the encrypted message in the template instance
$this->getTemplateInstance()->assignVariable('encrypted_message', $encryptedMessage);
- /*
- * Now we need to create an iterator, just as for the work units,
- * to create new keys from the encrypted message. The iterator will
- * not iterate over an object nor a collection. It will instead
- * encapsulate the "key production" into a class and not in a simple
- * for() loop. These keys then needs to be bundled into test units
- * and stored to database for later re-usage.
- */
-
- // First get an iterator, again the helper will do that for us
- $iteratorInstance = $this->getHelperInstance()->getKeyIterator();
-
- // Begin the "key production"
- while ($iteratorInstance->valid()) {
- // Get current key (which is not the key of the iterator)
- $currentKey = $iteratorInstance->current();
-
- // @TODO Do something with it
- $this->debugOutput('currentKey=' . $currentKey . ' needs to be processed.');
-
- // Continue with next one
- $iteratorInstance->next();
- } // END - while
-
- die(__METHOD__.": Ended the key production.\n");
+ // The state must be changed because we have a new message
+ $stateInstance->encryptedMessageGenerated();
}
}
}