olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kobl...@apache.org
Subject git commit: [OLINGO-238] adopt tests/odata-json-light-tests.js tests/odata-metadata-tests.js tests/odata-xml-tests.js
Date Fri, 16 May 2014 13:03:11 GMT
Repository: olingo-odata4-js
Updated Branches:
  refs/heads/master 0367d2bcd -> 2bff67778


[OLINGO-238] adopt tests/odata-json-light-tests.js tests/odata-metadata-tests.js tests/odata-xml-tests.js


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/commit/2bff6777
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/tree/2bff6777
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/diff/2bff6777

Branch: refs/heads/master
Commit: 2bff6777807a4f82e7ab4a9663e92fbc130ff127
Parents: 0367d2b
Author: Sven Kobler <sven.kobler-morris@sap.com>
Authored: Fri May 16 15:02:25 2014 +0200
Committer: Sven Kobler <sven.kobler-morris@sap.com>
Committed: Fri May 16 15:02:25 2014 +0200

----------------------------------------------------------------------
 datajs/tests/odata-json-light-tests.js |  2 +-
 datajs/tests/odata-metadata-tests.js   | 18 ++++----
 datajs/tests/odata-qunit-tests.htm     |  4 +-
 datajs/tests/odata-xml-tests.js        | 70 ++++++++++++++---------------
 4 files changed, 47 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/2bff6777/datajs/tests/odata-json-light-tests.js
