Fixed bug
[iotcloud.git] / version2 / src / java / iotcloud / Test.java
1 package iotcloud;
2
3 import java.util.List;
4 import java.util.ArrayList;
5
6 /**
7  * Test cases.
8  * @author Brian Demsky
9  * @version 1.0
10  */
11
12 public class Test {
13
14     public static final  int NUMBER_OF_TESTS = 15;
15
16     public static void main(String[] args)  throws ServerException {
17         if (args[0].equals("2")) {
18             test2();
19         } else if (args[0].equals("3")) {
20             test3();
21         } else if (args[0].equals("4")) {
22             test4();
23         } else if (args[0].equals("5")) {
24             test5();
25         } else if (args[0].equals("6")) {
26             test6();
27         } else if (args[0].equals("7")) {
28             test7();
29         } else if (args[0].equals("8")) {
30             test8();
31         } else if (args[0].equals("9")) {
32             test9();
33         } else if (args[0].equals("10")) {
34             test10();
35         } else if (args[0].equals("11")) {
36             test11();
37         }
38     }
39
40
41     static void test11() {
42
43         boolean foundError = false;
44         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
45
46         // Setup the 2 clients
47         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, 6000);
48
49         System.out.println("Init Table t1s");
50
51         while (true) {
52             try {
53                 t1.initTable();
54                 break;
55             } catch (Exception e) { }
56         }
57
58
59         System.out.println("Update Table t2");
60         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, 6001);
61         while (t2.update() == false) {}
62
63         // Make the Keys
64         System.out.println("Setting up keys");
65         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
66             System.out.println(i);
67
68             String a = "a" + i;
69             String b = "b" + i;
70             String c = "c" + i;
71             String d = "d" + i;
72             IoTString ia = new IoTString(a);
73             IoTString ib = new IoTString(b);
74             IoTString ic = new IoTString(c);
75             IoTString id = new IoTString(d);
76
77             while (true) {
78                 try {
79                     t1.createNewKey(ia, 321);
80                     break;
81                 } catch (Exception e) { }
82             }
83
84             while (true) {
85                 try {
86                     t1.createNewKey(ib, 351);
87                     break;
88                 } catch (Exception e) { }
89             }
90
91             while (true) {
92                 try {
93                     t2.createNewKey(ic, 321);
94                     break;
95                 } catch (Exception e) { }
96             }
97
98             while (true) {
99                 try {
100                     t2.createNewKey(id, 351);
101                     break;
102                 } catch (Exception e) { }
103             }
104         }
105
106         // Do Updates for the keys
107         System.out.println("Setting Key-Values...");
108         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
109             System.out.println(i);
110             String keyA = "a" + i;
111             String keyB = "b" + i;
112             String keyC = "c" + i;
113             String keyD = "d" + i;
114             String valueA = "a" + i;
115             String valueB = "b" + i;
116             String valueC = "c" + i;
117             String valueD = "d" + i;
118
119             IoTString iKeyA = new IoTString(keyA);
120             IoTString iKeyB = new IoTString(keyB);
121             IoTString iKeyC = new IoTString(keyC);
122             IoTString iKeyD = new IoTString(keyD);
123             IoTString iValueA = new IoTString(valueA);
124             IoTString iValueB = new IoTString(valueB);
125             IoTString iValueC = new IoTString(valueC);
126             IoTString iValueD = new IoTString(valueD);
127
128
129             String keyAPrev = "a" + (i - 1);
130             String keyBPrev = "b" + (i - 1);
131             String keyCPrev = "c" + (i - 1);
132             String keyDPrev = "d" + (i - 1);
133             String valueAPrev = "a" + (i - 1);
134             String valueBPrev = "b" + (i - 1);
135             String valueCPrev = "c" + (i - 1);
136             String valueDPrev = "d" + (i - 1);
137
138             IoTString iKeyAPrev = new IoTString(keyAPrev);
139             IoTString iKeyBPrev = new IoTString(keyBPrev);
140             IoTString iKeyCPrev = new IoTString(keyCPrev);
141             IoTString iKeyDPrev = new IoTString(keyDPrev);
142             IoTString iValueAPrev = new IoTString(valueAPrev);
143             IoTString iValueBPrev = new IoTString(valueBPrev);
144             IoTString iValueCPrev = new IoTString(valueCPrev);
145             IoTString iValueDPrev = new IoTString(valueDPrev);
146
147
148             System.out.println("t1 A");
149             t1.startTransaction();
150             t1.addKV(iKeyA, iValueA);
151             transStatusList.add(t1.commitTransaction());
152
153             System.out.println("t1 B");
154             t1.startTransaction();
155             t1.addKV(iKeyB, iValueB);
156             transStatusList.add(t1.commitTransaction());
157
158             System.out.println("t2 C");
159             t2.startTransaction();
160             t2.addKV(iKeyC, iValueC);
161             transStatusList.add(t2.commitTransaction());
162
163             System.out.println("t2 D");
164             t2.startTransaction();
165             t2.addKV(iKeyD, iValueD);
166             transStatusList.add(t2.commitTransaction());
167         }
168
169         System.out.println("Updating...");
170         while (t1.update() == false) {}
171         while (t2.update() == false) {}
172         while (t1.update() == false) {}
173         while (t2.update() == false) {}
174
175         System.out.println("Checking Key-Values...");
176         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
177
178             String keyA = "a" + i;
179             String keyB = "b" + i;
180             String keyC = "c" + i;
181             String keyD = "d" + i;
182             String valueA = "a" + i;
183             String valueB = "b" + i;
184             String valueC = "c" + i;
185             String valueD = "d" + i;
186
187             IoTString iKeyA = new IoTString(keyA);
188             IoTString iKeyB = new IoTString(keyB);
189             IoTString iKeyC = new IoTString(keyC);
190             IoTString iKeyD = new IoTString(keyD);
191             IoTString iValueA = new IoTString(valueA);
192             IoTString iValueB = new IoTString(valueB);
193             IoTString iValueC = new IoTString(valueC);
194             IoTString iValueD = new IoTString(valueD);
195
196
197             IoTString testValA1 = t1.getCommitted(iKeyA);
198             IoTString testValB1 = t1.getCommitted(iKeyB);
199             IoTString testValC1 = t1.getCommitted(iKeyC);
200             IoTString testValD1 = t1.getCommitted(iKeyD);
201
202             IoTString testValA2 = t2.getCommitted(iKeyA);
203             IoTString testValB2 = t2.getCommitted(iKeyB);
204             IoTString testValC2 = t2.getCommitted(iKeyC);
205             IoTString testValD2 = t2.getCommitted(iKeyD);
206
207             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
208                 System.out.println("Key-Value t1 incorrect: " + keyA + "    " + testValA1);
209                 foundError = true;
210             }
211
212             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
213                 System.out.println("Key-Value t1 incorrect: " + keyB + "    " + testValB1);
214                 foundError = true;
215             }
216
217             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
218                 System.out.println("Key-Value t1 incorrect: " + keyC + "    " + testValC1);
219                 foundError = true;
220             }
221
222             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
223                 System.out.println("Key-Value t1 incorrect: " + keyD + "    " + testValD1);
224                 foundError = true;
225             }
226
227
228             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
229                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
230                 foundError = true;
231             }
232
233             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
234                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
235                 foundError = true;
236             }
237
238             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
239                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
240                 foundError = true;
241             }
242
243             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
244                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
245                 foundError = true;
246             }
247         }
248
249         for (TransactionStatus status : transStatusList) {
250             if (status.getStatus() != TransactionStatus.StatusCommitted) {
251                 foundError = true;
252             }
253         }
254
255         if (foundError) {
256             System.out.println("Found Errors...");
257         } else {
258             System.out.println("No Errors Found...");
259         }
260
261         t1.close();
262         t2.close();
263     }
264
265     static void test10() {
266
267         boolean foundError = false;
268         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
269
270         // Setup the 2 clients
271         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, 6000);
272         System.out.println("Init Table t1s");
273         while (true) {
274             try {
275                 t1.initTable();
276                 break;
277             } catch (Exception e) { }
278         }
279         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, 6001);
280         while (t2.update() == false) {}
281
282         t1.addLocalCommunication(351, "127.0.0.1", 6001);
283         t2.addLocalCommunication(321, "127.0.0.1", 6000);
284
285
286         // Make the Keys
287         System.out.println("Setting up keys");
288         for (int i = 0; i < 4; i++) {
289             String a = "a" + i;
290             String b = "b" + i;
291             String c = "c" + i;
292             String d = "d" + i;
293             IoTString ia = new IoTString(a);
294             IoTString ib = new IoTString(b);
295             IoTString ic = new IoTString(c);
296             IoTString id = new IoTString(d);
297             while (true) {
298                 try {
299                     t1.createNewKey(ia, 321);
300                     break;
301                 } catch (Exception e) { }
302             }
303
304             while (true) {
305                 try {
306                     t1.createNewKey(ib, 351);
307                     break;
308                 } catch (Exception e) { }
309             }
310
311             while (true) {
312                 try {
313                     t2.createNewKey(ic, 321);
314                     break;
315                 } catch (Exception e) { }
316             }
317
318             while (true) {
319                 try {
320                     t2.createNewKey(id, 351);
321                     break;
322                 } catch (Exception e) { }
323             }
324         }
325
326
327         // Do Updates for the keys
328         System.out.println("B========================");
329         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
330             for (int i = 0; i < 4; i++) {
331
332                 System.out.println(i);
333
334                 String keyB = "b" + i;
335                 String valueB = "b" + (i + t);
336
337                 IoTString iKeyB = new IoTString(keyB);
338                 IoTString iValueB = new IoTString(valueB);
339
340                 t1.startTransaction();
341                 System.out.println(t1.getSpeculativeAtomic(iKeyB));
342                 t1.addKV(iKeyB, iValueB);
343                 transStatusList.add(t1.commitTransaction());
344             }
345         }
346         System.out.println();
347
348
349         System.out.println("C========================");
350         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
351             for (int i = 0; i < 4; i++) {
352                 System.out.println(i);
353
354                 String keyC = "c" + i;
355                 String valueC = "c" + (i + t);
356
357                 IoTString iKeyC = new IoTString(keyC);
358                 IoTString iValueC = new IoTString(valueC);
359
360                 t2.startTransaction();
361                 System.out.println(t2.getSpeculativeAtomic(iKeyC));
362                 t2.addKV(iKeyC, iValueC);
363                 transStatusList.add(t2.commitTransaction());
364             }
365         }
366         System.out.println();
367
368
369         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
370             for (int i = 0; i < 4; i++) {
371                 String keyA = "a" + i;
372                 String keyD = "d" + i;
373                 String valueA = "a" + (i + t);
374                 String valueD = "d" + (i + t);
375
376                 IoTString iKeyA = new IoTString(keyA);
377                 IoTString iKeyD = new IoTString(keyD);
378                 IoTString iValueA = new IoTString(valueA);
379                 IoTString iValueD = new IoTString(valueD);
380
381
382                 t1.startTransaction();
383                 t1.addKV(iKeyA, iValueA);
384                 transStatusList.add(t1.commitTransaction());
385
386
387                 t2.startTransaction();
388                 t2.addKV(iKeyD, iValueD);
389                 transStatusList.add(t2.commitTransaction());
390                 System.out.println();
391             }
392         }
393         System.out.println();
394
395         System.out.println("Updating...");
396         System.out.println("t1 -=-=-=-=-=-=-=-");
397         while (t1.update() == false) {}
398         System.out.println("t2 -=-=-=-=-=-=-=-");
399         while (t2.update() == false) {}
400         System.out.println("t1 -=-=-=-=-=-=-=-");
401         while (t1.update() == false) {}
402         System.out.println("t2 -=-=-=-=-=-=-=-");
403         while (t2.update() == false) {}
404
405
406         System.out.println("Checking Key-Values...");
407         for (int i = 0; i < 4; i++) {
408
409             String keyA = "a" + i;
410             String keyB = "b" + i;
411             String keyC = "c" + i;
412             String keyD = "d" + i;
413             String valueA = "a" + (i + NUMBER_OF_TESTS - 1);
414             String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
415             String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
416             String valueD = "d" + (i + NUMBER_OF_TESTS - 1);
417
418             IoTString iKeyA = new IoTString(keyA);
419             IoTString iKeyB = new IoTString(keyB);
420             IoTString iKeyC = new IoTString(keyC);
421             IoTString iKeyD = new IoTString(keyD);
422             IoTString iValueA = new IoTString(valueA);
423             IoTString iValueB = new IoTString(valueB);
424             IoTString iValueC = new IoTString(valueC);
425             IoTString iValueD = new IoTString(valueD);
426
427
428             IoTString testValA1 = t1.getCommitted(iKeyA);
429             IoTString testValB1 = t1.getCommitted(iKeyB);
430             IoTString testValC1 = t1.getCommitted(iKeyC);
431             IoTString testValD1 = t1.getCommitted(iKeyD);
432
433             IoTString testValA2 = t2.getCommitted(iKeyA);
434             IoTString testValB2 = t2.getCommitted(iKeyB);
435             IoTString testValC2 = t2.getCommitted(iKeyC);
436             IoTString testValD2 = t2.getCommitted(iKeyD);
437
438             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
439                 System.out.println("Key-Value t1 incorrect: " + keyA + "    " + testValA1);
440                 foundError = true;
441             }
442
443             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
444                 System.out.println("Key-Value t1 incorrect: " + keyB + "    " + testValB1);
445                 foundError = true;
446             }
447
448             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
449                 System.out.println("Key-Value t1 incorrect: " + keyC + "    " + testValC1);
450                 foundError = true;
451             }
452
453             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
454                 System.out.println("Key-Value t1 incorrect: " + keyD + "    " + testValD1);
455                 foundError = true;
456             }
457
458             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
459                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
460                 foundError = true;
461             }
462
463             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
464                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
465                 foundError = true;
466             }
467
468             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
469                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
470                 foundError = true;
471             }
472
473             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
474                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
475                 foundError = true;
476             }
477         }
478
479         int counter = 0;
480         for (TransactionStatus status : transStatusList) {
481             if (status.getStatus() != TransactionStatus.StatusCommitted) {
482                 foundError = true;
483                 System.out.println(counter + "    Status: " + status.getStatus());
484             }
485             counter++;
486         }
487
488         if (foundError) {
489             System.out.println("Found Errors...");
490         } else {
491             System.out.println("No Errors Found...");
492         }
493
494         t1.close();
495         t2.close();
496     }
497
498     static void test9() {
499
500         boolean foundError = false;
501         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
502
503         // Setup the 2 clients
504         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, 6000);
505
506         System.out.println("Init Table t1s");
507         while (true) {
508             try {
509                 t1.initTable();
510                 break;
511             } catch (Exception e) { }
512         }
513
514
515         System.out.println("Update Table t2");
516         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, 6001);
517         while (t2.update() == false) {}
518
519         t1.addLocalCommunication(351, "127.0.0.1", 6001);
520         t2.addLocalCommunication(321, "127.0.0.1", 6000);
521
522         // Make the Keys
523         System.out.println("Setting up keys");
524         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
525             System.out.println(i);
526
527             String a = "a" + i;
528             String b = "b" + i;
529             String c = "c" + i;
530             String d = "d" + i;
531             IoTString ia = new IoTString(a);
532             IoTString ib = new IoTString(b);
533             IoTString ic = new IoTString(c);
534             IoTString id = new IoTString(d);
535
536             while (true) {
537                 try {
538                     t1.createNewKey(ia, 321);
539                     break;
540                 } catch (Exception e) { }
541             }
542
543             while (true) {
544                 try {
545                     t1.createNewKey(ib, 351);
546                     break;
547                 } catch (Exception e) { }
548             }
549
550             while (true) {
551                 try {
552                     t2.createNewKey(ic, 321);
553                     break;
554                 } catch (Exception e) { }
555             }
556
557             while (true) {
558                 try {
559                     t2.createNewKey(id, 351);
560                     break;
561                 } catch (Exception e) { }
562             }
563         }
564
565         System.out.println("A, D...");
566         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
567             String keyA = "a" + i;
568             String keyD = "d" + i;
569             String valueA = "a" + i;
570             String valueD = "d" + i;
571
572             IoTString iKeyA = new IoTString(keyA);
573             IoTString iKeyD = new IoTString(keyD);
574             IoTString iValueA = new IoTString(valueA);
575             IoTString iValueD = new IoTString(valueD);
576
577             t1.startTransaction();
578             t1.addKV(iKeyA, iValueA);
579             transStatusList.add(t1.commitTransaction());
580
581             t2.startTransaction();
582             t2.addKV(iKeyD, iValueD);
583             transStatusList.add(t2.commitTransaction());
584         }
585
586         while (t1.updateFromLocal(351) == false) {}
587         while (t2.updateFromLocal(321) == false) {}
588
589
590         System.out.println("Updating...");
591         System.out.println("Checking Key-Values...");
592
593         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
594
595             String keyA = "a" + i;
596             String keyD = "d" + i;
597             String valueA = "a" + i;
598             String valueD = "d" + i;
599
600
601             IoTString iKeyA = new IoTString(keyA);
602             IoTString iKeyD = new IoTString(keyD);
603             IoTString iValueA = new IoTString(valueA);
604             IoTString iValueD = new IoTString(valueD);
605
606
607             IoTString testValA1 = t1.getCommitted(iKeyA);
608             IoTString testValD1 = t1.getCommitted(iKeyD);
609             IoTString testValA2 = t2.getCommitted(iKeyA);
610             IoTString testValD2 = t2.getCommitted(iKeyD);
611
612
613             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
614                 System.out.println("Key-Value t1 incorrect: " + keyA + "    " + testValA1);
615                 foundError = true;
616             }
617
618             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
619                 System.out.println("Key-Value t1 incorrect: " + keyD + "    " + testValD1);
620                 foundError = true;
621             }
622
623
624             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
625                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
626                 foundError = true;
627             }
628
629             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
630                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
631                 foundError = true;
632             }
633         }
634
635         for (TransactionStatus status : transStatusList) {
636             if (status.getStatus() != TransactionStatus.StatusCommitted) {
637                 foundError = true;
638             }
639         }
640
641         if (foundError) {
642             System.out.println("Found Errors...");
643         } else {
644             System.out.println("No Errors Found...");
645         }
646
647         t1.close();
648         t2.close();
649     }
650
651     static void test8() {
652
653         boolean foundError = false;
654         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
655
656         // Setup the 2 clients
657         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, 6000);
658
659         System.out.println("Init Table t1s");
660
661         while (true) {
662             try {
663                 t1.initTable();
664                 break;
665             } catch (Exception e) { }
666         }
667
668
669         System.out.println("Update Table t2");
670         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, 6001);
671         while (t2.update() == false) {}
672
673         t1.addLocalCommunication(351, "127.0.0.1", 6001);
674         t2.addLocalCommunication(321, "127.0.0.1", 6000);
675
676         // Make the Keys
677         System.out.println("Setting up keys");
678         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
679             System.out.println(i);
680
681             String a = "a" + i;
682             String b = "b" + i;
683             String c = "c" + i;
684             String d = "d" + i;
685             IoTString ia = new IoTString(a);
686             IoTString ib = new IoTString(b);
687             IoTString ic = new IoTString(c);
688             IoTString id = new IoTString(d);
689
690             while (true) {
691                 try {
692                     t1.createNewKey(ia, 321);
693                     break;
694                 } catch (Exception e) { }
695             }
696
697             while (true) {
698                 try {
699                     t1.createNewKey(ib, 351);
700                     break;
701                 } catch (Exception e) { }
702             }
703
704             while (true) {
705                 try {
706                     t2.createNewKey(ic, 321);
707                     break;
708                 } catch (Exception e) { }
709             }
710
711             while (true) {
712                 try {
713                     t2.createNewKey(id, 351);
714                     break;
715                 } catch (Exception e) { }
716             }
717         }
718
719         // Do Updates for the keys
720         System.out.println("Setting Key-Values...");
721         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
722             System.out.println(i);
723             String keyA = "a" + i;
724             String keyB = "b" + i;
725             String keyC = "c" + i;
726             String keyD = "d" + i;
727             String valueA = "a" + i;
728             String valueB = "b" + i;
729             String valueC = "c" + i;
730             String valueD = "d" + i;
731
732             IoTString iKeyA = new IoTString(keyA);
733             IoTString iKeyB = new IoTString(keyB);
734             IoTString iKeyC = new IoTString(keyC);
735             IoTString iKeyD = new IoTString(keyD);
736             IoTString iValueA = new IoTString(valueA);
737             IoTString iValueB = new IoTString(valueB);
738             IoTString iValueC = new IoTString(valueC);
739             IoTString iValueD = new IoTString(valueD);
740
741
742             String keyAPrev = "a" + (i - 1);
743             String keyBPrev = "b" + (i - 1);
744             String keyCPrev = "c" + (i - 1);
745             String keyDPrev = "d" + (i - 1);
746             String valueAPrev = "a" + (i - 1);
747             String valueBPrev = "b" + (i - 1);
748             String valueCPrev = "c" + (i - 1);
749             String valueDPrev = "d" + (i - 1);
750
751             IoTString iKeyAPrev = new IoTString(keyAPrev);
752             IoTString iKeyBPrev = new IoTString(keyBPrev);
753             IoTString iKeyCPrev = new IoTString(keyCPrev);
754             IoTString iKeyDPrev = new IoTString(keyDPrev);
755             IoTString iValueAPrev = new IoTString(valueAPrev);
756             IoTString iValueBPrev = new IoTString(valueBPrev);
757             IoTString iValueCPrev = new IoTString(valueCPrev);
758             IoTString iValueDPrev = new IoTString(valueDPrev);
759
760             t1.startTransaction();
761             t1.addKV(iKeyA, iValueA);
762             transStatusList.add(t1.commitTransaction());
763
764             t1.startTransaction();
765             t1.addKV(iKeyB, iValueB);
766             transStatusList.add(t1.commitTransaction());
767
768             t2.startTransaction();
769             t2.addKV(iKeyC, iValueC);
770             transStatusList.add(t2.commitTransaction());
771
772             t2.startTransaction();
773             t2.addKV(iKeyD, iValueD);
774             transStatusList.add(t2.commitTransaction());
775         }
776
777         System.out.println("Updating...");
778         while (t1.update() == false) {}
779         while (t2.update() == false) {}
780         while (t1.update() == false) {}
781         while (t2.update() == false) {}
782
783         System.out.println("Checking Key-Values...");
784         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
785
786             String keyA = "a" + i;
787             String keyB = "b" + i;
788             String keyC = "c" + i;
789             String keyD = "d" + i;
790             String valueA = "a" + i;
791             String valueB = "b" + i;
792             String valueC = "c" + i;
793             String valueD = "d" + i;
794
795             IoTString iKeyA = new IoTString(keyA);
796             IoTString iKeyB = new IoTString(keyB);
797             IoTString iKeyC = new IoTString(keyC);
798             IoTString iKeyD = new IoTString(keyD);
799             IoTString iValueA = new IoTString(valueA);
800             IoTString iValueB = new IoTString(valueB);
801             IoTString iValueC = new IoTString(valueC);
802             IoTString iValueD = new IoTString(valueD);
803
804
805             IoTString testValA1 = t1.getCommitted(iKeyA);
806             IoTString testValB1 = t1.getCommitted(iKeyB);
807             IoTString testValC1 = t1.getCommitted(iKeyC);
808             IoTString testValD1 = t1.getCommitted(iKeyD);
809
810             IoTString testValA2 = t2.getCommitted(iKeyA);
811             IoTString testValB2 = t2.getCommitted(iKeyB);
812             IoTString testValC2 = t2.getCommitted(iKeyC);
813             IoTString testValD2 = t2.getCommitted(iKeyD);
814
815             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
816                 System.out.println("Key-Value t1 incorrect: " + keyA + "    " + testValA1);
817                 foundError = true;
818             }
819
820             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
821                 System.out.println("Key-Value t1 incorrect: " + keyB + "    " + testValB1);
822                 foundError = true;
823             }
824
825             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
826                 System.out.println("Key-Value t1 incorrect: " + keyC + "    " + testValC1);
827                 foundError = true;
828             }
829
830             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
831                 System.out.println("Key-Value t1 incorrect: " + keyD + "    " + testValD1);
832                 foundError = true;
833             }
834
835
836             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
837                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
838                 foundError = true;
839             }
840
841             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
842                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
843                 foundError = true;
844             }
845
846             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
847                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
848                 foundError = true;
849             }
850
851             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
852                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
853                 foundError = true;
854             }
855         }
856
857         int count = 0;
858         for (TransactionStatus status : transStatusList) {
859             if (status.getStatus() != TransactionStatus.StatusCommitted) {
860                 foundError = true;
861                 System.out.println("Status: " + status.getStatus() + "   " + status.getTransactionSequenceNumber());
862             }
863
864             count++;
865         }
866
867         if (foundError) {
868             System.out.println("Found Errors...");
869         } else {
870             System.out.println("No Errors Found...");
871         }
872
873         t1.close();
874         t2.close();
875
876         System.out.println();
877         System.out.println();
878         t1.printSlots();
879
880         System.out.println();
881         System.out.println();
882         t2.printSlots();
883     }
884
885     static void test7() throws ServerException {
886
887         boolean foundError = false;
888         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
889
890         // Setup the 2 clients
891         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
892         t1.initTable();
893         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
894         t2.update();
895
896         // Make the Keys
897         System.out.println("Setting up keys");
898         for (int i = 0; i < 4; i++) {
899             String a = "a" + i;
900             String b = "b" + i;
901             String c = "c" + i;
902             String d = "d" + i;
903             IoTString ia = new IoTString(a);
904             IoTString ib = new IoTString(b);
905             IoTString ic = new IoTString(c);
906             IoTString id = new IoTString(d);
907             t1.createNewKey(ia, 321);
908             t1.createNewKey(ib, 351);
909             t2.createNewKey(ic, 321);
910             t2.createNewKey(id, 351);
911         }
912
913         // Do Updates for the keys
914         System.out.println("Setting Key-Values...");
915
916         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
917             for (int i = 0; i < 4; i++) {
918                 String keyB = "b" + i;
919                 String valueB = "b" + (i + t);
920
921                 IoTString iKeyB = new IoTString(keyB);
922                 IoTString iValueB = new IoTString(valueB);
923
924                 t1.startTransaction();
925                 t1.getSpeculativeAtomic(iKeyB);
926                 t1.addKV(iKeyB, iValueB);
927                 transStatusList.add(t1.commitTransaction());
928             }
929         }
930
931         for (int i = 0; i < 4; i++) {
932
933             String keyB = "b" + i;
934             String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
935             IoTString iKeyB = new IoTString(keyB);
936             IoTString iValueB = new IoTString(valueB);
937
938             IoTString testValB1 = t1.getSpeculative(iKeyB);
939             IoTString testValB2 = t2.getSpeculative(iKeyB);
940
941             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
942                 System.out.println("Key-Value t1 incorrect: " + keyB + "    " + testValB1);
943                 foundError = true;
944             }
945
946             if ((testValB2 != null)) {
947                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
948                 foundError = true;
949             }
950         }
951
952         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
953             for (int i = 0; i < 4; i++) {
954                 String keyC = "c" + i;
955                 String valueC = "c" + (i + t);
956
957                 IoTString iKeyC = new IoTString(keyC);
958                 IoTString iValueC = new IoTString(valueC);
959
960                 t2.startTransaction();
961                 t2.getSpeculativeAtomic(iKeyC);
962                 t2.addKV(iKeyC, iValueC);
963                 transStatusList.add(t2.commitTransaction());
964             }
965         }
966
967         for (int i = 0; i < 4; i++) {
968             String keyC = "c" + i;
969             String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
970             IoTString iKeyC = new IoTString(keyC);
971             IoTString iValueC = new IoTString(valueC);
972
973             IoTString testValC1 = t1.getSpeculative(iKeyC);
974             IoTString testValC2 = t2.getSpeculative(iKeyC);
975
976             if ((testValC1 != null)) {
977                 System.out.println("Key-Value t1 incorrect: " + keyC + "   " + testValC1);
978                 foundError = true;
979             }
980
981             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
982                 System.out.println("Key-Value t2 incorrect: " + keyC + "   " + testValC2);
983                 foundError = true;
984             }
985         }
986
987         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
988             for (int i = 0; i < 4; i++) {
989                 String keyA = "a" + i;
990                 String keyD = "d" + i;
991                 String valueA = "a" + (i + t);
992                 String valueD = "d" + (i + t);
993
994                 IoTString iKeyA = new IoTString(keyA);
995                 IoTString iKeyD = new IoTString(keyD);
996                 IoTString iValueA = new IoTString(valueA);
997                 IoTString iValueD = new IoTString(valueD);
998
999                 t1.startTransaction();
1000                 t1.addKV(iKeyA, iValueA);
1001                 transStatusList.add(t1.commitTransaction());
1002
1003                 t2.startTransaction();
1004                 t2.addKV(iKeyD, iValueD);
1005                 transStatusList.add(t2.commitTransaction());
1006             }
1007         }
1008
1009         System.out.println("Updating Clients...");
1010         t1.update();
1011         t2.update();
1012         t1.update();
1013         t2.update();
1014
1015         System.out.println("Checking Key-Values...");
1016         for (int i = 0; i < 4; i++) {
1017
1018             String keyA = "a" + i;
1019             String keyB = "b" + i;
1020             String keyC = "c" + i;
1021             String keyD = "d" + i;
1022             String valueA = "a" + (i + NUMBER_OF_TESTS - 1);
1023             String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
1024             String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
1025             String valueD = "d" + (i + NUMBER_OF_TESTS - 1);
1026
1027             IoTString iKeyA = new IoTString(keyA);
1028             IoTString iKeyB = new IoTString(keyB);
1029             IoTString iKeyC = new IoTString(keyC);
1030             IoTString iKeyD = new IoTString(keyD);
1031             IoTString iValueA = new IoTString(valueA);
1032             IoTString iValueB = new IoTString(valueB);
1033             IoTString iValueC = new IoTString(valueC);
1034             IoTString iValueD = new IoTString(valueD);
1035
1036
1037             IoTString testValA1 = t1.getCommitted(iKeyA);
1038             IoTString testValB1 = t1.getCommitted(iKeyB);
1039             IoTString testValC1 = t1.getCommitted(iKeyC);
1040             IoTString testValD1 = t1.getCommitted(iKeyD);
1041
1042             IoTString testValA2 = t2.getCommitted(iKeyA);
1043             IoTString testValB2 = t2.getCommitted(iKeyB);
1044             IoTString testValC2 = t2.getCommitted(iKeyC);
1045             IoTString testValD2 = t2.getCommitted(iKeyD);
1046
1047             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1048                 System.out.println("Key-Value t1 incorrect: " + keyA + "    " + testValA1);
1049                 foundError = true;
1050             }
1051
1052             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1053                 System.out.println("Key-Value t1 incorrect: " + keyB + "    " + testValB1);
1054                 foundError = true;
1055             }
1056
1057             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1058                 System.out.println("Key-Value t1 incorrect: " + keyC + "    " + testValC1);
1059                 foundError = true;
1060             }
1061
1062             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1063                 System.out.println("Key-Value t1 incorrect: " + keyD + "    " + testValD1);
1064                 foundError = true;
1065             }
1066
1067             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1068                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1069                 foundError = true;
1070             }
1071
1072             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1073                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1074                 foundError = true;
1075             }
1076
1077             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1078                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1079                 foundError = true;
1080             }
1081
1082             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1083                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1084                 foundError = true;
1085             }
1086         }
1087
1088         for (TransactionStatus status : transStatusList) {
1089             if (status.getStatus() != TransactionStatus.StatusCommitted) {
1090                 foundError = true;
1091             }
1092         }
1093
1094         if (foundError) {
1095             System.out.println("Found Errors...");
1096         } else {
1097             System.out.println("No Errors Found...");
1098         }
1099     }
1100
1101     static void test6() throws ServerException {
1102
1103         boolean foundError = false;
1104         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1105
1106         // Setup the 2 clients
1107         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
1108         t1.initTable();
1109         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
1110         t2.update();
1111
1112         // Make the Keys
1113         System.out.println("Setting up keys");
1114         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1115             String a = "a" + i;
1116             String b = "b" + i;
1117             String c = "c" + i;
1118             String d = "d" + i;
1119             IoTString ia = new IoTString(a);
1120             IoTString ib = new IoTString(b);
1121             IoTString ic = new IoTString(c);
1122             IoTString id = new IoTString(d);
1123             t1.createNewKey(ia, 321);
1124             t1.createNewKey(ib, 351);
1125             t2.createNewKey(ic, 321);
1126             t2.createNewKey(id, 351);
1127         }
1128
1129         // Do Updates for the keys
1130         System.out.println("Setting Key-Values...");
1131         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1132             String keyA = "a" + i;
1133             String keyB = "b" + i;
1134             String keyC = "c" + i;
1135             String keyD = "d" + i;
1136             String valueA = "a" + i;
1137             String valueB = "b" + i;
1138             String valueC = "c" + i;
1139             String valueD = "d" + i;
1140
1141             IoTString iKeyA = new IoTString(keyA);
1142             IoTString iKeyB = new IoTString(keyB);
1143             IoTString iKeyC = new IoTString(keyC);
1144             IoTString iKeyD = new IoTString(keyD);
1145             IoTString iValueA = new IoTString(valueA);
1146             IoTString iValueB = new IoTString(valueB);
1147             IoTString iValueC = new IoTString(valueC);
1148             IoTString iValueD = new IoTString(valueD);
1149
1150             t1.startTransaction();
1151             t1.getCommittedAtomic(iKeyA);
1152             t1.addKV(iKeyA, iValueA);
1153             transStatusList.add(t1.commitTransaction());
1154
1155             t1.startTransaction();
1156             t1.getCommittedAtomic(iKeyB);
1157             t1.addKV(iKeyB, iValueB);
1158             transStatusList.add(t1.commitTransaction());
1159
1160             t2.startTransaction();
1161             t2.getCommittedAtomic(iKeyC);
1162             t2.addKV(iKeyC, iValueC);
1163             transStatusList.add(t2.commitTransaction());
1164
1165             t2.startTransaction();
1166             t2.getCommittedAtomic(iKeyD);
1167             t2.addKV(iKeyD, iValueD);
1168             transStatusList.add(t2.commitTransaction());
1169         }
1170
1171         System.out.println("Updating Clients...");
1172         t1.update();
1173         t2.update();
1174
1175         System.out.println("Checking Key-Values...");
1176         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1177
1178             String keyA = "a" + i;
1179             String keyB = "b" + i;
1180             String keyC = "c" + i;
1181             String keyD = "d" + i;
1182             String valueA = "a" + i;
1183             String valueB = "b" + i;
1184             String valueC = "c" + i;
1185             String valueD = "d" + i;
1186
1187             IoTString iKeyA = new IoTString(keyA);
1188             IoTString iKeyB = new IoTString(keyB);
1189             IoTString iKeyC = new IoTString(keyC);
1190             IoTString iKeyD = new IoTString(keyD);
1191             IoTString iValueA = new IoTString(valueA);
1192             IoTString iValueB = new IoTString(valueB);
1193             IoTString iValueC = new IoTString(valueC);
1194             IoTString iValueD = new IoTString(valueD);
1195
1196
1197             IoTString testValA1 = t1.getCommitted(iKeyA);
1198             IoTString testValB1 = t1.getCommitted(iKeyB);
1199             IoTString testValC1 = t1.getCommitted(iKeyC);
1200             IoTString testValD1 = t1.getCommitted(iKeyD);
1201
1202             IoTString testValA2 = t2.getCommitted(iKeyA);
1203             IoTString testValB2 = t2.getCommitted(iKeyB);
1204             IoTString testValC2 = t2.getCommitted(iKeyC);
1205             IoTString testValD2 = t2.getCommitted(iKeyD);
1206
1207             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1208                 System.out.println("Key-Value t1 incorrect: " + keyA);
1209                 foundError = true;
1210             }
1211
1212             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1213                 System.out.println("Key-Value t1 incorrect: " + keyB);
1214                 foundError = true;
1215             }
1216
1217             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1218                 System.out.println("Key-Value t1 incorrect: " + keyC);
1219                 foundError = true;
1220             }
1221
1222             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1223                 System.out.println("Key-Value t1 incorrect: " + keyD);
1224                 foundError = true;
1225             }
1226
1227
1228             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1229                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1230                 foundError = true;
1231             }
1232
1233             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1234                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1235                 foundError = true;
1236             }
1237
1238             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1239                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1240                 foundError = true;
1241             }
1242
1243             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1244                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1245                 foundError = true;
1246             }
1247         }
1248
1249         for (TransactionStatus status : transStatusList) {
1250             if (status.getStatus() != TransactionStatus.StatusCommitted) {
1251                 foundError = true;
1252             }
1253         }
1254
1255         if (foundError) {
1256             System.out.println("Found Errors...");
1257         } else {
1258             System.out.println("No Errors Found...");
1259         }
1260     }
1261
1262     static void test5() throws ServerException {
1263
1264         boolean foundError = false;
1265         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1266
1267         // Setup the 2 clients
1268         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
1269         t1.initTable();
1270         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
1271         t2.update();
1272
1273
1274         // Make the Keys
1275         System.out.println("Setting up keys");
1276         for (int i = 0; i < 4; i++) {
1277             String a = "a" + i;
1278             String b = "b" + i;
1279             String c = "c" + i;
1280             String d = "d" + i;
1281             IoTString ia = new IoTString(a);
1282             IoTString ib = new IoTString(b);
1283             IoTString ic = new IoTString(c);
1284             IoTString id = new IoTString(d);
1285             t1.createNewKey(ia, 321);
1286             t1.createNewKey(ib, 351);
1287             t2.createNewKey(ic, 321);
1288             t2.createNewKey(id, 351);
1289         }
1290
1291         // Do Updates for the keys
1292         System.out.println("Setting Key-Values...");
1293
1294         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1295             for (int i = 0; i < 4; i++) {
1296                 String keyB = "b" + i;
1297                 String valueB = "b" + (i + t);
1298
1299                 IoTString iKeyB = new IoTString(keyB);
1300                 IoTString iValueB = new IoTString(valueB);
1301
1302                 t1.startTransaction();
1303                 t1.addKV(iKeyB, iValueB);
1304                 transStatusList.add(t1.commitTransaction());
1305             }
1306         }
1307
1308         for (int i = 0; i < 4; i++) {
1309
1310             String keyB = "b" + i;
1311             String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
1312             IoTString iKeyB = new IoTString(keyB);
1313             IoTString iValueB = new IoTString(valueB);
1314
1315             IoTString testValB1 = t1.getSpeculative(iKeyB);
1316             IoTString testValB2 = t2.getSpeculative(iKeyB);
1317
1318             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1319                 System.out.println("Key-Value t1 incorrect: " + keyB);
1320                 foundError = true;
1321             }
1322
1323             if ((testValB2 != null)) {
1324                 System.out.println("Key-Value t2 incorrect: " + keyB);
1325                 foundError = true;
1326             }
1327         }
1328
1329         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1330             for (int i = 0; i < 4; i++) {
1331                 String keyC = "c" + i;
1332                 String valueC = "c" + (i + t);
1333
1334                 IoTString iKeyC = new IoTString(keyC);
1335                 IoTString iValueC = new IoTString(valueC);
1336
1337                 t2.startTransaction();
1338                 t2.addKV(iKeyC, iValueC);
1339                 transStatusList.add(t2.commitTransaction());
1340             }
1341         }
1342
1343         for (int i = 0; i < 4; i++) {
1344             String keyC = "c" + i;
1345             String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
1346             IoTString iKeyC = new IoTString(keyC);
1347             IoTString iValueC = new IoTString(valueC);
1348
1349             IoTString testValC1 = t1.getSpeculative(iKeyC);
1350             IoTString testValC2 = t2.getSpeculative(iKeyC);
1351
1352             if ((testValC1 != null)) {
1353                 System.out.println("Key-Value t1 incorrect: " + keyC + "   " + testValC1);
1354                 foundError = true;
1355             }
1356
1357             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1358                 System.out.println("Key-Value t2 incorrect: " + keyC + "   " + testValC2);
1359                 foundError = true;
1360             }
1361         }
1362
1363         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1364             for (int i = 0; i < 4; i++) {
1365                 String keyA = "a" + i;
1366                 String keyD = "d" + i;
1367                 String valueA = "a" + (i + t);
1368                 String valueD = "d" + (i + t);
1369
1370                 IoTString iKeyA = new IoTString(keyA);
1371                 IoTString iKeyD = new IoTString(keyD);
1372                 IoTString iValueA = new IoTString(valueA);
1373                 IoTString iValueD = new IoTString(valueD);
1374
1375                 t1.startTransaction();
1376                 t1.addKV(iKeyA, iValueA);
1377                 transStatusList.add(t1.commitTransaction());
1378
1379                 t2.startTransaction();
1380                 t2.addKV(iKeyD, iValueD);
1381                 transStatusList.add(t2.commitTransaction());
1382             }
1383         }
1384
1385         System.out.println("Updating Clients...");
1386         t1.update();
1387         t2.update();
1388
1389
1390         System.out.println("Checking Key-Values...");
1391         for (int i = 0; i < 4; i++) {
1392
1393             String keyA = "a" + i;
1394             String keyB = "b" + i;
1395             String keyC = "c" + i;
1396             String keyD = "d" + i;
1397             String valueA = "a" + (i + NUMBER_OF_TESTS - 1);
1398             String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
1399             String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
1400             String valueD = "d" + (i + NUMBER_OF_TESTS - 1);
1401
1402             IoTString iKeyA = new IoTString(keyA);
1403             IoTString iKeyB = new IoTString(keyB);
1404             IoTString iKeyC = new IoTString(keyC);
1405             IoTString iKeyD = new IoTString(keyD);
1406             IoTString iValueA = new IoTString(valueA);
1407             IoTString iValueB = new IoTString(valueB);
1408             IoTString iValueC = new IoTString(valueC);
1409             IoTString iValueD = new IoTString(valueD);
1410
1411
1412             IoTString testValA1 = t1.getCommitted(iKeyA);
1413             IoTString testValB1 = t1.getCommitted(iKeyB);
1414             IoTString testValC1 = t1.getCommitted(iKeyC);
1415             IoTString testValD1 = t1.getCommitted(iKeyD);
1416
1417             IoTString testValA2 = t2.getCommitted(iKeyA);
1418             IoTString testValB2 = t2.getCommitted(iKeyB);
1419             IoTString testValC2 = t2.getCommitted(iKeyC);
1420             IoTString testValD2 = t2.getCommitted(iKeyD);
1421
1422             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1423                 System.out.println("Key-Value t1 incorrect: " + keyA + "    " + testValA1);
1424                 foundError = true;
1425             }
1426
1427             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1428                 System.out.println("Key-Value t1 incorrect: " + keyB + "    " + testValB1);
1429                 foundError = true;
1430             }
1431
1432             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1433                 System.out.println("Key-Value t1 incorrect: " + keyC + "    " + testValC1);
1434                 foundError = true;
1435             }
1436
1437             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1438                 System.out.println("Key-Value t1 incorrect: " + keyD + "    " + testValD1);
1439                 foundError = true;
1440             }
1441
1442
1443             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1444                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1445                 foundError = true;
1446             }
1447
1448             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1449                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1450                 foundError = true;
1451             }
1452
1453             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1454                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1455                 foundError = true;
1456             }
1457
1458             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1459                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1460                 foundError = true;
1461             }
1462         }
1463
1464         for (TransactionStatus status : transStatusList) {
1465             if (status.getStatus() != TransactionStatus.StatusCommitted) {
1466                 foundError = true;
1467             }
1468         }
1469
1470         if (foundError) {
1471             System.out.println("Found Errors...");
1472         } else {
1473             System.out.println("No Errors Found...");
1474         }
1475     }
1476
1477     static void test4() throws ServerException {
1478
1479         boolean foundError = false;
1480         long startTime = 0;
1481         long endTime = 0;
1482         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1483
1484         // Setup the 2 clients
1485         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
1486         t1.initTable();
1487         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
1488         t2.update();
1489
1490         // Make the Keys
1491         System.out.println("Setting up keys");
1492         startTime = System.currentTimeMillis();
1493         for (int i = 0; i < 4; i++) {
1494             String a = "a" + i;
1495             String b = "b" + i;
1496             String c = "c" + i;
1497             String d = "d" + i;
1498             IoTString ia = new IoTString(a);
1499             IoTString ib = new IoTString(b);
1500             IoTString ic = new IoTString(c);
1501             IoTString id = new IoTString(d);
1502             t1.createNewKey(ia, 321);
1503             t1.createNewKey(ib, 351);
1504             t2.createNewKey(ic, 321);
1505             t2.createNewKey(id, 351);
1506         }
1507         endTime = System.currentTimeMillis();
1508         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1509         System.out.println("Time Taken Per Key: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4))   );
1510         System.out.println();
1511
1512
1513         // Do Updates for the keys
1514         System.out.println("Setting Key-Values...");
1515         startTime = System.currentTimeMillis();
1516         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1517             for (int i = 0; i < 4; i++) {
1518                 String keyA = "a" + i;
1519                 String keyB = "b" + i;
1520                 String keyC = "c" + i;
1521                 String keyD = "d" + i;
1522                 String valueA = "a" + i;
1523                 String valueB = "b" + i;
1524                 String valueC = "c" + i;
1525                 String valueD = "d" + i;
1526
1527                 IoTString iKeyA = new IoTString(keyA);
1528                 IoTString iKeyB = new IoTString(keyB);
1529                 IoTString iKeyC = new IoTString(keyC);
1530                 IoTString iKeyD = new IoTString(keyD);
1531                 IoTString iValueA = new IoTString(valueA);
1532                 IoTString iValueB = new IoTString(valueB);
1533                 IoTString iValueC = new IoTString(valueC);
1534                 IoTString iValueD = new IoTString(valueD);
1535
1536                 t1.startTransaction();
1537                 t1.addKV(iKeyA, iValueA);
1538                 transStatusList.add(t1.commitTransaction());
1539
1540                 t1.startTransaction();
1541                 t1.addKV(iKeyB, iValueB);
1542                 transStatusList.add(t1.commitTransaction());
1543
1544                 t2.startTransaction();
1545                 t2.addKV(iKeyC, iValueC);
1546                 transStatusList.add(t2.commitTransaction());
1547
1548                 t2.startTransaction();
1549                 t2.addKV(iKeyD, iValueD);
1550                 transStatusList.add(t2.commitTransaction());
1551             }
1552         }
1553         endTime = System.currentTimeMillis();
1554         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1555         System.out.println("Time Taken Per Update: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 16))   );
1556         System.out.println();
1557
1558
1559         System.out.println("Updating Clients...");
1560         t1.update();
1561         t2.update();
1562
1563
1564         System.out.println("Checking Key-Values...");
1565         for (int i = 0; i < 4; i++) {
1566
1567             String keyA = "a" + i;
1568             String keyB = "b" + i;
1569             String keyC = "c" + i;
1570             String keyD = "d" + i;
1571             String valueA = "a" + i;
1572             String valueB = "b" + i;
1573             String valueC = "c" + i;
1574             String valueD = "d" + i;
1575
1576             IoTString iKeyA = new IoTString(keyA);
1577             IoTString iKeyB = new IoTString(keyB);
1578             IoTString iKeyC = new IoTString(keyC);
1579             IoTString iKeyD = new IoTString(keyD);
1580             IoTString iValueA = new IoTString(valueA);
1581             IoTString iValueB = new IoTString(valueB);
1582             IoTString iValueC = new IoTString(valueC);
1583             IoTString iValueD = new IoTString(valueD);
1584
1585
1586             IoTString testValA1 = t1.getCommitted(iKeyA);
1587             IoTString testValB1 = t1.getCommitted(iKeyB);
1588             IoTString testValC1 = t1.getCommitted(iKeyC);
1589             IoTString testValD1 = t1.getCommitted(iKeyD);
1590
1591             IoTString testValA2 = t2.getCommitted(iKeyA);
1592             IoTString testValB2 = t2.getCommitted(iKeyB);
1593             IoTString testValC2 = t2.getCommitted(iKeyC);
1594             IoTString testValD2 = t2.getCommitted(iKeyD);
1595
1596             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1597                 System.out.println("Key-Value t1 incorrect: " + keyA);
1598                 foundError = true;
1599             }
1600
1601             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1602                 System.out.println("Key-Value t1 incorrect: " + keyB);
1603                 foundError = true;
1604             }
1605
1606             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1607                 System.out.println("Key-Value t1 incorrect: " + keyC);
1608                 foundError = true;
1609             }
1610
1611             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1612                 System.out.println("Key-Value t1 incorrect: " + keyD);
1613                 foundError = true;
1614             }
1615
1616
1617             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1618                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1619                 foundError = true;
1620             }
1621
1622             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1623                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1624                 foundError = true;
1625             }
1626
1627             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1628                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1629                 foundError = true;
1630             }
1631
1632             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1633                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1634                 foundError = true;
1635             }
1636         }
1637
1638         for (TransactionStatus status : transStatusList) {
1639             if (status.getStatus() != TransactionStatus.StatusCommitted) {
1640                 foundError = true;
1641             }
1642         }
1643
1644         if (foundError) {
1645             System.out.println("Found Errors...");
1646         } else {
1647             System.out.println("No Errors Found...");
1648         }
1649     }
1650
1651     static void test3() throws ServerException {
1652
1653         long startTime = 0;
1654         long endTime = 0;
1655         boolean foundError = false;
1656
1657         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1658
1659         // Setup the 2 clients
1660         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
1661         t1.initTable();
1662         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
1663         t2.update();
1664
1665
1666         // Make the Keys
1667         System.out.println("Setting up keys");
1668         startTime = System.currentTimeMillis();
1669         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1670             String a = "a" + i;
1671             String b = "b" + i;
1672             String c = "c" + i;
1673             String d = "d" + i;
1674             IoTString ia = new IoTString(a);
1675             IoTString ib = new IoTString(b);
1676             IoTString ic = new IoTString(c);
1677             IoTString id = new IoTString(d);
1678             t1.createNewKey(ia, 321);
1679             t1.createNewKey(ib, 351);
1680             t2.createNewKey(ic, 321);
1681             t2.createNewKey(id, 351);
1682         }
1683         endTime = System.currentTimeMillis();
1684         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1685         System.out.println("Time Taken Per Key: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4))   );
1686         System.out.println();
1687
1688
1689         // Do Updates for the keys
1690         System.out.println("Setting Key-Values...");
1691         startTime = System.currentTimeMillis();
1692
1693         System.out.println("B...");
1694         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1695             String keyB = "b" + i;
1696             String valueB = "b" + i;
1697
1698             IoTString iKeyB = new IoTString(keyB);
1699             IoTString iValueB = new IoTString(valueB);
1700
1701             t1.startTransaction();
1702             t1.addKV(iKeyB, iValueB);
1703             transStatusList.add(t1.commitTransaction());
1704         }
1705
1706         System.out.println("C...");
1707         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1708             String keyC = "c" + i;
1709             String valueC = "c" + i;
1710
1711             IoTString iKeyC = new IoTString(keyC);
1712             IoTString iValueC = new IoTString(valueC);
1713
1714             t2.startTransaction();
1715             t2.addKV(iKeyC, iValueC);
1716             transStatusList.add(t2.commitTransaction());
1717         }
1718
1719         System.out.println("A, D...");
1720         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1721             String keyA = "a" + i;
1722             String keyD = "d" + i;
1723             String valueA = "a" + i;
1724             String valueD = "d" + i;
1725
1726             IoTString iKeyA = new IoTString(keyA);
1727             IoTString iKeyD = new IoTString(keyD);
1728             IoTString iValueA = new IoTString(valueA);
1729             IoTString iValueD = new IoTString(valueD);
1730
1731             t1.startTransaction();
1732             t1.addKV(iKeyA, iValueA);
1733             transStatusList.add(t1.commitTransaction());
1734
1735             t2.startTransaction();
1736             t2.addKV(iKeyD, iValueD);
1737             transStatusList.add(t2.commitTransaction());
1738         }
1739         endTime = System.currentTimeMillis();
1740         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1741         System.out.println("Time Taken Per Update: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4))   );
1742         System.out.println();
1743
1744
1745         System.out.println("Updating Clients...");
1746         t1.update();
1747         t2.update();
1748
1749
1750         System.out.println("Checking Key-Values...");
1751         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1752
1753             String keyA = "a" + i;
1754             String keyB = "b" + i;
1755             String keyC = "c" + i;
1756             String keyD = "d" + i;
1757             String valueA = "a" + i;
1758             String valueB = "b" + i;
1759             String valueC = "c" + i;
1760             String valueD = "d" + i;
1761
1762             IoTString iKeyA = new IoTString(keyA);
1763             IoTString iKeyB = new IoTString(keyB);
1764             IoTString iKeyC = new IoTString(keyC);
1765             IoTString iKeyD = new IoTString(keyD);
1766             IoTString iValueA = new IoTString(valueA);
1767             IoTString iValueB = new IoTString(valueB);
1768             IoTString iValueC = new IoTString(valueC);
1769             IoTString iValueD = new IoTString(valueD);
1770
1771
1772             IoTString testValA1 = t1.getCommitted(iKeyA);
1773             IoTString testValB1 = t1.getCommitted(iKeyB);
1774             IoTString testValC1 = t1.getCommitted(iKeyC);
1775             IoTString testValD1 = t1.getCommitted(iKeyD);
1776
1777             IoTString testValA2 = t2.getCommitted(iKeyA);
1778             IoTString testValB2 = t2.getCommitted(iKeyB);
1779             IoTString testValC2 = t2.getCommitted(iKeyC);
1780             IoTString testValD2 = t2.getCommitted(iKeyD);
1781
1782             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1783                 System.out.println("Key-Value t1 incorrect: " + keyA);
1784                 foundError = true;
1785             }
1786
1787             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1788                 System.out.println("Key-Value t1 incorrect: " + keyB);
1789                 foundError = true;
1790             }
1791
1792             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1793                 System.out.println("Key-Value t1 incorrect: " + keyC);
1794                 foundError = true;
1795             }
1796
1797             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1798                 System.out.println("Key-Value t1 incorrect: " + keyD);
1799                 foundError = true;
1800             }
1801
1802
1803             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1804                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1805                 foundError = true;
1806             }
1807
1808             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1809                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1810                 foundError = true;
1811             }
1812
1813             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1814                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1815                 foundError = true;
1816             }
1817
1818             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1819                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1820                 foundError = true;
1821             }
1822         }
1823
1824         for (TransactionStatus status : transStatusList) {
1825             if (status.getStatus() != TransactionStatus.StatusCommitted) {
1826                 foundError = true;
1827             }
1828         }
1829
1830         if (foundError) {
1831             System.out.println("Found Errors...");
1832         } else {
1833             System.out.println("No Errors Found...");
1834         }
1835     }
1836
1837     static void test2() throws ServerException {
1838
1839         boolean foundError = false;
1840         long startTime = 0;
1841         long endTime = 0;
1842         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1843
1844         // Setup the 2 clients
1845         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
1846         t1.initTable();
1847         System.out.println("T1 Ready");
1848
1849         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
1850         t2.update();
1851         System.out.println("T2 Ready");
1852
1853         // Make the Keys
1854         System.out.println("Setting up keys");
1855         startTime = System.currentTimeMillis();
1856         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1857             System.out.println(i);
1858             String a = "a" + i;
1859             String b = "b" + i;
1860             String c = "c" + i;
1861             String d = "d" + i;
1862             IoTString ia = new IoTString(a);
1863             IoTString ib = new IoTString(b);
1864             IoTString ic = new IoTString(c);
1865             IoTString id = new IoTString(d);
1866             t1.createNewKey(ia, 321);
1867             t1.createNewKey(ib, 351);
1868             t2.createNewKey(ic, 321);
1869             t2.createNewKey(id, 351);
1870         }
1871         endTime = System.currentTimeMillis();
1872         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1873         System.out.println("Time Taken Per Key: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4))   );
1874         System.out.println();
1875
1876         // Do Updates for the keys
1877         System.out.println("Setting Key-Values...");
1878         startTime = System.currentTimeMillis();
1879         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1880             System.out.println(i);
1881             String keyA = "a" + i;
1882             String keyB = "b" + i;
1883             String keyC = "c" + i;
1884             String keyD = "d" + i;
1885             String valueA = "a" + i;
1886             String valueB = "b" + i;
1887             String valueC = "c" + i;
1888             String valueD = "d" + i;
1889
1890             IoTString iKeyA = new IoTString(keyA);
1891             IoTString iKeyB = new IoTString(keyB);
1892             IoTString iKeyC = new IoTString(keyC);
1893             IoTString iKeyD = new IoTString(keyD);
1894             IoTString iValueA = new IoTString(valueA);
1895             IoTString iValueB = new IoTString(valueB);
1896             IoTString iValueC = new IoTString(valueC);
1897             IoTString iValueD = new IoTString(valueD);
1898
1899
1900             t1.startTransaction();
1901             t1.addKV(iKeyA, iValueA);
1902             transStatusList.add(t1.commitTransaction());
1903
1904
1905             t1.startTransaction();
1906             t1.addKV(iKeyB, iValueB);
1907             transStatusList.add(t1.commitTransaction());
1908
1909             t2.startTransaction();
1910             t2.addKV(iKeyC, iValueC);
1911             transStatusList.add(t2.commitTransaction());
1912
1913             t2.startTransaction();
1914             t2.addKV(iKeyD, iValueD);
1915             transStatusList.add(t2.commitTransaction());
1916
1917         }
1918         endTime = System.currentTimeMillis();
1919         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1920         System.out.println("Time Taken Per Update: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4))   );
1921         System.out.println();
1922
1923
1924         System.out.println("Updating Clients...");
1925         t1.update();
1926         t2.update();
1927
1928
1929         System.out.println("Checking Key-Values...");
1930         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1931
1932             String keyA = "a" + i;
1933             String keyB = "b" + i;
1934             String keyC = "c" + i;
1935             String keyD = "d" + i;
1936             String valueA = "a" + i;
1937             String valueB = "b" + i;
1938             String valueC = "c" + i;
1939             String valueD = "d" + i;
1940
1941             IoTString iKeyA = new IoTString(keyA);
1942             IoTString iKeyB = new IoTString(keyB);
1943             IoTString iKeyC = new IoTString(keyC);
1944             IoTString iKeyD = new IoTString(keyD);
1945             IoTString iValueA = new IoTString(valueA);
1946             IoTString iValueB = new IoTString(valueB);
1947             IoTString iValueC = new IoTString(valueC);
1948             IoTString iValueD = new IoTString(valueD);
1949
1950
1951             IoTString testValA1 = t1.getCommitted(iKeyA);
1952             IoTString testValB1 = t1.getCommitted(iKeyB);
1953             IoTString testValC1 = t1.getCommitted(iKeyC);
1954             IoTString testValD1 = t1.getCommitted(iKeyD);
1955
1956             IoTString testValA2 = t2.getCommitted(iKeyA);
1957             IoTString testValB2 = t2.getCommitted(iKeyB);
1958             IoTString testValC2 = t2.getCommitted(iKeyC);
1959             IoTString testValD2 = t2.getCommitted(iKeyD);
1960
1961             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1962                 System.out.println("Key-Value t1 incorrect: " + keyA);
1963                 foundError = true;
1964             }
1965
1966             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1967                 System.out.println("Key-Value t1 incorrect: " + keyB);
1968                 foundError = true;
1969             }
1970
1971             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1972                 System.out.println("Key-Value t1 incorrect: " + keyC);
1973                 foundError = true;
1974             }
1975
1976             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1977                 System.out.println("Key-Value t1 incorrect: " + keyD);
1978                 foundError = true;
1979             }
1980
1981
1982             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1983                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1984                 foundError = true;
1985             }
1986
1987             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1988                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1989                 foundError = true;
1990             }
1991
1992             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1993                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1994                 foundError = true;
1995             }
1996
1997             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1998                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1999                 foundError = true;
2000             }
2001         }
2002
2003         for (TransactionStatus status : transStatusList) {
2004             if (status.getStatus() != TransactionStatus.StatusCommitted) {
2005                 foundError = true;
2006                 System.out.println(status.getStatus());
2007             }
2008         }
2009
2010         if (foundError) {
2011             System.out.println("Found Errors...");
2012         } else {
2013             System.out.println("No Errors Found...");
2014         }
2015
2016         // System.out.println();
2017         // System.out.println();
2018         // t1.printSlots();
2019
2020         // System.out.println();
2021         // System.out.println();
2022         // t2.printSlots();
2023     }
2024 }