Changes
[iotcloud.git] / src2 / java / iotcloud / Test.java
1 package iotcloud;
2
3 /**
4  * Test cases.
5  * @author Brian Demsky
6  * @version 1.0
7  */
8
9 public class Test {
10         public static void main(String[] args) {
11                 if (args[0].equals("2")) {
12                         test2();
13                 }
14         }
15
16         static void test2() {
17                 Table t1 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321);
18                 t1.initTable();
19                 Table t2 = new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351);
20                 t2.update();
21
22                 for (int i = 0; i < 600; i++) {
23                         String a = "STR" + i;
24                         String b = "ABR" + i;
25                         IoTString ia = new IoTString(a);
26                         IoTString ib = new IoTString(b);
27
28
29                         t1.createNewKey(ia, 321);
30                         t2.createNewKey(ib, 351);
31
32                         t1.startTransaction();
33                         t1.addKV(ia, ia);
34                         t1.commitTransaction();
35
36                         t2.startTransaction();
37                         t2.addKV(ib, ib);
38                         t2.commitTransaction();
39                 }
40
41                 t1.update();
42                 t2.update();
43
44
45                 for (int i = 0; i < 600; i++) {
46                         String a = "STR" + i;
47                         String b = "ABR" + i;
48                         IoTString ia = new IoTString(a);
49                         IoTString ib = new IoTString(b);
50
51                         System.out.println(ib + "->" + t1.getCommitted(ib));
52                         System.out.println(ia + "->" + t2.getCommitted(ia));
53                 }
54         }
55 }