Changes
[iotcloud.git] / version2 / src / java / light_fan_benchmark / BulbSwitch.java
index 208482fc9eb7fc4bad17403c3cf72750a8f7a918..172446d9c7f2c951a0972140aec5a51948891081 100644 (file)
@@ -10,30 +10,32 @@ class BulbSwitch {
         System.out.println(Integer.parseInt(args[0]));
 
         Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", Integer.parseInt(args[0]), -1);
-        t1.update();
+        t1.rebuild(); // update
 
 
         String a = "bulb";
+        String b = "fan";
+        IoTString ib = new IoTString(b);
         IoTString ia = new IoTString(a);
+
         t1.createNewKey(ia, 321);
 
 
         String valueA = "on";
+        String valueB = "off";
         IoTString iValueA = new IoTString(valueA);
+        IoTString iValueB = new IoTString(valueB);
 
 
-        String valueB = "off";
-        IoTString iValueB = new IoTString(valueB);
 
         System.out.println("Starting System");
-
         Scanner keyboard = new Scanner(System.in);
 
-
         while (true) {
 
 
-            System.out.println("Enter 0 for off, 1 for on");
+            System.out.println("Enter 0 for off, 1 for on for bulb");
+            System.out.println("Enter 3 for off, 2 for on for fan");
             int myint = keyboard.nextInt();
 
             if (myint == 0) {
@@ -42,12 +44,23 @@ class BulbSwitch {
                 t1.addKV(ia, iValueB);
                 t1.commitTransaction();
 
-            } else {
+            } else if (myint == 1) {
                 t1.update();
                 t1.startTransaction();
                 t1.addKV(ia, iValueA);
                 t1.commitTransaction();
-
+            }
+            else if (myint == 2) {
+                t1.update();
+                t1.startTransaction();
+                t1.addKV(ib, iValueA);
+                t1.commitTransaction();
+            }
+            else if (myint == 3) {
+                t1.update();
+                t1.startTransaction();
+                t1.addKV(ib, iValueB);
+                t1.commitTransaction();
             }
 
         }