修改部分API注释bug
This commit is contained in:
EnderByEndera
2024-01-13 10:23:48 +08:00
parent 135a1ae04c
commit ee10a17aea
32 changed files with 201 additions and 173 deletions

View File

@@ -94,7 +94,7 @@ class TemplateServiceTest {
void testUpdateTemplateSuccess() {
List<Template> templates = templateService.queryTemplates("DDOS", 1, 1);
Template testTemplate = templates.get(0);
testTemplate.setTemplateName("洪泛型DDOS攻击-"+LocalDateTime.now());
testTemplate.setTemplateName("洪泛型DDOS攻击-" + LocalDateTime.now());
assertTrue(templateService.updateTemplate(testTemplate.getTemplateId(), testTemplate));
}

View File

@@ -13,6 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
@SpringBootTest
public class DynamicRuleServiceTest {
private final DynamicRuleService dynamicRuleService;
@Autowired
public DynamicRuleServiceTest(DynamicRuleService dynamicRuleService) {
this.dynamicRuleService = dynamicRuleService;
@@ -36,7 +37,7 @@ public class DynamicRuleServiceTest {
@Test
void testDeleteDynamicRule() {
// dynamicRuleService.deleteDynamicRuleObject(8);
// dynamicRuleService.deleteDynamicRuleObject(8);
}
@Test
@@ -61,7 +62,7 @@ public class DynamicRuleServiceTest {
@Test
void testQueryDynamicRuleObject() {
List<DynamicRuleObject> objects = dynamicRuleService.queryDynamicRuleObject( null,null,1, 10);
List<DynamicRuleObject> objects = dynamicRuleService.queryDynamicRuleObject(null, null, 1, 10);
System.out.println(objects);
}
}

View File

@@ -16,6 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class StaticRuleServiceTest {
private final StaticRuleService staticRuleService;
private StaticRuleObject staticRuleTest;
@Autowired
public StaticRuleServiceTest(StaticRuleService staticRuleService) {
this.staticRuleService = staticRuleService;
@@ -41,9 +42,9 @@ public class StaticRuleServiceTest {
}
@Test
void testNewStaticRule(){
void testNewStaticRule() {
Integer i = 0;
while(i<20) {
while (i < 20) {
i++;
StaticRuleObject object = new StaticRuleObject();
@@ -63,8 +64,9 @@ public class StaticRuleServiceTest {
}
//assertTrue(id>0);
}
@Test
void testNewStaticRules(){
void testNewStaticRules() {
List<StaticRuleObject> staticRuleObjects = new ArrayList<>();
for (int i = 0; i < 100; i++) {
staticRuleObjects.add(staticRuleTest);
@@ -74,17 +76,18 @@ public class StaticRuleServiceTest {
}
@Test
void testDeleteStaticRule(){
void testDeleteStaticRule() {
int i = 0;
List<Integer> list = new ArrayList<>();
list.add(1);
while(i<2) {
while (i < 2) {
i++;
staticRuleService.deleteStaticRules(list);
}
}
@Test
void testUpdateStaticRule(){
void testUpdateStaticRule() {
StaticRuleObject object = new StaticRuleObject();
@@ -104,17 +107,18 @@ public class StaticRuleServiceTest {
staticRuleService.updateStaticRule(5, object);
}
@Test
void testQueryStaticRule(){
void testQueryStaticRule() {
StaticRuleObject object = staticRuleService.queryStaticRuleById(7);
System.out.println(object);
}
@Test
void testQueryStaticRuleList(){
void testQueryStaticRuleList() {
List<StaticRuleObject> objectList = staticRuleService.queryStaticRule(null,null,1,10);
List<StaticRuleObject> objectList = staticRuleService.queryStaticRule(null, null, 1, 10);
System.out.println(objectList);
}

View File

@@ -44,12 +44,15 @@ class TaskServiceTest {
@Test
void testNewTaskSuccess() {
for (int i = 0; i < 100; i++){
for (int i = 0; i < 100; i++) {
LocalDateTime taskStartTime = LocalDateTime.now().plusDays(i);
LocalDateTime taskEndTime = LocalDateTime.now().plusDays(i+10);
LocalDateTime taskEndTime = LocalDateTime.now().plusDays(i + 10);
task.setTaskStartTime(taskStartTime);
task.setTaskEndTime(taskEndTime);
assertDoesNotThrow(() -> {Long taskId = taskService.newTask(task); assertTrue(taskId > 0);});
assertDoesNotThrow(() -> {
Long taskId = taskService.newTask(task);
assertTrue(taskId > 0);
});
assertTrue(task.getTaskId() > 0);
}
}
@@ -82,7 +85,7 @@ class TaskServiceTest {
@Test
void testDeleteTask() {
long testNum = taskService.queryTasks(null, null, null, null, 1, 10)
long testNum = taskService.queryTasks(null, null, null, null, 1, 10)
.get(0).getTaskId();
assertTrue(taskService.deleteTask(testNum));

View File

@@ -11,13 +11,14 @@ import org.springframework.boot.test.context.SpringBootTest;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertTrue;
@SpringBootTest
class WhiteListServiceTest {
private final WhiteListService whiteListService;
private WhiteListObject whiteListObject;
@Autowired
WhiteListServiceTest(WhiteListService whiteListService) {
this.whiteListService = whiteListService;
@@ -59,12 +60,12 @@ class WhiteListServiceTest {
//object.setWhiteListId(7);
object.setWhiteListName("test_update");
whiteListService.updateWhiteListObject(7,object);
whiteListService.updateWhiteListObject(7, object);
}
@Test
void testExistWhiteList() {
List<Integer> ruleIds = List.of(6,7,8);
List<Integer> ruleIds = List.of(6, 7, 8);
// List<String> ip_list = whiteListService.existWhiteListObject(ruleIds);
// System.out.println(ip_list);
}