]> git.mxchange.org Git - hub.git/commitdiff
Two methods in CruncherTestUnitProducer are now throwing UnsupportedOperationExceptio...
authorRoland Häder <roland@mxchange.org>
Sat, 2 Apr 2011 22:32:54 +0000 (22:32 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 2 Apr 2011 22:32:54 +0000 (22:32 +0000)
application/hub/main/iterator/producer/class_TestUnitKeyProducerIterator.php
application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php

index 1e52bf435e32a6dcc47935685e0d84781e71c667..189eb0ee8277189e076417567f1ff6094c7f50cb 100644 (file)
@@ -35,7 +35,7 @@ class TestUnitKeyProducerIterator extends BaseIterator implements Iterator {
        /**
         * Creates an instance of this class
         *
-        * @return      $iteratorInstance               An instance of a Iterator class
+        * @return      $iteratorInstance       An instance of a Iterator class
         */
        public final static function createTestUnitKeyProducerIterator () {
                // Get new instance
@@ -64,15 +64,10 @@ class TestUnitKeyProducerIterator extends BaseIterator implements Iterator {
         * Getter for key from group or generic
         *
         * @return      $key    Current key in iteration
+        * @throws      UnsupportedOperationException   This method should not be called
         */
        public function key () {
-               // Default is null
-               $key = null;
-
-               $this->partialStub('Please implement this method.');
-
-               // Return it
-               return $key;
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
        /**
@@ -88,9 +83,10 @@ class TestUnitKeyProducerIterator extends BaseIterator implements Iterator {
         * Rewinds to the beginning of the iteration
         *
         * @return      void
+        * @throws      UnsupportedOperationException   This method should not be called
         */
        public function rewind () {
-               $this->partialStub('Please implement this method.');
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
        /**
index deb010694e62f45c931e8b66377cc9373cd22386..172083521054447c8401ec9d63bbaa831718a536 100644 (file)
@@ -111,14 +111,27 @@ 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 nor a collection. It will instead
-                        * encapsulate "key production" into a class and not in a simple
+                        * 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();
-                       die(__METHOD__."\n");
+
+                       // 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");
                }
        }
 }