4 import java.util.ArrayList;
14 public static final int NUMBER_OF_TESTS = 25;
16 public static void main(String[] args) throws ServerException {
17 if (args[0].equals("2")) {
19 } else if (args[0].equals("3")) {
21 } else if (args[0].equals("4")) {
23 } else if (args[0].equals("5")) {
25 } else if (args[0].equals("6")) {
27 } else if (args[0].equals("7")) {
29 } else if (args[0].equals("8")) {
31 } else if (args[0].equals("9")) {
33 } else if (args[0].equals("10")) {
35 } else if (args[0].equals("11")) {
37 } else if (args[0].equals("12")) {
39 } else if (args[0].equals("13")) {
43 else if (args[0].equals("14")) {
49 static void test14() throws ServerException {
50 TimingSingleton timer = TimingSingleton.getInstance();
52 boolean foundError = false;
55 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
57 // Setup the 2 clients
58 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
60 System.out.println("T1 Ready");
63 System.out.println("Setting up keys");
64 startTime = System.nanoTime();
65 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
66 System.out.println(i);
68 IoTString ia = new IoTString(a);
69 t1.createNewKey(ia, 321);
71 endTime = System.nanoTime();
72 long keysDt = endTime - startTime;
73 long keysNet = timer.getTime();
75 System.out.println("Total Key Create Time: " + keysDt / 1000000);
76 System.out.println("Total Key Create Time Network: " + keysNet / 1000000);
77 System.out.println("Total Key Create Time no Network: " + (keysDt - keysNet) / 1000000);
82 static void test13() throws ServerException {
83 TimingSingleton timer = TimingSingleton.getInstance();
85 boolean foundError = false;
88 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
90 // Setup the 2 clients
91 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
93 System.out.println("T1 Ready");
95 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
97 System.out.println("T2 Ready");
100 System.out.println("Setting up keys");
101 startTime = System.nanoTime();
102 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
103 System.out.println(i);
108 IoTString ia = new IoTString(a);
109 IoTString ib = new IoTString(b);
110 IoTString ic = new IoTString(c);
111 IoTString id = new IoTString(d);
112 t1.createNewKey(ia, 351);
113 t1.createNewKey(ib, 351);
114 t2.createNewKey(ic, 321);
115 t2.createNewKey(id, 321);
117 endTime = System.nanoTime();
118 long keysDt = endTime - startTime;
119 long keysNet = timer.getTime();
121 // Do Updates for the keys
122 System.out.println("Setting Key-Values...");
123 startTime = System.nanoTime();
124 for (int t = 0; t < 3; t++) {
125 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
126 System.out.println(i);
127 String keyA = "a" + i;
128 String keyB = "b" + i;
129 String keyC = "c" + i;
130 String keyD = "d" + i;
131 String valueA = "a" + i;
132 String valueB = "b" + i;
133 String valueC = "c" + i;
134 String valueD = "d" + i;
136 IoTString iKeyA = new IoTString(keyA);
137 IoTString iKeyB = new IoTString(keyB);
138 IoTString iKeyC = new IoTString(keyC);
139 IoTString iKeyD = new IoTString(keyD);
140 IoTString iValueA = new IoTString(valueA);
141 IoTString iValueB = new IoTString(valueB);
142 IoTString iValueC = new IoTString(valueC);
143 IoTString iValueD = new IoTString(valueD);
146 t1.startTransaction();
147 t1.addKV(iKeyA, iValueA);
148 transStatusList.add(t1.commitTransaction());
150 t1.startTransaction();
151 t1.addKV(iKeyB, iValueB);
152 transStatusList.add(t1.commitTransaction());
154 t2.startTransaction();
155 t2.addKV(iKeyC, iValueC);
156 transStatusList.add(t2.commitTransaction());
158 t2.startTransaction();
159 t2.addKV(iKeyD, iValueD);
160 transStatusList.add(t2.commitTransaction());
164 endTime = System.nanoTime();
165 long writesDt = endTime - startTime;
166 long writesNet = timer.getTime() - keysNet;
168 System.out.println("Updating Clients...");
169 startTime = System.nanoTime();
172 endTime = System.nanoTime();
173 long updatesDt = endTime - startTime;
174 long updatesNet = timer.getTime() - keysNet - writesNet;
177 System.out.println("Total Key Create Time: " + keysDt / 1000000);
178 System.out.println("Total Key Create Time Network: " + keysNet / 1000000);
179 System.out.println("Total Key Create Time no Network: " + (keysDt - keysNet) / 1000000);
180 System.out.println();
181 System.out.println("Total write Time: " + writesDt / 1000000);
182 System.out.println("Total write Time Network: " + writesNet / 1000000);
183 System.out.println("Total write Time no Network: " + (writesDt - writesNet) / 1000000);
184 System.out.println();
185 System.out.println("Total updates Time: " + updatesDt / 1000000);
186 System.out.println("Total updates Time Network: " + updatesNet / 1000000);
187 System.out.println("Total updates Time no Network: " + (updatesDt - updatesNet) / 1000000);
191 static void test12() throws ServerException {
192 TimingSingleton timer = TimingSingleton.getInstance();
194 boolean foundError = false;
197 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
199 // Setup the 2 clients
200 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
202 System.out.println("T1 Ready");
204 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
206 System.out.println("T2 Ready");
209 System.out.println("Setting up keys");
210 startTime = System.nanoTime();
211 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
212 System.out.println(i);
217 IoTString ia = new IoTString(a);
218 IoTString ib = new IoTString(b);
219 IoTString ic = new IoTString(c);
220 IoTString id = new IoTString(d);
221 t1.createNewKey(ia, 321);
222 t1.createNewKey(ib, 321);
223 t2.createNewKey(ic, 351);
224 t2.createNewKey(id, 351);
226 endTime = System.nanoTime();
227 long keysDt = endTime - startTime;
228 long keysNet = timer.getTime();
230 // Do Updates for the keys
231 System.out.println("Setting Key-Values...");
232 startTime = System.nanoTime();
233 for (int t = 0; t < 3; t++) {
234 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
235 System.out.println(i);
236 String keyA = "a" + i;
237 String keyB = "b" + i;
238 String keyC = "c" + i;
239 String keyD = "d" + i;
240 String valueA = "a" + i;
241 String valueB = "b" + i;
242 String valueC = "c" + i;
243 String valueD = "d" + i;
245 IoTString iKeyA = new IoTString(keyA);
246 IoTString iKeyB = new IoTString(keyB);
247 IoTString iKeyC = new IoTString(keyC);
248 IoTString iKeyD = new IoTString(keyD);
249 IoTString iValueA = new IoTString(valueA);
250 IoTString iValueB = new IoTString(valueB);
251 IoTString iValueC = new IoTString(valueC);
252 IoTString iValueD = new IoTString(valueD);
255 t1.startTransaction();
256 t1.addKV(iKeyA, iValueA);
257 transStatusList.add(t1.commitTransaction());
259 t1.startTransaction();
260 t1.addKV(iKeyB, iValueB);
261 transStatusList.add(t1.commitTransaction());
263 t2.startTransaction();
264 t2.addKV(iKeyC, iValueC);
265 transStatusList.add(t2.commitTransaction());
267 t2.startTransaction();
268 t2.addKV(iKeyD, iValueD);
269 transStatusList.add(t2.commitTransaction());
273 endTime = System.nanoTime();
274 long writesDt = endTime - startTime;
275 long writesNet = timer.getTime() - keysNet;
277 System.out.println("Updating Clients...");
278 startTime = System.nanoTime();
281 endTime = System.nanoTime();
282 long updatesDt = endTime - startTime;
283 long updatesNet = timer.getTime() - keysNet - writesNet;
286 System.out.println("Total Key Create Time: " + keysDt / 1000000);
287 System.out.println("Total Key Create Time Network: " + keysNet / 1000000);
288 System.out.println("Total Key Create Time no Network: " + (keysDt - keysNet) / 1000000);
289 System.out.println();
290 System.out.println("Total write Time: " + writesDt / 1000000);
291 System.out.println("Total write Time Network: " + writesNet / 1000000);
292 System.out.println("Total write Time no Network: " + (writesDt - writesNet) / 1000000);
293 System.out.println();
294 System.out.println("Total updates Time: " + updatesDt / 1000000);
295 System.out.println("Total updates Time Network: " + updatesNet / 1000000);
296 System.out.println("Total updates Time no Network: " + (updatesDt - updatesNet) / 1000000);
300 static void test11() {
302 boolean foundError = false;
303 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
305 // Setup the 2 clients
306 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, 6000);
308 System.out.println("Init Table t1s");
314 } catch (Exception e) { }
318 System.out.println("Update Table t2");
319 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, 6001);
320 while (t2.update() == false) {}
323 System.out.println("Setting up keys");
324 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
325 System.out.println(i);
331 IoTString ia = new IoTString(a);
332 IoTString ib = new IoTString(b);
333 IoTString ic = new IoTString(c);
334 IoTString id = new IoTString(d);
338 t1.createNewKey(ia, 321);
340 } catch (Exception e) { }
345 t1.createNewKey(ib, 351);
347 } catch (Exception e) { }
352 t2.createNewKey(ic, 321);
354 } catch (Exception e) { }
359 t2.createNewKey(id, 351);
361 } catch (Exception e) { }
365 // Do Updates for the keys
366 System.out.println("Setting Key-Values...");
367 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
368 System.out.println(i);
369 String keyA = "a" + i;
370 String keyB = "b" + i;
371 String keyC = "c" + i;
372 String keyD = "d" + i;
373 String valueA = "a" + i;
374 String valueB = "b" + i;
375 String valueC = "c" + i;
376 String valueD = "d" + i;
378 IoTString iKeyA = new IoTString(keyA);
379 IoTString iKeyB = new IoTString(keyB);
380 IoTString iKeyC = new IoTString(keyC);
381 IoTString iKeyD = new IoTString(keyD);
382 IoTString iValueA = new IoTString(valueA);
383 IoTString iValueB = new IoTString(valueB);
384 IoTString iValueC = new IoTString(valueC);
385 IoTString iValueD = new IoTString(valueD);
388 String keyAPrev = "a" + (i - 1);
389 String keyBPrev = "b" + (i - 1);
390 String keyCPrev = "c" + (i - 1);
391 String keyDPrev = "d" + (i - 1);
392 String valueAPrev = "a" + (i - 1);
393 String valueBPrev = "b" + (i - 1);
394 String valueCPrev = "c" + (i - 1);
395 String valueDPrev = "d" + (i - 1);
397 IoTString iKeyAPrev = new IoTString(keyAPrev);
398 IoTString iKeyBPrev = new IoTString(keyBPrev);
399 IoTString iKeyCPrev = new IoTString(keyCPrev);
400 IoTString iKeyDPrev = new IoTString(keyDPrev);
401 IoTString iValueAPrev = new IoTString(valueAPrev);
402 IoTString iValueBPrev = new IoTString(valueBPrev);
403 IoTString iValueCPrev = new IoTString(valueCPrev);
404 IoTString iValueDPrev = new IoTString(valueDPrev);
407 System.out.println("t1 A");
408 t1.startTransaction();
409 t1.addKV(iKeyA, iValueA);
410 transStatusList.add(t1.commitTransaction());
412 System.out.println("t1 B");
413 t1.startTransaction();
414 t1.addKV(iKeyB, iValueB);
415 transStatusList.add(t1.commitTransaction());
417 System.out.println("t2 C");
418 t2.startTransaction();
419 t2.addKV(iKeyC, iValueC);
420 transStatusList.add(t2.commitTransaction());
422 System.out.println("t2 D");
423 t2.startTransaction();
424 t2.addKV(iKeyD, iValueD);
425 transStatusList.add(t2.commitTransaction());
428 System.out.println("Updating...");
429 while (t1.update() == false) {}
430 while (t2.update() == false) {}
431 while (t1.update() == false) {}
432 while (t2.update() == false) {}
434 System.out.println("Checking Key-Values...");
435 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
437 String keyA = "a" + i;
438 String keyB = "b" + i;
439 String keyC = "c" + i;
440 String keyD = "d" + i;
441 String valueA = "a" + i;
442 String valueB = "b" + i;
443 String valueC = "c" + i;
444 String valueD = "d" + i;
446 IoTString iKeyA = new IoTString(keyA);
447 IoTString iKeyB = new IoTString(keyB);
448 IoTString iKeyC = new IoTString(keyC);
449 IoTString iKeyD = new IoTString(keyD);
450 IoTString iValueA = new IoTString(valueA);
451 IoTString iValueB = new IoTString(valueB);
452 IoTString iValueC = new IoTString(valueC);
453 IoTString iValueD = new IoTString(valueD);
456 IoTString testValA1 = t1.getCommitted(iKeyA);
457 IoTString testValB1 = t1.getCommitted(iKeyB);
458 IoTString testValC1 = t1.getCommitted(iKeyC);
459 IoTString testValD1 = t1.getCommitted(iKeyD);
461 IoTString testValA2 = t2.getCommitted(iKeyA);
462 IoTString testValB2 = t2.getCommitted(iKeyB);
463 IoTString testValC2 = t2.getCommitted(iKeyC);
464 IoTString testValD2 = t2.getCommitted(iKeyD);
466 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
467 System.out.println("Key-Value t1 incorrect: " + keyA + " " + testValA1);
471 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
472 System.out.println("Key-Value t1 incorrect: " + keyB + " " + testValB1);
476 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
477 System.out.println("Key-Value t1 incorrect: " + keyC + " " + testValC1);
481 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
482 System.out.println("Key-Value t1 incorrect: " + keyD + " " + testValD1);
487 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
488 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
492 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
493 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
497 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
498 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
502 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
503 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
508 for (TransactionStatus status : transStatusList) {
509 if (status.getStatus() != TransactionStatus.StatusCommitted) {
515 System.out.println("Found Errors...");
517 System.out.println("No Errors Found...");
524 static void test10() {
526 boolean foundError = false;
527 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
529 // Setup the 2 clients
530 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, 6000);
531 System.out.println("Init Table t1s");
536 } catch (Exception e) { }
538 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, 6001);
539 while (t2.update() == false) {}
541 t1.addLocalCommunication(351, "127.0.0.1", 6001);
542 t2.addLocalCommunication(321, "127.0.0.1", 6000);
546 System.out.println("Setting up keys");
547 for (int i = 0; i < 4; i++) {
552 IoTString ia = new IoTString(a);
553 IoTString ib = new IoTString(b);
554 IoTString ic = new IoTString(c);
555 IoTString id = new IoTString(d);
558 t1.createNewKey(ia, 321);
560 } catch (Exception e) { }
565 t1.createNewKey(ib, 351);
567 } catch (Exception e) { }
572 t2.createNewKey(ic, 321);
574 } catch (Exception e) { }
579 t2.createNewKey(id, 351);
581 } catch (Exception e) { }
586 // Do Updates for the keys
587 System.out.println("B========================");
588 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
589 for (int i = 0; i < 4; i++) {
591 System.out.println(i);
593 String keyB = "b" + i;
594 String valueB = "b" + (i + t);
596 IoTString iKeyB = new IoTString(keyB);
597 IoTString iValueB = new IoTString(valueB);
599 t1.startTransaction();
600 System.out.println(t1.getSpeculativeAtomic(iKeyB));
601 t1.addKV(iKeyB, iValueB);
602 transStatusList.add(t1.commitTransaction());
605 System.out.println();
608 System.out.println("C========================");
609 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
610 for (int i = 0; i < 4; i++) {
611 System.out.println(i);
613 String keyC = "c" + i;
614 String valueC = "c" + (i + t);
616 IoTString iKeyC = new IoTString(keyC);
617 IoTString iValueC = new IoTString(valueC);
619 t2.startTransaction();
620 System.out.println(t2.getSpeculativeAtomic(iKeyC));
621 t2.addKV(iKeyC, iValueC);
622 transStatusList.add(t2.commitTransaction());
625 System.out.println();
628 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
629 for (int i = 0; i < 4; i++) {
630 String keyA = "a" + i;
631 String keyD = "d" + i;
632 String valueA = "a" + (i + t);
633 String valueD = "d" + (i + t);
635 IoTString iKeyA = new IoTString(keyA);
636 IoTString iKeyD = new IoTString(keyD);
637 IoTString iValueA = new IoTString(valueA);
638 IoTString iValueD = new IoTString(valueD);
641 t1.startTransaction();
642 t1.addKV(iKeyA, iValueA);
643 transStatusList.add(t1.commitTransaction());
646 t2.startTransaction();
647 t2.addKV(iKeyD, iValueD);
648 transStatusList.add(t2.commitTransaction());
649 System.out.println();
652 System.out.println();
654 System.out.println("Updating...");
655 System.out.println("t1 -=-=-=-=-=-=-=-");
656 while (t1.update() == false) {}
657 System.out.println("t2 -=-=-=-=-=-=-=-");
658 while (t2.update() == false) {}
659 System.out.println("t1 -=-=-=-=-=-=-=-");
660 while (t1.update() == false) {}
661 System.out.println("t2 -=-=-=-=-=-=-=-");
662 while (t2.update() == false) {}
665 System.out.println("Checking Key-Values...");
666 for (int i = 0; i < 4; i++) {
668 String keyA = "a" + i;
669 String keyB = "b" + i;
670 String keyC = "c" + i;
671 String keyD = "d" + i;
672 String valueA = "a" + (i + NUMBER_OF_TESTS - 1);
673 String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
674 String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
675 String valueD = "d" + (i + NUMBER_OF_TESTS - 1);
677 IoTString iKeyA = new IoTString(keyA);
678 IoTString iKeyB = new IoTString(keyB);
679 IoTString iKeyC = new IoTString(keyC);
680 IoTString iKeyD = new IoTString(keyD);
681 IoTString iValueA = new IoTString(valueA);
682 IoTString iValueB = new IoTString(valueB);
683 IoTString iValueC = new IoTString(valueC);
684 IoTString iValueD = new IoTString(valueD);
687 IoTString testValA1 = t1.getCommitted(iKeyA);
688 IoTString testValB1 = t1.getCommitted(iKeyB);
689 IoTString testValC1 = t1.getCommitted(iKeyC);
690 IoTString testValD1 = t1.getCommitted(iKeyD);
692 IoTString testValA2 = t2.getCommitted(iKeyA);
693 IoTString testValB2 = t2.getCommitted(iKeyB);
694 IoTString testValC2 = t2.getCommitted(iKeyC);
695 IoTString testValD2 = t2.getCommitted(iKeyD);
697 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
698 System.out.println("Key-Value t1 incorrect: " + keyA + " " + testValA1);
702 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
703 System.out.println("Key-Value t1 incorrect: " + keyB + " " + testValB1);
707 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
708 System.out.println("Key-Value t1 incorrect: " + keyC + " " + testValC1);
712 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
713 System.out.println("Key-Value t1 incorrect: " + keyD + " " + testValD1);
717 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
718 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
722 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
723 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
727 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
728 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
732 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
733 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
739 for (TransactionStatus status : transStatusList) {
740 if (status.getStatus() != TransactionStatus.StatusCommitted) {
742 System.out.println(counter + " Status: " + status.getStatus());
748 System.out.println("Found Errors...");
750 System.out.println("No Errors Found...");
757 static void test9() {
759 boolean foundError = false;
760 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
762 // Setup the 2 clients
763 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, 6000);
765 System.out.println("Init Table t1s");
770 } catch (Exception e) { }
774 System.out.println("Update Table t2");
775 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, 6001);
776 while (t2.update() == false) {}
778 t1.addLocalCommunication(351, "127.0.0.1", 6001);
779 t2.addLocalCommunication(321, "127.0.0.1", 6000);
782 System.out.println("Setting up keys");
783 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
784 System.out.println(i);
790 IoTString ia = new IoTString(a);
791 IoTString ib = new IoTString(b);
792 IoTString ic = new IoTString(c);
793 IoTString id = new IoTString(d);
797 t1.createNewKey(ia, 321);
799 } catch (Exception e) { }
804 t1.createNewKey(ib, 351);
806 } catch (Exception e) { }
811 t2.createNewKey(ic, 321);
813 } catch (Exception e) { }
818 t2.createNewKey(id, 351);
820 } catch (Exception e) { }
824 System.out.println("A, D...");
825 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
826 String keyA = "a" + i;
827 String keyD = "d" + i;
828 String valueA = "a" + i;
829 String valueD = "d" + i;
831 IoTString iKeyA = new IoTString(keyA);
832 IoTString iKeyD = new IoTString(keyD);
833 IoTString iValueA = new IoTString(valueA);
834 IoTString iValueD = new IoTString(valueD);
836 t1.startTransaction();
837 t1.addKV(iKeyA, iValueA);
838 transStatusList.add(t1.commitTransaction());
840 t2.startTransaction();
841 t2.addKV(iKeyD, iValueD);
842 transStatusList.add(t2.commitTransaction());
845 // while (t1.updateFromLocal(351) == false) {}
846 // while (t2.updateFromLocal(321) == false) {}
849 System.out.println("Updating...");
850 System.out.println("Checking Key-Values...");
852 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
854 String keyA = "a" + i;
855 String keyD = "d" + i;
856 String valueA = "a" + i;
857 String valueD = "d" + i;
860 IoTString iKeyA = new IoTString(keyA);
861 IoTString iKeyD = new IoTString(keyD);
862 IoTString iValueA = new IoTString(valueA);
863 IoTString iValueD = new IoTString(valueD);
866 IoTString testValA1 = t1.getCommitted(iKeyA);
867 IoTString testValD1 = t1.getCommitted(iKeyD);
868 IoTString testValA2 = t2.getCommitted(iKeyA);
869 IoTString testValD2 = t2.getCommitted(iKeyD);
872 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
873 System.out.println("Key-Value t1 incorrect: " + keyA + " " + testValA1);
877 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
878 System.out.println("Key-Value t1 incorrect: " + keyD + " " + testValD1);
883 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
884 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
888 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
889 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
894 for (TransactionStatus status : transStatusList) {
895 if (status.getStatus() != TransactionStatus.StatusCommitted) {
901 System.out.println("Found Errors...");
903 System.out.println("No Errors Found...");
910 static void test8() {
911 TimingSingleton timer = TimingSingleton.getInstance();
915 boolean foundError = false;
916 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
918 // Setup the 2 clients
919 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, 6000);
921 System.out.println("Init Table t1s");
927 } catch (Exception e) { }
931 System.out.println("Update Table t2");
932 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, 6001);
933 while (t2.update() == false) {}
935 t1.addLocalCommunication(351, "127.0.0.1", 6001);
936 t2.addLocalCommunication(321, "127.0.0.1", 6000);
939 System.out.println("Setting up keys");
940 startTime = System.nanoTime();
941 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
942 System.out.println(i);
948 IoTString ia = new IoTString(a);
949 IoTString ib = new IoTString(b);
950 IoTString ic = new IoTString(c);
951 IoTString id = new IoTString(d);
955 t1.createNewKey(ia, 321);
957 } catch (Exception e) { }
962 t1.createNewKey(ib, 351);
964 } catch (Exception e) { }
969 t2.createNewKey(ic, 321);
971 } catch (Exception e) { }
976 t2.createNewKey(id, 351);
978 } catch (Exception e) { }
981 endTime = System.nanoTime();
982 long keysDt = endTime - startTime;
983 long keysNet = timer.getTime();
986 // Do Updates for the keys
987 startTime = System.nanoTime();
988 System.out.println("Setting Key-Values...");
989 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
990 System.out.println(i);
991 String keyA = "a" + i;
992 String keyB = "b" + i;
993 String keyC = "c" + i;
994 String keyD = "d" + i;
995 String valueA = "a" + i;
996 String valueB = "b" + i;
997 String valueC = "c" + i;
998 String valueD = "d" + i;
1000 IoTString iKeyA = new IoTString(keyA);
1001 IoTString iKeyB = new IoTString(keyB);
1002 IoTString iKeyC = new IoTString(keyC);
1003 IoTString iKeyD = new IoTString(keyD);
1004 IoTString iValueA = new IoTString(valueA);
1005 IoTString iValueB = new IoTString(valueB);
1006 IoTString iValueC = new IoTString(valueC);
1007 IoTString iValueD = new IoTString(valueD);
1010 String keyAPrev = "a" + (i - 1);
1011 String keyBPrev = "b" + (i - 1);
1012 String keyCPrev = "c" + (i - 1);
1013 String keyDPrev = "d" + (i - 1);
1014 String valueAPrev = "a" + (i - 1);
1015 String valueBPrev = "b" + (i - 1);
1016 String valueCPrev = "c" + (i - 1);
1017 String valueDPrev = "d" + (i - 1);
1019 IoTString iKeyAPrev = new IoTString(keyAPrev);
1020 IoTString iKeyBPrev = new IoTString(keyBPrev);
1021 IoTString iKeyCPrev = new IoTString(keyCPrev);
1022 IoTString iKeyDPrev = new IoTString(keyDPrev);
1023 IoTString iValueAPrev = new IoTString(valueAPrev);
1024 IoTString iValueBPrev = new IoTString(valueBPrev);
1025 IoTString iValueCPrev = new IoTString(valueCPrev);
1026 IoTString iValueDPrev = new IoTString(valueDPrev);
1028 t1.startTransaction();
1029 t1.addKV(iKeyA, iValueA);
1030 transStatusList.add(t1.commitTransaction());
1032 t1.startTransaction();
1033 t1.addKV(iKeyB, iValueB);
1034 transStatusList.add(t1.commitTransaction());
1036 t2.startTransaction();
1037 t2.addKV(iKeyC, iValueC);
1038 transStatusList.add(t2.commitTransaction());
1040 t2.startTransaction();
1041 t2.addKV(iKeyD, iValueD);
1042 transStatusList.add(t2.commitTransaction());
1044 endTime = System.nanoTime();
1045 long writesDt = endTime - startTime;
1046 long writesNet = timer.getTime() - keysNet;
1050 System.out.println("Updating...");
1051 startTime = System.nanoTime();
1052 while (t1.update() == false) {}
1053 while (t2.update() == false) {}
1054 while (t1.update() == false) {}
1055 while (t2.update() == false) {}
1056 endTime = System.nanoTime();
1057 long updatesDt = endTime - startTime;
1058 long updatesNet = timer.getTime() - keysNet - writesNet;
1061 System.out.println("Total Key Create Time: " + keysDt / 1000000);
1062 System.out.println("Total Key Create Time Network: " + keysNet / 1000000);
1063 System.out.println("Total Key Create Time no Network: " + (keysDt - keysNet) / 1000000);
1064 System.out.println();
1065 System.out.println("Total write Time: " + writesDt / 1000000);
1066 System.out.println("Total write Time Network: " + writesNet / 1000000);
1067 System.out.println("Total write Time no Network: " + (writesDt - writesNet) / 1000000);
1068 System.out.println();
1069 System.out.println("Total updates Time: " + updatesDt / 1000000);
1070 System.out.println("Total updates Time Network: " + updatesNet / 1000000);
1071 System.out.println("Total updates Time no Network: " + (updatesDt - updatesNet) / 1000000);
1076 // System.out.println("Checking Key-Values...");
1077 // for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1079 // String keyA = "a" + i;
1080 // String keyB = "b" + i;
1081 // String keyC = "c" + i;
1082 // String keyD = "d" + i;
1083 // String valueA = "a" + i;
1084 // String valueB = "b" + i;
1085 // String valueC = "c" + i;
1086 // String valueD = "d" + i;
1088 // IoTString iKeyA = new IoTString(keyA);
1089 // IoTString iKeyB = new IoTString(keyB);
1090 // IoTString iKeyC = new IoTString(keyC);
1091 // IoTString iKeyD = new IoTString(keyD);
1092 // IoTString iValueA = new IoTString(valueA);
1093 // IoTString iValueB = new IoTString(valueB);
1094 // IoTString iValueC = new IoTString(valueC);
1095 // IoTString iValueD = new IoTString(valueD);
1098 // IoTString testValA1 = t1.getCommitted(iKeyA);
1099 // IoTString testValB1 = t1.getCommitted(iKeyB);
1100 // IoTString testValC1 = t1.getCommitted(iKeyC);
1101 // IoTString testValD1 = t1.getCommitted(iKeyD);
1103 // IoTString testValA2 = t2.getCommitted(iKeyA);
1104 // IoTString testValB2 = t2.getCommitted(iKeyB);
1105 // IoTString testValC2 = t2.getCommitted(iKeyC);
1106 // IoTString testValD2 = t2.getCommitted(iKeyD);
1108 // if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1109 // System.out.println("Key-Value t1 incorrect: " + keyA + " " + testValA1);
1110 // foundError = true;
1113 // if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1114 // System.out.println("Key-Value t1 incorrect: " + keyB + " " + testValB1);
1115 // foundError = true;
1118 // if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1119 // System.out.println("Key-Value t1 incorrect: " + keyC + " " + testValC1);
1120 // foundError = true;
1123 // if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1124 // System.out.println("Key-Value t1 incorrect: " + keyD + " " + testValD1);
1125 // foundError = true;
1129 // if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1130 // System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
1131 // foundError = true;
1134 // if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1135 // System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
1136 // foundError = true;
1139 // if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1140 // System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1141 // foundError = true;
1144 // if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1145 // System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
1146 // foundError = true;
1150 // for (TransactionStatus status : transStatusList) {
1151 // if (status.getStatus() != TransactionStatus.StatusCommitted) {
1152 // foundError = true;
1156 // if (foundError) {
1157 // System.out.println("Found Errors...");
1159 // System.out.println("No Errors Found...");
1165 // System.out.println();
1166 // System.out.println();
1169 // System.out.println();
1170 // System.out.println();
1174 static void test7() throws ServerException {
1176 boolean foundError = false;
1177 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1179 // Setup the 2 clients
1180 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
1182 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
1186 System.out.println("Setting up keys");
1187 for (int i = 0; i < 4; i++) {
1192 IoTString ia = new IoTString(a);
1193 IoTString ib = new IoTString(b);
1194 IoTString ic = new IoTString(c);
1195 IoTString id = new IoTString(d);
1196 t1.createNewKey(ia, 321);
1197 t1.createNewKey(ib, 351);
1198 t2.createNewKey(ic, 321);
1199 t2.createNewKey(id, 351);
1202 // Do Updates for the keys
1203 System.out.println("Setting Key-Values...");
1205 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1206 for (int i = 0; i < 4; i++) {
1207 String keyB = "b" + i;
1208 String valueB = "b" + (i + t);
1210 IoTString iKeyB = new IoTString(keyB);
1211 IoTString iValueB = new IoTString(valueB);
1213 t1.startTransaction();
1214 t1.getSpeculativeAtomic(iKeyB);
1215 t1.addKV(iKeyB, iValueB);
1216 transStatusList.add(t1.commitTransaction());
1220 for (int i = 0; i < 4; i++) {
1222 String keyB = "b" + i;
1223 String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
1224 IoTString iKeyB = new IoTString(keyB);
1225 IoTString iValueB = new IoTString(valueB);
1227 IoTString testValB1 = t1.getSpeculative(iKeyB);
1228 IoTString testValB2 = t2.getSpeculative(iKeyB);
1230 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1231 System.out.println("Key-Value t1 incorrect: " + keyB + " " + testValB1);
1235 if ((testValB2 != null)) {
1236 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
1241 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1242 for (int i = 0; i < 4; i++) {
1243 String keyC = "c" + i;
1244 String valueC = "c" + (i + t);
1246 IoTString iKeyC = new IoTString(keyC);
1247 IoTString iValueC = new IoTString(valueC);
1249 t2.startTransaction();
1250 t2.getSpeculativeAtomic(iKeyC);
1251 t2.addKV(iKeyC, iValueC);
1252 transStatusList.add(t2.commitTransaction());
1256 for (int i = 0; i < 4; i++) {
1257 String keyC = "c" + i;
1258 String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
1259 IoTString iKeyC = new IoTString(keyC);
1260 IoTString iValueC = new IoTString(valueC);
1262 IoTString testValC1 = t1.getSpeculative(iKeyC);
1263 IoTString testValC2 = t2.getSpeculative(iKeyC);
1265 if ((testValC1 != null)) {
1266 System.out.println("Key-Value t1 incorrect: " + keyC + " " + testValC1);
1270 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1271 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1276 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1277 for (int i = 0; i < 4; i++) {
1278 String keyA = "a" + i;
1279 String keyD = "d" + i;
1280 String valueA = "a" + (i + t);
1281 String valueD = "d" + (i + t);
1283 IoTString iKeyA = new IoTString(keyA);
1284 IoTString iKeyD = new IoTString(keyD);
1285 IoTString iValueA = new IoTString(valueA);
1286 IoTString iValueD = new IoTString(valueD);
1288 t1.startTransaction();
1289 t1.addKV(iKeyA, iValueA);
1290 transStatusList.add(t1.commitTransaction());
1292 t2.startTransaction();
1293 t2.addKV(iKeyD, iValueD);
1294 transStatusList.add(t2.commitTransaction());
1298 System.out.println("Updating Clients...");
1304 System.out.println("Checking Key-Values...");
1305 for (int i = 0; i < 4; i++) {
1307 String keyA = "a" + i;
1308 String keyB = "b" + i;
1309 String keyC = "c" + i;
1310 String keyD = "d" + i;
1311 String valueA = "a" + (i + NUMBER_OF_TESTS - 1);
1312 String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
1313 String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
1314 String valueD = "d" + (i + NUMBER_OF_TESTS - 1);
1316 IoTString iKeyA = new IoTString(keyA);
1317 IoTString iKeyB = new IoTString(keyB);
1318 IoTString iKeyC = new IoTString(keyC);
1319 IoTString iKeyD = new IoTString(keyD);
1320 IoTString iValueA = new IoTString(valueA);
1321 IoTString iValueB = new IoTString(valueB);
1322 IoTString iValueC = new IoTString(valueC);
1323 IoTString iValueD = new IoTString(valueD);
1326 IoTString testValA1 = t1.getCommitted(iKeyA);
1327 IoTString testValB1 = t1.getCommitted(iKeyB);
1328 IoTString testValC1 = t1.getCommitted(iKeyC);
1329 IoTString testValD1 = t1.getCommitted(iKeyD);
1331 IoTString testValA2 = t2.getCommitted(iKeyA);
1332 IoTString testValB2 = t2.getCommitted(iKeyB);
1333 IoTString testValC2 = t2.getCommitted(iKeyC);
1334 IoTString testValD2 = t2.getCommitted(iKeyD);
1336 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1337 System.out.println("Key-Value t1 incorrect: " + keyA + " " + testValA1);
1341 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1342 System.out.println("Key-Value t1 incorrect: " + keyB + " " + testValB1);
1346 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1347 System.out.println("Key-Value t1 incorrect: " + keyC + " " + testValC1);
1351 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1352 System.out.println("Key-Value t1 incorrect: " + keyD + " " + testValD1);
1356 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1357 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
1361 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1362 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
1366 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1367 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1371 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1372 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
1377 for (TransactionStatus status : transStatusList) {
1378 if (status.getStatus() != TransactionStatus.StatusCommitted) {
1384 System.out.println("Found Errors...");
1386 System.out.println("No Errors Found...");
1390 static void test6() throws ServerException {
1392 boolean foundError = false;
1393 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1395 // Setup the 2 clients
1396 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
1398 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
1402 System.out.println("Setting up keys");
1403 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1408 IoTString ia = new IoTString(a);
1409 IoTString ib = new IoTString(b);
1410 IoTString ic = new IoTString(c);
1411 IoTString id = new IoTString(d);
1412 t1.createNewKey(ia, 321);
1413 t1.createNewKey(ib, 351);
1414 t2.createNewKey(ic, 321);
1415 t2.createNewKey(id, 351);
1418 // Do Updates for the keys
1419 System.out.println("Setting Key-Values...");
1420 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1421 String keyA = "a" + i;
1422 String keyB = "b" + i;
1423 String keyC = "c" + i;
1424 String keyD = "d" + i;
1425 String valueA = "a" + i;
1426 String valueB = "b" + i;
1427 String valueC = "c" + i;
1428 String valueD = "d" + i;
1430 IoTString iKeyA = new IoTString(keyA);
1431 IoTString iKeyB = new IoTString(keyB);
1432 IoTString iKeyC = new IoTString(keyC);
1433 IoTString iKeyD = new IoTString(keyD);
1434 IoTString iValueA = new IoTString(valueA);
1435 IoTString iValueB = new IoTString(valueB);
1436 IoTString iValueC = new IoTString(valueC);
1437 IoTString iValueD = new IoTString(valueD);
1439 t1.startTransaction();
1440 t1.getCommittedAtomic(iKeyA);
1441 t1.addKV(iKeyA, iValueA);
1442 transStatusList.add(t1.commitTransaction());
1444 t1.startTransaction();
1445 t1.getCommittedAtomic(iKeyB);
1446 t1.addKV(iKeyB, iValueB);
1447 transStatusList.add(t1.commitTransaction());
1449 t2.startTransaction();
1450 t2.getCommittedAtomic(iKeyC);
1451 t2.addKV(iKeyC, iValueC);
1452 transStatusList.add(t2.commitTransaction());
1454 t2.startTransaction();
1455 t2.getCommittedAtomic(iKeyD);
1456 t2.addKV(iKeyD, iValueD);
1457 transStatusList.add(t2.commitTransaction());
1460 System.out.println("Updating Clients...");
1464 System.out.println("Checking Key-Values...");
1465 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1467 String keyA = "a" + i;
1468 String keyB = "b" + i;
1469 String keyC = "c" + i;
1470 String keyD = "d" + i;
1471 String valueA = "a" + i;
1472 String valueB = "b" + i;
1473 String valueC = "c" + i;
1474 String valueD = "d" + i;
1476 IoTString iKeyA = new IoTString(keyA);
1477 IoTString iKeyB = new IoTString(keyB);
1478 IoTString iKeyC = new IoTString(keyC);
1479 IoTString iKeyD = new IoTString(keyD);
1480 IoTString iValueA = new IoTString(valueA);
1481 IoTString iValueB = new IoTString(valueB);
1482 IoTString iValueC = new IoTString(valueC);
1483 IoTString iValueD = new IoTString(valueD);
1486 IoTString testValA1 = t1.getCommitted(iKeyA);
1487 IoTString testValB1 = t1.getCommitted(iKeyB);
1488 IoTString testValC1 = t1.getCommitted(iKeyC);
1489 IoTString testValD1 = t1.getCommitted(iKeyD);
1491 IoTString testValA2 = t2.getCommitted(iKeyA);
1492 IoTString testValB2 = t2.getCommitted(iKeyB);
1493 IoTString testValC2 = t2.getCommitted(iKeyC);
1494 IoTString testValD2 = t2.getCommitted(iKeyD);
1496 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1497 System.out.println("Key-Value t1 incorrect: " + keyA);
1501 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1502 System.out.println("Key-Value t1 incorrect: " + keyB);
1506 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1507 System.out.println("Key-Value t1 incorrect: " + keyC);
1511 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1512 System.out.println("Key-Value t1 incorrect: " + keyD);
1517 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1518 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
1522 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1523 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
1527 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1528 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1532 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1533 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
1538 for (TransactionStatus status : transStatusList) {
1539 if (status.getStatus() != TransactionStatus.StatusCommitted) {
1545 System.out.println("Found Errors...");
1547 System.out.println("No Errors Found...");
1551 static void test5() throws ServerException {
1553 boolean foundError = false;
1554 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1556 // Setup the 2 clients
1557 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
1559 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
1564 System.out.println("Setting up keys");
1565 for (int i = 0; i < 4; i++) {
1570 IoTString ia = new IoTString(a);
1571 IoTString ib = new IoTString(b);
1572 IoTString ic = new IoTString(c);
1573 IoTString id = new IoTString(d);
1574 t1.createNewKey(ia, 321);
1575 t1.createNewKey(ib, 351);
1576 t2.createNewKey(ic, 321);
1577 t2.createNewKey(id, 351);
1580 // Do Updates for the keys
1581 System.out.println("Setting Key-Values...");
1583 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1584 for (int i = 0; i < 4; i++) {
1585 String keyB = "b" + i;
1586 String valueB = "b" + (i + t);
1588 IoTString iKeyB = new IoTString(keyB);
1589 IoTString iValueB = new IoTString(valueB);
1591 t1.startTransaction();
1592 t1.addKV(iKeyB, iValueB);
1593 transStatusList.add(t1.commitTransaction());
1597 for (int i = 0; i < 4; i++) {
1599 String keyB = "b" + i;
1600 String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
1601 IoTString iKeyB = new IoTString(keyB);
1602 IoTString iValueB = new IoTString(valueB);
1604 IoTString testValB1 = t1.getSpeculative(iKeyB);
1605 IoTString testValB2 = t2.getSpeculative(iKeyB);
1607 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1608 System.out.println("Key-Value t1 incorrect: " + keyB);
1612 if ((testValB2 != null)) {
1613 System.out.println("Key-Value t2 incorrect: " + keyB);
1618 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1619 for (int i = 0; i < 4; i++) {
1620 String keyC = "c" + i;
1621 String valueC = "c" + (i + t);
1623 IoTString iKeyC = new IoTString(keyC);
1624 IoTString iValueC = new IoTString(valueC);
1626 t2.startTransaction();
1627 t2.addKV(iKeyC, iValueC);
1628 transStatusList.add(t2.commitTransaction());
1632 for (int i = 0; i < 4; i++) {
1633 String keyC = "c" + i;
1634 String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
1635 IoTString iKeyC = new IoTString(keyC);
1636 IoTString iValueC = new IoTString(valueC);
1638 IoTString testValC1 = t1.getSpeculative(iKeyC);
1639 IoTString testValC2 = t2.getSpeculative(iKeyC);
1641 if ((testValC1 != null)) {
1642 System.out.println("Key-Value t1 incorrect: " + keyC + " " + testValC1);
1646 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1647 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1652 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1653 for (int i = 0; i < 4; i++) {
1654 String keyA = "a" + i;
1655 String keyD = "d" + i;
1656 String valueA = "a" + (i + t);
1657 String valueD = "d" + (i + t);
1659 IoTString iKeyA = new IoTString(keyA);
1660 IoTString iKeyD = new IoTString(keyD);
1661 IoTString iValueA = new IoTString(valueA);
1662 IoTString iValueD = new IoTString(valueD);
1664 t1.startTransaction();
1665 t1.addKV(iKeyA, iValueA);
1666 transStatusList.add(t1.commitTransaction());
1668 t2.startTransaction();
1669 t2.addKV(iKeyD, iValueD);
1670 transStatusList.add(t2.commitTransaction());
1674 System.out.println("Updating Clients...");
1679 System.out.println("Checking Key-Values...");
1680 for (int i = 0; i < 4; i++) {
1682 String keyA = "a" + i;
1683 String keyB = "b" + i;
1684 String keyC = "c" + i;
1685 String keyD = "d" + i;
1686 String valueA = "a" + (i + NUMBER_OF_TESTS - 1);
1687 String valueB = "b" + (i + NUMBER_OF_TESTS - 1);
1688 String valueC = "c" + (i + NUMBER_OF_TESTS - 1);
1689 String valueD = "d" + (i + NUMBER_OF_TESTS - 1);
1691 IoTString iKeyA = new IoTString(keyA);
1692 IoTString iKeyB = new IoTString(keyB);
1693 IoTString iKeyC = new IoTString(keyC);
1694 IoTString iKeyD = new IoTString(keyD);
1695 IoTString iValueA = new IoTString(valueA);
1696 IoTString iValueB = new IoTString(valueB);
1697 IoTString iValueC = new IoTString(valueC);
1698 IoTString iValueD = new IoTString(valueD);
1701 IoTString testValA1 = t1.getCommitted(iKeyA);
1702 IoTString testValB1 = t1.getCommitted(iKeyB);
1703 IoTString testValC1 = t1.getCommitted(iKeyC);
1704 IoTString testValD1 = t1.getCommitted(iKeyD);
1706 IoTString testValA2 = t2.getCommitted(iKeyA);
1707 IoTString testValB2 = t2.getCommitted(iKeyB);
1708 IoTString testValC2 = t2.getCommitted(iKeyC);
1709 IoTString testValD2 = t2.getCommitted(iKeyD);
1711 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1712 System.out.println("Key-Value t1 incorrect: " + keyA + " " + testValA1);
1716 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1717 System.out.println("Key-Value t1 incorrect: " + keyB + " " + testValB1);
1721 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1722 System.out.println("Key-Value t1 incorrect: " + keyC + " " + testValC1);
1726 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1727 System.out.println("Key-Value t1 incorrect: " + keyD + " " + testValD1);
1732 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1733 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
1737 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1738 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
1742 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1743 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1747 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1748 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
1753 for (TransactionStatus status : transStatusList) {
1754 if (status.getStatus() != TransactionStatus.StatusCommitted) {
1760 System.out.println("Found Errors...");
1762 System.out.println("No Errors Found...");
1766 static void test4() throws ServerException {
1768 boolean foundError = false;
1771 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1773 // Setup the 2 clients
1774 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
1776 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
1780 System.out.println("Setting up keys");
1781 startTime = System.currentTimeMillis();
1782 for (int i = 0; i < 4; i++) {
1787 IoTString ia = new IoTString(a);
1788 IoTString ib = new IoTString(b);
1789 IoTString ic = new IoTString(c);
1790 IoTString id = new IoTString(d);
1791 t1.createNewKey(ia, 321);
1792 t1.createNewKey(ib, 351);
1793 t2.createNewKey(ic, 321);
1794 t2.createNewKey(id, 351);
1796 endTime = System.currentTimeMillis();
1797 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
1798 System.out.println("Time Taken Per Key: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
1799 System.out.println();
1802 // Do Updates for the keys
1803 System.out.println("Setting Key-Values...");
1804 startTime = System.currentTimeMillis();
1805 for (int t = 0; t < NUMBER_OF_TESTS; t++) {
1806 for (int i = 0; i < 4; i++) {
1807 String keyA = "a" + i;
1808 String keyB = "b" + i;
1809 String keyC = "c" + i;
1810 String keyD = "d" + i;
1811 String valueA = "a" + i;
1812 String valueB = "b" + i;
1813 String valueC = "c" + i;
1814 String valueD = "d" + i;
1816 IoTString iKeyA = new IoTString(keyA);
1817 IoTString iKeyB = new IoTString(keyB);
1818 IoTString iKeyC = new IoTString(keyC);
1819 IoTString iKeyD = new IoTString(keyD);
1820 IoTString iValueA = new IoTString(valueA);
1821 IoTString iValueB = new IoTString(valueB);
1822 IoTString iValueC = new IoTString(valueC);
1823 IoTString iValueD = new IoTString(valueD);
1825 t1.startTransaction();
1826 t1.addKV(iKeyA, iValueA);
1827 transStatusList.add(t1.commitTransaction());
1829 t1.startTransaction();
1830 t1.addKV(iKeyB, iValueB);
1831 transStatusList.add(t1.commitTransaction());
1833 t2.startTransaction();
1834 t2.addKV(iKeyC, iValueC);
1835 transStatusList.add(t2.commitTransaction());
1837 t2.startTransaction();
1838 t2.addKV(iKeyD, iValueD);
1839 transStatusList.add(t2.commitTransaction());
1842 endTime = System.currentTimeMillis();
1843 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
1844 System.out.println("Time Taken Per Update: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 16)) );
1845 System.out.println();
1848 System.out.println("Updating Clients...");
1853 System.out.println("Checking Key-Values...");
1854 for (int i = 0; i < 4; i++) {
1856 String keyA = "a" + i;
1857 String keyB = "b" + i;
1858 String keyC = "c" + i;
1859 String keyD = "d" + i;
1860 String valueA = "a" + i;
1861 String valueB = "b" + i;
1862 String valueC = "c" + i;
1863 String valueD = "d" + i;
1865 IoTString iKeyA = new IoTString(keyA);
1866 IoTString iKeyB = new IoTString(keyB);
1867 IoTString iKeyC = new IoTString(keyC);
1868 IoTString iKeyD = new IoTString(keyD);
1869 IoTString iValueA = new IoTString(valueA);
1870 IoTString iValueB = new IoTString(valueB);
1871 IoTString iValueC = new IoTString(valueC);
1872 IoTString iValueD = new IoTString(valueD);
1875 IoTString testValA1 = t1.getCommitted(iKeyA);
1876 IoTString testValB1 = t1.getCommitted(iKeyB);
1877 IoTString testValC1 = t1.getCommitted(iKeyC);
1878 IoTString testValD1 = t1.getCommitted(iKeyD);
1880 IoTString testValA2 = t2.getCommitted(iKeyA);
1881 IoTString testValB2 = t2.getCommitted(iKeyB);
1882 IoTString testValC2 = t2.getCommitted(iKeyC);
1883 IoTString testValD2 = t2.getCommitted(iKeyD);
1885 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
1886 System.out.println("Key-Value t1 incorrect: " + keyA);
1890 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
1891 System.out.println("Key-Value t1 incorrect: " + keyB);
1895 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
1896 System.out.println("Key-Value t1 incorrect: " + keyC);
1900 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
1901 System.out.println("Key-Value t1 incorrect: " + keyD);
1906 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
1907 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
1911 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
1912 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
1916 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
1917 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
1921 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
1922 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
1927 for (TransactionStatus status : transStatusList) {
1928 if (status.getStatus() != TransactionStatus.StatusCommitted) {
1934 System.out.println("Found Errors...");
1936 System.out.println("No Errors Found...");
1940 static void test3() throws ServerException {
1944 boolean foundError = false;
1946 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
1948 // Setup the 2 clients
1949 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
1951 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
1956 System.out.println("Setting up keys");
1957 startTime = System.currentTimeMillis();
1958 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1963 IoTString ia = new IoTString(a);
1964 IoTString ib = new IoTString(b);
1965 IoTString ic = new IoTString(c);
1966 IoTString id = new IoTString(d);
1967 t1.createNewKey(ia, 321);
1968 t1.createNewKey(ib, 351);
1969 t2.createNewKey(ic, 321);
1970 t2.createNewKey(id, 351);
1972 endTime = System.currentTimeMillis();
1973 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
1974 System.out.println("Time Taken Per Key: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
1975 System.out.println();
1978 // Do Updates for the keys
1979 System.out.println("Setting Key-Values...");
1980 startTime = System.currentTimeMillis();
1982 System.out.println("B...");
1983 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1984 String keyB = "b" + i;
1985 String valueB = "b" + i;
1987 IoTString iKeyB = new IoTString(keyB);
1988 IoTString iValueB = new IoTString(valueB);
1990 t1.startTransaction();
1991 t1.addKV(iKeyB, iValueB);
1992 transStatusList.add(t1.commitTransaction());
1995 System.out.println("C...");
1996 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
1997 String keyC = "c" + i;
1998 String valueC = "c" + i;
2000 IoTString iKeyC = new IoTString(keyC);
2001 IoTString iValueC = new IoTString(valueC);
2003 t2.startTransaction();
2004 t2.addKV(iKeyC, iValueC);
2005 transStatusList.add(t2.commitTransaction());
2008 System.out.println("A, D...");
2009 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
2010 String keyA = "a" + i;
2011 String keyD = "d" + i;
2012 String valueA = "a" + i;
2013 String valueD = "d" + i;
2015 IoTString iKeyA = new IoTString(keyA);
2016 IoTString iKeyD = new IoTString(keyD);
2017 IoTString iValueA = new IoTString(valueA);
2018 IoTString iValueD = new IoTString(valueD);
2020 t1.startTransaction();
2021 t1.addKV(iKeyA, iValueA);
2022 transStatusList.add(t1.commitTransaction());
2024 t2.startTransaction();
2025 t2.addKV(iKeyD, iValueD);
2026 transStatusList.add(t2.commitTransaction());
2028 endTime = System.currentTimeMillis();
2029 System.out.println("Time Taken: " + (double) ((endTime - startTime) / 1000.0) );
2030 System.out.println("Time Taken Per Update: " + (double) (((endTime - startTime) / 1000.0) / (NUMBER_OF_TESTS * 4)) );
2031 System.out.println();
2034 System.out.println("Updating Clients...");
2039 System.out.println("Checking Key-Values...");
2040 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
2042 String keyA = "a" + i;
2043 String keyB = "b" + i;
2044 String keyC = "c" + i;
2045 String keyD = "d" + i;
2046 String valueA = "a" + i;
2047 String valueB = "b" + i;
2048 String valueC = "c" + i;
2049 String valueD = "d" + i;
2051 IoTString iKeyA = new IoTString(keyA);
2052 IoTString iKeyB = new IoTString(keyB);
2053 IoTString iKeyC = new IoTString(keyC);
2054 IoTString iKeyD = new IoTString(keyD);
2055 IoTString iValueA = new IoTString(valueA);
2056 IoTString iValueB = new IoTString(valueB);
2057 IoTString iValueC = new IoTString(valueC);
2058 IoTString iValueD = new IoTString(valueD);
2061 IoTString testValA1 = t1.getCommitted(iKeyA);
2062 IoTString testValB1 = t1.getCommitted(iKeyB);
2063 IoTString testValC1 = t1.getCommitted(iKeyC);
2064 IoTString testValD1 = t1.getCommitted(iKeyD);
2066 IoTString testValA2 = t2.getCommitted(iKeyA);
2067 IoTString testValB2 = t2.getCommitted(iKeyB);
2068 IoTString testValC2 = t2.getCommitted(iKeyC);
2069 IoTString testValD2 = t2.getCommitted(iKeyD);
2071 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
2072 System.out.println("Key-Value t1 incorrect: " + keyA);
2076 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
2077 System.out.println("Key-Value t1 incorrect: " + keyB);
2081 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
2082 System.out.println("Key-Value t1 incorrect: " + keyC);
2086 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
2087 System.out.println("Key-Value t1 incorrect: " + keyD);
2092 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
2093 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
2097 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
2098 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
2102 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
2103 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
2107 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
2108 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
2113 for (TransactionStatus status : transStatusList) {
2114 if (status.getStatus() != TransactionStatus.StatusCommitted) {
2120 System.out.println("Found Errors...");
2122 System.out.println("No Errors Found...");
2126 static void test2() throws ServerException {
2127 TimingSingleton timer = TimingSingleton.getInstance();
2129 boolean foundError = false;
2130 List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
2132 // Setup the 2 clients
2133 Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
2135 System.out.println("T1 Ready");
2137 Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
2139 System.out.println("T2 Ready");
2142 System.out.println("Setting up keys");
2143 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
2144 System.out.println(i);
2149 IoTString ia = new IoTString(a);
2150 IoTString ib = new IoTString(b);
2151 IoTString ic = new IoTString(c);
2152 IoTString id = new IoTString(d);
2153 t1.createNewKey(ia, 321);
2154 t1.createNewKey(ib, 351);
2155 t2.createNewKey(ic, 321);
2156 t2.createNewKey(id, 351);
2159 // Do Updates for the keys
2160 System.out.println("Setting Key-Values...");
2161 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
2162 System.out.println(i);
2163 String keyA = "a" + i;
2164 String keyB = "b" + i;
2165 String keyC = "c" + i;
2166 String keyD = "d" + i;
2167 String valueA = "a" + i;
2168 String valueB = "b" + i;
2169 String valueC = "c" + i;
2170 String valueD = "d" + i;
2172 IoTString iKeyA = new IoTString(keyA);
2173 IoTString iKeyB = new IoTString(keyB);
2174 IoTString iKeyC = new IoTString(keyC);
2175 IoTString iKeyD = new IoTString(keyD);
2176 IoTString iValueA = new IoTString(valueA);
2177 IoTString iValueB = new IoTString(valueB);
2178 IoTString iValueC = new IoTString(valueC);
2179 IoTString iValueD = new IoTString(valueD);
2182 t1.startTransaction();
2183 t1.addKV(iKeyA, iValueA);
2184 transStatusList.add(t1.commitTransaction());
2185 t1.startTransaction();
2186 t1.addKV(iKeyB, iValueB);
2187 transStatusList.add(t1.commitTransaction());
2189 t2.startTransaction();
2190 t2.addKV(iKeyC, iValueC);
2191 transStatusList.add(t2.commitTransaction());
2193 t2.startTransaction();
2194 t2.addKV(iKeyD, iValueD);
2195 transStatusList.add(t2.commitTransaction());
2199 System.out.println("Updating Clients...");
2206 System.out.println("Checking Key-Values...");
2207 for (int i = 0; i < NUMBER_OF_TESTS; i++) {
2209 String keyA = "a" + i;
2210 String keyB = "b" + i;
2211 String keyC = "c" + i;
2212 String keyD = "d" + i;
2213 String valueA = "a" + i;
2214 String valueB = "b" + i;
2215 String valueC = "c" + i;
2216 String valueD = "d" + i;
2218 IoTString iKeyA = new IoTString(keyA);
2219 IoTString iKeyB = new IoTString(keyB);
2220 IoTString iKeyC = new IoTString(keyC);
2221 IoTString iKeyD = new IoTString(keyD);
2222 IoTString iValueA = new IoTString(valueA);
2223 IoTString iValueB = new IoTString(valueB);
2224 IoTString iValueC = new IoTString(valueC);
2225 IoTString iValueD = new IoTString(valueD);
2228 IoTString testValA1 = t1.getCommitted(iKeyA);
2229 IoTString testValB1 = t1.getCommitted(iKeyB);
2230 IoTString testValC1 = t1.getCommitted(iKeyC);
2231 IoTString testValD1 = t1.getCommitted(iKeyD);
2233 IoTString testValA2 = t2.getCommitted(iKeyA);
2234 IoTString testValB2 = t2.getCommitted(iKeyB);
2235 IoTString testValC2 = t2.getCommitted(iKeyC);
2236 IoTString testValD2 = t2.getCommitted(iKeyD);
2238 if ((testValA1 == null) || (testValA1.equals(iValueA) == false)) {
2239 System.out.println("Key-Value t1 incorrect: " + keyA);
2243 if ((testValB1 == null) || (testValB1.equals(iValueB) == false)) {
2244 System.out.println("Key-Value t1 incorrect: " + keyB);
2248 if ((testValC1 == null) || (testValC1.equals(iValueC) == false)) {
2249 System.out.println("Key-Value t1 incorrect: " + keyC);
2253 if ((testValD1 == null) || (testValD1.equals(iValueD) == false)) {
2254 System.out.println("Key-Value t1 incorrect: " + keyD);
2259 if ((testValA2 == null) || (testValA2.equals(iValueA) == false)) {
2260 System.out.println("Key-Value t2 incorrect: " + keyA + " " + testValA2);
2264 if ((testValB2 == null) || (testValB2.equals(iValueB) == false)) {
2265 System.out.println("Key-Value t2 incorrect: " + keyB + " " + testValB2);
2269 if ((testValC2 == null) || (testValC2.equals(iValueC) == false)) {
2270 System.out.println("Key-Value t2 incorrect: " + keyC + " " + testValC2);
2274 if ((testValD2 == null) || (testValD2.equals(iValueD) == false)) {
2275 System.out.println("Key-Value t2 incorrect: " + keyD + " " + testValD2);
2280 for (TransactionStatus status : transStatusList) {
2281 if (status.getStatus() != TransactionStatus.StatusCommitted) {
2283 System.out.println(status.getStatus());
2288 System.out.println("Found Errors...");
2290 System.out.println("No Errors Found...");
2293 // System.out.println();
2294 // System.out.println();
2297 // System.out.println();
2298 // System.out.println();