101ca77983c555a97f7ea054edcb50429d656e07
[iotcloud.git] / src / java / iotcloud / Test.java
1 package iotcloud;
2
3 public class Test {
4         public static void main(String[] args) {
5                 if (args[0].equals("1"))
6                         test1();
7                 else if(args[0].equals("2"))
8                         test2();
9
10         }
11
12         static void test2() {
13                 Table t1=new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 321);
14                 t1.initTable();
15                 Table t2=new Table("http://127.0.0.1/test.iotcloud/", "reallysecret", 351);
16                 t2.update();
17                 for(int i=0; i<600; i++) {
18                         String a="STR"+i;
19                         String b="ABR"+i;
20                         IoTString ia=new IoTString(a);
21                         IoTString ib=new IoTString(b);
22                         t1.put(ia, ia);
23                         t2.put(ib, ib);
24                         t1.update();
25                         System.out.println(ib+"->"+t1.get(ib));
26                         System.out.println(ia+"->"+t2.get(ia));
27                 }
28         }
29
30         static void test1() {
31                 TestCloudComm cc=new TestCloudComm();
32                 Table t1=new Table(cc, 6513);
33                 t1.initTable();
34                 Table t2=new Table(cc, 6512);
35                 t2.update();
36                 for(int i=0; i<600; i++) {
37                         String a="STR"+i;
38                         String b="ABR"+i;
39                         IoTString ia=new IoTString(a);
40                         IoTString ib=new IoTString(b);
41                         t1.put(ia, ia);
42                         t2.put(ib, ib);
43                         t1.update();
44                         System.out.println(ib+"->"+t1.get(ib));
45                         System.out.println(ia+"->"+t2.get(ia));
46                 }
47                 for(int i=0; i<600; i++) {
48                         String a="STR"+i;
49                         String b="ABR"+i;
50                         IoTString ia=new IoTString(a);
51                         IoTString ib=new IoTString(b);
52                         System.out.println(ib+"->"+t1.get(ib));
53                         System.out.println(ia+"->"+t2.get(ia));
54                         System.out.println(ib+"->"+t2.get(ib));
55                         System.out.println(ia+"->"+t1.get(ia));
56                 }
57
58         }
59 }