From: Roland Häder Date: Sat, 2 Apr 2011 22:32:54 +0000 (+0000) Subject: Two methods in CruncherTestUnitProducer are now throwing UnsupportedOperationExceptio... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d91881a2c11a519833b971873c516ceda30e1497;p=hub.git Two methods in CruncherTestUnitProducer are now throwing UnsupportedOperationException if they got called which should not happen. --- diff --git a/application/hub/main/iterator/producer/class_TestUnitKeyProducerIterator.php b/application/hub/main/iterator/producer/class_TestUnitKeyProducerIterator.php index 1e52bf435..189eb0ee8 100644 --- a/application/hub/main/iterator/producer/class_TestUnitKeyProducerIterator.php +++ b/application/hub/main/iterator/producer/class_TestUnitKeyProducerIterator.php @@ -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); } /** diff --git a/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php b/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php index deb010694..172083521 100644 --- a/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php +++ b/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php @@ -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"); } } }