Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
if(!dojo._hasResource["dojox.data.tests.stores.HtmlTableStore"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2
dojo._hasResource["dojox.data.tests.stores.HtmlTableStore"] = true;
3
dojo.provide("dojox.data.tests.stores.HtmlTableStore");
4
dojo.require("dojox.data.HtmlTableStore");
5
dojo.require("dojo.data.api.Read");
6
dojo.require("dojo.data.api.Identity");
7
 
8
 
9
dojox.data.tests.stores.HtmlTableStore.getBooks2Store = function(){
10
	return new dojox.data.HtmlTableStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books2.html").toString(), tableId: "books2"});
11
};
12
 
13
dojox.data.tests.stores.HtmlTableStore.getBooksStore = function(){
14
	return new dojox.data.HtmlTableStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books.html").toString(), tableId: "books"});
15
};
16
 
17
doh.register("dojox.data.tests.stores.HtmlTableStore",
18
	[
19
/***************************************
20
     dojo.data.api.Read API
21
***************************************/
22
		function testReadAPI_fetch_all(t){
23
			//	summary:
24
			//		Simple test of fetching all xml items through an XML element called isbn
25
			//	description:
26
			//		Simple test of fetching all xml items through an XML element called isbn
27
			var store = dojox.data.tests.stores.HtmlTableStore.getBooksStore();
28
 
29
			var d = new doh.Deferred();
30
			function onComplete(items, request) {
31
				t.assertEqual(20, items.length);
32
				d.callback(true);
33
			}
34
			function onError(error, request) {
35
				d.errback(error);
36
			}
37
			store.fetch({query:{isbn:"*"}, onComplete: onComplete, onError: onError});
38
			return d; //Object
39
		},
40
		function testReadAPI_fetch_one(t){
41
			//	summary:
42
			//		Simple test of fetching one xml items through an XML element called isbn
43
			//	description:
44
			//		Simple test of fetching one xml items through an XML element called isbn
45
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
46
 
47
			var d = new doh.Deferred();
48
			function onComplete(items, request) {
49
				t.assertEqual(1, items.length);
50
				d.callback(true);
51
			}
52
			function onError(error, request) {
53
				d.errback(error);
54
			}
55
			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
56
			return d; //Object
57
		},
58
		function testReadAPI_fetch_paging(t){
59
			//	summary:
60
			//		Simple test of fetching one xml items through an XML element called isbn
61
			//	description:
62
			//		Simple test of fetching one xml items through an XML element called isbn
63
			var store = dojox.data.tests.stores.HtmlTableStore.getBooksStore();
64
 
65
			var d = new doh.Deferred();
66
			function dumpFirstFetch(items, request){
67
				t.assertEqual(5, items.length);
68
				request.start = 3;
69
				request.count = 1;
70
				request.onComplete = dumpSecondFetch;
71
				store.fetch(request);
72
			}
73
 
74
			function dumpSecondFetch(items, request){
75
				t.assertEqual(1, items.length);
76
				request.start = 0;
77
				request.count = 5;
78
				request.onComplete = dumpThirdFetch;
79
				store.fetch(request);
80
			}
81
 
82
			function dumpThirdFetch(items, request){
83
				t.assertEqual(5, items.length);
84
				request.start = 2;
85
				request.count = 20;
86
				request.onComplete = dumpFourthFetch;
87
				store.fetch(request);
88
			}
89
 
90
			function dumpFourthFetch(items, request){
91
				t.assertEqual(18, items.length);
92
				request.start = 9;
93
				request.count = 100;
94
				request.onComplete = dumpFifthFetch;
95
				store.fetch(request);
96
			}
97
 
98
			function dumpFifthFetch(items, request){
99
				t.assertEqual(11, items.length);
100
				request.start = 2;
101
				request.count = 20;
102
				request.onComplete = dumpSixthFetch;
103
				store.fetch(request);
104
			}
105
 
106
			function dumpSixthFetch(items, request){
107
				t.assertEqual(18, items.length);
108
				d.callback(true);
109
			}
110
 
111
			function completed(items, request){
112
				t.assertEqual(20, items.length);
113
				request.start = 1;
114
				request.count = 5;
115
				request.onComplete = dumpFirstFetch;
116
				store.fetch(request);
117
			}
118
 
119
			function error(errData, request){
120
				d.errback(errData);
121
			}
122
 
123
			store.fetch({onComplete: completed, onError: error});
124
			return d; //Object
125
		},
126
		function testReadAPI_fetch_pattern0(t){
127
			//	summary:
128
			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match
129
			//	description:
130
			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match
131
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
132
			var d = new doh.Deferred();
133
			function onComplete(items, request) {
134
				t.assertEqual(1, items.length);
135
				d.callback(true);
136
			}
137
			function onError(error, request) {
138
				d.errback(error);
139
			}
140
			store.fetch({query:{isbn:"?9B574"}, onComplete: onComplete, onError: onError});
141
			return d; //Object
142
		},
143
		function testReadAPI_fetch_pattern1(t){
144
			//	summary:
145
			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match
146
			//	description:
147
			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match
148
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
149
			var d = new doh.Deferred();
150
			function onComplete(items, request) {
151
				t.assertEqual(4, items.length);
152
				d.callback(true);
153
			}
154
			function onError(error, request) {
155
				d.errback(error);
156
			}
157
			store.fetch({query:{isbn:"A9B57?"}, onComplete: onComplete, onError: onError});
158
			return d; //Object
159
		},
160
		function testReadAPI_fetch_pattern2(t){
161
			//	summary:
162
			//		Simple test of fetching one xml items through an XML element called isbn with * pattern match
163
			//	description:
164
			//		Simple test of fetching one xml items through an XML element called isbn with * pattern match
165
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
166
			var d = new doh.Deferred();
167
			function onComplete(items, request) {
168
				t.assertEqual(5, items.length);
169
				d.callback(true);
170
			}
171
			function onError(error, request) {
172
				d.errback(error);
173
			}
174
			store.fetch({query:{isbn:"A9*"}, onComplete: onComplete, onError: onError});
175
			return d; //Object
176
		},
177
		function testReadAPI_fetch_pattern_caseInsensitive(t){
178
			//	summary:
179
			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case insensitive mode.
180
			//	description:
181
			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case insensitive mode.
182
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
183
			var d = new doh.Deferred();
184
			function onComplete(items, request) {
185
				t.assertEqual(1, items.length);
186
				d.callback(true);
187
			}
188
			function onError(error, request) {
189
				d.errback(error);
190
			}
191
			store.fetch({query:{isbn:"?9b574"}, queryOptions: {ignoreCase: true}, onComplete: onComplete, onError: onError});
192
			return d; //Object
193
		},
194
		function testReadAPI_fetch_pattern_caseSensitive(t){
195
			//	summary:
196
			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case sensitive mode.
197
			//	description:
198
			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case sensitive mode.
199
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
200
			var d = new doh.Deferred();
201
			function onComplete(items, request) {
202
				t.assertEqual(1, items.length);
203
				d.callback(true);
204
			}
205
			function onError(error, request) {
206
				d.errback(error);
207
			}
208
			store.fetch({query:{isbn:"?9B574"}, queryOptions: {ignoreCase: false}, onComplete: onComplete, onError: onError});
209
			return d; //Object
210
		},
211
		function testReadAPI_getLabel(t){
212
			//	summary:
213
			//		Simple test of the getLabel function against a store set that has a label defined.
214
			//	description:
215
			//		Simple test of the getLabel function against a store set that has a label defined.
216
 
217
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
218
 
219
			var d = new doh.Deferred();
220
			function onComplete(items, request){
221
				t.assertEqual(items.length, 1);
222
				var label = store.getLabel(items[0]);
223
				t.assertTrue(label !== null);
224
				t.assertEqual("Table Row #3", label);
225
				d.callback(true);
226
			}
227
			function onError(error, request) {
228
				d.errback(error);
229
			}
230
			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
231
			return d;
232
		},
233
		function testReadAPI_getLabelAttributes(t){
234
			//	summary:
235
			//		Simple test of the getLabelAttributes function against a store set that has a label defined.
236
			//	description:
237
			//		Simple test of the getLabelAttributes function against a store set that has a label defined.
238
 
239
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
240
 
241
			var d = new doh.Deferred();
242
			function onComplete(items, request){
243
				t.assertEqual(items.length, 1);
244
				var labelList = store.getLabelAttributes(items[0]);
245
				t.assertTrue(labelList === null);
246
				d.callback(true);
247
			}
248
			function onError(error, request) {
249
				d.errback(error);
250
			}
251
			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
252
			return d;
253
		},
254
 
255
		function testReadAPI_getValue(t){
256
			 //	summary:
257
			 //		Simple test of the getValue API
258
			 //	description:
259
			 //		Simple test of the getValue API
260
			 var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
261
 
262
			 var d = new doh.Deferred();
263
			 function onComplete(items, request) {
264
				 t.assertEqual(1, items.length);
265
				 var item = items[0];
266
				 t.assertTrue(store.hasAttribute(item,"isbn"));
267
				 t.assertEqual(store.getValue(item,"isbn"), "A9B574");
268
				 d.callback(true);
269
			 }
270
			 function onError(error, request) {
271
				 d.errback(error);
272
			 }
273
			 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
274
			 return d; //Object
275
		},
276
		function testReadAPI_getValues(t){
277
			 //	summary:
278
			 //		Simple test of the getValues API
279
			 //	description:
280
			 //		Simple test of the getValues API
281
			 var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
282
 
283
			 var d = new doh.Deferred();
284
			 function onComplete(items, request) {
285
				 t.assertEqual(1, items.length);
286
				 var item = items[0];
287
				 t.assertTrue(store.hasAttribute(item,"isbn"));
288
				 var values = store.getValues(item,"isbn");
289
				 t.assertEqual(1,values.length);
290
				 t.assertEqual("A9B574", values[0]);
291
				 d.callback(true);
292
			 }
293
			 function onError(error, request) {
294
				 d.errback(error);
295
			 }
296
			 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
297
			 return d; //Object
298
		},
299
		function testReadAPI_isItem(t){
300
			 //	summary:
301
			 //		Simple test of the isItem API
302
			 //	description:
303
			 //		Simple test of the isItem API
304
			 var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
305
 
306
			 var d = new doh.Deferred();
307
			 function onComplete(items, request) {
308
				t.assertEqual(1, items.length);
309
				var item = items[0];
310
				t.assertTrue(store.isItem(item));
311
				t.assertTrue(!store.isItem({}));
312
				t.assertTrue(!store.isItem("Foo"));
313
				t.assertTrue(!store.isItem(1));
314
				d.callback(true);
315
			 }
316
			 function onError(error, request) {
317
				 d.errback(error);
318
			 }
319
			 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
320
			 return d; //Object
321
		},
322
		function testReadAPI_isItem_multistore(t){
323
			//	summary:
324
			//		Simple test of the isItem API across multiple store instances.
325
			//	description:
326
			//		Simple test of the isItem API across multiple store instances.
327
			var store1 = dojox.data.tests.stores.HtmlTableStore.getBooksStore();
328
			var store2 = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
329
 
330
			var d = new doh.Deferred();
331
			function onComplete1(items, request) {
332
				t.assertEqual(1, items.length);
333
				var item1 = items[0];
334
				t.assertTrue(store1.isItem(item1));
335
 
336
				function onComplete2(items, request) {
337
					t.assertEqual(1, items.length);
338
					var item2 = items[0];
339
					t.assertTrue(store2.isItem(item2));
340
					t.assertTrue(!store1.isItem(item2));
341
					t.assertTrue(!store2.isItem(item1));
342
					d.callback(true);
343
				}
344
				store2.fetch({query:{isbn:"A9B574"}, onComplete: onComplete2, onError: onError});
345
			}
346
			function onError(error, request) {
347
				d.errback(error);
348
			}
349
			store1.fetch({query:{isbn:"1"}, onComplete: onComplete1, onError: onError});
350
			return d; //Object
351
		},
352
		function testReadAPI_hasAttribute(t){
353
			//	summary:
354
			//		Simple test of the hasAttribute API
355
			//	description:
356
			//		Simple test of the hasAttribute API
357
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
358
 
359
			var d = new doh.Deferred();
360
			function onComplete(items, request) {
361
				t.assertEqual(1, items.length);
362
				var item = items[0];
363
				t.assertTrue(store.hasAttribute(item,"isbn"));
364
				t.assertTrue(!store.hasAttribute(item,"bob"));
365
				d.callback(true);
366
			}
367
			function onError(error, request) {
368
				d.errback(error);
369
			}
370
			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
371
			return d; //Object
372
		},
373
		function testReadAPI_containsValue(t){
374
			//	summary:
375
			//		Simple test of the containsValue API
376
			//	description:
377
			//		Simple test of the containsValue API
378
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
379
 
380
			var d = new doh.Deferred();
381
			function onComplete(items, request) {
382
				t.assertEqual(1, items.length);
383
				var item = items[0];
384
				t.assertTrue(store.containsValue(item,"isbn", "A9B574"));
385
				t.assertTrue(!store.containsValue(item,"isbn", "bob"));
386
				d.callback(true);
387
			}
388
			function onError(error, request) {
389
				d.errback(error);
390
			}
391
			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
392
			return d; //Object
393
		},
394
		function testReadAPI_sortDescending(t){
395
			//	summary:
396
			//		Simple test of the sorting API in descending order.
397
			//	description:
398
			//		Simple test of the sorting API in descending order.
399
			var store = dojox.data.tests.stores.HtmlTableStore.getBooksStore();
400
 
401
			//Comparison is done as a string type (toString comparison), so the order won't be numeric
402
			//So have to compare in 'alphabetic' order.
403
			var order = [9,8,7,6,5,4,3,20,2,19,18,17,16,15,14,13,12,11,10,1];
404
 
405
			var d = new doh.Deferred();
406
			function onComplete(items, request) {
407
				t.assertEqual(20, items.length);
408
 
409
				for(var i = 0; i < items.length; i++){
410
					t.assertEqual(order[i], store.getValue(items[i],"isbn").toString());
411
				}
412
				d.callback(true);
413
			}
414
			function onError(error, request) {
415
				d.errback(error);
416
			}
417
 
418
			var sortAttributes = [{attribute: "isbn", descending: true}];
419
			store.fetch({query:{isbn:"*"}, sort: sortAttributes, onComplete: onComplete, onError: onError});
420
			return d; //Object
421
		},
422
		function testReadAPI_sortAscending(t){
423
			//	summary:
424
			//		Simple test of the sorting API in ascending order.
425
			//	description:
426
			//		Simple test of the sorting API in ascending order.
427
			var store = dojox.data.tests.stores.HtmlTableStore.getBooksStore();
428
 
429
			//Comparison is done as a string type (toString comparison), so the order won't be numeric
430
			//So have to compare in 'alphabetic' order.
431
			var order = [1,10,11,12,13,14,15,16,17,18,19,2,20,3,4,5,6,7,8,9];
432
 
433
			var d = new doh.Deferred();
434
			function onComplete(items, request) {
435
				t.assertEqual(20, items.length);
436
				var itemId = 1;
437
				for(var i = 0; i < items.length; i++){
438
					t.assertEqual(order[i], store.getValue(items[i],"isbn").toString());
439
				}
440
				d.callback(true);
441
			}
442
			function onError(error, request) {
443
				d.errback(error);
444
			}
445
 
446
			var sortAttributes = [{attribute: "isbn"}];
447
			store.fetch({query:{isbn:"*"}, sort: sortAttributes, onComplete: onComplete, onError: onError});
448
			return d; //Object
449
		},
450
		function testReadAPI_sortDescendingNumeric(t){
451
			//	summary:
452
			//		Simple test of the sorting API in descending order using a numeric comparator.
453
			//	description:
454
			//		Simple test of the sorting API in descending order using a numeric comparator.
455
			var store = dojox.data.tests.stores.HtmlTableStore.getBooksStore();
456
 
457
			//isbn should be treated as a numeric, not as a string comparison
458
			store.comparatorMap = {};
459
			store.comparatorMap["isbn"] = function(a, b){
460
				var ret = 0;
461
				if(parseInt(a.toString()) > parseInt(b.toString())){
462
					ret = 1;
463
				}else if(parseInt(a.toString()) < parseInt(b.toString())){
464
					ret = -1;
465
				}
466
				return ret; //int, {-1,0,1}
467
			};
468
 
469
			var d = new doh.Deferred();
470
			function onComplete(items, request) {
471
                		t.assertEqual(20, items.length);
472
                		var itemId = 20;
473
				for(var i = 0; i < items.length; i++){
474
					t.assertEqual(itemId, store.getValue(items[i],"isbn").toString());
475
					itemId--;
476
				}
477
				d.callback(true);
478
			}
479
			function onError(error, request) {
480
				d.errback(error);
481
			}
482
 
483
			var sortAttributes = [{attribute: "isbn", descending: true}];
484
			store.fetch({query:{isbn:"*"}, sort: sortAttributes, onComplete: onComplete, onError: onError});
485
			return d; //Object
486
		},
487
		function testReadAPI_sortAscendingNumeric(t){
488
			//	summary:
489
			//		Simple test of the sorting API in ascending order using a numeric comparator.
490
			//	description:
491
			//		Simple test of the sorting API in ascending order using a numeric comparator.
492
			var store = dojox.data.tests.stores.HtmlTableStore.getBooksStore();
493
 
494
			//isbn should be treated as a numeric, not as a string comparison
495
			store.comparatorMap = {};
496
			store.comparatorMap["isbn"] = function(a, b){
497
				var ret = 0;
498
				if(parseInt(a.toString()) > parseInt(b.toString())){
499
					ret = 1;
500
				}else if(parseInt(a.toString()) < parseInt(b.toString())){
501
					ret = -1;
502
				}
503
				return ret; //int, {-1,0,1}
504
			};
505
 
506
			var d = new doh.Deferred();
507
			function onComplete(items, request) {
508
				t.assertEqual(20, items.length);
509
				var itemId = 1;
510
				for(var i = 0; i < items.length; i++){
511
					t.assertEqual(itemId, store.getValue(items[i],"isbn").toString());
512
					itemId++;
513
				}
514
				d.callback(true);
515
			}
516
			function onError(error, request) {
517
				d.errback(error);
518
			}
519
 
520
			var sortAttributes = [{attribute: "isbn"}];
521
			store.fetch({query:{isbn:"*"}, sort: sortAttributes, onComplete: onComplete, onError: onError});
522
			return d; //Object
523
		},
524
		function testReadAPI_isItemLoaded(t){
525
			//	summary:
526
			//		Simple test of the isItemLoaded API
527
			//	description:
528
			//		Simple test of the isItemLoaded API
529
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
530
 
531
			var d = new doh.Deferred();
532
			function onComplete(items, request) {
533
				t.assertEqual(1, items.length);
534
				var item = items[0];
535
				t.assertTrue(store.isItemLoaded(item));
536
				d.callback(true);
537
			}
538
			function onError(error, request) {
539
				d.errback(error);
540
			}
541
			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
542
			return d; //Object
543
		},
544
		function testReadAPI_getFeatures(t){
545
			//	summary:
546
			//		Simple test of the getFeatures function of the store
547
			//	description:
548
			//		Simple test of the getFeatures function of the store
549
 
550
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
551
			var features = store.getFeatures();
552
			var count = 0;
553
			for(i in features){
554
				t.assertTrue((i === "dojo.data.api.Read" || i === "dojo.data.api.Identity"));
555
				count++;
556
			}
557
			t.assertEqual(2, count);
558
		},
559
		function testReadAPI_getAttributes(t){
560
			//	summary:
561
			//		Simple test of the getAttributes API
562
			//	description:
563
			//		Simple test of the getAttributes API
564
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
565
 
566
			var d = new doh.Deferred();
567
			function onComplete(items, request) {
568
				t.assertEqual(1, items.length);
569
				var item = items[0];
570
				var attributes = store.getAttributes(item);
571
				t.assertEqual(3,attributes.length);
572
				for(var i=0; i<attributes.length; i++){
573
					t.assertTrue((attributes[i] === "isbn" || attributes[i] === "title" || attributes[i] === "author"));
574
				}
575
				d.callback(true);
576
			}
577
			function onError(error, request) {
578
				d.errback(error);
579
			}
580
			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
581
			return d; //Object
582
		},
583
		function testReadAPI_functionConformance(t){
584
			//	summary:
585
			//		Simple test read API conformance.  Checks to see all declared functions are actual functions on the instances.
586
			//	description:
587
			//		Simple test read API conformance.  Checks to see all declared functions are actual functions on the instances.
588
 
589
			var testStore = dojox.data.tests.stores.HtmlTableStore.getBooksStore();
590
			var readApi = new dojo.data.api.Read();
591
			var passed = true;
592
 
593
			for(i in readApi){
594
				var member = readApi[i];
595
				//Check that all the 'Read' defined functions exist on the test store.
596
				if(typeof member === "function"){
597
					var testStoreMember = testStore[i];
598
					if(!(typeof testStoreMember === "function")){
599
						console.log("Problem with function: [" + i + "]");
600
						passed = false;
601
						break;
602
					}
603
				}
604
			}
605
			t.assertTrue(passed);
606
		},
607
/***************************************
608
     dojo.data.api.Identity API
609
***************************************/
610
		function testIdentityAPI_getIdentity(t){
611
			//	summary:
612
			//		Simple test of the getAttributes API
613
			//	description:
614
			//		Simple test of the getAttributes API
615
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
616
 
617
			var d = new doh.Deferred();
618
			function onComplete(items, request) {
619
				t.assertEqual(1, items.length);
620
				var item = items[0];
621
				t.assertEqual(3,store.getIdentity(item));
622
				d.callback(true);
623
			}
624
			function onError(error, request) {
625
				d.errback(error);
626
			}
627
			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
628
			return d; //Object
629
		},
630
		function testIdentityAPI_getIdentityAttributes(t){
631
			//	summary:
632
			//		Simple test of the getAttributes API
633
			//	description:
634
			//		Simple test of the getAttributes API
635
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
636
 
637
			var d = new doh.Deferred();
638
			function onComplete(items, request) {
639
				t.assertEqual(1, items.length);
640
				var item = items[0];
641
				//Should have none, as it's not a public attribute.
642
				var attributes = store.getIdentityAttributes(item);
643
				t.assertEqual(null, attributes);
644
				d.callback(true);
645
			}
646
			function onError(error, request) {
647
				d.errback(error);
648
			}
649
			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
650
			return d; //Object
651
		},
652
		function testIdentityAPI_fetchItemByIdentity(t){
653
			//	summary:
654
			//		Simple test of the fetchItemByIdentity API
655
			//	description:
656
			//		Simple test of the fetchItemByIdentity API
657
			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();
658
 
659
			var d = new doh.Deferred();
660
			function onItem(item, request) {
661
				t.assertTrue(item !== null);
662
				t.assertTrue(store.isItem(item));
663
				t.assertEqual("A9B574", store.getValue(item, "isbn"));
664
				d.callback(true);
665
			}
666
			function onError(error, request) {
667
				d.errback(error);
668
			}
669
			store.fetchItemByIdentity({identity: 3, onItem: onItem, onError: onError});
670
			return d; //Object
671
		},
672
		function testIdentityAPI_functionConformance(t){
673
			//	summary:
674
			//		Simple test identity API conformance.  Checks to see all declared functions are actual functions on the instances.
675
			//	description:
676
			//		Simple test identity API conformance.  Checks to see all declared functions are actual functions on the instances.
677
 
678
			var testStore = dojox.data.tests.stores.HtmlTableStore.getBooksStore();
679
			var identityApi = new dojo.data.api.Identity();
680
			var passed = true;
681
 
682
			for(i in identityApi){
683
				var member = identityApi[i];
684
				//Check that all the 'Read' defined functions exist on the test store.
685
				if(typeof member === "function"){
686
					var testStoreMember = testStore[i];
687
					if(!(typeof testStoreMember === "function")){
688
						console.log("Problem with function: [" + i + "]");
689
						passed = false;
690
						break;
691
					}
692
				}
693
			}
694
			t.assertTrue(passed);
695
		}
696
	]
697
);
698
 
699
//Register the remote tests ... when they work.
700
//doh.registerUrl("dojox.data.tests.stores.HtmlTableStore.remote", dojo.moduleUrl("dojox.data.tests", "ml/test_HtmlTableStore_declaratively.html"));
701
 
702
}