From: Ali Younis Date: Thu, 3 Aug 2017 05:12:10 +0000 (-0700) Subject: Added simple test X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ae903c2edcaf687c96fa193cf410739b9d483d4f;p=iotcloud.git Added simple test --- diff --git a/version2/src/java/simple_test/Controller.java b/version2/src/java/simple_test/Controller.java new file mode 100644 index 0000000..78ac151 --- /dev/null +++ b/version2/src/java/simple_test/Controller.java @@ -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 index 0000000..b9f7ee4 --- /dev/null +++ b/version2/src/java/simple_test/README.txt @@ -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 + + +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 index 0000000..dbce681 --- /dev/null +++ b/version2/src/java/simple_test/build.bash @@ -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 index 0000000..33c4ede --- /dev/null +++ b/version2/src/java/simple_test/run.bash @@ -0,0 +1 @@ +java -cp .:/Users/Ali/Desktop/iotcloud/version2/src/java/iotcloud/bin Controller \ No newline at end of file