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