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
|
}
|