Authored by qinchao

test配置文件

1 package com.monitor.influxdb; 1 package com.monitor.influxdb;
2 2
  3 +import com.monitor.influxdb.mapper.impl.CommonQuery;
  4 +import com.monitor.influxdb.util.QueryResultUtil;
3 import org.influxdb.dto.Pong; 5 import org.influxdb.dto.Pong;
4 import org.influxdb.dto.Query; 6 import org.influxdb.dto.Query;
5 import org.influxdb.dto.QueryResult; 7 import org.influxdb.dto.QueryResult;
@@ -29,6 +31,8 @@ public class InfluxDBSimpleTest { @@ -29,6 +31,8 @@ public class InfluxDBSimpleTest {
29 @Autowired 31 @Autowired
30 private InluxDBSingle inluxDBSingle; 32 private InluxDBSingle inluxDBSingle;
31 33
  34 + @Autowired
  35 + private CommonQuery commonQuery;
32 36
33 @Before 37 @Before
34 public void init() { 38 public void init() {
@@ -37,7 +41,7 @@ public class InfluxDBSimpleTest { @@ -37,7 +41,7 @@ public class InfluxDBSimpleTest {
37 41
38 @Test 42 @Test
39 public void test() { 43 public void test() {
40 - InfluxDBModel influxDBModel = inluxDBSingle.getInfluxDBByName("test"); 44 + /* InfluxDBModel influxDBModel = inluxDBSingle.getInfluxDBByName("test");
41 Pong pong = influxDBModel.getInfluxDB().ping(); 45 Pong pong = influxDBModel.getInfluxDB().ping();
42 logger.info("pong: {}", pong.getResponseTime()); 46 logger.info("pong: {}", pong.getResponseTime());
43 47
@@ -46,15 +50,25 @@ public class InfluxDBSimpleTest { @@ -46,15 +50,25 @@ public class InfluxDBSimpleTest {
46 for (String strDatabase : databaseList) { 50 for (String strDatabase : databaseList) {
47 logger.info("name:{}", strDatabase); 51 logger.info("name:{}", strDatabase);
48 } 52 }
  53 +*/
49 54
50 -  
51 - Query query=new Query("select * from rabbitmq_sent","yoho_order"); 55 + /* Query query=new Query("select * from rabbitmq_sent","yoho_order");
52 QueryResult result=influxDBModel.getInfluxDB().query(query); 56 QueryResult result=influxDBModel.getInfluxDB().query(query);
53 Iterator<QueryResult.Result> itResult=result.getResults().iterator(); 57 Iterator<QueryResult.Result> itResult=result.getResults().iterator();
54 while (itResult.hasNext()){ 58 while (itResult.hasNext()){
55 QueryResult.Result result1=itResult.next(); 59 QueryResult.Result result1=itResult.next();
56 60
57 logger.info("{}",result.toString()); 61 logger.info("{}",result.toString());
  62 + }*/
  63 + String sql="select \"name\",number from test";
  64 + String db="gml_test";
  65 + QueryResult queryResult = commonQuery.query("test", sql, db);
  66 + logger.info("{}",queryResult);
  67 + List<QueryResult.Series> seriesList = QueryResultUtil.getSeries(queryResult);
  68 + if (seriesList == null) {
  69 + logger.info(" null series list");
  70 + }else{
  71 + logger.info(" ok series list");
58 } 72 }
59 73
60 } 74 }
1 # ******************** influxdb common configs ******************** 1 # ******************** influxdb common configs ********************
2 influxdb.num=1 2 influxdb.num=1
3 influxdb.name=test 3 influxdb.name=test
4 -influxdb.ip=http://172.16.6.82:32768  
5 -influxdb.user=frw  
6 -influxdb.pwd=frw 4 +influxdb.ip=http://192.168.103.93:8086
  5 +influxdb.user=root
  6 +influxdb.pwd=123456
7 influxdb.connect.timeout=15 7 influxdb.connect.timeout=15
8 influxdb.read.timeout=40 8 influxdb.read.timeout=40
9 influxdb.write.timeout=20 9 influxdb.write.timeout=20