11 public static final int NUMBER_OF_TESTS = 1000;
13 public static void main(String[] args) {
14 if (args[0].equals("2")) {
16 } else if (args[0].equals("3")) {
18 } else if (args[0].equals("4")) {
20 } else if (args[0].equals("5")) {
22 } else if (args[0].equals("6")) {
24 } else if (args[0].equals("7")) {
26 } else if (args[0].equals("8")) {
28 } else if (args[0].equals("9")) {
35 // Setup the 2 clients
36 Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321);
38 Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351);
43 System.out.println("Setting up keys");
44 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
49 IoTString ia = new IoTString(a);
50 IoTString ib = new IoTString(b);
51 IoTString ic = new IoTString(c);
52 IoTString id = new IoTString(d);
53 t1.createNewKey(ia, 321);
54 t1.createNewKey(ib, 351);
55 t2.createNewKey(ic, 321);
56 t2.createNewKey(id, 351);
59 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
64 IoTString ia = new IoTString(a);
65 IoTString ib = new IoTString(b);
66 IoTString ic = new IoTString(c);
67 IoTString id = new IoTString(d);
68 t1.createNewKey(ia, 1000);
69 t1.createNewKey(ib, 1000);
70 t2.createNewKey(ic, 1000);
71 t2.createNewKey(id, 1000);
74 System.out.println("Updating Clients...");
80 boolean foundError = false;
82 System.out.println("Checking Key-Values...");
83 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
85 String keyA = "a" + i;
86 String keyB = "b" + i;
87 String keyC = "c" + i;
88 String keyD = "d" + i;
90 IoTString iKeyA = new IoTString(keyA);
91 IoTString iKeyB = new IoTString(keyB);
92 IoTString iKeyC = new IoTString(keyC);
93 IoTString iKeyD = new IoTString(keyD);
96 Long testValA1 = t1.getArbitrator(iKeyA);
97 Long testValB1 = t1.getArbitrator(iKeyB);
98 Long testValC1 = t1.getArbitrator(iKeyC);
99 Long testValD1 = t1.getArbitrator(iKeyD);
101 Long testValA2 = t2.getArbitrator(iKeyA);
102 Long testValB2 = t2.getArbitrator(iKeyB);
103 Long testValC2 = t2.getArbitrator(iKeyC);
104 Long testValD2 = t2.getArbitrator(iKeyD);
106 if ((testValA1 == null) || (testValA1 != 321)) {
107 System.out.println("Key-Value t1 incorrect: " + keyA + " " + testValA1);
111 if ((testValB1 == null) || (testValB1 != 351)) {
112 System.out.println("Key-Value t1 incorrect: " + keyB + " " + testValB1);
116 if ((testValC1 == null) || (testValC1 != 321)) {
117 System.out.println("Key-Value t1 incorrect: " + keyC + " " + testValC1);
121 if ((testValD1 == null) || (testValD1 != 351)) {
122 System.out.println("Key-Value t1 incorrect: " + keyD + " " + testValD1);
126 if ((testValA2 == null) || (testValA2 != 321)) {
127 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
131 if ((testValB2 == null) || (testValB2 != 351)) {
132 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
136 if ((testValC2 == null) || (testValC2 != 321)) {
137 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
141 if ((testValD2 == null) || (testValD2 != 351)) {
142 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
148 System.out.println("Found Errors...");
150 System.out.println("No Errors Found...");
154 static void test8() {
156 boolean foundError = false;
158 // Setup the 2 clients
159 Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321);
161 Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351);
168 System.out.println("Setting up keys");
169 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
174 IoTString ia = new IoTString(a);
175 IoTString ib = new IoTString(b);
176 IoTString ic = new IoTString(c);
177 IoTString id = new IoTString(d);
178 t1.createNewKey(ia, 321);
179 t1.createNewKey(ib, 351);
180 t2.createNewKey(ic, 321);
181 t2.createNewKey(id, 351);
185 // Do Updates for the keys
186 System.out.println("Setting Key-Values...");
193 String valueA0 = "a0";
194 String valueB0 = "b0";
195 String valueC0 = "c0";
196 String valueD0 = "d0";
198 IoTString iKeyA0 = new IoTString(keyA0);
199 IoTString iKeyB0 = new IoTString(keyB0);
200 IoTString iKeyC0 = new IoTString(keyC0);
201 IoTString iKeyD0 = new IoTString(keyD0);
202 IoTString iValueA0 = new IoTString(valueA0);
203 IoTString iValueB0 = new IoTString(valueB0);
204 IoTString iValueC0 = new IoTString(valueC0);
205 IoTString iValueD0 = new IoTString(valueD0);
207 t1.startTransaction();
208 t1.addKV( iKeyA0, iValueA0);
209 t1.commitTransaction();
211 t1.startTransaction();
212 t1.addKV(iKeyB0, iValueB0);
213 t1.commitTransaction();
215 t2.startTransaction();
216 t2.addKV(iKeyC0, iValueC0);
217 t2.commitTransaction();
219 t2.startTransaction();
220 t2.addKV(iKeyD0, iValueD0);
221 t2.commitTransaction();
223 for (int i = 1; i < NUMBER_OF_TESTS; i++) {
224 String keyB = "b" + i;
225 String valueB = "b" + i;
226 IoTString iKeyB = new IoTString(keyB);
227 IoTString iValueB = new IoTString(valueB);
229 String keyBOld = "b" + (i - 1);
230 String valueBOld = "b" + (i - 1);
231 IoTString iKeyBOld = new IoTString(keyBOld);
232 IoTString iValueBOld = new IoTString(valueBOld);
235 t1.startTransaction();
236 t1.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyBOld, iValueBOld, Guard.Equal))));
237 t1.addKV(iKeyB, iValueB);
238 t1.commitTransaction();
241 System.out.println("Checking Key-Values...");
242 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
244 String keyB = "b" + i;
245 String valueB = "b" + i;
247 IoTString iKeyB = new IoTString(keyB);
248 IoTString iValueB = new IoTString(valueB);
250 IoTString testValB1 = t1.getSpeculative(iKeyB);
252 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
253 System.out.println("Key-Value t1 incorrect: " + keyB);
260 System.out.println("Updating Clients...");
266 System.out.println("Checking Key-Values...");
267 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
269 String keyA = "a" + i;
270 String keyB = "b" + i;
271 String keyC = "c" + i;
272 String keyD = "d" + i;
273 String valueA = "a" + i;
274 String valueB = "b" + i;
275 String valueC = "c" + i;
276 String valueD = "d" + i;
278 IoTString iKeyA = new IoTString(keyA);
279 IoTString iKeyB = new IoTString(keyB);
280 IoTString iKeyC = new IoTString(keyC);
281 IoTString iKeyD = new IoTString(keyD);
282 IoTString iValueA = new IoTString(valueA);
283 IoTString iValueB = new IoTString(valueB);
284 IoTString iValueC = new IoTString(valueC);
285 IoTString iValueD = new IoTString(valueD);
288 IoTString testValA1 = t1.getCommitted(iKeyA);
289 IoTString testValB1 = t1.getCommitted(iKeyB);
290 IoTString testValC1 = t1.getCommitted(iKeyC);
291 IoTString testValD1 = t1.getCommitted(iKeyD);
293 IoTString testValA2 = t2.getCommitted(iKeyA);
294 IoTString testValB2 = t2.getCommitted(iKeyB);
295 IoTString testValC2 = t2.getCommitted(iKeyC);
296 IoTString testValD2 = t2.getCommitted(iKeyD);
300 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
301 System.out.println("Key-Value t1 incorrect: " + keyA);
305 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
306 System.out.println("Key-Value t1 incorrect: " + keyB);
310 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
311 System.out.println("Key-Value t1 incorrect: " + keyC);
315 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
316 System.out.println("Key-Value t1 incorrect: " + keyD);
321 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
322 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
326 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
327 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
331 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
332 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
336 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
337 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
341 if (testValA1 != null) {
342 System.out.println("Key-Value t1 incorrect: " + keyA);
346 if (testValB1 != null) {
347 System.out.println("Key-Value t1 incorrect: " + keyB);
351 if (testValC1 != null) {
352 System.out.println("Key-Value t1 incorrect: " + keyC);
356 if (testValD1 != null) {
357 System.out.println("Key-Value t1 incorrect: " + keyD);
361 if (testValA2 != null) {
362 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
366 if (testValB2 != null) {
367 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
371 if (testValC2 != null) {
372 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
376 if (testValD2 != null) {
377 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
384 System.out.println("Found Errors...");
386 System.out.println("No Errors Found...");
390 static void test7() {
395 // Setup the 2 clients
396 Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321);
398 Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351);
405 System.out.println("Setting up keys");
406 startTime = System.currentTimeMillis();
407 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
412 IoTString ia = new IoTString(a);
413 IoTString ib = new IoTString(b);
414 IoTString ic = new IoTString(c);
415 IoTString id = new IoTString(d);
416 t1.createNewKey(ia, 321);
417 t1.createNewKey(ib, 351);
418 t2.createNewKey(ic, 321);
419 t2.createNewKey(id, 351);
421 endTime = System.currentTimeMillis();
423 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
424 System.out.println("Time Taken Per Key: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
425 System.out.println();
428 // Do Updates for the keys
429 System.out.println("Setting Key-Values...");
430 startTime = System.currentTimeMillis();
438 String valueA0 = "a0";
439 String valueB0 = "b0";
440 String valueC0 = "c0";
441 String valueD0 = "d0";
443 IoTString iKeyA0 = new IoTString(keyA0);
444 IoTString iKeyB0 = new IoTString(keyB0);
445 IoTString iKeyC0 = new IoTString(keyC0);
446 IoTString iKeyD0 = new IoTString(keyD0);
447 IoTString iValueA0 = new IoTString(valueA0);
448 IoTString iValueB0 = new IoTString(valueB0);
449 IoTString iValueC0 = new IoTString(valueC0);
450 IoTString iValueD0 = new IoTString(valueD0);
452 t1.startTransaction();
453 t1.addKV( iKeyA0, iValueA0);
454 t1.commitTransaction();
456 t1.startTransaction();
457 t1.addKV(iKeyB0, iValueB0);
458 t1.commitTransaction();
460 t2.startTransaction();
461 t2.addKV(iKeyC0, iValueC0);
462 t2.commitTransaction();
464 t2.startTransaction();
465 t2.addKV(iKeyD0, iValueD0);
466 t2.commitTransaction();
468 for (int i = 1; i < NUMBER_OF_TESTS; i++) {
469 String keyB = "b" + i;
470 String valueB = "b" + i;
471 IoTString iKeyB = new IoTString(keyB);
472 IoTString iValueB = new IoTString(valueB);
474 String keyBOld = "b" + (i - 1);
475 String valueBOld = "b" + (i - 2);
476 IoTString iKeyBOld = new IoTString(keyBOld);
477 IoTString iValueBOld = new IoTString(valueBOld);
480 t1.startTransaction();
481 t1.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyBOld, iValueBOld, Guard.Equal))));
482 t1.addKV(iKeyB, iValueB);
483 t1.commitTransaction();
486 for (int i = 1; i < NUMBER_OF_TESTS; i++) {
487 String keyC = "c" + i;
488 String valueC = "c" + i;
489 IoTString iKeyC = new IoTString(keyC);
490 IoTString iValueC = new IoTString(valueC);
492 String keyCOld = "c" + (i - 1);
493 String valueCOld = "c" + (i - 2);
494 IoTString iKeyCOld = new IoTString(keyCOld);
495 IoTString iValueCOld = new IoTString(valueCOld);
498 t2.startTransaction();
499 t2.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyCOld, iValueCOld, Guard.Equal))));
500 t2.addKV(iKeyC, iValueC);
501 t2.commitTransaction();
504 for (int i = 1; i < NUMBER_OF_TESTS; i++) {
505 String keyA = "a" + i;
506 String keyD = "d" + i;
507 String valueA = "a" + i;
508 String valueD = "d" + i;
510 IoTString iKeyA = new IoTString(keyA);
511 IoTString iKeyD = new IoTString(keyD);
512 IoTString iValueA = new IoTString(valueA);
513 IoTString iValueD = new IoTString(valueD);
516 String keyAOld = "a" + (i - 1);
517 String keyDOld = "d" + (i - 1);
518 String valueAOld = "a" + (i - 2);
519 String valueDOld = "d" + (i - 2);
520 IoTString iKeyAOld = new IoTString(keyAOld);
521 IoTString iKeyDOld = new IoTString(keyDOld);
522 IoTString iValueAOld = new IoTString(valueAOld);
523 IoTString iValueDOld = new IoTString(valueDOld);
526 t1.startTransaction();
527 t1.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyAOld, iValueAOld, Guard.Equal))));
528 t1.addKV(iKeyA, iValueA);
529 t1.commitTransaction();
531 t2.startTransaction();
532 t2.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyDOld, iValueDOld, Guard.Equal))));
533 t2.addKV(iKeyD, iValueD);
534 t2.commitTransaction();
537 endTime = System.currentTimeMillis();
539 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
540 System.out.println("Time Taken Per Update: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
541 System.out.println();
544 System.out.println("Updating Clients...");
550 boolean foundError = false;
552 System.out.println("Checking Key-Values...");
553 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
555 String keyA = "a" + i;
556 String keyB = "b" + i;
557 String keyC = "c" + i;
558 String keyD = "d" + i;
559 String valueA = "a" + i;
560 String valueB = "b" + i;
561 String valueC = "c" + i;
562 String valueD = "d" + i;
564 IoTString iKeyA = new IoTString(keyA);
565 IoTString iKeyB = new IoTString(keyB);
566 IoTString iKeyC = new IoTString(keyC);
567 IoTString iKeyD = new IoTString(keyD);
568 IoTString iValueA = new IoTString(valueA);
569 IoTString iValueB = new IoTString(valueB);
570 IoTString iValueC = new IoTString(valueC);
571 IoTString iValueD = new IoTString(valueD);
574 IoTString testValA1 = t1.getCommitted(iKeyA);
575 IoTString testValB1 = t1.getCommitted(iKeyB);
576 IoTString testValC1 = t1.getCommitted(iKeyC);
577 IoTString testValD1 = t1.getCommitted(iKeyD);
579 IoTString testValA2 = t2.getCommitted(iKeyA);
580 IoTString testValB2 = t2.getCommitted(iKeyB);
581 IoTString testValC2 = t2.getCommitted(iKeyC);
582 IoTString testValD2 = t2.getCommitted(iKeyD);
586 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
587 System.out.println("Key-Value t1 incorrect: " + keyA);
591 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
592 System.out.println("Key-Value t1 incorrect: " + keyB);
596 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
597 System.out.println("Key-Value t1 incorrect: " + keyC);
601 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
602 System.out.println("Key-Value t1 incorrect: " + keyD);
607 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
608 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
612 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
613 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
617 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
618 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
622 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
623 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
627 if (testValA1 != null) {
628 System.out.println("Key-Value t1 incorrect: " + keyA);
632 if (testValB1 != null) {
633 System.out.println("Key-Value t1 incorrect: " + keyB);
637 if (testValC1 != null) {
638 System.out.println("Key-Value t1 incorrect: " + keyC);
642 if (testValD1 != null) {
643 System.out.println("Key-Value t1 incorrect: " + keyD);
647 if (testValA2 != null) {
648 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
652 if (testValB2 != null) {
653 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
657 if (testValC2 != null) {
658 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
662 if (testValD2 != null) {
663 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
670 System.out.println("Found Errors...");
672 System.out.println("No Errors Found...");
676 static void test6() {
681 // Setup the 2 clients
682 Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321);
684 Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351);
691 System.out.println("Setting up keys");
692 startTime = System.currentTimeMillis();
693 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
698 IoTString ia = new IoTString(a);
699 IoTString ib = new IoTString(b);
700 IoTString ic = new IoTString(c);
701 IoTString id = new IoTString(d);
702 t1.createNewKey(ia, 321);
703 t1.createNewKey(ib, 351);
704 t2.createNewKey(ic, 321);
705 t2.createNewKey(id, 351);
707 endTime = System.currentTimeMillis();
709 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
710 System.out.println("Time Taken Per Key: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
711 System.out.println();
714 // Do Updates for the keys
715 System.out.println("Setting Key-Values...");
716 startTime = System.currentTimeMillis();
719 t1.startTransaction();
720 t1.addKV( new IoTString("a0"), new IoTString("a0"));
721 t1.commitTransaction();
723 t1.startTransaction();
724 t1.addKV(new IoTString("b0"), new IoTString("b0"));
725 t1.commitTransaction();
727 t2.startTransaction();
728 t2.addKV(new IoTString("c0"), new IoTString("c0"));
729 t2.commitTransaction();
731 t2.startTransaction();
732 t2.addKV(new IoTString("d0"), new IoTString("d0"));
733 t2.commitTransaction();
735 for (int i = 1; i < NUMBER_OF_TESTS; i++) {
736 String keyB = "b" + i;
737 String valueB = "b" + i;
738 IoTString iKeyB = new IoTString(keyB);
739 IoTString iValueB = new IoTString(valueB);
741 String keyBOld = "b" + (i - 1);
742 String valueBOld = "b" + (i - 1);
743 IoTString iKeyBOld = new IoTString(keyBOld);
744 IoTString iValueBOld = new IoTString(valueBOld);
747 t1.startTransaction();
748 t1.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyBOld, iValueBOld, Guard.Equal))));
749 t1.addKV(iKeyB, iValueB);
750 t1.commitTransaction();
753 for (int i = 1; i < NUMBER_OF_TESTS; i++) {
754 String keyC = "c" + i;
755 String valueC = "c" + i;
756 IoTString iKeyC = new IoTString(keyC);
757 IoTString iValueC = new IoTString(valueC);
759 String keyCOld = "c" + (i - 1);
760 String valueCOld = "c" + (i - 1);
761 IoTString iKeyCOld = new IoTString(keyCOld);
762 IoTString iValueCOld = new IoTString(valueCOld);
765 t2.startTransaction();
766 t2.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyCOld, iValueCOld, Guard.Equal))));
767 t2.addKV(iKeyC, iValueC);
768 t2.commitTransaction();
771 for (int i = 1; i < NUMBER_OF_TESTS; i++) {
772 String keyA = "a" + i;
773 String keyD = "d" + i;
774 String valueA = "a" + i;
775 String valueD = "d" + i;
777 IoTString iKeyA = new IoTString(keyA);
778 IoTString iKeyD = new IoTString(keyD);
779 IoTString iValueA = new IoTString(valueA);
780 IoTString iValueD = new IoTString(valueD);
783 String keyAOld = "a" + (i - 1);
784 String keyDOld = "d" + (i - 1);
785 String valueAOld = "a" + (i - 1);
786 String valueDOld = "d" + (i - 1);
787 IoTString iKeyAOld = new IoTString(keyAOld);
788 IoTString iKeyDOld = new IoTString(keyDOld);
789 IoTString iValueAOld = new IoTString(valueAOld);
790 IoTString iValueDOld = new IoTString(valueDOld);
793 t1.startTransaction();
794 t1.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyAOld, iValueAOld, Guard.Equal))));
795 t1.addKV(iKeyA, iValueA);
796 t1.commitTransaction();
798 t2.startTransaction();
799 t2.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyDOld, iValueDOld, Guard.Equal))));
800 t2.addKV(iKeyD, iValueD);
801 t2.commitTransaction();
804 endTime = System.currentTimeMillis();
806 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
807 System.out.println("Time Taken Per Update: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
808 System.out.println();
811 System.out.println("Updating Clients...");
817 boolean foundError = false;
819 System.out.println("Checking Key-Values...");
820 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
822 String keyA = "a" + i;
823 String keyB = "b" + i;
824 String keyC = "c" + i;
825 String keyD = "d" + i;
826 String valueA = "a" + i;
827 String valueB = "b" + i;
828 String valueC = "c" + i;
829 String valueD = "d" + i;
831 IoTString iKeyA = new IoTString(keyA);
832 IoTString iKeyB = new IoTString(keyB);
833 IoTString iKeyC = new IoTString(keyC);
834 IoTString iKeyD = new IoTString(keyD);
835 IoTString iValueA = new IoTString(valueA);
836 IoTString iValueB = new IoTString(valueB);
837 IoTString iValueC = new IoTString(valueC);
838 IoTString iValueD = new IoTString(valueD);
841 IoTString testValA1 = t1.getCommitted(iKeyA);
842 IoTString testValB1 = t1.getCommitted(iKeyB);
843 IoTString testValC1 = t1.getCommitted(iKeyC);
844 IoTString testValD1 = t1.getCommitted(iKeyD);
846 IoTString testValA2 = t2.getCommitted(iKeyA);
847 IoTString testValB2 = t2.getCommitted(iKeyB);
848 IoTString testValC2 = t2.getCommitted(iKeyC);
849 IoTString testValD2 = t2.getCommitted(iKeyD);
851 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
852 System.out.println("Key-Value t1 incorrect: " + keyA);
856 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
857 System.out.println("Key-Value t1 incorrect: " + keyB);
861 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
862 System.out.println("Key-Value t1 incorrect: " + keyC);
866 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
867 System.out.println("Key-Value t1 incorrect: " + keyD);
872 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
873 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
877 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
878 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
882 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
883 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
887 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
888 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
894 System.out.println("Found Errors...");
896 System.out.println("No Errors Found...");
900 static void test5() {
905 // Setup the 2 clients
906 Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321);
908 Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351);
917 System.out.println("Setting up keys");
918 startTime = System.currentTimeMillis();
919 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
924 IoTString ia = new IoTString(a);
925 IoTString ib = new IoTString(b);
926 IoTString ic = new IoTString(c);
927 IoTString id = new IoTString(d);
928 t1.createNewKey(ia, 321);
929 t1.createNewKey(ib, 351);
930 t2.createNewKey(ic, 321);
931 t2.createNewKey(id, 351);
933 endTime = System.currentTimeMillis();
937 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
938 System.out.println("Time Taken Per Key: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
939 System.out.println();
942 // Do Updates for the keys
943 System.out.println("Setting Key-Values...");
944 startTime = System.currentTimeMillis();
945 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
946 String keyA = "a" + i;
947 String keyB = "b" + i;
948 String keyC = "c" + i;
949 String keyD = "d" + i;
950 String valueA = "a" + i;
951 String valueB = "b" + i;
952 String valueC = "c" + i;
953 String valueD = "d" + i;
955 IoTString iKeyA = new IoTString(keyA);
956 IoTString iKeyB = new IoTString(keyB);
957 IoTString iKeyC = new IoTString(keyC);
958 IoTString iKeyD = new IoTString(keyD);
959 IoTString iValueA = new IoTString(valueA);
960 IoTString iValueB = new IoTString(valueB);
961 IoTString iValueC = new IoTString(valueC);
962 IoTString iValueD = new IoTString(valueD);
967 String keyAOld = "a" + (i - 1);
968 String keyBOld = "b" + (i - 1);
969 String keyCOld = "c" + (i - 1);
970 String keyDOld = "d" + (i - 1);
971 String valueAOld = "a" + (i - 1);
972 String valueBOld = "b" + (i - 1);
973 String valueCOld = "c" + (i - 1);
974 String valueDOld = "d" + (i - 1);
976 IoTString iKeyAOld = new IoTString(keyAOld);
977 IoTString iKeyBOld = new IoTString(keyBOld);
978 IoTString iKeyCOld = new IoTString(keyCOld);
979 IoTString iKeyDOld = new IoTString(keyDOld);
980 IoTString iValueAOld = new IoTString(valueAOld);
981 IoTString iValueBOld = new IoTString(valueBOld);
982 IoTString iValueCOld = new IoTString(valueCOld);
983 IoTString iValueDOld = new IoTString(valueDOld);
985 t1.startTransaction();
986 t1.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyAOld, iValueAOld, Guard.Equal))));
987 t1.addKV(iKeyA, iValueA);
988 t1.commitTransaction();
990 t1.startTransaction();
991 t1.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyBOld, iValueBOld, Guard.Equal))));
992 t1.addKV(iKeyB, iValueB);
993 t1.commitTransaction();
995 t2.startTransaction();
996 t2.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyCOld, iValueCOld, Guard.Equal))));
997 t2.addKV(iKeyC, iValueC);
998 t2.commitTransaction();
1000 t2.startTransaction();
1001 t2.addGuard(new Guard(new IoTString(Guard.createExpression(iKeyDOld, iValueDOld, Guard.Equal))));
1002 t2.addKV(iKeyD, iValueD);
1003 t2.commitTransaction();
1007 t1.startTransaction();
1008 t1.addKV(iKeyA, iValueA);
1009 t1.commitTransaction();
1011 t1.startTransaction();
1012 t1.addKV(iKeyB, iValueB);
1013 t1.commitTransaction();
1015 t2.startTransaction();
1016 t2.addKV(iKeyC, iValueC);
1017 t2.commitTransaction();
1019 t2.startTransaction();
1020 t2.addKV(iKeyD, iValueD);
1021 t2.commitTransaction();
1024 endTime = System.currentTimeMillis();
1026 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
1027 System.out.println("Time Taken Per Update: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
1028 System.out.println();
1031 System.out.println("Updating Clients...");
1037 boolean foundError = false;
1039 System.out.println("Checking Key-Values...");
1040 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1042 String keyA = "a" + i;
1043 String keyB = "b" + i;
1044 String keyC = "c" + i;
1045 String keyD = "d" + i;
1046 String valueA = "a" + i;
1047 String valueB = "b" + i;
1048 String valueC = "c" + i;
1049 String valueD = "d" + i;
1051 IoTString iKeyA = new IoTString(keyA);
1052 IoTString iKeyB = new IoTString(keyB);
1053 IoTString iKeyC = new IoTString(keyC);
1054 IoTString iKeyD = new IoTString(keyD);
1055 IoTString iValueA = new IoTString(valueA);
1056 IoTString iValueB = new IoTString(valueB);
1057 IoTString iValueC = new IoTString(valueC);
1058 IoTString iValueD = new IoTString(valueD);
1061 IoTString testValA1 = t1.getCommitted(iKeyA);
1062 IoTString testValB1 = t1.getCommitted(iKeyB);
1063 IoTString testValC1 = t1.getCommitted(iKeyC);
1064 IoTString testValD1 = t1.getCommitted(iKeyD);
1066 IoTString testValA2 = t2.getCommitted(iKeyA);
1067 IoTString testValB2 = t2.getCommitted(iKeyB);
1068 IoTString testValC2 = t2.getCommitted(iKeyC);
1069 IoTString testValD2 = t2.getCommitted(iKeyD);
1071 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1072 System.out.println("Key-Value t1 incorrect: " + keyA);
1076 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1077 System.out.println("Key-Value t1 incorrect: " + keyB);
1081 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1082 System.out.println("Key-Value t1 incorrect: " + keyC);
1086 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1087 System.out.println("Key-Value t1 incorrect: " + keyD);
1092 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1093 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
1097 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1098 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
1102 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1103 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1107 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1108 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
1114 System.out.println("Found Errors...");
1116 System.out.println("No Errors Found...");
1120 static void test4() {
1125 // Setup the 2 clients
1126 Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321);
1128 Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351);
1133 System.out.println("Setting up keys");
1134 startTime = System.currentTimeMillis();
1135 for (int i = 0; i < 4; i++) {
1140 IoTString ia = new IoTString(a);
1141 IoTString ib = new IoTString(b);
1142 IoTString ic = new IoTString(c);
1143 IoTString id = new IoTString(d);
1144 t1.createNewKey(ia, 321);
1145 t1.createNewKey(ib, 351);
1146 t2.createNewKey(ic, 321);
1147 t2.createNewKey(id, 351);
1149 endTime = System.currentTimeMillis();
1153 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
1154 System.out.println("Time Taken Per Key: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
1155 System.out.println();
1158 // Do Updates for the keys
1159 System.out.println("Setting Key-Values...");
1160 startTime = System.currentTimeMillis();
1161 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1162 for (int i = 0; i < 4; i++) {
1163 String keyA = "a" + i;
1164 String keyB = "b" + i;
1165 String keyC = "c" + i;
1166 String keyD = "d" + i;
1167 String valueA = "a" + i;
1168 String valueB = "b" + i;
1169 String valueC = "c" + i;
1170 String valueD = "d" + i;
1172 IoTString iKeyA = new IoTString(keyA);
1173 IoTString iKeyB = new IoTString(keyB);
1174 IoTString iKeyC = new IoTString(keyC);
1175 IoTString iKeyD = new IoTString(keyD);
1176 IoTString iValueA = new IoTString(valueA);
1177 IoTString iValueB = new IoTString(valueB);
1178 IoTString iValueC = new IoTString(valueC);
1179 IoTString iValueD = new IoTString(valueD);
1181 t1.startTransaction();
1182 t1.addKV(iKeyA, iValueA);
1183 t1.commitTransaction();
1185 t1.startTransaction();
1186 t1.addKV(iKeyB, iValueB);
1187 t1.commitTransaction();
1189 t2.startTransaction();
1190 t2.addKV(iKeyC, iValueC);
1191 t2.commitTransaction();
1193 t2.startTransaction();
1194 t2.addKV(iKeyD, iValueD);
1195 t2.commitTransaction();
1198 endTime = System.currentTimeMillis();
1200 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
1201 System.out.println("Time Taken Per Update: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 8)) );
1202 System.out.println();
1205 System.out.println("Updating Clients...");
1211 boolean foundError = false;
1213 System.out.println("Checking Key-Values...");
1214 for (int i = 0; i < 4; i++) {
1216 String keyA = "a" + i;
1217 String keyB = "b" + i;
1218 String keyC = "c" + i;
1219 String keyD = "d" + i;
1220 String valueA = "a" + i;
1221 String valueB = "b" + i;
1222 String valueC = "c" + i;
1223 String valueD = "d" + i;
1225 IoTString iKeyA = new IoTString(keyA);
1226 IoTString iKeyB = new IoTString(keyB);
1227 IoTString iKeyC = new IoTString(keyC);
1228 IoTString iKeyD = new IoTString(keyD);
1229 IoTString iValueA = new IoTString(valueA);
1230 IoTString iValueB = new IoTString(valueB);
1231 IoTString iValueC = new IoTString(valueC);
1232 IoTString iValueD = new IoTString(valueD);
1235 IoTString testValA1 = t1.getCommitted(iKeyA);
1236 IoTString testValB1 = t1.getCommitted(iKeyB);
1237 IoTString testValC1 = t1.getCommitted(iKeyC);
1238 IoTString testValD1 = t1.getCommitted(iKeyD);
1240 IoTString testValA2 = t2.getCommitted(iKeyA);
1241 IoTString testValB2 = t2.getCommitted(iKeyB);
1242 IoTString testValC2 = t2.getCommitted(iKeyC);
1243 IoTString testValD2 = t2.getCommitted(iKeyD);
1245 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1246 System.out.println("Key-Value t1 incorrect: " + keyA);
1250 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1251 System.out.println("Key-Value t1 incorrect: " + keyB);
1255 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1256 System.out.println("Key-Value t1 incorrect: " + keyC);
1260 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1261 System.out.println("Key-Value t1 incorrect: " + keyD);
1266 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1267 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
1271 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1272 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
1276 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1277 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1281 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1282 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
1288 System.out.println("Found Errors...");
1290 System.out.println("No Errors Found...");
1294 static void test3() {
1299 // Setup the 2 clients
1300 Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321);
1302 Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351);
1307 System.out.println("Setting up keys");
1308 startTime = System.currentTimeMillis();
1309 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1314 IoTString ia = new IoTString(a);
1315 IoTString ib = new IoTString(b);
1316 IoTString ic = new IoTString(c);
1317 IoTString id = new IoTString(d);
1318 t1.createNewKey(ia, 321);
1319 t1.createNewKey(ib, 351);
1320 t2.createNewKey(ic, 321);
1321 t2.createNewKey(id, 351);
1323 endTime = System.currentTimeMillis();
1327 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
1328 System.out.println("Time Taken Per Key: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
1329 System.out.println();
1332 // Do Updates for the keys
1333 System.out.println("Setting Key-Values...");
1334 startTime = System.currentTimeMillis();
1335 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1336 String keyB = "b" + i;
1337 String valueB = "b" + i;
1339 IoTString iKeyB = new IoTString(keyB);
1340 IoTString iValueB = new IoTString(valueB);
1342 t1.startTransaction();
1343 t1.addKV(iKeyB, iValueB);
1344 t1.commitTransaction();
1347 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1348 String keyC = "c" + i;
1349 String valueC = "c" + i;
1351 IoTString iKeyC = new IoTString(keyC);
1352 IoTString iValueC = new IoTString(valueC);
1354 t2.startTransaction();
1355 t2.addKV(iKeyC, iValueC);
1356 t2.commitTransaction();
1359 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1360 String keyA = "a" + i;
1361 String keyD = "d" + i;
1362 String valueA = "a" + i;
1363 String valueD = "d" + i;
1365 IoTString iKeyA = new IoTString(keyA);
1366 IoTString iKeyD = new IoTString(keyD);
1367 IoTString iValueA = new IoTString(valueA);
1368 IoTString iValueD = new IoTString(valueD);
1370 t1.startTransaction();
1371 t1.addKV(iKeyA, iValueA);
1372 t1.commitTransaction();
1374 t2.startTransaction();
1375 t2.addKV(iKeyD, iValueD);
1376 t2.commitTransaction();
1378 endTime = System.currentTimeMillis();
1380 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
1381 System.out.println("Time Taken Per Update: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
1382 System.out.println();
1385 System.out.println("Updating Clients...");
1391 boolean foundError = false;
1393 System.out.println("Checking Key-Values...");
1394 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1396 String keyA = "a" + i;
1397 String keyB = "b" + i;
1398 String keyC = "c" + i;
1399 String keyD = "d" + i;
1400 String valueA = "a" + i;
1401 String valueB = "b" + i;
1402 String valueC = "c" + i;
1403 String valueD = "d" + i;
1405 IoTString iKeyA = new IoTString(keyA);
1406 IoTString iKeyB = new IoTString(keyB);
1407 IoTString iKeyC = new IoTString(keyC);
1408 IoTString iKeyD = new IoTString(keyD);
1409 IoTString iValueA = new IoTString(valueA);
1410 IoTString iValueB = new IoTString(valueB);
1411 IoTString iValueC = new IoTString(valueC);
1412 IoTString iValueD = new IoTString(valueD);
1415 IoTString testValA1 = t1.getCommitted(iKeyA);
1416 IoTString testValB1 = t1.getCommitted(iKeyB);
1417 IoTString testValC1 = t1.getCommitted(iKeyC);
1418 IoTString testValD1 = t1.getCommitted(iKeyD);
1420 IoTString testValA2 = t2.getCommitted(iKeyA);
1421 IoTString testValB2 = t2.getCommitted(iKeyB);
1422 IoTString testValC2 = t2.getCommitted(iKeyC);
1423 IoTString testValD2 = t2.getCommitted(iKeyD);
1425 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1426 System.out.println("Key-Value t1 incorrect: " + keyA);
1430 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1431 System.out.println("Key-Value t1 incorrect: " + keyB);
1435 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1436 System.out.println("Key-Value t1 incorrect: " + keyC);
1440 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1441 System.out.println("Key-Value t1 incorrect: " + keyD);
1446 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1447 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
1451 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1452 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
1456 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1457 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1461 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1462 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
1468 System.out.println("Found Errors...");
1470 System.out.println("No Errors Found...");
1474 static void test2() {
1479 // Setup the 2 clients
1480 Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321);
1482 Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351);
1491 System.out.println("Setting up keys");
1492 startTime = System.currentTimeMillis();
1493 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1498 IoTString ia = new IoTString(a);
1499 IoTString ib = new IoTString(b);
1500 IoTString ic = new IoTString(c);
1501 IoTString id = new IoTString(d);
1502 t1.createNewKey(ia, 321);
1503 t1.createNewKey(ib, 351);
1504 t2.createNewKey(ic, 321);
1505 t2.createNewKey(id, 351);
1507 endTime = System.currentTimeMillis();
1511 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
1512 System.out.println("Time Taken Per Key: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
1513 System.out.println();
1516 // Do Updates for the keys
1517 System.out.println("Setting Key-Values...");
1518 startTime = System.currentTimeMillis();
1519 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1520 String keyA = "a" + i;
1521 String keyB = "b" + i;
1522 String keyC = "c" + i;
1523 String keyD = "d" + i;
1524 String valueA = "a" + i;
1525 String valueB = "b" + i;
1526 String valueC = "c" + i;
1527 String valueD = "d" + i;
1529 IoTString iKeyA = new IoTString(keyA);
1530 IoTString iKeyB = new IoTString(keyB);
1531 IoTString iKeyC = new IoTString(keyC);
1532 IoTString iKeyD = new IoTString(keyD);
1533 IoTString iValueA = new IoTString(valueA);
1534 IoTString iValueB = new IoTString(valueB);
1535 IoTString iValueC = new IoTString(valueC);
1536 IoTString iValueD = new IoTString(valueD);
1538 t1.startTransaction();
1539 t1.addKV(iKeyA, iValueA);
1540 t1.commitTransaction();
1542 t1.startTransaction();
1543 t1.addKV(iKeyB, iValueB);
1544 t1.commitTransaction();
1546 t2.startTransaction();
1547 t2.addKV(iKeyC, iValueC);
1548 t2.commitTransaction();
1550 t2.startTransaction();
1551 t2.addKV(iKeyD, iValueD);
1552 t2.commitTransaction();
1554 endTime = System.currentTimeMillis();
1556 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
1557 System.out.println("Time Taken Per Update: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
1558 System.out.println();
1561 System.out.println("Updating Clients...");
1567 boolean foundError = false;
1569 System.out.println("Checking Key-Values...");
1570 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1572 String keyA = "a" + i;
1573 String keyB = "b" + i;
1574 String keyC = "c" + i;
1575 String keyD = "d" + i;
1576 String valueA = "a" + i;
1577 String valueB = "b" + i;
1578 String valueC = "c" + i;
1579 String valueD = "d" + i;
1581 IoTString iKeyA = new IoTString(keyA);
1582 IoTString iKeyB = new IoTString(keyB);
1583 IoTString iKeyC = new IoTString(keyC);
1584 IoTString iKeyD = new IoTString(keyD);
1585 IoTString iValueA = new IoTString(valueA);
1586 IoTString iValueB = new IoTString(valueB);
1587 IoTString iValueC = new IoTString(valueC);
1588 IoTString iValueD = new IoTString(valueD);
1591 IoTString testValA1 = t1.getCommitted(iKeyA);
1592 IoTString testValB1 = t1.getCommitted(iKeyB);
1593 IoTString testValC1 = t1.getCommitted(iKeyC);
1594 IoTString testValD1 = t1.getCommitted(iKeyD);
1596 IoTString testValA2 = t2.getCommitted(iKeyA);
1597 IoTString testValB2 = t2.getCommitted(iKeyB);
1598 IoTString testValC2 = t2.getCommitted(iKeyC);
1599 IoTString testValD2 = t2.getCommitted(iKeyD);
1601 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1602 System.out.println("Key-Value t1 incorrect: " + keyA);
1606 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1607 System.out.println("Key-Value t1 incorrect: " + keyB);
1611 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1612 System.out.println("Key-Value t1 incorrect: " + keyC);
1616 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1617 System.out.println("Key-Value t1 incorrect: " + keyD);
1622 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1623 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
1627 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1628 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
1632 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1633 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1637 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1638 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
1644 System.out.println("Found Errors...");
1646 System.out.println("No Errors Found...");