diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-14 15:39:19 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-14 15:39:19 +0000 |
commit | 1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch) | |
tree | 3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojox/data/tests/stores/SnapLogicStore.js | |
parent | 104d59099e048688c4dbac37d72137006e396558 (diff) | |
download | semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.bz2 |
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/data/tests/stores/SnapLogicStore.js')
-rw-r--r-- | includes/js/dojox/data/tests/stores/SnapLogicStore.js | 438 |
1 files changed, 0 insertions, 438 deletions
diff --git a/includes/js/dojox/data/tests/stores/SnapLogicStore.js b/includes/js/dojox/data/tests/stores/SnapLogicStore.js deleted file mode 100644 index d544799..0000000 --- a/includes/js/dojox/data/tests/stores/SnapLogicStore.js +++ /dev/null @@ -1,438 +0,0 @@ -if(!dojo._hasResource["dojox.data.tests.stores.SnapLogicStore"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.data.tests.stores.SnapLogicStore"] = true; -dojo.provide("dojox.data.tests.stores.SnapLogicStore"); -dojo.require("dojox.data.SnapLogicStore"); -dojo.require("dojo.data.api.Read"); - -dojox.data.tests.stores.SnapLogicStore.pipelineUrl = dojo.moduleUrl("dojox.data.tests", "stores/snap_pipeline.php").toString(); -dojox.data.tests.stores.SnapLogicStore.pipelineSize = 14; -dojox.data.tests.stores.SnapLogicStore.attributes = ["empno", "ename", "job", "hiredate", "sal", "comm", "deptno"]; - -dojox.data.tests.stores.SnapLogicStore.error = function(t, d, errData){ - // summary: - // The error callback function to be used for all of the tests. - d.errback(errData); -} - -doh.register("dojox.data.tests.stores.SnapLogicStore", - [ - { - name: "ReadAPI: Fetch One", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Simple test of a basic fetch from a SnapLogic pipeline - // description: - // Simple test of a basic fetch from a SnapLogic pipeline - - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function onComplete(items, request){ - t.assertEqual(1, items.length); - d.callback(true); - } - store.fetch({ count: 1, - onComplete: onComplete, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, doh, d) - }); - return d; //Object - } - }, - { - name: "ReadAPI: Fetch_10_Streaming", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Simple test of a basic fetch on SnapLogic pipeline. - // description: - // Simple test of a basic fetch on SnapLogic pipeline. - - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - count = 0; - - function onBegin(size, requestObj){ - t.assertEqual(dojox.data.tests.stores.SnapLogicStore.pipelineSize, size); - } - function onItem(item, requestObj){ - t.assertTrue(store.isItem(item)); - count++; - } - function onComplete(items, request){ - t.assertEqual(10, count); - t.assertTrue(items === null); - d.callback(true); - } - - //Get everything... - store.fetch({ onBegin: onBegin, - count: 10, - onItem: onItem, - onComplete: onComplete, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, t, d) - }); - return d; //Object - } - }, - { - name: "ReadAPI: Fetch Zero", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Try fetching 0 records. A count of the items in the pipeline should be returned. - // description: - // Try fetching 0 records. A count of the items in the pipeline should be returned. - - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function onBegin(count, request){ - t.assertEqual(dojox.data.tests.stores.SnapLogicStore.pipelineSize, count); - d.callback(true); - } - store.fetch({ count: 0, - onBegin: onBegin, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, doh, d) - }); - return d; //Object - } - }, - { - name: "ReadAPI: Fetch_Paging", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Test of multiple fetches on a single result. Paging, if you will. - // description: - // Test of multiple fetches on a single result. Paging, if you will. - - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function dumpFirstFetch(items, request){ - t.assertEqual(request.count, items.length); - request.start = dojox.data.tests.stores.SnapLogicStore.pipelineSize / 3; - request.count = 1; - request.onComplete = dumpSecondFetch; - store.fetch(request); - } - - function dumpSecondFetch(items, request){ - t.assertEqual(1, items.length); - request.start = 0; - request.count = dojox.data.tests.stores.SnapLogicStore.pipelineSize / 2; - request.onComplete = dumpThirdFetch; - store.fetch(request); - } - - function dumpThirdFetch(items, request){ - t.assertEqual(request.count, items.length); - request.count = dojox.data.tests.stores.SnapLogicStore.pipelineSize * 2; - request.onComplete = dumpFourthFetch; - store.fetch(request); - } - - function dumpFourthFetch(items, request){ - t.assertEqual(dojox.data.tests.stores.SnapLogicStore.pipelineSize, items.length); - request.start = Math.floor(3 * dojox.data.tests.stores.SnapLogicStore.pipelineSize / 4); - request.count = dojox.data.tests.stores.SnapLogicStore.pipelineSize; - request.onComplete = dumpFifthFetch; - store.fetch(request); - } - - function dumpFifthFetch(items, request){ - t.assertEqual(dojox.data.tests.stores.SnapLogicStore.pipelineSize - request.start, items.length); - request.start = 2; - request.count = dojox.data.tests.stores.SnapLogicStore.pipelineSize * 10; - request.onComplete = dumpSixthFetch; - store.fetch(request); - } - - function dumpSixthFetch(items, request){ - t.assertEqual(dojox.data.tests.stores.SnapLogicStore.pipelineSize - request.start, items.length); - d.callback(true); - } - - store.fetch({ count: 5, - onComplete: dumpFirstFetch, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, t, d)}); - return d; //Object - } - }, - { - name: "ReadAPI: getLabel", - timeout: 3000, //3 seconds - runTest: function(t) { - // summary: - // Test that the label function returns undefined since it's not supported. - // description: - // Test that the label function returns undefined since it's not supported. - - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function onComplete(items, request){ - t.assertEqual(items.length, 1); - var label = store.getLabel(items[0]); - t.assertTrue(label === undefined); - d.callback(true); - } - store.fetch({ count: 1, - onComplete: onComplete, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, t, d) - }); - return d; - } - }, - { - name: "ReadAPI: getLabelAttributes", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Simple test of the getLabelAttributes returns null since it's not supported. - // description: - // Simple test of the getLabelAttributes returns null since it's not supported. - - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function onComplete(items, request){ - t.assertEqual(items.length, 1); - var labelList = store.getLabelAttributes(items[0]); - t.assertTrue(labelList === null); - d.callback(true); - } - store.fetch({ count: 1, - onComplete: onComplete, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, t, d) - }); - return d; - } - }, - { - name: "ReadAPI: getValue", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Simple test of the getValue function of the store. - // description: - // Simple test of the getValue function of the store. - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function completedAll(items){ - t.assertEqual(1, items.length); - console.debug(items[0]); - t.assertTrue(store.getValue(items[0], "empno") === 7369); - t.assertTrue(store.getValue(items[0], "ename") === "SMITH,CLERK"); - console.debug(store.getValue(items[0], "sal")); - t.assertTrue(store.getValue(items[0], "sal") == 800.00); - console.debug(1); - t.assertTrue(store.getValue(items[0], "deptno") === 20); - d.callback(true); - } - - store.fetch({ count: 1, - onComplete: completedAll, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, t, d)}); - return d; - } - }, - { - name: "ReadAPI: getValues", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Simple test of the getValue function of the store. - // description: - // Simple test of the getValue function of the store. - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function completedAll(items){ - t.assertEqual(1, items.length); - for(var i = 0; i < dojox.data.tests.stores.SnapLogicStore.attributes.length; ++i){ - var values = store.getValues(items[0], dojox.data.tests.stores.SnapLogicStore.attributes[i]); - t.assertTrue(dojo.isArray(values)); - t.assertTrue(values[0] === store.getValue(items[0], dojox.data.tests.stores.SnapLogicStore.attributes[i])); - } - d.callback(true); - } - - store.fetch({ count: 1, - onComplete: completedAll, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, t, d)}); - return d; - } - }, - { - name: "ReadAPI: isItem", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Simple test of the isItem function of the store - // description: - // Simple test of the isItem function of the store - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function completedAll(items){ - t.assertEqual(5, items.length); - for(var i=0; i < items.length; i++){ - t.assertTrue(store.isItem(items[i])); - } - d.callback(true); - } - - //Get everything... - store.fetch({ count: 5, - onComplete: completedAll, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, t, d)}); - return d; //Object - } - }, - { - name: "ReadAPI: hasAttribute", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Simple test of the hasAttribute function of the store - // description: - // Simple test of the hasAttribute function of the store - - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function onComplete(items){ - t.assertEqual(1, items.length); - t.assertTrue(items[0] !== null); - for(var i = 0; i < dojox.data.tests.stores.SnapLogicStore.attributes.length; ++i){ - t.assertTrue(store.hasAttribute(items[0], dojox.data.tests.stores.SnapLogicStore.attributes[i])); - } - t.assertTrue(!store.hasAttribute(items[0], "Nothing")); - t.assertTrue(!store.hasAttribute(items[0], "Text")); - - //Test that null attributes throw an exception - var passed = false; - try{ - store.hasAttribute(items[0], null); - }catch (e){ - passed = true; - } - t.assertTrue(passed); - d.callback(true); - } - - //Get one item... - store.fetch({ count: 1, - onComplete: onComplete, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, t, d) - }); - return d; //Object - } - }, - { - name: "ReadAPI: containsValue", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Simple test of the containsValue function of the store - // description: - // Simple test of the containsValue function of the store - - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function onComplete(items){ - t.assertEqual(1, items.length); - var value = store.getValue(items[0], "LastName"); - t.assertTrue(store.containsValue(items[0], "LastName", value)); - d.callback(true); - } - - //Get one item... - store.fetch({ count: 1, - onComplete: onComplete, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, t, d) - }); - return d; //Object - } - }, - { - name: "ReadAPI: getAttributes", - timeout: 3000, //3 seconds. - runTest: function(t) { - // summary: - // Simple test of the getAttributes function of the store - // description: - // Simple test of the getAttributes function of the store - - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var d = new doh.Deferred(); - function onComplete(items){ - t.assertEqual(1, items.length); - - var itemAttributes = store.getAttributes(items[0]); - t.assertEqual(dojox.data.tests.stores.SnapLogicStore.attributes.length, itemAttributes.length); - for(var i = 0; i < dojox.data.tests.stores.SnapLogicStore.attributes.length; ++i){ - t.assertTrue(dojo.indexOf(itemAttributes, dojox.data.tests.stores.SnapLogicStore.attributes[i]) !== -1); - } - d.callback(true); - } - - //Get everything... - store.fetch({ count: 1, - onComplete: onComplete, - onError: dojo.partial(dojox.data.tests.stores.SnapLogicStore.error, t, d)}); - return d; //Object - } - }, - function testReadAPI_getFeatures(t){ - // summary: - // Simple test of the getFeatures function of the store - // description: - // Simple test of the getFeatures function of the store - - var store = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - - var features = store.getFeatures(); - var count = 0; - for(var i in features){ - t.assertEqual(i, "dojo.data.api.Read"); - count++; - } - - t.assertEqual(count, 1); - }, - function testReadAPI_functionConformance(t){ - // summary: - // Simple test read API conformance. Checks to see all declared functions are actual functions on the instances. - // description: - // Simple test read API conformance. Checks to see all declared functions are actual functions on the instances. - - var testStore = new dojox.data.SnapLogicStore({url: dojox.data.tests.stores.SnapLogicStore.pipelineUrl}); - var readApi = new dojo.data.api.Read(); - var passed = true; - - for(var i in readApi){ - if(i.toString().charAt(0) !== '_'){ - var member = readApi[i]; - //Check that all the 'Read' defined functions exist on the test store. - if(typeof member === "function"){ - var testStoreMember = testStore[i]; - if(!(typeof testStoreMember === "function")){ - passed = false; - break; - } - } - } - } - t.assertTrue(passed); - } - ] -); - -} |