|
|
package com.monitor.influxdb;
|
|
|
|
|
|
import com.monitor.influxdb.mapper.impl.CommonQuery;
|
|
|
import com.monitor.influxdb.util.QueryResultUtil;
|
|
|
import org.influxdb.dto.Pong;
|
|
|
import org.influxdb.dto.Query;
|
|
|
import org.influxdb.dto.QueryResult;
|
...
|
...
|
@@ -29,6 +31,8 @@ public class InfluxDBSimpleTest { |
|
|
@Autowired
|
|
|
private InluxDBSingle inluxDBSingle;
|
|
|
|
|
|
@Autowired
|
|
|
private CommonQuery commonQuery;
|
|
|
|
|
|
@Before
|
|
|
public void init() {
|
...
|
...
|
@@ -37,7 +41,7 @@ public class InfluxDBSimpleTest { |
|
|
|
|
|
@Test
|
|
|
public void test() {
|
|
|
InfluxDBModel influxDBModel = inluxDBSingle.getInfluxDBByName("test");
|
|
|
/* InfluxDBModel influxDBModel = inluxDBSingle.getInfluxDBByName("test");
|
|
|
Pong pong = influxDBModel.getInfluxDB().ping();
|
|
|
logger.info("pong: {}", pong.getResponseTime());
|
|
|
|
...
|
...
|
@@ -46,15 +50,25 @@ public class InfluxDBSimpleTest { |
|
|
for (String strDatabase : databaseList) {
|
|
|
logger.info("name:{}", strDatabase);
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
|
|
|
Query query=new Query("select * from rabbitmq_sent","yoho_order");
|
|
|
/* Query query=new Query("select * from rabbitmq_sent","yoho_order");
|
|
|
QueryResult result=influxDBModel.getInfluxDB().query(query);
|
|
|
Iterator<QueryResult.Result> itResult=result.getResults().iterator();
|
|
|
while (itResult.hasNext()){
|
|
|
QueryResult.Result result1=itResult.next();
|
|
|
|
|
|
logger.info("{}",result.toString());
|
|
|
}*/
|
|
|
String sql="select \"name\",number from test";
|
|
|
String db="gml_test";
|
|
|
QueryResult queryResult = commonQuery.query("test", sql, db);
|
|
|
logger.info("{}",queryResult);
|
|
|
List<QueryResult.Series> seriesList = QueryResultUtil.getSeries(queryResult);
|
|
|
if (seriesList == null) {
|
|
|
logger.info(" null series list");
|
|
|
}else{
|
|
|
logger.info(" ok series list");
|
|
|
}
|
|
|
|
|
|
}
|
...
|
...
|
|