You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2014/08/20 09:53:27 UTC

[4/5] [OLINGO-407] JS- V4's window.OData is not defined yet: part 1 - change window.datajs.V4 into window.odatajs (while V3: window.datajs).

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/5c98f9f3/JSLib/tests/store-indexeddb-tests.js
----------------------------------------------------------------------
diff --git a/JSLib/tests/store-indexeddb-tests.js b/JSLib/tests/store-indexeddb-tests.js
index 76fbb30..6751363 100644
--- a/JSLib/tests/store-indexeddb-tests.js
+++ b/JSLib/tests/store-indexeddb-tests.js
@@ -58,14 +58,14 @@
         });
 
         djstest.addTest(function testIndexedDBStoreConstructor() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             djstest.assertAreEqual(store.name, getCurrentStoreName());
             djstest.assertAreEqual(store.mechanism, "indexeddb");
             djstest.done();
         });
 
         djstest.addTest(function testIndexedDBStoreAddGet() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add("key", "value", function (key, value) {
                 djstest.assertAreEqual(key, "key");
                 djstest.assertAreEqual(value, "value");
@@ -78,7 +78,7 @@
         });
 
         djstest.addTest(function testIndexedDBStoreAddUpdateGet() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add("key", "value", function (key, value) {
                 store.update("key", "value2", function (key, value) {
                     djstest.assertAreEqual(key, "key");
@@ -93,7 +93,7 @@
         });
 
         djstest.addTest(function testIndexedDBStoreAddOrUpdateGet() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.addOrUpdate("key", "value", function (key, value) {
                 djstest.assertAreEqual(key, "key");
                 djstest.assertAreEqual(value, "value");
@@ -110,7 +110,7 @@
         });
 
         djstest.addTest(function testIndexedDBStoreAddRemoveContains() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add("key", "value", function (key, value) {
                 store.contains("key", function (result) {
                     djstest.assert(result);
@@ -126,7 +126,7 @@
         });
 
         djstest.addTest(function testIndexedDBStoreAddConsecutiveGetAllKeys() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add("key", "value", function (key, value) {
                 store.add("key2", "value2", function (key, value) {
                     store.add("key3", "value3", function (key, value) {
@@ -142,7 +142,7 @@
         djstest.addTest(function testIndexedDBStoreAddArrayClear() {
             var addedKeys = ["key", "key2", "key3"];
             var addedValues = ["value", "value2", "value3"];
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add(addedKeys, addedValues, function (keys, values) {
                 djstest.assertAreEqualDeep(keys, addedKeys);
                 djstest.assertAreEqualDeep(values, addedValues);
@@ -158,7 +158,7 @@
         djstest.addTest(function testIndexedDBStoreAddArrayUpdateArrayGetArray() {
             var addedKeys = ["key", "key2", "key3"];
             var addedValues = ["value", "value2", "value3"];
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add(addedKeys, addedValues, function (keys, values) {
                 djstest.assertAreEqualDeep(keys, addedKeys);
                 djstest.assertAreEqualDeep(values, addedValues);
@@ -179,7 +179,7 @@
         djstest.addTest(function testIndexedDBStoreAddOrUpdateArrayGetArray() {
             var expectedKeys = ["key", "key2", "key3"];
             var expectedValues = ["value", "value2", "value3"];
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add("key2", "value", function (key, value) {
                 store.addOrUpdate(expectedKeys, expectedValues, function (keys, values) {
                     djstest.assertAreEqualDeep(keys, expectedKeys);
@@ -193,7 +193,7 @@
         });
 
         djstest.addTest(function testIndexedDBStoreAddDuplicate() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add("key", "value", function (key, value) {
                 store.add("key", "value2", unexpectedSuccess, function (err) {
                     djstest.pass("Error callback called as expected");
@@ -203,7 +203,7 @@
         });
 
         djstest.addTest(function testIndexedDBStoreAddArrayDuplicate() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add(["key", "key2", "key"], ["value", "value2", "value3"], unexpectedSuccess, function (err) {
                 djstest.pass("Error callback called as expected");
                 djstest.done();
@@ -211,7 +211,7 @@
         });
 
         djstest.addTest(function testIndexedDBStoreGetArrayNonExistent() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add("key", "value", function (key, value) {
                 store.read(["key", "badkey"], function (keys, values) {
                     djstest.assertAreEqualDeep(keys, ["key", "badkey"]);
@@ -222,7 +222,7 @@
         });
 
         djstest.addTest(function testIndexedDBStoreUpdateNonExistent() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.update("badkey", "badvalue", unexpectedSuccess, function (err) {
                 djstest.pass("Error callback called as expected");
                 djstest.done();
@@ -230,7 +230,7 @@
         });
 
         djstest.addTest(function testIndexedDBStoreUpdateArrayNonExistent() {
-            var store = this.store = window.datajs.IndexedDBStore.create(getCurrentStoreName());
+            var store = this.store = window.odatajs.IndexedDBStore.create(getCurrentStoreName());
             store.add("key", "value", function (key, value) {
                 store.update(["key", "badkey"], ["value", "badvalue"], unexpectedSuccess, function (err) {
                     djstest.pass("Error callback called as expected");

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/5c98f9f3/JSLib/tests/store-tests.js
----------------------------------------------------------------------
diff --git a/JSLib/tests/store-tests.js b/JSLib/tests/store-tests.js
index 1a05849..4bf6d3e 100644
--- a/JSLib/tests/store-tests.js
+++ b/JSLib/tests/store-tests.js
@@ -67,9 +67,9 @@
     };
 
     var mechanismImplementations = {
-        indexeddb: { factory: datajs.IndexedDBStore, canCreate: canCreateIndexedDb, cleanup: cleanIndexedDbStorage },
-        dom: { factory: datajs.DomStore, canCreate: canCreateDomStore, cleanup: cleanDomStorage },
-        memory: { factory: datajs.MemoryStore, canCreate: canCreateMemoryStore, cleanup: cleanMemoryStorage }
+        indexeddb: { factory: odatajs.IndexedDBStore, canCreate: canCreateIndexedDb, cleanup: cleanIndexedDbStorage },
+        dom: { factory: odatajs.DomStore, canCreate: canCreateDomStore, cleanup: cleanDomStorage },
+        memory: { factory: odatajs.MemoryStore, canCreate: canCreateMemoryStore, cleanup: cleanMemoryStorage }
     };
 
     var oldWindowOnError;
@@ -78,7 +78,7 @@
         module("Unit", {
             mechanism: mechanism,
             createStore: function (name) {
-                var store = datajs.createStore(name + "_" + this.mechanism, this.mechanism);
+                var store = odatajs.createStore(name + "_" + this.mechanism, this.mechanism);
                 this.stores.push(store);
                 return store;
             },
@@ -641,7 +641,7 @@
         for (i = 0, len = tests.length; i < len; i++) {
             try {
                 var test = tests[i];
-                var store = datajs.createStore("testStore" + i, tests[i].mechanism);
+                var store = odatajs.createStore("testStore" + i, tests[i].mechanism);
 
                 if (!test.exception) {
                     djstest.assertAreEqual(store.mechanism, test.expected, "Created store of the expected mechanism");
@@ -672,7 +672,7 @@
             ];
 
             for (var i in tests) {
-                var store = datajs.createStore("best store ever " + i, tests[i]);
+                var store = odatajs.createStore("best store ever " + i, tests[i]);
                 djstest.assertAreEqual(store.mechanism, bestMechanism, "Mechanisms match");
             }
         } else {

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/5c98f9f3/datajs/demo/scripts/datajs_demo.js
----------------------------------------------------------------------
diff --git a/datajs/demo/scripts/datajs_demo.js b/datajs/demo/scripts/datajs_demo.js
index e2b830d..dbbb5db 100644
--- a/datajs/demo/scripts/datajs_demo.js
+++ b/datajs/demo/scripts/datajs_demo.js
@@ -38,7 +38,7 @@ var runSimpleReadRequest = function() {
         alert("err");
         alert(JSON.stringify(err));
     };
-    datajs.V4.oData.read(request, successFunction, failFunction);
+    odatajs.oData.read(request, successFunction, failFunction);
 };
 
 var runSimpleReadRequestWithMetadata = function () {
@@ -65,7 +65,7 @@ var runSimpleReadRequestWithMetadata = function () {
             alert("err");
             alert(JSON.stringify(err));
         };
-        datajs.V4.oData.read(request, successFunction, failFunction, null, null, metadata);
+        odatajs.oData.read(request, successFunction, failFunction, null, null, metadata);
     };
 
     var readMetadataFail = function (err) {
@@ -82,7 +82,7 @@ var runSimpleReadRequestWithMetadata = function () {
         data: null,
     };
 
-    datajs.V4.oData.read(metadataRequest, readMetadataSuccess, readMetadataFail, datajs.V4.oData.metadataHandler);
+    odatajs.oData.read(metadataRequest, readMetadataSuccess, readMetadataFail, odatajs.V4.oData.metadataHandler);
 };
 
 var readWithJsonP = function() {

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/5c98f9f3/datajs/src/index.js
----------------------------------------------------------------------
diff --git a/datajs/src/index.js b/datajs/src/index.js
index dbe1e64..739e53f 100644
--- a/datajs/src/index.js
+++ b/datajs/src/index.js
@@ -17,15 +17,15 @@
  * under the License.
  */
 
-if ( window.datajs===undefined) {
-    window.datajs = {};
+if ( window.odatajs===undefined) {
+    window.odatajs = {};
 }
 
-window.datajs.V4 = require('./lib/datajs.js');
-window.datajs.V4.oData = require('./lib/odata.js');
+window.odatajs = require('./lib/datajs.js');
+window.odatajs.oData = require('./lib/odata.js');
 
-window.datajs.V4.store = require('./lib/store.js');
-window.datajs.V4.cache = require('./lib/cache.js');
+window.odatajs.store = require('./lib/store.js');
+window.odatajs.cache = require('./lib/cache.js');
 
 /*
 function extend(target) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/5c98f9f3/datajs/src/lib/cache.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/cache.js b/datajs/src/lib/cache.js
index 4afc5cc..1a7e3c2 100644
--- a/datajs/src/lib/cache.js
+++ b/datajs/src/lib/cache.js
@@ -20,9 +20,9 @@
  /** @module cache */
 
 var datajs = require('./datajs.js');
-var utils = datajs.utils;
-var deferred = datajs.deferred;
-var storeReq = datajs.store;
+var utils = odatajs.utils;
+var deferred = odatajs.deferred;
+var storeReq = odatajs.store;
 var cacheSource = require('./cache/source');
 
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/5c98f9f3/datajs/tests/cache-tests.js
----------------------------------------------------------------------
diff --git a/datajs/tests/cache-tests.js b/datajs/tests/cache-tests.js
index dc9fa4e..d5ceac9 100644
--- a/datajs/tests/cache-tests.js
+++ b/datajs/tests/cache-tests.js
@@ -34,7 +34,7 @@
     };
 
     djstest.addTest(function dataCacheCountTest() {
-        var cache = datajs.cache.createDataCache({ name: "cache", source: foodsFeed });
+        var cache = odatajs.cache.createDataCache({ name: "cache", source: foodsFeed });
         cache.count().then(function (count) {
             djstest.assertAreEqual(count, collectionSize, "expected count for Foods");
             djstest.destroyCacheAndDone(cache);
@@ -42,7 +42,7 @@
     });
 
     djstest.addTest(function dataCacheCountOnLocalTest() {
-        var cache = datajs.cache.createDataCache({ name: "cache", source: foodsFeed, pageSize: collectionSize + 10, mechanism: "memory" });
+        var cache = odatajs.cache.createDataCache({ name: "cache", source: foodsFeed, pageSize: collectionSize + 10, mechanism: "memory" });
         cache.readRange(0, collectionSize + 10).then(function (data) {
             var expectedCount = data.value ? data.value.length : 0;
             cache.count().then(function (count) {
@@ -54,7 +54,7 @@
 
     djstest.addTest(function dataCacheCountAbortTest() {
         // Abort before completion.
-        var cache = datajs.cache.createDataCache({ name: "cache", source: foodsFeed });
+        var cache = odatajs.cache.createDataCache({ name: "cache", source: foodsFeed });
         var item = cache.count().then(thenFailTest, function (err) {
             djstest.assertAreEqual(true, err.canceled, "err.aborted is true");
             djstest.destroyCacheAndDone(cache);
@@ -86,9 +86,9 @@
             }
         };
 
-        var cache = datajs.cache.createDataCache(options);
+        var cache = odatajs.cache.createDataCache(options);
         cache.clear().then(function () {
-            var newCache = datajs.cache.createDataCache(options);
+            var newCache = odatajs.cache.createDataCache(options);
             resolve(newCache);
         }, function (err) {
             rejected = true;
@@ -349,7 +349,7 @@
             then(function (cache) {
                 cache.readRange(0, 2).then(function () {
                     options.source = "HtTp://ExampleURI.cOm/my%20service.svc";
-                    var newCache = datajs.cache.createDataCache(options);
+                    var newCache = odatajs.cache.createDataCache(options);
                     newCache.readRange(0, 2).then(function (data) {
                         djstest.assertAreEqualDeep(data.value, [1, 2], "Got the expected data from the new cache instance");
                         newCache.clear().then(function () {
@@ -502,7 +502,7 @@
                 return null;
             }
         };
-        var cache = datajs.cache.createDataCache({
+        var cache = odatajs.cache.createDataCache({
             name: "mem", mechanism: "memory", source: "http://www.example.org/service/",
             httpClient: httpClient
         });
@@ -675,53 +675,53 @@
         var cache;
 
         // Verify the defaults.
-        cache = datajs.cache.createDataCache({ name: "name", source: "src" });
+        cache = odatajs.cache.createDataCache({ name: "name", source: "src" });
 
         djstest.assertAreEqual(cache.onidle, undefined, "onidle is undefined");
 
         // Verify specific values.
-        cache = datajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: 2, prefetchSize: 3, idle: 123 });
+        cache = odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: 2, prefetchSize: 3, idle: 123 });
 
         djstest.assertAreEqual(cache.onidle, 123, "onidle is as specified");
 
         // Verify 0 pageSize 
         djstest.expectException(function () {
-            datajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: 0, prefetchSize: 3, idle: 123 });
+            odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: 0, prefetchSize: 3, idle: 123 });
         }, "zero pageSize");
 
         // Verify negative pageSize
         djstest.expectException(function () {
-            datajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: -2, prefetchSize: 3, idle: 123 });
+            odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: -2, prefetchSize: 3, idle: 123 });
         }, "negative pageSize");
 
         // Verify NaN pageSize
         djstest.expectException(function () {
-            cache = datajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: "2", prefetchSize: 3, idle: 123 });
+            cache = odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: "2", prefetchSize: 3, idle: 123 });
         }, "NaN pageSize");
 
         // Verify NaN cacheSize
         djstest.expectException(function () {
-            cache = datajs.cache.createDataCache({ name: "name", source: "src", cacheSize: "1", pageSize: 2, prefetchSize: 3, idle: 123 });
+            cache = odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: "1", pageSize: 2, prefetchSize: 3, idle: 123 });
         }, "NaN cacheSize");
 
         // Verify NaN prefetchSize
         djstest.expectException(function () {
-            cache = datajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: 2, prefetchSize: "3", idle: 123 });
+            cache = odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: 2, prefetchSize: "3", idle: 123 });
         }, "NaN prefetchSize");
 
         // Verify undefined name 
         djstest.expectException(function () {
-            datajs.cache.createDataCache({ source: "src", cacheSize: 1, pageSize: 1, prefetchSize: 3, idle: 123 });
+            odatajs.cache.createDataCache({ source: "src", cacheSize: 1, pageSize: 1, prefetchSize: 3, idle: 123 });
         }, "undefined name");
 
         // Verify null name 
         djstest.expectException(function () {
-            datajs.cache.createDataCache({ name: null, source: "src", cacheSize: 1, pageSize: 1, prefetchSize: 3, idle: 123 });
+            odatajs.cache.createDataCache({ name: null, source: "src", cacheSize: 1, pageSize: 1, prefetchSize: 3, idle: 123 });
         }, "null name");
 
         // Verify undefined source 
         djstest.expectException(function () {
-            datajs.cache.createDataCache({ name: "name", cacheSize: 1, pageSize: 1, prefetchSize: 3, idle: 123 });
+            odatajs.cache.createDataCache({ name: "name", cacheSize: 1, pageSize: 1, prefetchSize: 3, idle: 123 });
         }, "undefined source");
 
         djstest.done();
@@ -747,7 +747,7 @@
             }
         };
 
-        var cache = datajs.cache.createDataCache({ name: "name", source: cacheSource, mechanism: "memory", pageSize: 10 });
+        var cache = odatajs.cache.createDataCache({ name: "name", source: cacheSource, mechanism: "memory", pageSize: 10 });
         cache.count().then(function () {
             cache.readRange(0, 5).then(function () {
                 djstest.done();
@@ -760,13 +760,13 @@
         var failures = ["read-settings", "write-settings", "v2"];
         var failureIndex = 0;
 
-        var originalStore = datajs.store.createStore;
+        var originalStore = odatajs.store.createStore;
         var restoreStore = function () {
-            datajs.store.createStore = originalStore;
+            odatajs.store.createStore = originalStore;
         };
 
         var storeError = { message: "cacheInitializationFailTest error" };
-        datajs.store.createStore = function (name, mechanism) {
+        odatajs.store.createStore = function (name, mechanism) {
             return {
                 addOrUpdate: function (key, value, successCallback, errorCallback) {
                     if (failures[failureIndex] === "write-settings") {
@@ -795,7 +795,7 @@
 
         var nextFailure = function () {
             djstest.log("Failure mode: " + failures[failureIndex]);
-            var cache = datajs.cache.createDataCache({ name: "name", source: "foo", mechanism: "memory", pageSize: 10 });
+            var cache = odatajs.cache.createDataCache({ name: "name", source: "foo", mechanism: "memory", pageSize: 10 });
             try {
                 // The first readRange should succeed, because the data cache isn't really initialized at this time.
                 cache.readRange(1, 2).then(djstest.failAndDoneCallback("No function should succeed"), function (err) {
@@ -854,7 +854,7 @@
             }
         };
 
-        var cache = datajs.cache.createDataCache({ name: "name", source: cacheSource, mechanism: "memory", pageSize: 10 });
+        var cache = odatajs.cache.createDataCache({ name: "name", source: cacheSource, mechanism: "memory", pageSize: 10 });
         cache.readRange(0, 5).then(function () {
             djstest.fail("unexpected call to then success");
             djstest.done();
@@ -975,7 +975,7 @@
 
     djstest.addTest(function createDeferredTest() {
         // Verify basic use of deferred object.
-        var deferred = datajs.deferred.createDeferred();
+        var deferred = odatajs.deferred.createDeferred();
         deferred.then(function (val1, val2) {
             djstest.assertAreEqual(val1, 1, "val1 is as specified");
             djstest.assertAreEqual(val2, 2, "val2 is as specified");
@@ -986,7 +986,7 @@
 
     djstest.addTest(function deferredThenTest() {
         // Verify then registration and chaining.
-        var deferred = datajs.deferred.createDeferred();
+        var deferred = odatajs.deferred.createDeferred();
         deferred.then(function (val1, val2) {
             djstest.assertAreEqual(val1, 1, "val1 is as specified");
             djstest.assertAreEqual(val2, 2, "val2 is as specified");
@@ -996,7 +996,7 @@
             djstest.assert(foo !== "foo", "argument for chained 'then' is *not* result of previous call");
             djstest.assert(foo === 1, "argument for chained 'then' is same as for previous call");
 
-            var other = datajs.deferred.createDeferred();
+            var other = odatajs.deferred.createDeferred();
             other.then(null, function (err, msg) {
                 djstest.assertAreEqual("error", err, "err is as specified");
                 djstest.assertAreEqual("message", msg, "msg is as specified");
@@ -1007,7 +1007,7 @@
                 djstest.assertAreEqual("error", err, "err is as specified");
                 djstest.assertAreEqual("message", msg, "msg is as specified");
 
-                var multiple = datajs.deferred.createDeferred();
+                var multiple = odatajs.deferred.createDeferred();
                 var count = 0;
 
                 // See Compatibility Note A in DjsDeferred remarks.
@@ -1037,12 +1037,12 @@
 
     djstest.addTest(function deferredResolveTest() {
         // Resolve with no arguments.
-        var deferred = datajs.deferred.createDeferred();
+        var deferred = odatajs.deferred.createDeferred();
         deferred.then(function (arg) {
             djstest.assertAreEqual(arg, undefined, "resolve with no args shows up as undefined");
 
             // Resolve with no callbacks.
-            var other = datajs.deferred.createDeferred();
+            var other = odatajs.deferred.createDeferred();
             other.resolve();
             djstest.done();
         });
@@ -1052,12 +1052,12 @@
 
     djstest.addTest(function deferredRejectTest() {
         // Resolve with no arguments.   
-        var deferred = datajs.deferred.createDeferred();
+        var deferred = odatajs.deferred.createDeferred();
         deferred.then(null, function (arg) {
             djstest.assertAreEqual(arg, undefined, "reject with no args shows up as undefined");
 
             // Resolve with no callbacks.
-            var other = datajs.deferred.createDeferred();
+            var other = odatajs.deferred.createDeferred();
             other.reject();
             djstest.done();
         });
@@ -1079,7 +1079,7 @@
         var i, len;
         for (i = 0, len = tests.length; i < len; i++) {
             var test = tests[i];
-            djstest.assertAreEqual(datajs.cache.estimateSize(test.i), test.e);
+            djstest.assertAreEqual(odatajs.cache.estimateSize(test.i), test.e);
         }
         djstest.done();
     });
@@ -1099,7 +1099,7 @@
             }
         });
 
-        var cache = datajs.cache.createDataCache({
+        var cache = odatajs.cache.createDataCache({
             name: "cacheOptionsTunnel",
             source: "http://foo-bar/",
             user: "the-user",
@@ -1121,7 +1121,7 @@
     djstest.addTest(function dataCacheHandlesFullStoreTest() {
 
         var TestStore = function (name) {
-            var that = new window.datajs.store.MemoryStore(name);
+            var that = new window.odatajs.store.MemoryStore(name);
             that.addOrUpdate = function (key, value, success, error) {
                 if (key === "__settings") {
                     window.setTimeout(function () {
@@ -1160,14 +1160,14 @@
             }
         };
 
-        var originalCreateStore = window.datajs.store.createStore;
+        var originalCreateStore = window.odatajs.store.createStore;
 
-        window.datajs.store.createStore = function (name, mechanism) {
+        window.odatajs.store.createStore = function (name, mechanism) {
             return TestStore(name);
         };
 
         try {
-            var cache = datajs.cache.createDataCache({
+            var cache = odatajs.cache.createDataCache({
                 name: "cache",
                 pageSize: 5,
                 prefetchSize: 0,
@@ -1175,7 +1175,7 @@
                 mechanism: "teststore"
             });
         } finally {
-            window.datajs.store.createStore = originalCreateStore;
+            window.odatajs.store.createStore = originalCreateStore;
         }
 
         cache.readRange(0, 5).then(function (data) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/5c98f9f3/datajs/tests/common/common.js
----------------------------------------------------------------------
diff --git a/datajs/tests/common/common.js b/datajs/tests/common/common.js
index cd764a9..f43fd99 100644
--- a/datajs/tests/common/common.js
+++ b/datajs/tests/common/common.js
@@ -17,10 +17,10 @@
  * under the License.
 */
 (function (window, undefined) {
-        window.OData = window.datajs.V4.oData;
-        window.temp = window.datajs.V4;
-        window.temp.store = window.datajs.V4.store;
-        window.temp.cache = window.datajs.V4.cache;
-        window.datajs = window.temp;
+        window.OData = window.odatajs.oData;
+        window.temp = window.odatajs;
+        window.temp.store = window.odatajs.store;
+        window.temp.cache = window.odatajs.cache;
+        window.odatajs = window.temp;
         delete window.temp;
 })(this);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/5c98f9f3/datajs/tests/datajs-cache-large-collection-functional-tests.js
----------------------------------------------------------------------
diff --git a/datajs/tests/datajs-cache-large-collection-functional-tests.js b/datajs/tests/datajs-cache-large-collection-functional-tests.js
index d3c9a87..02a9c1f 100644
--- a/datajs/tests/datajs-cache-large-collection-functional-tests.js
+++ b/datajs/tests/datajs-cache-large-collection-functional-tests.js
@@ -128,7 +128,7 @@
                         mechanism: params.mechanism, cacheSize: params.cacheSize
                     };
 
-                    var cache = datajs.cache.createDataCache(options);
+                    var cache = odatajs.cache.createDataCache(options);
                     this.caches.push({ name: options.name,
                         cache: cache
                     });
@@ -161,7 +161,7 @@
                             mechanism: params.mechanism, cacheSize: params.cacheSize
                         };
 
-                        var cache = datajs.cache.createDataCache(options);
+                        var cache = odatajs.cache.createDataCache(options);
                         this.caches.push({ name: options.name, cache: cache });
 
                         var cacheOracle = new CacheOracle(params.feed, params.pageSize, itemsInCollection);