GitHub PullRequestReviewCommentEvent at 2014-03-11 11:03:03
Repository: fiware-orion
Actor: fgalan
Payload: {"comment":{"url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/comments/10468522","id":10468522,"diff_hunk":"@@ -0,0 +1,392 @@\n+# Copyright 2014 Telefonica Investigacion y Desarrollo, S.A.U\n+#\n+# This file is part of Orion Context Broker.\n+#\n+# Orion Context Broker is free software: you can redistribute it and/or\n+# modify it under the terms of the GNU Affero General Public License as\n+# published by the Free Software Foundation, either version 3 of the\n+# License, or (at your option) any later version.\n+#\n+# Orion Context Broker is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n+# General Public License for more details.\n+#\n+# You should have received a copy of the GNU Affero General Public License\n+# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/.\n+#\n+# For those usages not covered by this license please contact with\n+# fermin at tid dot es\n+\n+# VALGRIND_READY - to mark the test ready for valgrindTestSuite.sh\n+\n+--NAME--\n+XML Parse Complex Values\n+--SHELL-INIT--\n+source ../harnessFunctions.sh\n+\n+dbInit CB\n+brokerStart CB\n+\n+--SHELL--\n+source ../harnessFunctions.sh\n+\n+# 1. Complex contextValue without vector\n+echo \"1: +++++++++++++++++++++++++++++++++\"\n+url='/ngsi10/updateContext'\n+payload='<updateContextRequest>\n+  <contextElementList>\n+    <contextElement>\n+      <entityId type=\"Room\" isPattern=\"false\">\n+        <id>ConferenceRoom</id>\n+      </entityId>\n+      <contextAttributeList>\n+        <contextAttribute>\n+          <name>temperature</name>\n+          <type>degree</type>\n+          <contextValue>\n+            <level1>\n+              <value1>1</value1>\n+              <level2>\n+                <value2>2</value2>\n+                <value3>3</value3>\n+                <value4>4</value4>\n+                <level3>\n+                  <value31>vv2</value31>\n+                  <value32>vv3</value32>\n+                  <value33>vv4</value33>\n+                </level3>\n+              </level2>\n+              <level2again>\n+                <value5>5</value5>\n+                <value6>6</value6>\n+              </level2again>\n+            </level1>\n+          </contextValue>\n+        </contextAttribute>\n+      </contextAttributeList>\n+    </contextElement>\n+  </contextElementList>\n+  <updateAction>APPEND</updateAction>\n+</updateContextRequest>'\n+curlXml ${url} \"${payload}\"\n+\n+# 2. Complex contextValue with vector\n+echo \"2: +++++++++++++++++++++++++++++++++\"\n+url='/ngsi10/updateContext'\n+payload='<updateContextRequest>\n+  <contextElementList>\n+    <contextElement>\n+      <entityId type=\"Room\" isPattern=\"false\">\n+        <id>ConferenceRoom</id>\n+      </entityId>\n+      <contextAttributeList>\n+        <contextAttribute>\n+          <name>temperature</name>\n+          <type>degree</type>\n+          <contextValue>\n+            <level1>\n+              <value1>1</value1>\n+              <level2>\n+                <value2>2</value2>\n+                <value3>3</value3>\n+                <value4>4</value4>\n+                <level3 type=\"vector\">\n+                  <value>vv2</value>\n+                  <value>vv3</value>\n+                  <value>vv4</value>\n+                </level3>\n+              </level2>\n+              <level2again>\n+                <value5>5</value5>\n+                <value6>6</value6>\n+              </level2again>\n+            </level1>\n+          </contextValue>\n+        </contextAttribute>\n+      </contextAttributeList>\n+    </contextElement>\n+  </contextElementList>\n+  <updateAction>APPEND</updateAction>\n+</updateContextRequest>'\n+curlXml ${url} \"${payload}\"\n+\n+# 3. Complex contextValue with vector but one of the items have an incorrect tagname\n+echo \"3: +++++++++++++++++++++++++++++++++\"\n+url='/ngsi10/updateContext'\n+payload='<updateContextRequest>\n+  <contextElementList>\n+    <contextElement>\n+      <entityId type=\"Room\" isPattern=\"false\">\n+        <id>ConferenceRoom</id>\n+      </entityId>\n+      <contextAttributeList>\n+        <contextAttribute>\n+          <name>temperature</name>\n+          <type>degree</type>\n+          <contextValue>\n+            <level1>\n+              <value1>1</value1>\n+              <level2>\n+                <value2>2</value2>\n+                <value3>3</value3>\n+                <value4>4</value4>\n+                <level3 type=\"vector\">\n+                  <value>vv2</value>\n+                  <value>vv3</value>\n+                  <value3>vv4</value3>\n+                </level3>\n+              </level2>\n+              <level2again>\n+                <value5>5</value5>\n+                <value6>6</value6>\n+              </level2again>\n+            </level1>\n+          </contextValue>\n+        </contextAttribute>\n+      </contextAttributeList>\n+    </contextElement>\n+  </contextElementList>\n+  <updateAction>APPEND</updateAction>\n+</updateContextRequest>'\n+curlXml ${url} \"${payload}\"\n+\n+# 4. Complex contextValue with vector but two type-attributes\n+echo \"4: +++++++++++++++++++++++++++++++++\"\n+url='/ngsi10/updateContext'\n+payload='<updateContextRequest>\n+  <contextElementList>\n+    <contextElement>\n+      <entityId type=\"Room\" isPattern=\"false\">\n+        <id>ConferenceRoom</id>\n+      </entityId>\n+      <contextAttributeList>\n+        <contextAttribute>\n+          <name>temperature</name>\n+          <type>degree</type>\n+          <contextValue>\n+            <level1>\n+              <value1>1</value1>\n+              <level2>\n+                <value2>2</value2>\n+                <value3>3</value3>\n+                <value4>4</value4>\n+                <level3 type=\"vector\" type=\"vector\">\n+                  <value>vv2</value>\n+                  <value>vv3</value>\n+                  <value>vv4</value>\n+                </level3>\n+              </level2>\n+              <level2again>\n+                <value5>5</value5>\n+                <value6>6</value6>\n+              </level2again>\n+            </level1>\n+          </contextValue>\n+        </contextAttribute>\n+      </contextAttributeList>\n+    </contextElement>\n+  </contextElementList>\n+  <updateAction>APPEND</updateAction>\n+</updateContextRequest>'\n+curlXml ${url} \"${payload}\"\n+\n+# 5. Complex contextValue with vector but type-attribute with value != 'vector'\n+echo \"5: +++++++++++++++++++++++++++++++++\"\n+url='/ngsi10/updateContext'\n+payload='<updateContextRequest>\n+  <contextElementList>\n+    <contextElement>\n+      <entityId type=\"Room\" isPattern=\"false\">\n+        <id>ConferenceRoom</id>\n+      </entityId>\n+      <contextAttributeList>\n+        <contextAttribute>\n+          <name>temperature</name>\n+          <type>degree</type>\n+          <contextValue>\n+            <level1>\n+              <value1>1</value1>\n+              <level2>\n+                <value2>2</value2>\n+                <value3>3</value3>\n+                <value4>4</value4>\n+                <level3 type=\"badType\">\n+                  <value>vv2</value>\n+                  <value>vv3</value>\n+                  <value>vv4</value>\n+                </level3>\n+              </level2>\n+              <level2again>\n+                <value5>5</value5>\n+                <value6>6</value6>\n+              </level2again>\n+            </level1>\n+          </contextValue>\n+        </contextAttribute>\n+      </contextAttributeList>\n+    </contextElement>\n+  </contextElementList>\n+  <updateAction>APPEND</updateAction>\n+</updateContextRequest>'\n+curlXml ${url} \"${payload}\"\n+\n+# 6. Complex contextValue with vector but with unknown attribute\n+echo \"6: +++++++++++++++++++++++++++++++++\"\n+url='/ngsi10/updateContext'\n+payload='<updateContextRequest>\n+  <contextElementList>\n+    <contextElement>\n+      <entityId type=\"Room\" isPattern=\"false\">\n+        <id>ConferenceRoom</id>\n+      </entityId>\n+      <contextAttributeList>\n+        <contextAttribute>\n+          <name>temperature</name>\n+          <type>degree</type>\n+          <contextValue>\n+            <level1>\n+              <value1>1</value1>\n+              <level2>\n+                <value2>2</value2>\n+                <value3>3</value3>\n+                <value4>4</value4>\n+                <level3 happy=\"yes\">\n+                  <value>vv2</value>\n+                  <value>vv3</value>\n+                  <value>vv4</value>\n+                </level3>\n+              </level2>\n+              <level2again>\n+                <value5>5</value5>\n+                <value6>6</value6>\n+              </level2again>\n+            </level1>\n+          </contextValue>\n+        </contextAttribute>\n+      </contextAttributeList>\n+    </contextElement>\n+  </contextElementList>\n+  <updateAction>APPEND</updateAction>\n+</updateContextRequest>'\n+curlXml ${url} \"${payload}\"\n+\n+--REGEXPECT--\n+1: +++++++++++++++++++++++++++++++++\n+HTTP/1.1 200 OK\n+Content-Length: 644\n+Content-Type: application/xml\n+Date: REGEX(.*)\n+\n+<?xml version=\"1.0\"?>\n+<updateContextResponse>\n+  <contextResponseList>\n+    <contextElementResponse>\n+      <contextElement>\n+        <entityId type=\"Room\" isPattern=\"false\">\n+          <id>ConferenceRoom</id>\n+        </entityId>\n+        <contextAttributeList>\n+          <contextAttribute>\n+            <name>temperature</name>\n+            <type>degree</type>\n+            <contextValue/>\n+          </contextAttribute>\n+        </contextAttributeList>\n+      </contextElement>\n+      <statusCode>\n+        <code>200</code>\n+        <reasonPhrase>OK</reasonPhrase>\n+      </statusCode>\n+    </contextElementResponse>\n+  </contextResponseList>\n+</updateContextResponse>\n+2: +++++++++++++++++++++++++++++++++\n+HTTP/1.1 200 OK\n+Content-Length: 644\n+Content-Type: application/xml\n+Date: REGEX(.*)\n+\n+<?xml version=\"1.0\"?>\n+<updateContextResponse>\n+  <contextResponseList>\n+    <contextElementResponse>\n+      <contextElement>\n+        <entityId type=\"Room\" isPattern=\"false\">\n+          <id>ConferenceRoom</id>\n+        </entityId>\n+        <contextAttributeList>\n+          <contextAttribute>\n+            <name>temperature</name>\n+            <type>degree</type>\n+            <contextValue/>\n+          </contextAttribute>\n+        </contextAttributeList>\n+      </contextElement>\n+      <statusCode>\n+        <code>200</code>\n+        <reasonPhrase>OK</reasonPhrase>\n+      </statusCode>\n+    </contextElementResponse>\n+  </contextResponseList>\n+</updateContextResponse>\n+3: +++++++++++++++++++++++++++++++++\n+HTTP/1.1 200 OK\n+Content-Length: 246\n+Content-Type: application/xml\n+Date: REGEX(.*)\n+\n+<?xml version=\"1.0\"?>\n+<updateContextResponse>\n+  <errorCode>\n+    <code>400</code>\n+    <reasonPhrase>Bad Request</reasonPhrase>\n+    <details>complex value error: bad tag-name of vector item: 'value3' (should be 'value')</details>\n+  </errorCode>\n+</updateContextResponse>\n+4: +++++++++++++++++++++++++++++++++\n+HTTP/1.1 200 OK\n+Content-Length: 249\n+Content-Type: application/xml\n+Date: REGEX(.*)\n+\n+<?xml version=\"1.0\"?>\n+<updateContextResponse>\n+  <errorCode>\n+    <code>400</code>\n+    <reasonPhrase>Bad Request</reasonPhrase>\n+    <details>Bad value for XML attribute 'type' for 'level3': 'more than one 'type' attribute'</details>\n+  </errorCode>\n+</updateContextResponse>\n+5: +++++++++++++++++++++++++++++++++\n+HTTP/1.1 200 OK\n+Content-Length: 226\n+Content-Type: application/xml\n+Date: REGEX(.*)\n+\n+<?xml version=\"1.0\"?>\n+<updateContextResponse>\n+  <errorCode>\n+    <code>400</code>\n+    <reasonPhrase>Bad Request</reasonPhrase>\n+    <details>Bad value for XML attribute 'type' for 'level3': 'badType'</details>\n+  </errorCode>\n+</updateContextResponse>\n+6: +++++++++++++++++++++++++++++++++\n+HTTP/1.1 200 OK\n+Content-Length: 244\n+Content-Type: application/xml\n+Date: REGEX(.*)\n+\n+<?xml version=\"1.0\"?>\n+<updateContextResponse>\n+  <errorCode>\n+    <code>400</code>\n+    <reasonPhrase>Bad Request</reasonPhrase>\n+    <details>Bad value for XML attribute 'type' for 'level3': 'unknown attribute 'happy''</details>","path":"test/testharness/xmlParse/xmlParseComplexValues.test","position":386,"original_position":386,"commit_id":"29e3f7e1f44a4dbeac135540da28a2469f73b65f","original_commit_id":"29e3f7e1f44a4dbeac135540da28a2469f73b65f","user":{"login":"fgalan","id":1534240,"avatar_url":"https://gravatar.com/avatar/1936b0d16210811a2aa8de96295f0693?d=https%3A%2F%2Fidenticons.github.com%2F85e6a070e15f4ef503f07baf6d6ddba1.png&r=x","gravatar_id":"1936b0d16210811a2aa8de96295f0693","url":"https://api.github.com/users/fgalan","html_url":"https://github.com/fgalan","followers_url":"https://api.github.com/users/fgalan/followers","following_url":"https://api.github.com/users/fgalan/following{/other_user}","gists_url":"https://api.github.com/users/fgalan/gists{/gist_id}","starred_url":"https://api.github.com/users/fgalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgalan/subscriptions","organizations_url":"https://api.github.com/users/fgalan/orgs","repos_url":"https://api.github.com/users/fgalan/repos","events_url":"https://api.github.com/users/fgalan/events{/privacy}","received_events_url":"https://api.github.com/users/fgalan/received_events","type":"User","site_admin":false},"body":"I think that adding attributes (apart from `type`) is the complex value subtree is allowed. In that case, we just ignore them.","created_at":"2014-03-11T11:03:03Z","updated_at":"2014-03-11T11:03:03Z","html_url":"https://github.com/telefonicaid/fiware-orion/pull/267#discussion_r10468522","pull_request_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/267","_links":{"self":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/comments/10468522"},"html":{"href":"https://github.com/telefonicaid/fiware-orion/pull/267#discussion_r10468522"},"pull_request":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/267"}}}}