Added simple test
authorAli Younis <ayounis@uci.edu>
Thu, 3 Aug 2017 05:12:10 +0000 (22:12 -0700)
committerAli Younis <ayounis@uci.edu>
Thu, 3 Aug 2017 05:12:10 +0000 (22:12 -0700)
version2/src/java/simple_test/Controller.java [new file with mode: 0644]
version2/src/java/simple_test/README.txt [new file with mode: 0644]
version2/src/java/simple_test/build.bash [new file with mode: 0755]
version2/src/java/simple_test/run.bash [new file with mode: 0755]

diff --git a/version2/src/java/simple_test/Controller.java b/version2/src/java/simple_test/Controller.java
new file mode 100644 (file)
index 0000000..78ac151
--- /dev/null
@@ -0,0 +1,48 @@
+import iotcloud.*;
+
+class Controller {
+    public static void main(String[] args) throws Exception {
+
+
+        Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 399, -1);
+        // t1.initTable();
+        t1.rebuild();
+
+        String a = "bulb";
+        IoTString ia = new IoTString(a);
+        t1.createNewKey(ia, 399);
+
+        t1.update();
+
+
+
+        String valueA = "on";
+        IoTString iValueA = new IoTString(valueA);
+
+
+        IoTString testValA1 = t1.getCommitted(ia);
+
+        if ((testValA1 != null) && (testValA1.equals(iValueA) == true)) {
+            System.out.println("Is True");
+        } else {
+            System.out.println("Is False or Null");
+        }
+
+
+
+        t1.startTransaction();
+        t1.addKV(ia, iValueA);
+        t1.commitTransaction();
+
+        t1.update();
+        testValA1 = t1.getCommitted(ia);
+
+        if ((testValA1 != null) && (testValA1.equals(iValueA) == true)) {
+            System.out.println("Is True");
+        } else {
+            System.out.println("Is False or Null");
+        }
+
+    }
+
+}
\ No newline at end of file
diff --git a/version2/src/java/simple_test/README.txt b/version2/src/java/simple_test/README.txt
new file mode 100644 (file)
index 0000000..b9f7ee4
--- /dev/null
@@ -0,0 +1,17 @@
+First build using:
+    ./build.bash
+
+To run this example run:
+    
+    # Starts the light bulb controller
+    ./run1.bash   
+
+    # Starts the fan controller
+    ./run3.bash   
+
+
+    # For each switch you need to run (can launch as many of these as desired as long as input number is different)
+    ./run2.bash <a unique integer not equal to 321 or 351>
+
+
+Dont forget to clear the cloud server directory
\ No newline at end of file
diff --git a/version2/src/java/simple_test/build.bash b/version2/src/java/simple_test/build.bash
new file mode 100755 (executable)
index 0000000..dbce681
--- /dev/null
@@ -0,0 +1 @@
+javac -cp .:/Users/Ali/Desktop/iotcloud/version2/src/java/iotcloud/bin *.java
\ No newline at end of file
diff --git a/version2/src/java/simple_test/run.bash b/version2/src/java/simple_test/run.bash
new file mode 100755 (executable)
index 0000000..33c4ede
--- /dev/null
@@ -0,0 +1 @@
+java -cp .:/Users/Ali/Desktop/iotcloud/version2/src/java/iotcloud/bin Controller
\ No newline at end of file