JavaApiInfluxDBTest.java
2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.monitor;
import com.alibaba.fastjson.JSON;
import com.monitor.influxdb.mapper.impl.JavaApiStaticsMapper;
import com.monitor.javaserver.common.JavaApiStatics;
import com.monitor.model.domain.JavaApiStaticsModel;
import com.monitor.model.request.JavaApiStatusReq;
import com.monitor.model.response.JavaApiStatusRep;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by fruwei on 2016/6/22.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
"classpath*:META-INF/spring/spring*.xml"})
@PropertySource({"classpath:jdbc.properties",
"classpath:*.properties"})
public class JavaApiInfluxDBTest {
Logger logger = LoggerFactory.getLogger("test");
@Autowired
JavaApiStaticsMapper javaApiStaticsMapper;
@Test
public void testQuery() {
JavaApiStatusReq param = new JavaApiStatusReq();
param.setServiceId(21);
param.setServiceId(43);
JavaApiStaticsModel rel = javaApiStaticsMapper.selectlatestJavaApiStatics(null, param);
logger.info(rel.toString());
}
@Test
public void testBatchQuery() {
List<JavaApiStatusReq> listParam = new ArrayList<>();
for (int i = 0; i < 30; i++) {
JavaApiStatusReq param1 = new JavaApiStatusReq();
param1.setServiceId(19);
param1.setMObjectId(24);
listParam.add(param1);
}
long start = System.currentTimeMillis();
logger.info("############################################start...");
List<JavaApiStaticsModel> rel = javaApiStaticsMapper.selectlatestJavaApiStaticsList(null, listParam);
long end = System.currentTimeMillis();
logger.info("###########################################end... cost : {}", (end - start));
logger.info("############################################rel: {}", JSON.toJSON(rel));
logger.info(rel.toString());
}
}