TestResetCompute.java.svn-base 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import org.apache.hadoop.conf.Configuration;
  2. import org.apache.hadoop.hbase.HBaseConfiguration;
  3. import com.sagacloud.json.JSONObject;
  4. import com.zillion.database.agent.ZillionAgent;
  5. public class TestResetCompute {
  6. public static String database_name = "db_public";
  7. public static void main(String[] args) throws Exception {
  8. Configuration configuration = HBaseConfiguration.create();
  9. String zookeeper_connectionAddress = "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181";
  10. int zookeeper_sessionTimeout = 300000;
  11. ZillionAgent agent = new ZillionAgent(configuration, zookeeper_connectionAddress, zookeeper_sessionTimeout);
  12. agent.Start();
  13. JSONObject Criteria = new JSONObject();
  14. JSONObject wrapperObject = new JSONObject();
  15. wrapperObject.put("QueryType", "delete");
  16. wrapperObject.put("Database", database_name);
  17. wrapperObject.put("Datatable", "fjd_0_computelog");
  18. wrapperObject.put("Criteria", Criteria);
  19. agent.Query(wrapperObject);
  20. Criteria = new JSONObject();
  21. wrapperObject = new JSONObject();
  22. wrapperObject.put("QueryType", "delete");
  23. wrapperObject.put("Database", database_name);
  24. wrapperObject.put("Datatable", "fjd_0_computedetail");
  25. wrapperObject.put("Criteria", Criteria);
  26. agent.Query(wrapperObject);
  27. Criteria = new JSONObject();
  28. wrapperObject = new JSONObject();
  29. wrapperObject.put("QueryType", "delete");
  30. wrapperObject.put("Database", database_name);
  31. wrapperObject.put("Datatable", "fjd_0_metercomputetime");
  32. wrapperObject.put("Criteria", Criteria);
  33. agent.Query(wrapperObject);
  34. Criteria = new JSONObject();
  35. wrapperObject = new JSONObject();
  36. wrapperObject.put("QueryType", "delete");
  37. wrapperObject.put("Database", database_name);
  38. wrapperObject.put("Datatable", "fjd_0_buildingcomputetime");
  39. wrapperObject.put("Criteria", Criteria);
  40. agent.Query(wrapperObject);
  41. JSONObject InsertObject = new JSONObject();
  42. InsertObject.put("building", "1101080001");
  43. InsertObject.put("compute_time", "20170101000000");
  44. InsertObject.put("first_compute_time", "20170101000000");
  45. wrapperObject = new JSONObject();
  46. wrapperObject.put("QueryType", "insert");
  47. wrapperObject.put("Database", database_name);
  48. wrapperObject.put("Datatable", "fjd_0_buildingcomputetime");
  49. wrapperObject.put("InsertObject", InsertObject);
  50. agent.Query(wrapperObject);
  51. agent.Stop();
  52. }
  53. }