----------------------------------------------------------------------
diff --git a/datajs/tests/odata-json-light-tests.js b/datajs/tests/odata-json-light-tests.js
index a00e941..fa8d55b 100644
--- a/datajs/tests/odata-json-light-tests.js
+++ b/datajs/tests/odata-json-light-tests.js
@@ -293,7 +293,7 @@
     var verifyReadJsonLightData = function (input, expected, message, model) {
         var response = { headers: { "Content-Type": "application/json;odata.metadata=full",
DataServiceVersion: "4.0" }, body: JSON.stringify(input) };
 
-        OData.jsonHandler.read(response, { metadata: model });
+        OData.json.jsonHandler.read(response, { metadata: model });
         djstest.assertAreEqualDeep(response.data, expected, message);
     };
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/2bff6777/datajs/tests/odata-metadata-tests.js
----------------------------------------------------------------------
diff --git a/datajs/tests/odata-metadata-tests.js b/datajs/tests/odata-metadata-tests.js
index 85e96ed..ea41072 100644
--- a/datajs/tests/odata-metadata-tests.js
+++ b/datajs/tests/odata-metadata-tests.js
@@ -45,7 +45,7 @@
 
         var i, len;
         for (i = 0, len = cases.length; i < len; i++) {
-            djstest.assertAreEqual(window.OData.scriptCase(cases[i].i), cases[i].e, "processed
input matches expected value");
+            djstest.assertAreEqual(window.OData.metadata.scriptCase(cases[i].i), cases[i].e,
"processed input matches expected value");
         }
 
         djstest.done();
@@ -53,7 +53,7 @@
 
     djstest.addTest(function testGetChildSchema() {
         // Test cases as input parent / input element / result tuples.
-        var schema = window.OData.schema;
+        var schema = window.OData.metadata.schema;
         var cases = [
             { ip: schema.elements.EntityType, ie: "Property", e: { isArray: true, propertyName:
"property"} },
             { ip: schema.elements.EntityType, ie: "Key", e: { isArray: true, propertyName:
"key"} },
@@ -63,7 +63,7 @@
 
         var i, len;
         for (i = 0, len = cases.length; i < len; i++) {
-            var result = window.OData.getChildSchema(cases[i].ip, cases[i].ie);
+            var result = window.OData.metadata.getChildSchema(cases[i].ip, cases[i].ie);
             djstest.assertAreEqualDeep(result, cases[i].e, "getChildSchema matches target");
         }
 
@@ -411,8 +411,8 @@
 
         var i, len;
         for (i = 0, len = cases.length; i < len; i++) {
-            var doc = window.datajs.xmlParse(cases[i].i);
-            var schema = window.OData.parseConceptualModelElement(doc.documentElement);
+            var doc = window.datajs.xml.xmlParse(cases[i].i);
+            var schema = window.OData.metadata.parseConceptualModelElement(doc.documentElement);
             djstest.assertAreEqualDeep(schema, cases[i].e, "parseConceptualModelElement result
matches target");
         }
 
@@ -433,8 +433,8 @@
         '      </EntityType></Schema></edmx:DataServices></edmx:Edmx>';
 
 
-        var doc = window.datajs.xmlParse(testCsdl);
-        var schema = window.OData.parseConceptualModelElement(doc.documentElement);
+        var doc = window.datajs.xml.xmlParse(testCsdl);
+        var schema = window.OData.metadata.parseConceptualModelElement(doc.documentElement);
 
         djstest.assertAreEqual(schema.dataServices.schema[0].term.length, 2, "schema.DataServices.Schema.Term.length
=== 2");
         djstest.assertAreEqual(schema.dataServices.schema[0].term[0].name, "Rating", "schema.DataServices.Schema.Term[0].name
=== 'Rating'");
@@ -467,8 +467,8 @@
         '    </Schema></edmx:DataServices></edmx:Edmx>';
 
 
-        var doc = window.datajs.xmlParse(testCsdl);
-        var schema = window.OData.parseConceptualModelElement(doc.documentElement);
+        var doc = window.datajs.xml.xmlParse(testCsdl);
+        var schema = window.OData.metadata.parseConceptualModelElement(doc.documentElement);
 
         djstest.assertAreEqual(schema.dataServices.schema[0].annotations.length, 2, "Annotations
number");
         djstest.assertAreEqual(schema.dataServices.schema[0].annotations[0].annotation.length,
1, "Annotation number");

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/2bff6777/datajs/tests/odata-qunit-tests.htm
----------------------------------------------------------------------
diff --git a/datajs/tests/odata-qunit-tests.htm b/datajs/tests/odata-qunit-tests.htm
index b2bce5a..12c06c5 100644
--- a/datajs/tests/odata-qunit-tests.htm
+++ b/datajs/tests/odata-qunit-tests.htm
@@ -78,8 +78,8 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEAL
 <!--    <script type="text/javascript" src="odata-atom-tests.js"></script>-->
     <script type="text/javascript" src="odata-json-tests.js"></script>
 <!--    <script type="text/javascript" src="odata-json-light-tests.js"></script>-->
-<!--SK TODO enable    <script type="text/javascript" src="odata-metadata-tests.js"></script>-->
-<!--SK TODO enable    <script type="text/javascript" src="odata-xml-tests.js"></script>-->
+    <script type="text/javascript" src="odata-metadata-tests.js"></script>
+    <script type="text/javascript" src="odata-xml-tests.js"></script>
 <!--SK TODO enable    <script type="text/javascript" src="odata-handler-tests.js"></script>-->
 <!--SK TODO enable    <script type="text/javascript" src="odata-net-tests.js"></script>-->
 <!--SK TODO enable    <script type="text/javascript" src="odata-batch-tests.js"></script>-->

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/2bff6777/datajs/tests/odata-xml-tests.js
----------------------------------------------------------------------
diff --git a/datajs/tests/odata-xml-tests.js b/datajs/tests/odata-xml-tests.js
index 64605e8..a6f3ff9 100644
--- a/datajs/tests/odata-xml-tests.js
+++ b/datajs/tests/odata-xml-tests.js
@@ -24,7 +24,7 @@
 
         var i, len;
         for (i = 0, len = tests.length; i < len; i++) {
-            var actual = datajs.getURIInfo(tests[i].input);
+            var actual = datajs.utils.getURIInfo(tests[i].input);
             djstest.assertAreEqualDeep(actual, tests[i].expected, "test " + i + "didn't return
the expected URI parts");
         }
         djstest.done();
@@ -40,7 +40,7 @@
 
         var i, len;
         for (i = 0, len = tests.length; i < len; i++) {
-            var actual = datajs.normalizeURICase(tests[i].uri, tests[i].base);
+            var actual = datajs.utils.normalizeURICase(tests[i].uri, tests[i].base);
             djstest.assertAreEqual(actual, tests[i].expected, "test " + i + "didn't return
the expected URI");
         }
         djstest.done();
@@ -68,7 +68,7 @@
 
         var i, len;
         for (i = 0, len = tests.length; i < len; i++) {
-            var actual = datajs.normalizeURI(tests[i].uri, tests[i].base);
+            var actual = datajs.utils.normalizeURI(tests[i].uri, tests[i].base);
             djstest.assertAreEqual(actual, tests[i].expected, "test " + i + "didn't return
the expected normalized URI");
         }
         djstest.done();
@@ -76,7 +76,7 @@
 
     djstest.addTest(function xmlParseTest() {
         var xml = '<root xmlns:n1="http://namespace1" xml:base="http://base.org" />';
-        var root = datajs.xmlParse(xml);
+        var root = datajs.xml.xmlParse(xml);
         djstest.assert(root, "xml._parse didn't return a xml dom object");
         djstest.done();
     });
@@ -88,12 +88,12 @@
            <element base=\"this is not a xml base attribute\" /> \r\n\
          </root>\r\n";
 
-        var doc = datajs.xmlParse(xml);
-        var root = datajs.xmlFirstChildElement(doc);
-        var child = datajs.xmlFirstChildElement(root);
+        var doc = datajs.xml.xmlParse(xml);
+        var root = datajs.xml.xmlFirstChildElement(doc);
+        var child = datajs.xml.xmlFirstChildElement(root);
 
-        djstest.assertAreEqual(datajs.xmlBaseURI(root), "http://base.org", "xml._baseURI
didn't return the expected value");
-        djstest.assert(!datajs.xmlBaseURI(child), "xml._baseURI returned a value when it
wasn't expected");
+        djstest.assertAreEqual(datajs.xml.xmlBaseURI(root), "http://base.org", "xml._baseURI
didn't return the expected value");
+        djstest.assert(!datajs.xml.xmlBaseURI(child), "xml._baseURI returned a value when
it wasn't expected");
         djstest.done();
     });
 
@@ -104,13 +104,13 @@
         <element attribute=\"value\" n1:nsAttribute=\"nsValue\" /> \r\n\
      </root> \r\n";
 
-        var doc = datajs.xmlParse(xml);
-        var root = datajs.xmlFirstChildElement(doc);
-        var child = datajs.xmlFirstChildElement(root);
+        var doc = datajs.xml.xmlParse(xml);
+        var root = datajs.xml.xmlFirstChildElement(doc);
+        var child = datajs.xml.xmlFirstChildElement(root);
 
-        djstest.assertAreEqual(datajs.xmlAttributeValue(child, "attribute"), "value", "xml._attribute
didn't return the expected value for attribute");
-        djstest.assertAreEqual(datajs.xmlAttributeValue(child, "nsAttribute", "http://namespace1"),
"nsValue", "xml._attribute didn't return the expected value for nsAttribute");
-        djstest.assert(!datajs.xmlAttributeValue(child, "nsAttribute"), "xml._attribute returned
a value for nsAttribute without specifying a namespace");
+        djstest.assertAreEqual(datajs.xml.xmlAttributeValue(child, "attribute"), "value",
"xml._attribute didn't return the expected value for attribute");
+        djstest.assertAreEqual(datajs.xml.xmlAttributeValue(child, "nsAttribute", "http://namespace1"),
"nsValue", "xml._attribute didn't return the expected value for nsAttribute");
+        djstest.assert(!datajs.xml.xmlAttributeValue(child, "nsAttribute"), "xml._attribute
returned a value for nsAttribute without specifying a namespace");
 
         djstest.done();
     });
@@ -118,10 +118,10 @@
     djstest.addTest(function xmlLocalNameTest() {
         var xml = "<root xmlns:n1=\"http://namespace1\" /> \r\n";
 
-        var doc = datajs.xmlParse(xml);
-        var root = datajs.xmlFirstChildElement(doc);
+        var doc = datajs.xml.xmlParse(xml);
+        var root = datajs.xml.xmlFirstChildElement(doc);
 
-        djstest.assertAreEqual(datajs.xmlLocalName(root), "root", "xml._localName didn't
return the expected localName of the root element");
+        djstest.assertAreEqual(datajs.xml.xmlLocalName(root), "root", "xml._localName didn't
return the expected localName of the root element");
         djstest.done();
     });
 
@@ -134,11 +134,11 @@
          </root>\r\n";
 
 
-        var doc = datajs.xmlParse(xml);
-        var root = datajs.xmlFirstChildElement(doc);
-        var child = datajs.xmlFirstChildElement(root);
+        var doc = datajs.xml.xmlParse(xml);
+        var root = datajs.xml.xmlFirstChildElement(doc);
+        var child = datajs.xml.xmlFirstChildElement(root);
 
-        djstest.assertAreEqual(datajs.xmlLocalName(child), "element1", "xml.firstElement
returned didn't return the expected element");
+        djstest.assertAreEqual(datajs.xml.xmlLocalName(child), "element1", "xml.firstElement
returned didn't return the expected element");
         djstest.done();
     });
 
@@ -159,14 +159,14 @@
 
         var actual = [];
 
-        var doc = datajs.xmlParse(xml);
-        var root = datajs.xmlFirstChildElement(doc);
+        var doc = datajs.xml.xmlParse(xml);
+        var root = datajs.xml.xmlFirstChildElement(doc);
     
-        datajs.xmlChildElements(root, function (child) {
+        datajs.xml.xmlChildElements(root, function (child) {
             djstest.log("in child elements callback");
             actual.push({
-                localName: datajs.xmlLocalName(child),
-                nsURI: datajs.xmlNamespaceURI(child)
+                localName: datajs.xml.xmlLocalName(child),
+                nsURI: datajs.xml.xmlNamespaceURI(child)
             });
         });
 
@@ -190,15 +190,15 @@
 
         var actual = {};
 
-        var doc = datajs.xmlParse(xml);
-        var root = datajs.xmlFirstChildElement(doc);
+        var doc = datajs.xml.xmlParse(xml);
+        var root = datajs.xml.xmlFirstChildElement(doc);
 
-        datajs.xmlAttributes(root, function (attribute) {
+        datajs.xml.xmlAttributes(root, function (attribute) {
             djstest.log("in child elements callback");
-            var localName = datajs.xmlLocalName(attribute);
+            var localName = datajs.xml.xmlLocalName(attribute);
             actual[localName] = {
                 localName: localName, 
-                nsURI: datajs.xmlNamespaceURI(attribute),
+                nsURI: datajs.xml.xmlNamespaceURI(attribute),
                 value: attribute.value
             };
         });
@@ -224,7 +224,7 @@
 
         var i, len;
         for (i = 0, len = tests.length; i < len; i++) {
-            var result = datajs.hasLeadingOrTrailingWhitespace(tests[i].t);
+            var result = datajs.xml.hasLeadingOrTrailingWhitespace(tests[i].t);
             djstest.assertAreEqual(result, tests[i].r, "match for " + tests[i].t);
         }
 
@@ -247,8 +247,8 @@
         var i, len;
         for (i = 0, len = tests.length; i < len; i++) {
             var test = tests[i];
-            var doc = datajs.xmlParse(test.t);
-            var actual = datajs.xmlInnerText(doc);
+            var doc = datajs.xml.xmlParse(test.t);
+            var actual = datajs.xml.xmlInnerText(doc);
             djstest.assertAreEqual(actual, test.r, "test for [" + test.t + "]");
         }
 


Mime
View raw message