From 8847cb5156b29aea1354ea2448d036de7c409986 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 26 Mar 2011 17:04:37 +0000 Subject: [PATCH] Test units continued, XML MIME type worked-around: - XMLs must have the MIME type "text/plain" in subversion, with "application/xml" they would be threated as binary files... :-( - Template engine for cruncher test units basicly finished - TODOs.txt updated --- .gitattributes | 13 +- .../class_XmlAnnouncementTemplateEngine.php | 1 - .../class_XmlObjectRegistryTemplateEngine.php | 4 +- ...lass_XmlCruncherTestUnitTemplateEngine.php | 220 +++++++++++++++++- .../xml/cruncher/producer/test_unit.xml | 35 +++ .../xml/cruncher/producer/work_unit.xml | 68 ++++++ .../hub/templates/xml/node/node_status.xml | 2 +- .../xml/object_registry/object_registry.xml | 2 +- docs/TODOs.txt | 4 +- 9 files changed, 332 insertions(+), 17 deletions(-) create mode 100644 application/hub/templates/xml/cruncher/producer/work_unit.xml diff --git a/.gitattributes b/.gitattributes index 20724cafe..925aaa560 100644 --- a/.gitattributes +++ b/.gitattributes @@ -467,18 +467,19 @@ application/hub/main/visitor/tasks/class_ShutdownTaskVisitor.php svneol=native#t application/hub/starter.php -text svneol=unset#text/plain application/hub/templates/.htaccess -text svneol=unset#text/plain application/hub/templates/xml/.htaccess -text svneol=unset#text/plain -application/hub/templates/xml/.xml -text svneol=unset#application/xml +application/hub/templates/xml/.xml -text svneol=unset#text/plain application/hub/templates/xml/announcement/.htaccess -text svneol=unset#text/plain -application/hub/templates/xml/announcement/self_announcement.xml -text svneol=unset#application/xml +application/hub/templates/xml/announcement/self_announcement.xml -text svneol=unset#text/plain application/hub/templates/xml/cruncher/.htaccess svneol=native#text/plain application/hub/templates/xml/cruncher/producer/.htaccess svneol=native#text/plain -application/hub/templates/xml/cruncher/producer/test_unit.xml -text svneol=unset#application/xml +application/hub/templates/xml/cruncher/producer/test_unit.xml -text svneol=unset#text/plain +application/hub/templates/xml/cruncher/producer/work_unit.xml -text svneol=unset#text/plain application/hub/templates/xml/node/.htaccess -text svneol=unset#text/plain -application/hub/templates/xml/node/node_status.xml -text svneol=unset#application/xml +application/hub/templates/xml/node/node_status.xml -text svneol=unset#text/plain application/hub/templates/xml/object_registry/.htaccess -text svneol=unset#text/plain -application/hub/templates/xml/object_registry/object_registry.xml -text svneol=unset#application/xml +application/hub/templates/xml/object_registry/object_registry.xml -text svneol=unset#text/plain application/hub/templates/xml/self_connect/.htaccess -text svneol=unset#text/plain -application/hub/templates/xml/self_connect/self_connect.xml -text svneol=unset#application/xml +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/news/.htaccess -text svneol=unset#text/plain diff --git a/application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php b/application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php index bcd72d032..52e366432 100644 --- a/application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php +++ b/application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php @@ -244,7 +244,6 @@ class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements Compil * @param $resource XML parser resource (currently ignored) * @param $characters Characters to handle * @return void - * @todo Find something useful with this! */ public function characterHandler ($resource, $characters) { // Trim all spaces away diff --git a/application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php b/application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php index 8a2e198ad..c6afa7cc8 100644 --- a/application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php +++ b/application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php @@ -319,9 +319,11 @@ class XmlObjectRegistryTemplateEngine extends BaseTemplateEngine implements Comp /** * Starts the object-list * + * @param $objectCount Count of all objects * @return void + * @todo Handle $objectCount */ - private function startObjectList () { + private function startObjectList ($objectCount) { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('object_registry', 'object-list'); } diff --git a/application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php b/application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php index 8dc4160f8..3fadf06bc 100644 --- a/application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php +++ b/application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php @@ -34,6 +34,16 @@ class XmlCruncherTestUnitTemplateEngine extends BaseTemplateEngine implements Co * Sub nodes in the XML tree */ private $subNodes = array( + 'meta-data', + 'global-project-identifier', + 'cipher', + 'cipher-function', + 'cipher-name', + 'unprocessed-data', + 'cruncher-key-list', + 'cruncher-key', + 'key-id', + 'key-value' ); /** @@ -228,7 +238,6 @@ class XmlCruncherTestUnitTemplateEngine extends BaseTemplateEngine implements Co * @param $resource XML parser resource (currently ignored) * @param $characters Characters to handle * @return void - * @todo Find something useful with this! */ public function characterHandler ($resource, $characters) { // Trim all spaces away @@ -240,10 +249,9 @@ class XmlCruncherTestUnitTemplateEngine extends BaseTemplateEngine implements Co return false; } // END - if - // Get current XML node name as an array index - $nodeName = $this->getStackerInstance()->getNamed('cruncher_test_unit'); - - $this->partialStub('TODO: Do something with the gathered data.'); + // Assign the found characters to variable and use the last entry from + // stack as the name + parent::assignVariable($this->getStackerInstance()->getNamed('cruncher_test_unit'), $characters); } /** @@ -265,6 +273,208 @@ class XmlCruncherTestUnitTemplateEngine extends BaseTemplateEngine implements Co $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cruncher-test-unit'); } + /** + * Starts the meta-data + * + * @return void + */ + private function startMetaData () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'meta-data'); + } + + /** + * Starts the global-project-identifier + * + * @return void + */ + private function startGlobalProjectIdentifier () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'global-project-identifier'); + } + + /** + * Finishes the global-project-identifier + * + * @return void + */ + private function finishGlobalProjectIdentifier () { + // Pop the last entry + $this->getStackerInstance()->popNamed('cruncher_test_unit'); + } + + /** + * Starts the cipher + * + * @return void + */ + private function startCipher () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cipher'); + } + + /** + * Starts the cipher-function + * + * @return void + */ + private function startCipherFunction () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cipher-function'); + } + + /** + * Finishes the cipher-function + * + * @return void + */ + private function finishCipherFunction () { + // Pop the last entry + $this->getStackerInstance()->popNamed('cruncher_test_unit'); + } + + /** + * Starts the cipher-name + * + * @return void + */ + private function startCipherName () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cipher-name'); + } + + /** + * Finishes the cipher-name + * + * @return void + */ + private function finishCipherName () { + // Pop the last entry + $this->getStackerInstance()->popNamed('cruncher_test_unit'); + } + + /** + * Finishes the cipher + * + * @return void + */ + private function finishCipher () { + // Pop the last entry + $this->getStackerInstance()->popNamed('cruncher_test_unit'); + } + + /** + * Finishes the meta-data + * + * @return void + */ + private function finishMetaData () { + // Pop the last entry + $this->getStackerInstance()->popNamed('cruncher_test_unit'); + } + + /** + * Starts the unprocessed-data + * + * @return void + */ + private function startUnprocessedData () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'unprocessed-data'); + } + + /** + * Starts the cruncher-key-list + * + * @param $keyCount Count of keys in this test unit + * @return void + * @todo Handle $keyCount + */ + private function startCruncherKeyList ($keyCount) { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cruncher-key-list'); + } + + /** + * Starts the cruncher-key + * + * @return void + */ + private function startCruncherKey () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cruncher-key'); + } + + /** + * Starts the key-id + * + * @return void + */ + private function startKeyId () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'key-id'); + } + + /** + * Finishes the key-id + * + * @return void + */ + private function finishKeyId () { + // Pop the last entry + $this->getStackerInstance()->popNamed('cruncher_test_unit'); + } + + /** + * Starts the key-value + * + * @return void + */ + private function startKeyValue () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'key-value'); + } + + /** + * Finishes the key-value + * + * @return void + */ + private function finishKeyValue () { + // Pop the last entry + $this->getStackerInstance()->popNamed('cruncher_test_unit'); + } + + /** + * Finishes the cruncher-key + * + * @return void + */ + private function finishCruncherKey () { + // Pop the last entry + $this->getStackerInstance()->popNamed('cruncher_test_unit'); + } + + /** + * Finishes the cruncher-key-list + * + * @return void + */ + private function finishCruncherKeyList () { + // Pop the last entry + $this->getStackerInstance()->popNamed('cruncher_test_unit'); + } + + /** + * Finishes the unprocessed-data + * + * @return void + */ + private function finishUnprocessedData () { + // Pop the last entry + $this->getStackerInstance()->popNamed('cruncher_test_unit'); + } + /** * Finishes the test-unit * diff --git a/application/hub/templates/xml/cruncher/producer/test_unit.xml b/application/hub/templates/xml/cruncher/producer/test_unit.xml index e15fadffa..1efe031bd 100644 --- a/application/hub/templates/xml/cruncher/producer/test_unit.xml +++ b/application/hub/templates/xml/cruncher/producer/test_unit.xml @@ -22,4 +22,39 @@ You should have received a copy of the GNU General Public License along with this program. If not, see //--> + + + + {?global_project_idendifier?} + + + {?cipher_function?} + {?cipher_name?} + + + + + + + + + {?key_id?} + + + + diff --git a/application/hub/templates/xml/cruncher/producer/work_unit.xml b/application/hub/templates/xml/cruncher/producer/work_unit.xml new file mode 100644 index 000000000..cbe8611a4 --- /dev/null +++ b/application/hub/templates/xml/cruncher/producer/work_unit.xml @@ -0,0 +1,68 @@ + + + + + + + {?global_project_idendifier?} + + + {?cipher_function?} + {?cipher_name?} + + + {?hub_id?} + + {?session_id?} + + + + + + + + {?key_id?} + + + + + diff --git a/application/hub/templates/xml/node/node_status.xml b/application/hub/templates/xml/node/node_status.xml index 5aad61560..ee19cce4a 100644 --- a/application/hub/templates/xml/node/node_status.xml +++ b/application/hub/templates/xml/node/node_status.xml @@ -21,7 +21,7 @@ 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 //--> - + diff --git a/application/hub/templates/xml/object_registry/object_registry.xml b/application/hub/templates/xml/object_registry/object_registry.xml index 88f9426a5..b71ff74ba 100644 --- a/application/hub/templates/xml/object_registry/object_registry.xml +++ b/application/hub/templates/xml/object_registry/object_registry.xml @@ -31,7 +31,7 @@ along with this program. If not, see If you don't do so, you may be banned because of unknown object types your node tries to advertise/share. //--> - + diff --git a/docs/TODOs.txt b/docs/TODOs.txt index fd501fe7d..d7f5b79bb 100644 --- a/docs/TODOs.txt +++ b/docs/TODOs.txt @@ -81,13 +81,13 @@ ./application/hub/main/tasks/hub/ping/class_HubPingTask.php:73: * @todo 0% done ./application/hub/main/tasks/hub/update/class_HubUpdateCheckTask.php:53: * @todo 0% ./application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php:10: * @todo This template engine does not make use of setTemplateType() -./application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php:247: * @todo Find something useful with this! ./application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php:10: * @todo This template engine does not make use of setTemplateType() ./application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php:240: * @todo Find something useful with this! ./application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php:10: * @todo This template engine does not make use of setTemplateType() ./application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php:251: * @todo Find something useful with this! +./application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php:324: * @todo Handle $objectCount ./application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php:10: * @todo This template engine does not make use of setTemplateType() -./application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php:231: * @todo Find something useful with this! +./application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php:391: * @todo Handle $keyCount ./application/hub/main/tools/class_HubTools.php:128: // @TODO We may want to encapsulate this PHP call into an own class ./application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php:105: * @todo Does a query needs to perform some actions as an active task? ./application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php:116: * @todo Does a queue needs to perform some actions as an active task? -- 2.39.5