提交 | 用户 | 时间
|
e7c126
|
1 |
package com.xxl.job.admin.dao; |
H |
2 |
|
|
3 |
import com.xxl.job.admin.core.model.XxlJobInfo; |
|
4 |
import com.xxl.job.admin.core.scheduler.MisfireStrategyEnum; |
|
5 |
import com.xxl.job.admin.core.scheduler.ScheduleTypeEnum; |
|
6 |
import org.junit.jupiter.api.Test; |
|
7 |
import org.slf4j.Logger; |
|
8 |
import org.slf4j.LoggerFactory; |
|
9 |
import org.springframework.boot.test.context.SpringBootTest; |
|
10 |
|
|
11 |
import javax.annotation.Resource; |
|
12 |
import java.util.Date; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
|
16 |
public class XxlJobInfoDaoTest { |
|
17 |
private static Logger logger = LoggerFactory.getLogger(XxlJobInfoDaoTest.class); |
|
18 |
|
|
19 |
@Resource |
|
20 |
private XxlJobInfoDao xxlJobInfoDao; |
|
21 |
|
|
22 |
@Test |
|
23 |
public void pageList(){ |
|
24 |
List<XxlJobInfo> list = xxlJobInfoDao.pageList(0, 20, 0, -1, null, null, null); |
|
25 |
int list_count = xxlJobInfoDao.pageListCount(0, 20, 0, -1, null, null, null); |
|
26 |
|
|
27 |
logger.info("", list); |
|
28 |
logger.info("", list_count); |
|
29 |
|
|
30 |
List<XxlJobInfo> list2 = xxlJobInfoDao.getJobsByGroup(1); |
|
31 |
} |
|
32 |
|
|
33 |
@Test |
|
34 |
public void save_load(){ |
|
35 |
XxlJobInfo info = new XxlJobInfo(); |
|
36 |
info.setJobGroup(1); |
|
37 |
info.setJobDesc("desc"); |
|
38 |
info.setAuthor("setAuthor"); |
|
39 |
info.setAlarmEmail("setAlarmEmail"); |
|
40 |
info.setScheduleType(ScheduleTypeEnum.FIX_RATE.name()); |
|
41 |
info.setScheduleConf(String.valueOf(33)); |
|
42 |
info.setMisfireStrategy(MisfireStrategyEnum.DO_NOTHING.name()); |
|
43 |
info.setExecutorRouteStrategy("setExecutorRouteStrategy"); |
|
44 |
info.setExecutorHandler("setExecutorHandler"); |
|
45 |
info.setExecutorParam("setExecutorParam"); |
|
46 |
info.setExecutorBlockStrategy("setExecutorBlockStrategy"); |
|
47 |
info.setGlueType("setGlueType"); |
|
48 |
info.setGlueSource("setGlueSource"); |
|
49 |
info.setGlueRemark("setGlueRemark"); |
|
50 |
info.setChildJobId("1"); |
|
51 |
|
|
52 |
info.setAddTime(new Date()); |
|
53 |
info.setUpdateTime(new Date()); |
|
54 |
info.setGlueUpdatetime(new Date()); |
|
55 |
|
|
56 |
int count = xxlJobInfoDao.save(info); |
|
57 |
|
|
58 |
XxlJobInfo info2 = xxlJobInfoDao.loadById(info.getId()); |
|
59 |
info.setScheduleType(ScheduleTypeEnum.FIX_RATE.name()); |
|
60 |
info.setScheduleConf(String.valueOf(44)); |
|
61 |
info.setMisfireStrategy(MisfireStrategyEnum.FIRE_ONCE_NOW.name()); |
|
62 |
info2.setJobDesc("desc2"); |
|
63 |
info2.setAuthor("setAuthor2"); |
|
64 |
info2.setAlarmEmail("setAlarmEmail2"); |
|
65 |
info2.setExecutorRouteStrategy("setExecutorRouteStrategy2"); |
|
66 |
info2.setExecutorHandler("setExecutorHandler2"); |
|
67 |
info2.setExecutorParam("setExecutorParam2"); |
|
68 |
info2.setExecutorBlockStrategy("setExecutorBlockStrategy2"); |
|
69 |
info2.setGlueType("setGlueType2"); |
|
70 |
info2.setGlueSource("setGlueSource2"); |
|
71 |
info2.setGlueRemark("setGlueRemark2"); |
|
72 |
info2.setGlueUpdatetime(new Date()); |
|
73 |
info2.setChildJobId("1"); |
|
74 |
|
|
75 |
info2.setUpdateTime(new Date()); |
|
76 |
int item2 = xxlJobInfoDao.update(info2); |
|
77 |
|
|
78 |
xxlJobInfoDao.delete(info2.getId()); |
|
79 |
|
|
80 |
List<XxlJobInfo> list2 = xxlJobInfoDao.getJobsByGroup(1); |
|
81 |
|
|
82 |
int ret3 = xxlJobInfoDao.findAllCount(); |
|
83 |
|
|
84 |
} |
|
85 |
|
|
86 |
} |