提交 | 用户 | 时间
|
e7c126
|
1 |
package com.xxl.job.admin.dao; |
H |
2 |
|
|
3 |
import com.xxl.job.admin.core.model.XxlJobGroup; |
|
4 |
import org.junit.jupiter.api.Test; |
|
5 |
import org.springframework.boot.test.context.SpringBootTest; |
|
6 |
|
|
7 |
import javax.annotation.Resource; |
|
8 |
import java.util.Date; |
|
9 |
import java.util.List; |
|
10 |
|
|
11 |
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
|
12 |
public class XxlJobGroupDaoTest { |
|
13 |
|
|
14 |
@Resource |
|
15 |
private XxlJobGroupDao xxlJobGroupDao; |
|
16 |
|
|
17 |
@Test |
|
18 |
public void test(){ |
|
19 |
List<XxlJobGroup> list = xxlJobGroupDao.findAll(); |
|
20 |
|
|
21 |
List<XxlJobGroup> list2 = xxlJobGroupDao.findByAddressType(0); |
|
22 |
|
|
23 |
XxlJobGroup group = new XxlJobGroup(); |
|
24 |
group.setAppname("setAppName"); |
|
25 |
group.setTitle("setTitle"); |
|
26 |
group.setAddressType(0); |
|
27 |
group.setAddressList("setAddressList"); |
|
28 |
group.setUpdateTime(new Date()); |
|
29 |
|
|
30 |
int ret = xxlJobGroupDao.save(group); |
|
31 |
|
|
32 |
XxlJobGroup group2 = xxlJobGroupDao.load(group.getId()); |
|
33 |
group2.setAppname("setAppName2"); |
|
34 |
group2.setTitle("setTitle2"); |
|
35 |
group2.setAddressType(2); |
|
36 |
group2.setAddressList("setAddressList2"); |
|
37 |
group2.setUpdateTime(new Date()); |
|
38 |
|
|
39 |
int ret2 = xxlJobGroupDao.update(group2); |
|
40 |
|
|
41 |
int ret3 = xxlJobGroupDao.remove(group.getId()); |
|
42 |
} |
|
43 |
|
|
44 |
} |