]> git.mxchange.org Git - hub.git/commitdiff
Generation of test units and keys continued:
authorRoland Häder <roland@mxchange.org>
Thu, 31 Mar 2011 01:34:25 +0000 (01:34 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 31 Mar 2011 01:34:25 +0000 (01:34 +0000)
- Database folder for crunher projects added
- Introduced two methods to MessageHelper
- Introduced an iterator for test unit producers to generate keys
- TODOs.txt updated

12 files changed:
.gitattributes
application/hub/config.php
application/hub/interfaces/helper/messages/class_MessageHelper.php
application/hub/interfaces/work_units/class_UnitHelper.php
application/hub/main/cruncher/mcrypt/class_HubMcryptCruncher.php
application/hub/main/helper/messages/crypto/class_CryptoRandomUnitMessageHelper.php
application/hub/main/helper/work_units/cruncher/class_CruncherTestUnitHelper.php
application/hub/main/iterator/producer/.htaccess [new file with mode: 0644]
application/hub/main/iterator/producer/class_TestUnitKeyProducerIterator.php [new file with mode: 0644]
application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php
db/cruncher_projects/.htaccess [new file with mode: 0644]
docs/TODOs.txt

index 463b9931ac1a48b79f596344a55e468f41f436e6..0cc3d8ac562d21929ad275a0cde044a6843c6d18 100644 (file)
@@ -316,6 +316,8 @@ application/hub/main/iterator/pool/shutdown/class_Shutdown -text
 application/hub/main/iterator/pool/shutdown/class_ShutdownPoolIterator.php -text svneol=unset#text/plain
 application/hub/main/iterator/pool/tasks/.htaccess -text svneol=unset#text/plain
 application/hub/main/iterator/pool/tasks/class_TaskPoolIterator.php -text svneol=unset#text/plain
+application/hub/main/iterator/producer/.htaccess svneol=native#text/plain
+application/hub/main/iterator/producer/class_TestUnitKeyProducerIterator.php svneol=native#text/plain
 application/hub/main/listener/.htaccess -text svneol=unset#text/plain
 application/hub/main/listener/class_ -text svneol=unset#text/plain
 application/hub/main/listener/class_BaseListener.php -text svneol=unset#text/plain
@@ -510,6 +512,7 @@ application/hub/templates/xml/self_connect/.htaccess -text svneol=unset#text/pla
 application/hub/templates/xml/self_connect/self_connect.xml -text svneol=unset#text/plain
 /clear-cache.sh -text
 db/.htaccess -text svneol=unset#text/plain
+db/cruncher_projects/.htaccess svneol=native#text/plain
 db/cruncher_units/.htaccess svneol=native#text/plain
 db/news/.htaccess -text svneol=unset#text/plain
 db/node_data/.htaccess -text svneol=unset#text/plain
index 50351b2a32fd3c5a4e9da3ddb888586888beca27..4717447454e50c922e61e9a3a490d8dff5b7ef9b 100644 (file)
@@ -447,6 +447,12 @@ $cfg->setConfigEntry('query_iterator_class', 'DefaultIterator');
 // CFG: HUB-PING-ITERATOR-CLASS
 $cfg->setConfigEntry('hub_ping_iterator_class', 'HubPingIterator');
 
+// CFG: TEST-UNIT-PRODUCER-KEY-ITERATOR-CLASS
+$cfg->setConfigEntry('test_unit_producer_key_iterator_class', 'TestUnitKeyProducerIterator');
+
+// CFG: WORK-UNIT-PRODUCER-KEY-ITERATOR-CLASS
+$cfg->setConfigEntry('work_unit_producer_key_iterator_class', 'WorkUnitKeyProducerIterator');
+
 // CFG: LOCAL-QUERY-LIST-CLASS
 $cfg->setConfigEntry('local_query_list_class', 'LocalQueryList');
 
index 81057a706cf6ea08bc135162d2e7ebdae6721d48..2f2364b4cdd5ee8f0ae0c5a9c509d368cf058198 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 interface MessageHelper extends Helper {
+       /**
+        * Generates an encrypted random message
+        *
+        * @return      $encryptedMessage       The encrypted random message
+        */
+       function generateRandomMessage ();
+
+       /**
+        * "Getter" for an iterator for keys
+        *
+        * @param       $encryptedMessage       The encrypted message
+        * @return      $iteratorInstance       An instance of a Iterator class
+        */
+       function getKeyIterator ();
 }
 
 // [EOF]
index cada8ebc6b2ef6fb527d23bdb169ff507cd14a2d..bed72540bb94fc62536fa0025d098439537515e2 100644 (file)
@@ -25,9 +25,9 @@ interface UnitHelper extends FrameworkInterface {
        /**
         * Generates a work/test/foo unit instance
         *
-        * @return      $unitInstance   A work unit instance
+        * @return      $unitInstance   A work/test/foo unit instance
         */
-       function generateUnit ();
+       function generateNextUnitInstance ();
 }
 
 // [EOF]
index 442268e7c93cf4f560abc2de6eede8a982aa3ed4..ca4567b7187d6b84a2e4f1ab63de9014fb524a92 100644 (file)
@@ -72,7 +72,7 @@ class HubMcryptCruncher extends BaseHubCruncher implements CruncherHelper, Regis
                // We don't need an iterator here because we just need to generate some test units
                for ($idx = 0; $idx < $this->getConfigInstance()->getConfigEntry('cruncher_max_text_unit_amount'); $idx++) {
                        // Get a test unit from it
-                       $unitInstance = $generatorInstance->generateUnit();
+                       $unitInstance = $generatorInstance->generateNextUnitInstance();
 
                        // ... and finally queue it to the in-buffer queue
                        $this->queueUnitInstanceToInBuffer($unitInstance);
index 9ec203cb738f29d9478ada41cb4b6e1223288bba..9c11a07228e54482c7104a674fcb0b0622be01b2 100644 (file)
@@ -64,6 +64,19 @@ class CryptoRandomUnitMessageHelper extends BaseMessageHelper implements Message
                // Return it
                return $encryptedMessage;
        }
+
+       /**
+        * "Getter" for an iterator for keys
+        *
+        * @return      $iteratorInstance       An instance of a Iterator class
+        */
+       public function getKeyIterator () {
+               // Create the iterator instance
+               $iteratorInstance = ObjectFactory::createObjectByConfiguredName('test_unit_producer_key_iterator_class');
+
+               // And return it
+               return $iteratorInstance;
+       }
 }
 
 // [EOF]
