diff --git a/Bench4Q-Agent/ScenarioParameters/0adaae94-4809-4f08-b98c-09f73fae25ae/param1.txt b/Bench4Q-Agent/ScenarioParameters/0adaae94-4809-4f08-b98c-09f73fae25ae/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/0adaae94-4809-4f08-b98c-09f73fae25ae/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/1345e91e-ca37-41b0-be27-a4c9ce3293fd/param1.txt b/Bench4Q-Agent/ScenarioParameters/1345e91e-ca37-41b0-be27-a4c9ce3293fd/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/1345e91e-ca37-41b0-be27-a4c9ce3293fd/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/29a843f1-6d1c-4085-ba60-781d848f7bb8/param1.txt b/Bench4Q-Agent/ScenarioParameters/29a843f1-6d1c-4085-ba60-781d848f7bb8/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/29a843f1-6d1c-4085-ba60-781d848f7bb8/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/2e25b19a-42c6-4ba2-9317-40953bcf49cd/param1.txt b/Bench4Q-Agent/ScenarioParameters/2e25b19a-42c6-4ba2-9317-40953bcf49cd/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/2e25b19a-42c6-4ba2-9317-40953bcf49cd/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/316a2e15-a7a0-41d8-ba0b-609488a4e14e/param1.txt b/Bench4Q-Agent/ScenarioParameters/316a2e15-a7a0-41d8-ba0b-609488a4e14e/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/316a2e15-a7a0-41d8-ba0b-609488a4e14e/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/31b74fe3-aa58-4401-ad38-810a611fb2ec/param1.txt b/Bench4Q-Agent/ScenarioParameters/31b74fe3-aa58-4401-ad38-810a611fb2ec/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/31b74fe3-aa58-4401-ad38-810a611fb2ec/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/5af671c5-b064-4a3f-ad04-3dbe870de9db/param1.txt b/Bench4Q-Agent/ScenarioParameters/5af671c5-b064-4a3f-ad04-3dbe870de9db/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/5af671c5-b064-4a3f-ad04-3dbe870de9db/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/65df92e5-5747-43a6-b9a5-6c4501619e57/param1.txt b/Bench4Q-Agent/ScenarioParameters/65df92e5-5747-43a6-b9a5-6c4501619e57/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/65df92e5-5747-43a6-b9a5-6c4501619e57/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/8128f3cd-5aae-4526-80a3-dd076a676b7d/param1.txt b/Bench4Q-Agent/ScenarioParameters/8128f3cd-5aae-4526-80a3-dd076a676b7d/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/8128f3cd-5aae-4526-80a3-dd076a676b7d/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/9b874fd0-cc16-4ae5-920c-ef72c9b32697/param1.txt b/Bench4Q-Agent/ScenarioParameters/9b874fd0-cc16-4ae5-920c-ef72c9b32697/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/9b874fd0-cc16-4ae5-920c-ef72c9b32697/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/b399a98d-a4a2-42da-8aad-1cb6ec0244f9/param1.txt b/Bench4Q-Agent/ScenarioParameters/b399a98d-a4a2-42da-8aad-1cb6ec0244f9/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/b399a98d-a4a2-42da-8aad-1cb6ec0244f9/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/bf0a9d8d-55cb-4d42-a232-f6be771e3478/param1.txt b/Bench4Q-Agent/ScenarioParameters/bf0a9d8d-55cb-4d42-a232-f6be771e3478/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/bf0a9d8d-55cb-4d42-a232-f6be771e3478/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/c62f4626-50d8-4c80-8781-b9f1b3e6cfd6/param1.txt b/Bench4Q-Agent/ScenarioParameters/c62f4626-50d8-4c80-8781-b9f1b3e6cfd6/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/c62f4626-50d8-4c80-8781-b9f1b3e6cfd6/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/cdc7b76b-91b0-4b1d-a242-1163084efcfd/param1.txt b/Bench4Q-Agent/ScenarioParameters/cdc7b76b-91b0-4b1d-a242-1163084efcfd/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/cdc7b76b-91b0-4b1d-a242-1163084efcfd/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/de025d61-5179-447f-89f1-581e89bf6251/param1.txt b/Bench4Q-Agent/ScenarioParameters/de025d61-5179-447f-89f1-581e89bf6251/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/de025d61-5179-447f-89f1-581e89bf6251/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/e101d57d-caa7-4240-8495-17fc48826c36/param1.txt b/Bench4Q-Agent/ScenarioParameters/e101d57d-caa7-4240-8495-17fc48826c36/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/e101d57d-caa7-4240-8495-17fc48826c36/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/e2f0ad5b-0f55-46c6-92ac-279951fd4920/param1.txt b/Bench4Q-Agent/ScenarioParameters/e2f0ad5b-0f55-46c6-92ac-279951fd4920/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/e2f0ad5b-0f55-46c6-92ac-279951fd4920/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/f15a3933-dd64-49e0-ad1a-d87a336a35b7/param1.txt b/Bench4Q-Agent/ScenarioParameters/f15a3933-dd64-49e0-ad1a-d87a336a35b7/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/f15a3933-dd64-49e0-ad1a-d87a336a35b7/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/ScenarioParameters/f9b4da26-7ff8-44d6-a30f-3bee799dac9a/param1.txt b/Bench4Q-Agent/ScenarioParameters/f9b4da26-7ff8-44d6-a30f-3bee799dac9a/param1.txt deleted file mode 100644 index 748dc5f7..00000000 --- a/Bench4Q-Agent/ScenarioParameters/f9b4da26-7ff8-44d6-a30f-3bee799dac9a/param1.txt +++ /dev/null @@ -1 +0,0 @@ -row1;10;11~row2;20;21~row3,30,31~ \ No newline at end of file diff --git a/Bench4Q-Agent/pom.xml b/Bench4Q-Agent/pom.xml index b08d984e..31d93ab3 100644 --- a/Bench4Q-Agent/pom.xml +++ b/Bench4Q-Agent/pom.xml @@ -79,6 +79,12 @@ commons-io 2.4 + + + org.apache.hbase + hbase + 0.94.3 + diff --git a/Bench4Q-Agent/src/main/java/org/bench4q/agent/plugin/basic/hbase/GenerateDevices.java b/Bench4Q-Agent/src/main/java/org/bench4q/agent/plugin/basic/hbase/GenerateDevices.java new file mode 100644 index 00000000..607fd325 --- /dev/null +++ b/Bench4Q-Agent/src/main/java/org/bench4q/agent/plugin/basic/hbase/GenerateDevices.java @@ -0,0 +1,31 @@ +package org.bench4q.agent.plugin.basic.hbase; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.client.HTable; +import org.apache.hadoop.hbase.client.Put; + +public class GenerateDevices { + /** + * @param args + */ + public static void main(String[] args) { + // TODO Auto-generated method stub + Configuration conf = HBaseConfiguration.create(); + try { + HBaseAdmin admin = new HBaseAdmin(conf); + HTable table = new HTable(conf, "Devices"); + for (int i = 10002, j = 1002; i < 20000; i++, j++) { + Put put = new Put(String.valueOf(i).getBytes()); + put.add("INFO".getBytes(), "UserId".getBytes(), + String.valueOf(j).getBytes()); + table.put(put); + System.out.println(i + "_" + j); + } + } catch (Exception ex) { + + } + } + +} diff --git a/Bench4Q-Agent/src/main/java/org/bench4q/agent/plugin/basic/hbase/GenerateRecords.java b/Bench4Q-Agent/src/main/java/org/bench4q/agent/plugin/basic/hbase/GenerateRecords.java new file mode 100644 index 00000000..9a3e37fd --- /dev/null +++ b/Bench4Q-Agent/src/main/java/org/bench4q/agent/plugin/basic/hbase/GenerateRecords.java @@ -0,0 +1,59 @@ +package org.bench4q.agent.plugin.basic.hbase; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.client.Get; +import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.client.HTable; +import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.util.Bytes; + +public class GenerateRecords { + public String userId = null; + private Configuration conf = HBaseConfiguration.create(); + + public boolean openAndRes(byte[] type, String deviceId, String logicalName, + String id, String contextName) { + + try { + HBaseAdmin admin = new HBaseAdmin(conf); + HTable table = new HTable(conf, "Devices"); + Get get = new Get(Bytes.toBytes(deviceId)); + Result retDev = table.get(get); + if (retDev == null) { + System.out.println("this dev is not register"); + return false; + } + userId = Bytes.toString(retDev.getValue("INFO".getBytes(), + "UserId".getBytes())); + } catch (Exception ex) { + System.out.println(ex.getMessage()); + return false; + } + return true; + } + + public boolean send(double sum, double usage, double U, double I, + String time_userId) { + try { + HBaseAdmin admin = new HBaseAdmin(conf); + HTable table = new HTable(conf, "MeterLogData"); + Put put = new Put(time_userId.getBytes()); + put.add("AI".getBytes(), "Usage".getBytes(), String.valueOf(usage) + .getBytes()); + put.add("EU".getBytes(), "Sum".getBytes(), String.valueOf(sum) + .getBytes()); + put.add("SI".getBytes(), "U".getBytes(), String.valueOf(U) + .getBytes()); + put.add("SI".getBytes(), "I".getBytes(), String.valueOf(I) + .getBytes()); + table.put(put); + } catch (Exception ex) { + System.out.println(ex.getMessage()); + return false; + } + return true; + } +}