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