index 38cf1c67b4b62e767d695632d81dd69f6dda868a..8bb3926ca18a6ea9af5bab5a4759cc7462e63026 100644 (file)
@@ -63,7 +63,7 @@ class CruncherTestUnitHelper extends BaseWorkUnitHelper implements UnitHelper {
         * @return      $unitInstance   A work unit instance
         * @todo        0% done
         */
-       public function generateUnit () {
+       public function generateNextUnitInstance () {
                $this->partialStub('Please implement this method.');
        }
 }
diff --git a/application/hub/main/iterator/producer/.htaccess b/application/hub/main/iterator/producer/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/iterator/producer/class_TestUnitKeyProducerIterator.php b/application/hub/main/iterator/producer/class_TestUnitKeyProducerIterator.php
new file mode 100644 (file)
index 0000000..1e52bf4
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/**
+ * A TestUnitKeyProducer iterator
+ *
+ * @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 TestUnitKeyProducerIterator extends BaseIterator implements Iterator {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $iteratorInstance               An instance of a Iterator class
+        */
+       public final static function createTestUnitKeyProducerIterator () {
+               // Get new instance
+               $iteratorInstance = new TestUnitKeyProducerIterator();
+
+               // Return the prepared instance
+               return $iteratorInstance;
+       }
+
+       /**
+        * Getter for current value from group or generic
+        *
+        * @return      $current        Current value in iteration
+        */
+       public function current () {
+               // Default is null
+               $current = null;
+
+               $this->partialStub('Please implement this method.');
+
+               // Return it
+               return $current;
+       }
+
+       /**
+        * Getter for key from group or generic
+        *
+        * @return      $key    Current key in iteration
+        */
+       public function key () {
+               // Default is null
+               $key = null;
+
+               $this->partialStub('Please implement this method.');
+
+               // Return it
+               return $key;
+       }
+
+       /**
+        * Advances to the next entry
+        *
+        * @return      void
+        */
+       public function next () {
+               $this->partialStub('Please implement this method.');
+       }
+
+       /**
+        * Rewinds to the beginning of the iteration
+        *
+        * @return      void
+        */
+       public function rewind () {
+               $this->partialStub('Please implement this method.');
+       }
+
+       /**
+        * Checks wether the current entry is valid (not at the end of the list)
+        *
+        * @return      void
+        */
+       public function valid () {
+               $this->partialStub('Please implement this method.');
+       }
+}
+
+// [EOF]
+?>
index 545babfeeb36006329f95b851439b1527e6b584b..deb010694e62f45c931e8b66377cc9373cd22386 100644 (file)
@@ -110,11 +110,15 @@ class CruncherTestUnitProducer extends BaseUnitProducer implements UnitProducer,
                        /*
                         * 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 or collection. It will instead
+                        * not iterate over an object nor a collection. It will instead
                         * encapsulate "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();
+                       die(__METHOD__."\n");
                }
        }
 }
diff --git a/db/cruncher_projects/.htaccess b/db/cruncher_projects/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
index 7096d7682e228ce08b63c134134dc566e0885679..189ba59a60326ca2f3035fda8c66213b2e8cc1e3 100644 (file)
 ./inc/classes/exceptions/main/class_MissingMethodException.php:13: * @todo             Try to rewrite user/guest login classes and mark this exception as deprecated
 ./inc/classes/exceptions/main/class_NoConfigEntryException.php:10: * @todo             Rename this class to NoFoundEntryException
 ./inc/classes/interfaces/class_FrameworkInterface.php:11: * @todo              Find a better name for this interface
-./inc/classes/main/class_BaseFrameworkSystem.php:1178:  * @todo        Write a logging mechanism for productive mode
-./inc/classes/main/class_BaseFrameworkSystem.php:1192:                 // @TODO Finish this part!
+./inc/classes/main/class_BaseFrameworkSystem.php:1196:  * @todo        Write a logging mechanism for productive mode
+./inc/classes/main/class_BaseFrameworkSystem.php:1210:                 // @TODO Finish this part!
 ./inc/classes/main/class_BaseFrameworkSystem.php:169:  // @todo Try to clean these constants up
-./inc/classes/main/class_BaseFrameworkSystem.php:355:   * @todo        SearchableResult and UpdateableResult shall have a super interface to use here
+./inc/classes/main/class_BaseFrameworkSystem.php:367:   * @todo        SearchableResult and UpdateableResult shall have a super interface to use here
 ./inc/classes/main/commands/web/class_WebLoginAreaCommand.php:64:       * @todo        Add some stuff here: Some personal data, app/game related data
 ./inc/classes/main/commands/web/class_WebProblemCommand.php:58:         * @todo        0% done
 ./inc/classes/main/commands/web/class_WebStatusCommand.php:58:  * @todo        0% done
 ./inc/classes/main/controller/web/class_WebProblemController.php:40:    * @todo        Add some filters to this controller
 ./inc/classes/main/controller/web/class_WebRegisterController.php:40:   * @todo        Add some filters to this controller
 ./inc/classes/main/controller/web/class_WebStatusController.php:10: * @todo            This controller shall still provide some headlines for sidebars
-./inc/classes/main/criteria/search/class_SearchCriteria.php:114:        * @todo        Find a nice casting here. (int) allows until and including 32766.
+./inc/classes/main/criteria/search/class_SearchCriteria.php:126:        * @todo        Find a nice casting here. (int) allows until and including 32766.
 ./inc/classes/main/criteria/search/class_SearchCriteria.php:94:         * @todo        Find a nice casting here. (int) allows until and including 32766.
 ./inc/classes/main/database/databases/class_LocalFileDatabase.php:360:  * @todo        Do some checks on the database directory and files here
 ./inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php:426:       * @todo        Find something useful with this!