Fixed bugs, local communication HMAC added in
[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 = 10;
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, 6000);
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, 6001);
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         while (t2.update() == false) {}
777
778         System.out.println("Checking Key-Values...");
779         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
780
781             String keyA = "a" + i;
782             String keyB = "b" + i;
783             String keyC = "c" + i;
784             String keyD = "d" + i;
785             String valueA = "a" + i;
786             String valueB = "b" + i;
787             String valueC = "c" + i;
788             String valueD = "d" + i;
789
790             IoTString iKeyA = new IoTString(keyA);
791             IoTString iKeyB = new IoTString(keyB);
792             IoTString iKeyC = new IoTString(keyC);
793             IoTString iKeyD = new IoTString(keyD);
794             IoTString iValueA = new IoTString(valueA);
795             IoTString iValueB = new IoTString(valueB);
796             IoTString iValueC = new IoTString(valueC);
797             IoTString iValueD = new IoTString(valueD);
798
799
800             IoTString testValA1 = t1.getCommitted(iKeyA);
801             IoTString testValB1 = t1.getCommitted(iKeyB);
802             IoTString testValC1 = t1.getCommitted(iKeyC);
803             IoTString testValD1 = t1.getCommitted(iKeyD);
804
805             IoTString testValA2 = t2.getCommitted(iKeyA);
806             IoTString testValB2 = t2.getCommitted(iKeyB);
807             IoTString testValC2 = t2.getCommitted(iKeyC);
808             IoTString testValD2 = t2.getCommitted(iKeyD);
809
810             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
811                 System.out.println("Key-Value t1 incorrect: " + keyA + "    " + testValA1);
812                 foundError = true;
813             }
814
815             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
816                 System.out.println("Key-Value t1 incorrect: " + keyB + "    " + testValB1);
817                 foundError = true;
818             }
819
820             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
821                 System.out.println("Key-Value t1 incorrect: " + keyC + "    " + testValC1);
822                 foundError = true;
823             }
824
825             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
826                 System.out.println("Key-Value t1 incorrect: " + keyD + "    " + testValD1);
827                 foundError = true;
828             }
829
830
831             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
832                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
833                 foundError = true;
834             }
835
836             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
837                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
838                 foundError = true;
839             }
840
841             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
842                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
843                 foundError = true;
844             }
845
846             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
847                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
848                 foundError = true;
849             }
850         }
851
852         for (TransactionStatus status : transStatusList) {
853             if (status.getStatus() != TransactionStatus.StatusCommitted) {
854                 foundError = true;
855             }
856         }
857
858         if (foundError) {
859             System.out.println("Found Errors...");
860         } else {
861             System.out.println("No Errors Found...");
862         }
863
864         t1.close();
865         t2.close();
866     }
867
868     static void test7() throws ServerException {
869
870         boolean foundError = false;
871         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
872
873         // Setup the 2 clients
874         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
875         t1.initTable();
876         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
877         t2.update();
878
879         // Make the Keys
880         System.out.println("Setting up keys");
881         for (int i = 0; i < 4; i++) {
882             String a = "a" + i;
883             String b = "b" + i;
884             String c = "c" + i;
885             String d = "d" + i;
886             IoTString ia = new IoTString(a);
887             IoTString ib = new IoTString(b);
888             IoTString ic = new IoTString(c);
889             IoTString id = new IoTString(d);
890             t1.createNewKey(ia, 321);
891             t1.createNewKey(ib, 351);
892             t2.createNewKey(ic, 321);
893             t2.createNewKey(id, 351);
894         }
895
896         // Do Updates for the keys
897         System.out.println("Setting Key-Values...");
898
899         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
900             for (int i = 0; i < 4; i++) {
901                 String keyB = "b" + i;
902                 String valueB = "b" + (i + t);
903
904                 IoTString iKeyB = new IoTString(keyB);
905                 IoTString iValueB = new IoTString(valueB);
906
907                 t1.startTransaction();
908                 t1.getSpeculativeAtomic(iKeyB);
909                 t1.addKV(iKeyB, iValueB);
910                 transStatusList.add(t1.commitTransaction());
911             }
912         }
913
914         for (int i = 0; i < 4; i++) {
915
916             String keyB = "b" + i;
917             String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
918             IoTString iKeyB = new IoTString(keyB);
919             IoTString iValueB = new IoTString(valueB);
920
921             IoTString testValB1 = t1.getSpeculative(iKeyB);
922             IoTString testValB2 = t2.getSpeculative(iKeyB);
923
924             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
925                 System.out.println("Key-Value t1 incorrect: " + keyB + "    " + testValB1);
926                 foundError = true;
927             }
928
929             if ((testValB2 != null)) {
930                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
931                 foundError = true;
932             }
933         }
934
935         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
936             for (int i = 0; i < 4; i++) {
937                 String keyC = "c" + i;
938                 String valueC = "c" + (i + t);
939
940                 IoTString iKeyC = new IoTString(keyC);
941                 IoTString iValueC = new IoTString(valueC);
942
943                 t2.startTransaction();
944                 t2.getSpeculativeAtomic(iKeyC);
945                 t2.addKV(iKeyC, iValueC);
946                 transStatusList.add(t2.commitTransaction());
947             }
948         }
949
950         for (int i = 0; i < 4; i++) {
951             String keyC = "c" + i;
952             String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
953             IoTString iKeyC = new IoTString(keyC);
954             IoTString iValueC = new IoTString(valueC);
955
956             IoTString testValC1 = t1.getSpeculative(iKeyC);
957             IoTString testValC2 = t2.getSpeculative(iKeyC);
958
959             if ((testValC1 != null)) {
960                 System.out.println("Key-Value t1 incorrect: " + keyC + "   " + testValC1);
961                 foundError = true;
962             }
963
964             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
965                 System.out.println("Key-Value t2 incorrect: " + keyC + "   " + testValC2);
966                 foundError = true;
967             }
968         }
969
970         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
971             for (int i = 0; i < 4; i++) {
972                 String keyA = "a" + i;
973                 String keyD = "d" + i;
974                 String valueA = "a" + (i + t);
975                 String valueD = "d" + (i + t);
976
977                 IoTString iKeyA = new IoTString(keyA);
978                 IoTString iKeyD = new IoTString(keyD);
979                 IoTString iValueA = new IoTString(valueA);
980                 IoTString iValueD = new IoTString(valueD);
981
982                 t1.startTransaction();
983                 t1.addKV(iKeyA, iValueA);
984                 transStatusList.add(t1.commitTransaction());
985
986                 t2.startTransaction();
987                 t2.addKV(iKeyD, iValueD);
988                 transStatusList.add(t2.commitTransaction());
989             }
990         }
991
992         System.out.println("Updating Clients...");
993         t1.update();
994         t2.update();
995         t1.update();
996         t2.update();
997
998         System.out.println("Checking Key-Values...");
999         for (int i = 0; i < 4; i++) {
1000
1001             String keyA = "a" + i;
1002             String keyB = "b" + i;
1003             String keyC = "c" + i;
1004             String keyD = "d" + i;
1005             String valueA = "a" + (i + NUMBER_OF_TESTS - 1);
1006             String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
1007             String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
1008             String valueD = "d" + (i + NUMBER_OF_TESTS - 1);
1009
1010             IoTString iKeyA = new IoTString(keyA);
1011             IoTString iKeyB = new IoTString(keyB);
1012             IoTString iKeyC = new IoTString(keyC);
1013             IoTString iKeyD = new IoTString(keyD);
1014             IoTString iValueA = new IoTString(valueA);
1015             IoTString iValueB = new IoTString(valueB);
1016             IoTString iValueC = new IoTString(valueC);
1017             IoTString iValueD = new IoTString(valueD);
1018
1019
1020             IoTString testValA1 = t1.getCommitted(iKeyA);
1021             IoTString testValB1 = t1.getCommitted(iKeyB);
1022             IoTString testValC1 = t1.getCommitted(iKeyC);
1023             IoTString testValD1 = t1.getCommitted(iKeyD);
1024
1025             IoTString testValA2 = t2.getCommitted(iKeyA);
1026             IoTString testValB2 = t2.getCommitted(iKeyB);
1027             IoTString testValC2 = t2.getCommitted(iKeyC);
1028             IoTString testValD2 = t2.getCommitted(iKeyD);
1029
1030             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1031                 System.out.println("Key-Value t1 incorrect: " + keyA + "    " + testValA1);
1032                 foundError = true;
1033             }
1034
1035             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1036                 System.out.println("Key-Value t1 incorrect: " + keyB + "    " + testValB1);
1037                 foundError = true;
1038             }
1039
1040             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1041                 System.out.println("Key-Value t1 incorrect: " + keyC + "    " + testValC1);
1042                 foundError = true;
1043             }
1044
1045             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1046                 System.out.println("Key-Value t1 incorrect: " + keyD + "    " + testValD1);
1047                 foundError = true;
1048             }
1049
1050             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1051                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1052                 foundError = true;
1053             }
1054
1055             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1056                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1057                 foundError = true;
1058             }
1059
1060             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1061                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1062                 foundError = true;
1063             }
1064
1065             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1066                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1067                 foundError = true;
1068             }
1069         }
1070
1071         for (TransactionStatus status : transStatusList) {
1072             if (status.getStatus() != TransactionStatus.StatusCommitted) {
1073                 foundError = true;
1074             }
1075         }
1076
1077         if (foundError) {
1078             System.out.println("Found Errors...");
1079         } else {
1080             System.out.println("No Errors Found...");
1081         }
1082     }
1083
1084     static void test6() throws ServerException {
1085
1086         boolean foundError = false;
1087         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1088
1089         // Setup the 2 clients
1090         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
1091         t1.initTable();
1092         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
1093         t2.update();
1094
1095         // Make the Keys
1096         System.out.println("Setting up keys");
1097         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1098             String a = "a" + i;
1099             String b = "b" + i;
1100             String c = "c" + i;
1101             String d = "d" + i;
1102             IoTString ia = new IoTString(a);
1103             IoTString ib = new IoTString(b);
1104             IoTString ic = new IoTString(c);
1105             IoTString id = new IoTString(d);
1106             t1.createNewKey(ia, 321);
1107             t1.createNewKey(ib, 351);
1108             t2.createNewKey(ic, 321);
1109             t2.createNewKey(id, 351);
1110         }
1111
1112         // Do Updates for the keys
1113         System.out.println("Setting Key-Values...");
1114         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1115             String keyA = "a" + i;
1116             String keyB = "b" + i;
1117             String keyC = "c" + i;
1118             String keyD = "d" + i;
1119             String valueA = "a" + i;
1120             String valueB = "b" + i;
1121             String valueC = "c" + i;
1122             String valueD = "d" + i;
1123
1124             IoTString iKeyA = new IoTString(keyA);
1125             IoTString iKeyB = new IoTString(keyB);
1126             IoTString iKeyC = new IoTString(keyC);
1127             IoTString iKeyD = new IoTString(keyD);
1128             IoTString iValueA = new IoTString(valueA);
1129             IoTString iValueB = new IoTString(valueB);
1130             IoTString iValueC = new IoTString(valueC);
1131             IoTString iValueD = new IoTString(valueD);
1132
1133             t1.startTransaction();
1134             t1.getCommittedAtomic(iKeyA);
1135             t1.addKV(iKeyA, iValueA);
1136             transStatusList.add(t1.commitTransaction());
1137
1138             t1.startTransaction();
1139             t1.getCommittedAtomic(iKeyB);
1140             t1.addKV(iKeyB, iValueB);
1141             transStatusList.add(t1.commitTransaction());
1142
1143             t2.startTransaction();
1144             t2.getCommittedAtomic(iKeyC);
1145             t2.addKV(iKeyC, iValueC);
1146             transStatusList.add(t2.commitTransaction());
1147
1148             t2.startTransaction();
1149             t2.getCommittedAtomic(iKeyD);
1150             t2.addKV(iKeyD, iValueD);
1151             transStatusList.add(t2.commitTransaction());
1152         }
1153
1154         System.out.println("Updating Clients...");
1155         t1.update();
1156         t2.update();
1157
1158         System.out.println("Checking Key-Values...");
1159         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1160
1161             String keyA = "a" + i;
1162             String keyB = "b" + i;
1163             String keyC = "c" + i;
1164             String keyD = "d" + i;
1165             String valueA = "a" + i;
1166             String valueB = "b" + i;
1167             String valueC = "c" + i;
1168             String valueD = "d" + i;
1169
1170             IoTString iKeyA = new IoTString(keyA);
1171             IoTString iKeyB = new IoTString(keyB);
1172             IoTString iKeyC = new IoTString(keyC);
1173             IoTString iKeyD = new IoTString(keyD);
1174             IoTString iValueA = new IoTString(valueA);
1175             IoTString iValueB = new IoTString(valueB);
1176             IoTString iValueC = new IoTString(valueC);
1177             IoTString iValueD = new IoTString(valueD);
1178
1179
1180             IoTString testValA1 = t1.getCommitted(iKeyA);
1181             IoTString testValB1 = t1.getCommitted(iKeyB);
1182             IoTString testValC1 = t1.getCommitted(iKeyC);
1183             IoTString testValD1 = t1.getCommitted(iKeyD);
1184
1185             IoTString testValA2 = t2.getCommitted(iKeyA);
1186             IoTString testValB2 = t2.getCommitted(iKeyB);
1187             IoTString testValC2 = t2.getCommitted(iKeyC);
1188             IoTString testValD2 = t2.getCommitted(iKeyD);
1189
1190             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1191                 System.out.println("Key-Value t1 incorrect: " + keyA);
1192                 foundError = true;
1193             }
1194
1195             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1196                 System.out.println("Key-Value t1 incorrect: " + keyB);
1197                 foundError = true;
1198             }
1199
1200             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1201                 System.out.println("Key-Value t1 incorrect: " + keyC);
1202                 foundError = true;
1203             }
1204
1205             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1206                 System.out.println("Key-Value t1 incorrect: " + keyD);
1207                 foundError = true;
1208             }
1209
1210
1211             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1212                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1213                 foundError = true;
1214             }
1215
1216             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1217                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1218                 foundError = true;
1219             }
1220
1221             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1222                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1223                 foundError = true;
1224             }
1225
1226             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1227                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1228                 foundError = true;
1229             }
1230         }
1231
1232         for (TransactionStatus status : transStatusList) {
1233             if (status.getStatus() != TransactionStatus.StatusCommitted) {
1234                 foundError = true;
1235             }
1236         }
1237
1238         if (foundError) {
1239             System.out.println("Found Errors...");
1240         } else {
1241             System.out.println("No Errors Found...");
1242         }
1243     }
1244
1245     static void test5() throws ServerException {
1246
1247         boolean foundError = false;
1248         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1249
1250         // Setup the 2 clients
1251         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
1252         t1.initTable();
1253         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
1254         t2.update();
1255
1256
1257         // Make the Keys
1258         System.out.println("Setting up keys");
1259         for (int i = 0; i < 4; i++) {
1260             String a = "a" + i;
1261             String b = "b" + i;
1262             String c = "c" + i;
1263             String d = "d" + i;
1264             IoTString ia = new IoTString(a);
1265             IoTString ib = new IoTString(b);
1266             IoTString ic = new IoTString(c);
1267             IoTString id = new IoTString(d);
1268             t1.createNewKey(ia, 321);
1269             t1.createNewKey(ib, 351);
1270             t2.createNewKey(ic, 321);
1271             t2.createNewKey(id, 351);
1272         }
1273
1274         // Do Updates for the keys
1275         System.out.println("Setting Key-Values...");
1276
1277         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1278             for (int i = 0; i < 4; i++) {
1279                 String keyB = "b" + i;
1280                 String valueB = "b" + (i + t);
1281
1282                 IoTString iKeyB = new IoTString(keyB);
1283                 IoTString iValueB = new IoTString(valueB);
1284
1285                 t1.startTransaction();
1286                 t1.addKV(iKeyB, iValueB);
1287                 transStatusList.add(t1.commitTransaction());
1288             }
1289         }
1290
1291         for (int i = 0; i < 4; i++) {
1292
1293             String keyB = "b" + i;
1294             String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
1295             IoTString iKeyB = new IoTString(keyB);
1296             IoTString iValueB = new IoTString(valueB);
1297
1298             IoTString testValB1 = t1.getSpeculative(iKeyB);
1299             IoTString testValB2 = t2.getSpeculative(iKeyB);
1300
1301             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1302                 System.out.println("Key-Value t1 incorrect: " + keyB);
1303                 foundError = true;
1304             }
1305
1306             if ((testValB2 != null)) {
1307                 System.out.println("Key-Value t2 incorrect: " + keyB);
1308                 foundError = true;
1309             }
1310         }
1311
1312         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1313             for (int i = 0; i < 4; i++) {
1314                 String keyC = "c" + i;
1315                 String valueC = "c" + (i + t);
1316
1317                 IoTString iKeyC = new IoTString(keyC);
1318                 IoTString iValueC = new IoTString(valueC);
1319
1320                 t2.startTransaction();
1321                 t2.addKV(iKeyC, iValueC);
1322                 transStatusList.add(t2.commitTransaction());
1323             }
1324         }
1325
1326         for (int i = 0; i < 4; i++) {
1327             String keyC = "c" + i;
1328             String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
1329             IoTString iKeyC = new IoTString(keyC);
1330             IoTString iValueC = new IoTString(valueC);
1331
1332             IoTString testValC1 = t1.getSpeculative(iKeyC);
1333             IoTString testValC2 = t2.getSpeculative(iKeyC);
1334
1335             if ((testValC1 != null)) {
1336                 System.out.println("Key-Value t1 incorrect: " + keyC + "   " + testValC1);
1337                 foundError = true;
1338             }
1339
1340             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1341                 System.out.println("Key-Value t2 incorrect: " + keyC + "   " + testValC2);
1342                 foundError = true;
1343             }
1344         }
1345
1346         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1347             for (int i = 0; i < 4; i++) {
1348                 String keyA = "a" + i;
1349                 String keyD = "d" + i;
1350                 String valueA = "a" + (i + t);
1351                 String valueD = "d" + (i + t);
1352
1353                 IoTString iKeyA = new IoTString(keyA);
1354                 IoTString iKeyD = new IoTString(keyD);
1355                 IoTString iValueA = new IoTString(valueA);
1356                 IoTString iValueD = new IoTString(valueD);
1357
1358                 t1.startTransaction();
1359                 t1.addKV(iKeyA, iValueA);
1360                 transStatusList.add(t1.commitTransaction());
1361
1362                 t2.startTransaction();
1363                 t2.addKV(iKeyD, iValueD);
1364                 transStatusList.add(t2.commitTransaction());
1365             }
1366         }
1367
1368         System.out.println("Updating Clients...");
1369         t1.update();
1370         t2.update();
1371
1372
1373         System.out.println("Checking Key-Values...");
1374         for (int i = 0; i < 4; i++) {
1375
1376             String keyA = "a" + i;
1377             String keyB = "b" + i;
1378             String keyC = "c" + i;
1379             String keyD = "d" + i;
1380             String valueA = "a" + (i + NUMBER_OF_TESTS - 1);
1381             String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
1382             String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
1383             String valueD = "d" + (i + NUMBER_OF_TESTS - 1);
1384
1385             IoTString iKeyA = new IoTString(keyA);
1386             IoTString iKeyB = new IoTString(keyB);
1387             IoTString iKeyC = new IoTString(keyC);
1388             IoTString iKeyD = new IoTString(keyD);
1389             IoTString iValueA = new IoTString(valueA);
1390             IoTString iValueB = new IoTString(valueB);
1391             IoTString iValueC = new IoTString(valueC);
1392             IoTString iValueD = new IoTString(valueD);
1393
1394
1395             IoTString testValA1 = t1.getCommitted(iKeyA);
1396             IoTString testValB1 = t1.getCommitted(iKeyB);
1397             IoTString testValC1 = t1.getCommitted(iKeyC);
1398             IoTString testValD1 = t1.getCommitted(iKeyD);
1399
1400             IoTString testValA2 = t2.getCommitted(iKeyA);
1401             IoTString testValB2 = t2.getCommitted(iKeyB);
1402             IoTString testValC2 = t2.getCommitted(iKeyC);
1403             IoTString testValD2 = t2.getCommitted(iKeyD);
1404
1405             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1406                 System.out.println("Key-Value t1 incorrect: " + keyA + "    " + testValA1);
1407                 foundError = true;
1408             }
1409
1410             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1411                 System.out.println("Key-Value t1 incorrect: " + keyB + "    " + testValB1);
1412                 foundError = true;
1413             }
1414
1415             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1416                 System.out.println("Key-Value t1 incorrect: " + keyC + "    " + testValC1);
1417                 foundError = true;
1418             }
1419
1420             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1421                 System.out.println("Key-Value t1 incorrect: " + keyD + "    " + testValD1);
1422                 foundError = true;
1423             }
1424
1425
1426             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1427                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1428                 foundError = true;
1429             }
1430
1431             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1432                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1433                 foundError = true;
1434             }
1435
1436             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1437                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1438                 foundError = true;
1439             }
1440
1441             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1442                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1443                 foundError = true;
1444             }
1445         }
1446
1447         for (TransactionStatus status : transStatusList) {
1448             if (status.getStatus() != TransactionStatus.StatusCommitted) {
1449                 foundError = true;
1450             }
1451         }
1452
1453         if (foundError) {
1454             System.out.println("Found Errors...");
1455         } else {
1456             System.out.println("No Errors Found...");
1457         }
1458     }
1459
1460     static void test4() throws ServerException {
1461
1462         boolean foundError = false;
1463         long startTime = 0;
1464         long endTime = 0;
1465         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1466
1467         // Setup the 2 clients
1468         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
1469         t1.initTable();
1470         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
1471         t2.update();
1472
1473         // Make the Keys
1474         System.out.println("Setting up keys");
1475         startTime = System.currentTimeMillis();
1476         for (int i = 0; i < 4; i++) {
1477             String a = "a" + i;
1478             String b = "b" + i;
1479             String c = "c" + i;
1480             String d = "d" + i;
1481             IoTString ia = new IoTString(a);
1482             IoTString ib = new IoTString(b);
1483             IoTString ic = new IoTString(c);
1484             IoTString id = new IoTString(d);
1485             t1.createNewKey(ia, 321);
1486             t1.createNewKey(ib, 351);
1487             t2.createNewKey(ic, 321);
1488             t2.createNewKey(id, 351);
1489         }
1490         endTime = System.currentTimeMillis();
1491         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1492         System.out.println("Time Taken Per Key: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4))   );
1493         System.out.println();
1494
1495
1496         // Do Updates for the keys
1497         System.out.println("Setting Key-Values...");
1498         startTime = System.currentTimeMillis();
1499         for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1500             for (int i = 0; i < 4; i++) {
1501                 String keyA = "a" + i;
1502                 String keyB = "b" + i;
1503                 String keyC = "c" + i;
1504                 String keyD = "d" + i;
1505                 String valueA = "a" + i;
1506                 String valueB = "b" + i;
1507                 String valueC = "c" + i;
1508                 String valueD = "d" + i;
1509
1510                 IoTString iKeyA = new IoTString(keyA);
1511                 IoTString iKeyB = new IoTString(keyB);
1512                 IoTString iKeyC = new IoTString(keyC);
1513                 IoTString iKeyD = new IoTString(keyD);
1514                 IoTString iValueA = new IoTString(valueA);
1515                 IoTString iValueB = new IoTString(valueB);
1516                 IoTString iValueC = new IoTString(valueC);
1517                 IoTString iValueD = new IoTString(valueD);
1518
1519                 t1.startTransaction();
1520                 t1.addKV(iKeyA, iValueA);
1521                 transStatusList.add(t1.commitTransaction());
1522
1523                 t1.startTransaction();
1524                 t1.addKV(iKeyB, iValueB);
1525                 transStatusList.add(t1.commitTransaction());
1526
1527                 t2.startTransaction();
1528                 t2.addKV(iKeyC, iValueC);
1529                 transStatusList.add(t2.commitTransaction());
1530
1531                 t2.startTransaction();
1532                 t2.addKV(iKeyD, iValueD);
1533                 transStatusList.add(t2.commitTransaction());
1534             }
1535         }
1536         endTime = System.currentTimeMillis();
1537         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1538         System.out.println("Time Taken Per Update: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 16))   );
1539         System.out.println();
1540
1541
1542         System.out.println("Updating Clients...");
1543         t1.update();
1544         t2.update();
1545
1546
1547         System.out.println("Checking Key-Values...");
1548         for (int i = 0; i < 4; i++) {
1549
1550             String keyA = "a" + i;
1551             String keyB = "b" + i;
1552             String keyC = "c" + i;
1553             String keyD = "d" + i;
1554             String valueA = "a" + i;
1555             String valueB = "b" + i;
1556             String valueC = "c" + i;
1557             String valueD = "d" + i;
1558
1559             IoTString iKeyA = new IoTString(keyA);
1560             IoTString iKeyB = new IoTString(keyB);
1561             IoTString iKeyC = new IoTString(keyC);
1562             IoTString iKeyD = new IoTString(keyD);
1563             IoTString iValueA = new IoTString(valueA);
1564             IoTString iValueB = new IoTString(valueB);
1565             IoTString iValueC = new IoTString(valueC);
1566             IoTString iValueD = new IoTString(valueD);
1567
1568
1569             IoTString testValA1 = t1.getCommitted(iKeyA);
1570             IoTString testValB1 = t1.getCommitted(iKeyB);
1571             IoTString testValC1 = t1.getCommitted(iKeyC);
1572             IoTString testValD1 = t1.getCommitted(iKeyD);
1573
1574             IoTString testValA2 = t2.getCommitted(iKeyA);
1575             IoTString testValB2 = t2.getCommitted(iKeyB);
1576             IoTString testValC2 = t2.getCommitted(iKeyC);
1577             IoTString testValD2 = t2.getCommitted(iKeyD);
1578
1579             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1580                 System.out.println("Key-Value t1 incorrect: " + keyA);
1581                 foundError = true;
1582             }
1583
1584             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1585                 System.out.println("Key-Value t1 incorrect: " + keyB);
1586                 foundError = true;
1587             }
1588
1589             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1590                 System.out.println("Key-Value t1 incorrect: " + keyC);
1591                 foundError = true;
1592             }
1593
1594             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1595                 System.out.println("Key-Value t1 incorrect: " + keyD);
1596                 foundError = true;
1597             }
1598
1599
1600             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1601                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1602                 foundError = true;
1603             }
1604
1605             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1606                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1607                 foundError = true;
1608             }
1609
1610             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1611                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1612                 foundError = true;
1613             }
1614
1615             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1616                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1617                 foundError = true;
1618             }
1619         }
1620
1621         for (TransactionStatus status : transStatusList) {
1622             if (status.getStatus() != TransactionStatus.StatusCommitted) {
1623                 foundError = true;
1624             }
1625         }
1626
1627         if (foundError) {
1628             System.out.println("Found Errors...");
1629         } else {
1630             System.out.println("No Errors Found...");
1631         }
1632     }
1633
1634     static void test3() throws ServerException {
1635
1636         long startTime = 0;
1637         long endTime = 0;
1638         boolean foundError = false;
1639
1640         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1641
1642         // Setup the 2 clients
1643         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
1644         t1.initTable();
1645         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
1646         t2.update();
1647
1648
1649         // Make the Keys
1650         System.out.println("Setting up keys");
1651         startTime = System.currentTimeMillis();
1652         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1653             String a = "a" + i;
1654             String b = "b" + i;
1655             String c = "c" + i;
1656             String d = "d" + i;
1657             IoTString ia = new IoTString(a);
1658             IoTString ib = new IoTString(b);
1659             IoTString ic = new IoTString(c);
1660             IoTString id = new IoTString(d);
1661             t1.createNewKey(ia, 321);
1662             t1.createNewKey(ib, 351);
1663             t2.createNewKey(ic, 321);
1664             t2.createNewKey(id, 351);
1665         }
1666         endTime = System.currentTimeMillis();
1667         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1668         System.out.println("Time Taken Per Key: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4))   );
1669         System.out.println();
1670
1671
1672         // Do Updates for the keys
1673         System.out.println("Setting Key-Values...");
1674         startTime = System.currentTimeMillis();
1675
1676         System.out.println("B...");
1677         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1678             String keyB = "b" + i;
1679             String valueB = "b" + i;
1680
1681             IoTString iKeyB = new IoTString(keyB);
1682             IoTString iValueB = new IoTString(valueB);
1683
1684             t1.startTransaction();
1685             t1.addKV(iKeyB, iValueB);
1686             transStatusList.add(t1.commitTransaction());
1687         }
1688
1689         System.out.println("C...");
1690         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1691             String keyC = "c" + i;
1692             String valueC = "c" + i;
1693
1694             IoTString iKeyC = new IoTString(keyC);
1695             IoTString iValueC = new IoTString(valueC);
1696
1697             t2.startTransaction();
1698             t2.addKV(iKeyC, iValueC);
1699             transStatusList.add(t2.commitTransaction());
1700         }
1701
1702         System.out.println("A, D...");
1703         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1704             String keyA = "a" + i;
1705             String keyD = "d" + i;
1706             String valueA = "a" + i;
1707             String valueD = "d" + i;
1708
1709             IoTString iKeyA = new IoTString(keyA);
1710             IoTString iKeyD = new IoTString(keyD);
1711             IoTString iValueA = new IoTString(valueA);
1712             IoTString iValueD = new IoTString(valueD);
1713
1714             t1.startTransaction();
1715             t1.addKV(iKeyA, iValueA);
1716             transStatusList.add(t1.commitTransaction());
1717
1718             t2.startTransaction();
1719             t2.addKV(iKeyD, iValueD);
1720             transStatusList.add(t2.commitTransaction());
1721         }
1722         endTime = System.currentTimeMillis();
1723         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1724         System.out.println("Time Taken Per Update: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4))   );
1725         System.out.println();
1726
1727
1728         System.out.println("Updating Clients...");
1729         t1.update();
1730         t2.update();
1731
1732
1733         System.out.println("Checking Key-Values...");
1734         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1735
1736             String keyA = "a" + i;
1737             String keyB = "b" + i;
1738             String keyC = "c" + i;
1739             String keyD = "d" + i;
1740             String valueA = "a" + i;
1741             String valueB = "b" + i;
1742             String valueC = "c" + i;
1743             String valueD = "d" + i;
1744
1745             IoTString iKeyA = new IoTString(keyA);
1746             IoTString iKeyB = new IoTString(keyB);
1747             IoTString iKeyC = new IoTString(keyC);
1748             IoTString iKeyD = new IoTString(keyD);
1749             IoTString iValueA = new IoTString(valueA);
1750             IoTString iValueB = new IoTString(valueB);
1751             IoTString iValueC = new IoTString(valueC);
1752             IoTString iValueD = new IoTString(valueD);
1753
1754
1755             IoTString testValA1 = t1.getCommitted(iKeyA);
1756             IoTString testValB1 = t1.getCommitted(iKeyB);
1757             IoTString testValC1 = t1.getCommitted(iKeyC);
1758             IoTString testValD1 = t1.getCommitted(iKeyD);
1759
1760             IoTString testValA2 = t2.getCommitted(iKeyA);
1761             IoTString testValB2 = t2.getCommitted(iKeyB);
1762             IoTString testValC2 = t2.getCommitted(iKeyC);
1763             IoTString testValD2 = t2.getCommitted(iKeyD);
1764
1765             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1766                 System.out.println("Key-Value t1 incorrect: " + keyA);
1767                 foundError = true;
1768             }
1769
1770             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1771                 System.out.println("Key-Value t1 incorrect: " + keyB);
1772                 foundError = true;
1773             }
1774
1775             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1776                 System.out.println("Key-Value t1 incorrect: " + keyC);
1777                 foundError = true;
1778             }
1779
1780             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1781                 System.out.println("Key-Value t1 incorrect: " + keyD);
1782                 foundError = true;
1783             }
1784
1785
1786             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1787                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1788                 foundError = true;
1789             }
1790
1791             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1792                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1793                 foundError = true;
1794             }
1795
1796             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1797                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1798                 foundError = true;
1799             }
1800
1801             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1802                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
1803                 foundError = true;
1804             }
1805         }
1806
1807         for (TransactionStatus status : transStatusList) {
1808             if (status.getStatus() != TransactionStatus.StatusCommitted) {
1809                 foundError = true;
1810             }
1811         }
1812
1813         if (foundError) {
1814             System.out.println("Found Errors...");
1815         } else {
1816             System.out.println("No Errors Found...");
1817         }
1818     }
1819
1820     static void test2() throws ServerException {
1821
1822         boolean foundError = false;
1823         long startTime = 0;
1824         long endTime = 0;
1825         List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1826
1827         // Setup the 2 clients
1828         Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321, -1);
1829         t1.initTable();
1830         System.out.println("T1 Ready");
1831
1832         Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351, -1);
1833         t2.update();
1834         System.out.println("T2 Ready");
1835
1836         // Make the Keys
1837         System.out.println("Setting up keys");
1838         startTime = System.currentTimeMillis();
1839         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1840             System.out.println(i);
1841             String a = "a" + i;
1842             String b = "b" + i;
1843             String c = "c" + i;
1844             String d = "d" + i;
1845             IoTString ia = new IoTString(a);
1846             IoTString ib = new IoTString(b);
1847             IoTString ic = new IoTString(c);
1848             IoTString id = new IoTString(d);
1849             t1.createNewKey(ia, 321);
1850             t1.createNewKey(ib, 351);
1851             t2.createNewKey(ic, 321);
1852             t2.createNewKey(id, 351);
1853         }
1854         endTime = System.currentTimeMillis();
1855         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1856         System.out.println("Time Taken Per Key: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4))   );
1857         System.out.println();
1858
1859         // Do Updates for the keys
1860         System.out.println("Setting Key-Values...");
1861         startTime = System.currentTimeMillis();
1862         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1863             System.out.println(i);
1864             String keyA = "a" + i;
1865             String keyB = "b" + i;
1866             String keyC = "c" + i;
1867             String keyD = "d" + i;
1868             String valueA = "a" + i;
1869             String valueB = "b" + i;
1870             String valueC = "c" + i;
1871             String valueD = "d" + i;
1872
1873             IoTString iKeyA = new IoTString(keyA);
1874             IoTString iKeyB = new IoTString(keyB);
1875             IoTString iKeyC = new IoTString(keyC);
1876             IoTString iKeyD = new IoTString(keyD);
1877             IoTString iValueA = new IoTString(valueA);
1878             IoTString iValueB = new IoTString(valueB);
1879             IoTString iValueC = new IoTString(valueC);
1880             IoTString iValueD = new IoTString(valueD);
1881
1882
1883             System.out.println("===============================================================================");
1884             System.out.println("AAAAAAAA");
1885             System.out.println("===============================================================================");
1886             t1.startTransaction();
1887             t1.addKV(iKeyA, iValueA);
1888             transStatusList.add(t1.commitTransaction());
1889             System.out.println();
1890
1891
1892             System.out.println("===============================================================================");
1893             System.out.println("BBBBBBB");
1894             System.out.println("===============================================================================");
1895             t1.startTransaction();
1896             t1.addKV(iKeyB, iValueB);
1897             transStatusList.add(t1.commitTransaction());
1898             System.out.println();
1899
1900
1901             System.out.println("===============================================================================");
1902             System.out.println("CCCCCCC");
1903             System.out.println("===============================================================================");
1904             t2.startTransaction();
1905             t2.addKV(iKeyC, iValueC);
1906             transStatusList.add(t2.commitTransaction());
1907             System.out.println();
1908
1909
1910             System.out.println("===============================================================================");
1911             System.out.println("DDDDDDDDDD");
1912             System.out.println("===============================================================================");
1913             t2.startTransaction();
1914             t2.addKV(iKeyD, iValueD);
1915             transStatusList.add(t2.commitTransaction());
1916             System.out.println();
1917
1918         }
1919         endTime = System.currentTimeMillis();
1920         System.out.println("Time Taken: " + (double)   ((endTime - startTime) / 1000.0)    );
1921         System.out.println("Time Taken Per Update: " + (double)  (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4))   );
1922         System.out.println();
1923
1924
1925         System.out.println("Updating Clients...");
1926         t1.update();
1927         t2.update();
1928
1929
1930         System.out.println("Checking Key-Values...");
1931         for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1932
1933             String keyA = "a" + i;
1934             String keyB = "b" + i;
1935             String keyC = "c" + i;
1936             String keyD = "d" + i;
1937             String valueA = "a" + i;
1938             String valueB = "b" + i;
1939             String valueC = "c" + i;
1940             String valueD = "d" + i;
1941
1942             IoTString iKeyA = new IoTString(keyA);
1943             IoTString iKeyB = new IoTString(keyB);
1944             IoTString iKeyC = new IoTString(keyC);
1945             IoTString iKeyD = new IoTString(keyD);
1946             IoTString iValueA = new IoTString(valueA);
1947             IoTString iValueB = new IoTString(valueB);
1948             IoTString iValueC = new IoTString(valueC);
1949             IoTString iValueD = new IoTString(valueD);
1950
1951
1952             IoTString testValA1 = t1.getCommitted(iKeyA);
1953             IoTString testValB1 = t1.getCommitted(iKeyB);
1954             IoTString testValC1 = t1.getCommitted(iKeyC);
1955             IoTString testValD1 = t1.getCommitted(iKeyD);
1956
1957             IoTString testValA2 = t2.getCommitted(iKeyA);
1958             IoTString testValB2 = t2.getCommitted(iKeyB);
1959             IoTString testValC2 = t2.getCommitted(iKeyC);
1960             IoTString testValD2 = t2.getCommitted(iKeyD);
1961
1962             if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1963                 System.out.println("Key-Value t1 incorrect: " + keyA);
1964                 foundError = true;
1965             }
1966
1967             if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1968                 System.out.println("Key-Value t1 incorrect: " + keyB);
1969                 foundError = true;
1970             }
1971
1972             if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1973                 System.out.println("Key-Value t1 incorrect: " + keyC);
1974                 foundError = true;
1975             }
1976
1977             if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1978                 System.out.println("Key-Value t1 incorrect: " + keyD);
1979                 foundError = true;
1980             }
1981
1982
1983             if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1984                 System.out.println("Key-Value t2 incorrect: " + keyA + "    " + testValA2);
1985                 foundError = true;
1986             }
1987
1988             if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1989                 System.out.println("Key-Value t2 incorrect: " + keyB + "    " + testValB2);
1990                 foundError = true;
1991             }
1992
1993             if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1994                 System.out.println("Key-Value t2 incorrect: " + keyC + "    " + testValC2);
1995                 foundError = true;
1996             }
1997
1998             if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1999                 System.out.println("Key-Value t2 incorrect: " + keyD + "    " + testValD2);
2000                 foundError = true;
2001             }
2002         }
2003
2004         for (TransactionStatus status : transStatusList) {
2005             if (status.getStatus() != TransactionStatus.StatusCommitted) {
2006                 foundError = true;
2007                 System.out.println(status.getStatus());
2008             }
2009         }
2010
2011         if (foundError) {
2012             System.out.println("Found Errors...");
2013         } else {
2014             System.out.println("No Errors Found...");
2015         }
2016
2017         System.out.println();
2018         System.out.println();
2019         t1.printSlots();
2020
2021         System.out.println();
2022         System.out.println();
2023         t2.printSlots();
2024     }
2025 }