JavaApiDBTest.java
1.51 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
package com.monitor;
import com.model.JavaApiInfo;
import com.monitor.cmdb.service.IJavaApiInfoService;
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.List;
/**
* Created by fruwei on 2016/6/17.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
"classpath*:META-INF/spring/spring*.xml"})
@PropertySource({"classpath:jdbc.properties",
"classpath:*.properties"})
public class JavaApiDBTest {
Logger logger = LoggerFactory.getLogger("test");
@Autowired
IJavaApiInfoService javaApiInfoService;
@Test
public void testAdd() {
JavaApiInfo javaApiInfo = new JavaApiInfo();
javaApiInfo.setApiName("test");
javaApiInfo.setServiceType(1);
javaApiInfo.setApiUrl("1111111");
javaApiInfoService.saveJavaApiInfo(javaApiInfo);
}
@Test
public void testQuery() {
List<JavaApiInfo> list = javaApiInfoService.queryJavaApiInfo();
for (JavaApiInfo javaApiInfo : list) {
logger.info(javaApiInfo.getApiName());
}
}
@Test
public void testDel() {
}
@Test
public void testUpdate() {
javaApiInfoService.delJavaApiInfo(1);
}
}