VAServerHttpServiceTest.java
3.6 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package com.viontech.fanxing.task.service;
import com.alibaba.fastjson.JSON;
import com.viontech.fanxing.commons.constant.TaskStatus;
import com.viontech.fanxing.commons.model.StoreConfig;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.service.RedisService;
import com.viontech.fanxing.task.model.TaskData;
import com.viontech.fanxing.commons.model.main.VaServerInfo;
import com.viontech.fanxing.task.repository.TaskDataRedisRepository;
import com.viontech.fanxing.task.repository.VAServerRedisRepository;
import com.viontech.fanxing.task.service.adapter.TaskService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
/**
* .
*
* @author 谢明辉
* @date 2021/7/21
*/
@SpringBootTest
@RunWith(SpringRunner.class)
class VAServerHttpServiceTest {
private static final String TASK_UNID = "abcd-xxxx-xxxxxx-xxxxxx";
private static final String DEV_ID = "sn3device1";
@Resource
VAServerHttpService vaServerHttpService;
@Resource
RedisService redisService;
@Resource
private VAServerRedisRepository vaServerRedisRepository;
@Resource
private OpsClientService opsClientService;
private VaServerInfo vaServerInfo;
private TaskData taskData;
@Resource
private TaskService taskService;
@Resource
private TaskDataRedisRepository taskDataRedisRepository;
@BeforeEach
public void before() {
this.vaServerInfo = vaServerRedisRepository.getVAServerInfoById(DEV_ID);
this.taskData = new TaskData();
Task task = new Task();
task.setUnid(TASK_UNID);
this.taskData.setTask(task);
}
@Test
void snapshot() {
vaServerHttpService.snapshot(TASK_UNID, vaServerInfo);
}
@Test
void getAnalyzeStream() {
Object analyzeStream = vaServerHttpService.getAnalyzeStream(TASK_UNID, vaServerInfo);
}
@Test
void startAnalyzeStream() {
vaServerHttpService.startAnalyzeStream(TASK_UNID, vaServerInfo, "rtsp://192.168.9.245:10087/abcd-xxxx-xxxxxx-xxxxxx");
}
@Test
void switchScene() {
vaServerHttpService.switchScene(TASK_UNID, vaServerInfo, "1");
}
@Test
void updateAlternate() {
vaServerHttpService.updateRotationStatus(TASK_UNID, 1, vaServerInfo);
}
@Test
void getAlternate() {
vaServerHttpService.getRotationStatus(TASK_UNID, vaServerInfo);
}
@Test
void status() {
vaServerHttpService.status(vaServerInfo);
}
@Test
void storeConfig() {
String storeConfig = opsClientService.getStoreConfigById(6L);
System.out.println(storeConfig);
}
@Test
void testJsonArray() {
}
@Test
void test() throws Exception {
// RMap<String, String> taskVaServerMap = redisService.getTaskVaServerMap();
// taskVaServerMap.put("b0c20c4a-fffd-11eb-a74d-0242ac11001d", DEV_ID);
taskService.updateStatus(19L, TaskStatus.RUNNING.val);
// RScoredSortedSet<String> set = redisService.getClient().getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET);
// RScoredSortedSet<String> set2 = redisService.getClient().getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_TERMINATED_TASK_UNID_SET);
// set.add(DateUtil.parse("yyyy-MM-dd HH:mm:ss", "2021-08-11 13:18:00").getTime(), "tttttttttttttttttt");
// set2.add(DateUtil.parse("yyyy-MM-dd HH:mm:ss", "2021-08-11 13:20:00").getTime(), "tttttttttttttttttt");
}
}