]> git.mxchange.org Git - hub.git/commitdiff
Test units continued, XML MIME type worked-around:
authorRoland Häder <roland@mxchange.org>
Sat, 26 Mar 2011 17:04:37 +0000 (17:04 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 26 Mar 2011 17:04:37 +0000 (17:04 +0000)
- 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
application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php
application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php
application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php
application/hub/templates/xml/cruncher/producer/test_unit.xml
application/hub/templates/xml/cruncher/producer/work_unit.xml [new file with mode: 0644]
application/hub/templates/xml/node/node_status.xml
application/hub/templates/xml/object_registry/object_registry.xml
docs/TODOs.txt

index 20724cafe571f097a4e7b6b10da79d3bba89e2a7..925aaa560751e6657b580ad8075118644b24d2fb 100644 (file)
@@ -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
index bcd72d0323dd52432ee12b2778187b8f8c1ebb13..52e3664322e5d657a7a9d23919d601839353ec71 100644 (file)
@@ -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
index 8a2e198ad17862715977e427f1352911375d3194..c6afa7cc88f1f0e684241a7af2175f02e2c7d439 100644 (file)
@@ -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');
        }
index 8dc4160f8d29a8f74851d0587526ac2123f30888..3fadf06bc9d01d648057bba4c478bfbc179b0f33 100644 (file)
@@ -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
         *
index e15fadffaec57a7c18bb0277972a073f4b2922e2..1efe031bd58ec603441be8ea01fd977177a5728c 100644 (file)
@@ -22,4 +22,39 @@ You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>
 //-->
 <cruncher-test-unit>
+       <!--
+       This node stores meta-data which is needed to manage this test unit.
+       //-->
+       <meta-data>
+               <!--
+               The global project identifier, or short GPI, identifies every crunching
+               project in the global cloud (aka "hub" project). Therefore it has to be
+               unique (globally unique). This is ensured by hashing the node's hub-id
+               and some more data (will be specified later on).
+               //-->
+               <global-project-identifier>{?global_project_idendifier?}</global-project-identifier>
+               <!--
+               The used cipher to crunch the given keys. Currently only 'mcrypt' is
+               supported as "cipher function".
+               //-->
+               <cipher>
+                       <cipher-function>{?cipher_function?}</cipher-function>
+                       <cipher-name>{?cipher_name?}</cipher-name>
+               </cipher>
+       </meta-data>
+       <!--
+       The data the cruncher shall process for this test unit.
+       //-->
+       <unprocessed-data>
+               <!--
+               Because this is a WU for crunchers, there is always a key list.
+               //-->
+               <cruncher-key-list key-count="{?key_count?}">
+                       <!-- A single key to crunch. //-->
+                       <cruncher-key>
+                               <key-id>{?key_id?}</key-id>
+                               <key-value><![CDATA[{?key_value?}]]></key-value>
+                       </cruncher-key>
+               </cruncher-key-list>
+       </unprocessed-data>
 </cruncher-test-unit>
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 (file)
index 0000000..cbe8611
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+A XML template for the producer to produce work units
+
+@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/>
+//-->
+<cruncher-work-unit>
+       <!--
+       This node stores meta-data which is needed to manage this work unit (WU).
+       //-->
+       <meta-data>
+               <!--
+               The global project identifier, or short GPI, identifies every crunching
+               project in the cloud (aka "hub" project). Therefore it has to be unique
+               (globally unique). This is ensured by hashing the node's hub-id and some
+               more data (will be specified later on).
+               //-->
+               <global-project-identifier>{?global_project_idendifier?}</global-project-identifier>
+               <!--
+               The used cipher to crunch the given keys. Currently only 'mcrypt' is
+               supported as "cipher function".
+               //-->
+               <cipher>
+                       <cipher-function>{?cipher_function?}</cipher-function>
+                       <cipher-name>{?cipher_name?}</cipher-name>
+               </cipher>
+               <!--
+               The node's hub-id. This is required to verify the GPI.
+               //-->
+               <hub-id>{?hub_id?}</hub-id>
+               <!--
+               The node's current session-id. This is required to verify the hub-id.
+               //-->
+               <session-id>{?session_id?}</session-id>
+       </meta-data>
+       <!--
+       The data the cruncher shall process for this work unit.
+       //-->
+       <unprocessed-data>
+               <!--
+               Because this is a WU for crunchers, there is always a key list.
+               //-->
+               <cruncher-key-list key-count="{?key_count?}">
+                       <!-- A single key to crunch. //-->
+                       <cruncher-key>
+                               <key-id>{?key_id?}</key-id>
+                               <key-value><![CDATA[{?key_value?}]]></key-value>
+                       </cruncher-key>
+               </cruncher-key-list>
+       </unprocessed-data>
+</cruncher-work-unit>
index 5aad61560f79b60b0db48e7f126eaad77dfa7e09..ee19cce4aa3890c2e5f003387d997f69b9d990bf 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>
 //-->
-<node-status-list>
+<node-status-list status-count="{?status_count?}">
        <!-- This hub cannot be reached from outside by TCP only. //-->
        <node-status status="unreachable_tcp" />
        <!-- This hub cannot be reached from outside by UDP only. //-->
index 88f9426a5b752940de36e2418153ebd6b827a0eb..b71ff74ba307b7dce63087953b7ad859fb120019 100644 (file)
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
        If you don't do so, you may be banned because of unknown object types your
        node tries to advertise/share.
        //-->
-       <object-list>
+       <object-list object-count="{?object_count?}">
                <!-- A single object type we want to share. //-->
                <object-list-entry>
                        <!-- The actual name, this must be the same as tag names are. //-->
index fd501fe7dece4bde63b190de7320385afbb7e3ef..d7f5b79bbb74671c9501cbfac22c87f23d414dd7 100644 (file)
 ./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?