diff --git a/src/main/java/com/dispose/controller/DisposeTaskController.java b/src/main/java/com/dispose/controller/DisposeTaskController.java index 65d82645..21356f6e 100644 --- a/src/main/java/com/dispose/controller/DisposeTaskController.java +++ b/src/main/java/com/dispose/controller/DisposeTaskController.java @@ -16,9 +16,9 @@ import com.dispose.pojo.dto.protocol.device.manager.BasePagesGetReq; import com.dispose.pojo.dto.protocol.task.GetDeviceTaskDetail; import com.dispose.pojo.dto.protocol.task.GetTaskDetail; import com.dispose.pojo.dto.protocol.task.GetTaskRsp; -import com.dispose.pojo.dto.protocol.task.IpTaskStartMulRsp; import com.dispose.pojo.dto.protocol.task.IpTaskStartReq; -import com.dispose.pojo.dto.protocol.task.TaskStartRsp; +import com.dispose.pojo.dto.protocol.task.IpTaskStartRsp; +import com.dispose.pojo.dto.protocol.task.TaskStartMulRsp; import com.dispose.pojo.dto.protocol.task.TaskStopItem; import com.dispose.pojo.dto.protocol.task.TaskStopRsp; import com.dispose.pojo.entity.DeviceTask; @@ -119,7 +119,7 @@ public class DisposeTaskController { MulReturnType ret = disposeTaskService.createTask(task); // 设置返回消息 - TaskStartRsp rspInfo = TaskStartRsp.builder() + IpTaskStartRsp rspInfo = IpTaskStartRsp.builder() .disposeIp(task.getDisposeObject()) .build(); @@ -150,9 +150,9 @@ public class DisposeTaskController { @PostMapping("/startMulIp") @ResponseBody @ApiOperation("启动处置任务") - public ProtocolRespDTO startTaskMulIp(@Validated(ValidGroups.TaskStartMulReqValid.class) + public ProtocolRespDTO startTaskMulIp(@Validated(ValidGroups.TaskStartMulReqValid.class) @RequestBody ProtocolReqDTO mr, - @NotNull @RequestHeader HttpHeaders headers) { + @NotNull @RequestHeader HttpHeaders headers) { IpTaskStartReq req = mr.getMsgContent(); Long devId = Long.parseLong(Optional.ofNullable(req.getId()).orElse("-1")); Long aId = userAccountService.getUserIdByAuthHead(Objects.requireNonNull(headers.get("Authorization")).get(0)); @@ -165,7 +165,7 @@ public class DisposeTaskController { Integer flowBand = Optional.ofNullable(req.getFlowBandwidth()) .orElse(DisposeConfigValue.DEFAULT_DISPOSE_BANDWIDTH); - IpTaskStartMulRsp mulRsp = IpTaskStartMulRsp.builder() + TaskStartMulRsp mulRsp = TaskStartMulRsp.builder() .items(new ArrayList<>()) .build(); @@ -187,7 +187,7 @@ public class DisposeTaskController { MulReturnType ret = disposeTaskService.createTask(task); // 设置返回消息 - TaskStartRsp rspInfo = TaskStartRsp.builder() + IpTaskStartRsp rspInfo = IpTaskStartRsp.builder() .disposeIp(ip) .build(); diff --git a/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStartRsp.java b/src/main/java/com/dispose/pojo/dto/protocol/task/IpTaskStartRsp.java similarity index 93% rename from src/main/java/com/dispose/pojo/dto/protocol/task/TaskStartRsp.java rename to src/main/java/com/dispose/pojo/dto/protocol/task/IpTaskStartRsp.java index 30126516..8de85eaa 100644 --- a/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStartRsp.java +++ b/src/main/java/com/dispose/pojo/dto/protocol/task/IpTaskStartRsp.java @@ -19,7 +19,7 @@ import lombok.EqualsAndHashCode; @AllArgsConstructor @JsonPropertyOrder({"taskId", "disposeIp", "expireTime", "status", "message"}) @JsonInclude(JsonInclude.Include.NON_NULL) -public class TaskStartRsp extends BaseIdResp { +public class IpTaskStartRsp extends BaseIdResp { /** * The Dispose ip. */ diff --git a/src/main/java/com/dispose/pojo/dto/protocol/task/IpTaskStartMulRsp.java b/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStartMulRsp.java similarity index 87% rename from src/main/java/com/dispose/pojo/dto/protocol/task/IpTaskStartMulRsp.java rename to src/main/java/com/dispose/pojo/dto/protocol/task/TaskStartMulRsp.java index 398369de..a923ba80 100644 --- a/src/main/java/com/dispose/pojo/dto/protocol/task/IpTaskStartMulRsp.java +++ b/src/main/java/com/dispose/pojo/dto/protocol/task/TaskStartMulRsp.java @@ -21,9 +21,9 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @JsonInclude(JsonInclude.Include.NON_NULL) -public class IpTaskStartMulRsp extends BaseRespStatus { +public class TaskStartMulRsp extends BaseRespStatus { /** * The Items. */ - List items; + List items; } diff --git a/src/test/java/com/dispose/test/dev/controller/DisposeTaskControllerTest.java b/src/test/java/com/dispose/test/dev/controller/DisposeTaskControllerTest.java index 0393fdcc..d2434311 100644 --- a/src/test/java/com/dispose/test/dev/controller/DisposeTaskControllerTest.java +++ b/src/test/java/com/dispose/test/dev/controller/DisposeTaskControllerTest.java @@ -14,9 +14,9 @@ import com.dispose.pojo.dto.protocol.base.ProtocolReqDTO; import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO; import com.dispose.pojo.dto.protocol.device.manager.BasePagesGetReq; import com.dispose.pojo.dto.protocol.task.GetTaskRsp; -import com.dispose.pojo.dto.protocol.task.IpTaskStartMulRsp; import com.dispose.pojo.dto.protocol.task.IpTaskStartReq; -import com.dispose.pojo.dto.protocol.task.TaskStartRsp; +import com.dispose.pojo.dto.protocol.task.IpTaskStartRsp; +import com.dispose.pojo.dto.protocol.task.TaskStartMulRsp; import com.dispose.pojo.dto.protocol.task.TaskStopItem; import com.dispose.pojo.dto.protocol.task.TaskStopRsp; import com.dispose.pojo.entity.DisposeTask; @@ -129,8 +129,8 @@ public class DisposeTaskControllerTest extends InitTestEnvironment { .getResponse() .getContentAsString(); - ProtocolRespDTO rspInfo = objectMapper.readValue(ret, - new TypeReference>() { + ProtocolRespDTO rspInfo = objectMapper.readValue(ret, + new TypeReference>() { }); verifyRespProtocol(rspInfo); @@ -190,8 +190,8 @@ public class DisposeTaskControllerTest extends InitTestEnvironment { .getContentAsString(); - ProtocolRespDTO rspInfo = objectMapper.readValue(ret, - new TypeReference>() { + ProtocolRespDTO rspInfo = objectMapper.readValue(ret, + new TypeReference>() { }); verifyRespProtocol(rspInfo); @@ -320,8 +320,8 @@ public class DisposeTaskControllerTest extends InitTestEnvironment { log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(ret)); - ProtocolRespDTO rspInfo = objectMapper.readValue(ret, - new TypeReference>() { + ProtocolRespDTO rspInfo = objectMapper.readValue(ret, + new TypeReference>() { }); verifyRespProtocol(rspInfo); diff --git a/src/test/java/com/dispose/test/testcase/dev/v200/CodeCoverage.java b/src/test/java/com/dispose/test/testcase/dev/v200/CodeCoverage.java index 29551513..f4383809 100644 --- a/src/test/java/com/dispose/test/testcase/dev/v200/CodeCoverage.java +++ b/src/test/java/com/dispose/test/testcase/dev/v200/CodeCoverage.java @@ -6,7 +6,7 @@ import com.dispose.common.SecurityConfigValue; import com.dispose.pojo.dto.protocol.base.BaseRespStatus; import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO; import com.dispose.pojo.dto.protocol.task.GetTaskRsp; -import com.dispose.pojo.dto.protocol.task.IpTaskStartMulRsp; +import com.dispose.pojo.dto.protocol.task.TaskStartMulRsp; import com.dispose.test.common.QATestItem; import com.dispose.test.common.TestPriority; import com.dispose.test.common.VerifyProtoRespCallback; @@ -38,10 +38,10 @@ public class CodeCoverage { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"mulDisposeIp\":[\"192.168.50.\",\"192.168.50\"],\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) CodeCoverage::verifyJsonExceptionResp) + .verifyCallback((VerifyProtoRespCallback) CodeCoverage::verifyJsonExceptionResp) .prepareCallback(c -> SecurityConfigValue.SECURITY_PROTOCOL_TYPE = ProtoCryptoType.CRYPTO_BASE64.getCode()) .build(), diff --git a/src/test/java/com/dispose/test/testcase/qa/v200/P1All.java b/src/test/java/com/dispose/test/testcase/qa/v200/P1All.java index 82113a13..0618f11c 100644 --- a/src/test/java/com/dispose/test/testcase/qa/v200/P1All.java +++ b/src/test/java/com/dispose/test/testcase/qa/v200/P1All.java @@ -12,7 +12,7 @@ import com.dispose.pojo.dto.protocol.base.IdArraysReq; import com.dispose.pojo.dto.protocol.device.manager.AddDeviceRsp; import com.dispose.pojo.dto.protocol.device.manager.CommDeviceListRsp; import com.dispose.pojo.dto.protocol.task.GetTaskRsp; -import com.dispose.pojo.dto.protocol.task.TaskStartRsp; +import com.dispose.pojo.dto.protocol.task.IpTaskStartRsp; import com.dispose.pojo.dto.protocol.task.TaskStopRsp; import com.dispose.pojo.entity.DisposeDevice; import com.dispose.test.common.QATestItem; @@ -239,10 +239,10 @@ public class P1All { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":\"192.168.50.2\",\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[1,2,3,4,5]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> { + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> { Assert.assertNotNull(v); Assert.assertNotNull(v.getMsgContent()); Assert.assertEquals((long)v.getCode(), e.getHttpCode()); @@ -262,10 +262,10 @@ public class P1All { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":\"ABCD:EF01:2345:6789:ABCD:EF01:2345:6789\",\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[1,2,3,4,5]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> { + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> { Assert.assertNotNull(v); Assert.assertNotNull(v.getMsgContent()); Assert.assertEquals((long)v.getCode(), e.getHttpCode()); diff --git a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStart.java b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStart.java index 5a396aba..e0ee14e5 100644 --- a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStart.java +++ b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStart.java @@ -4,7 +4,7 @@ import com.dispose.common.ErrorCode; import com.dispose.common.Helper; import com.dispose.pojo.dto.protocol.base.BaseRespStatus; import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO; -import com.dispose.pojo.dto.protocol.task.TaskStartRsp; +import com.dispose.pojo.dto.protocol.task.IpTaskStartRsp; import com.dispose.test.common.QATestItem; import com.dispose.test.common.TestPriority; import com.dispose.test.common.VerifyProtoRespCallback; @@ -35,10 +35,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":\"192.168.51.2\",\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[-1]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.51.2")) + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.51.2")) .build(), QATestItem.builder() @@ -50,10 +50,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":\"ABCD:EF01:2345:6789:ABCD:EF01:2345:6789\",\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[-1]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "ABCD:EF01:2345" + + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "ABCD:EF01:2345" + ":6789:ABCD:EF01:2345:6789")) .build(), @@ -66,10 +66,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":\"192.168.50.2\",\"disposeTime\":10,\"flowDirection\":0," + "\"attackType\":[1,2,3,4,5]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.50.2")) + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.50.2")) .build(), QATestItem.builder() @@ -81,10 +81,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":\"192.168.50.3\",\"disposeTime\":10,\"flowDirection\":1," + "\"attackType\":[1,2,3,4,5]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.50.3")) + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.50.3")) .build(), QATestItem.builder() @@ -96,10 +96,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":2," + "\"disposeIp\":\"192.168.50.3\",\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[-1]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.50.3")) + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.50.3")) .build(), QATestItem.builder() @@ -111,10 +111,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":1," + "\"disposeIp\":\"192.168.50.2\",\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[-1]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.50.2")) + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.50.2")) .build(), QATestItem.builder() @@ -126,10 +126,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":3," + "\"disposeIp\":\"192.168.50.2\",\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[-1]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.50.2")) + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, "192.168.50.2")) .build(), QATestItem.builder() @@ -139,10 +139,10 @@ public class P2TaskStart { .urlPath("/task/start") .method(RequestMethod.POST) .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) + .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) .build(), QATestItem.builder() @@ -154,10 +154,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":null," + "\"disposeIp\":\"192.168.50.2\",\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[1,2,3,4,5]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) + .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) .build(), QATestItem.builder() @@ -169,10 +169,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":\"0\"," + "\"disposeIp\":\"192.168.50.2\",\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[1,2,3,4,5]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) + .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) .build(), QATestItem.builder() @@ -183,10 +183,10 @@ public class P2TaskStart { .method(RequestMethod.POST) .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":null,\"disposeTime\":10,\"flowDirection\":2,\"attackType\":[1,2,3,4,5]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) + .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) .build(), QATestItem.builder() @@ -198,10 +198,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":192.168.50.2,\"disposeTime\":10,\"flowDirection\":2,\"attackType\":[1," + "2,3,4,5]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) + .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) .build(), QATestItem.builder() @@ -213,10 +213,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":\"192.168.50.2\",\"disposeTime\":null,\"flowDirection\":2," + "\"attackType\":[1,2,3,4,5]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) + .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) .build(), QATestItem.builder() @@ -228,10 +228,10 @@ public class P2TaskStart { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":\"192.168.50.2\",\"disposeTime\":\"10\",\"flowDirection\":2," + "\"attackType\":[1,2,3,4,5]}}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) + .verifyCallback((VerifyProtoRespCallback)P2TaskStart::verifyJsonExceptionResp) .build(), }; @@ -251,7 +251,7 @@ public class P2TaskStart { * @param e the e * @param ipAddr the ip addr */ - private static void verifySucceed(ProtocolRespDTO v, ErrorCode e, String ipAddr) { + private static void verifySucceed(ProtocolRespDTO v, ErrorCode e, String ipAddr) { String disposeIp = v.getMsgContent().getDisposeIp(); Assert.assertNotNull(v); Assert.assertNotNull(v.getMsgContent()); diff --git a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStartMulIp.java b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStartMulIp.java index 1903980e..e2e8106b 100644 --- a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStartMulIp.java +++ b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStartMulIp.java @@ -3,7 +3,7 @@ package com.dispose.test.testcase.qa.v200; import com.dispose.common.ErrorCode; import com.dispose.pojo.dto.protocol.base.BaseRespStatus; import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO; -import com.dispose.pojo.dto.protocol.task.IpTaskStartMulRsp; +import com.dispose.pojo.dto.protocol.task.TaskStartMulRsp; import com.dispose.test.common.QATestItem; import com.dispose.test.common.TestPriority; import com.dispose.test.common.VerifyProtoRespCallback; @@ -37,10 +37,10 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "192.168.50.4", "192.168.50.3" })) .build(), @@ -54,10 +54,10 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[-1]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "192.168.50.4", "192.168.50.3" })) .build(), @@ -71,10 +71,10 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":2}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "192.168.50.4", "192.168.50.3" })) .build(), @@ -89,10 +89,10 @@ public class P2TaskStartMulIp { "\"mulDisposeIp\":[\"ABCD:EF01:2345:6789:ABCD:EF01:2345:6789\"," + "\"ABCD:EF01:2345:6789:ABCD:EF01:2345:1234\"],\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", "ABCD:EF01:2345:6789:ABCD:EF01:2345:1234" })) .build(), @@ -107,10 +107,10 @@ public class P2TaskStartMulIp { "\"mulDisposeIp\":[\"ABCD:EF01:2345:6789:ABCD:EF01:2345:6789\"," + "\"ABCD:EF01:2345:6789:ABCD:EF01:2345:1234\"],\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[-1]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", "ABCD:EF01:2345:6789:ABCD:EF01:2345:1234" })) .build(), @@ -125,10 +125,10 @@ public class P2TaskStartMulIp { "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"," + "\"ABCD:EF01:2345:6789:ABCD:EF01:2345:6789\"],\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "192.168.50.4", "192.168.50.3","ABCD:EF01:2345:6789:ABCD:EF01:2345:6789" })) .build(), @@ -142,10 +142,10 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":0,\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "192.168.50.4", "192.168.50.3" })) .build(), @@ -159,10 +159,10 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":1,\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "192.168.50.4", "192.168.50.3" })) .build(), @@ -176,10 +176,10 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":2," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[-1]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "192.168.50.4", "192.168.50.3" })) .build(), @@ -193,10 +193,10 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":1," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[-1]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "192.168.50.4", "192.168.50.3" })) .build(), @@ -210,10 +210,10 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":3," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[-1]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_OK) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ + .verifyCallback((VerifyProtoRespCallback) (v, e, c) -> verifySucceed(v, e, new String[]{ "192.168.50.4", "192.168.50.3" })) .build(), @@ -225,7 +225,7 @@ public class P2TaskStartMulIp { .urlPath("/task/startMulIp") .method(RequestMethod.POST) .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) .verifyCallback(P2TaskStartMulIp::verifyJsonExceptionResp) @@ -240,7 +240,7 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":null," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) .verifyCallback(P2TaskStartMulIp::verifyJsonExceptionResp) @@ -255,7 +255,7 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":\"0\"," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) .verifyCallback(P2TaskStartMulIp::verifyJsonExceptionResp) @@ -269,7 +269,7 @@ public class P2TaskStartMulIp { .method(RequestMethod.POST) .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":null,\"disposeTime\":10,\"flowDirection\":2,\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) .verifyCallback(P2TaskStartMulIp::verifyJsonExceptionResp) @@ -284,7 +284,7 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"disposeIp\":192.168.50.2,\"disposeTime\":10,\"flowDirection\":2,\"attackType\":[1," + "2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) .verifyCallback(P2TaskStartMulIp::verifyJsonExceptionResp) @@ -299,7 +299,7 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":null," + "\"flowDirection\":2,\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) .verifyCallback(P2TaskStartMulIp::verifyJsonExceptionResp) @@ -314,7 +314,7 @@ public class P2TaskStartMulIp { .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":0," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":\"10\"," + "\"flowDirection\":2,\"attackType\":[1,2,3,4,5]}}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) .verifyCallback(P2TaskStartMulIp::verifyJsonExceptionResp) @@ -337,7 +337,7 @@ public class P2TaskStartMulIp { * @param e the e * @param ipList the ip list */ - private static void verifySucceed(ProtocolRespDTO v, ErrorCode e, String[] ipList) { + private static void verifySucceed(ProtocolRespDTO v, ErrorCode e, String[] ipList) { Assert.assertNotNull(v); Assert.assertNotNull(v.getMsgContent()); Assert.assertEquals((long) v.getCode(), e.getHttpCode()); diff --git a/src/test/java/com/dispose/test/testcase/qa/v200/P3All.java b/src/test/java/com/dispose/test/testcase/qa/v200/P3All.java index a3379344..663d579d 100644 --- a/src/test/java/com/dispose/test/testcase/qa/v200/P3All.java +++ b/src/test/java/com/dispose/test/testcase/qa/v200/P3All.java @@ -7,8 +7,8 @@ import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO; import com.dispose.pojo.dto.protocol.device.info.GetDeviceInfoRsp; import com.dispose.pojo.dto.protocol.device.manager.GetDeviceRsp; import com.dispose.pojo.dto.protocol.task.GetTaskRsp; -import com.dispose.pojo.dto.protocol.task.IpTaskStartMulRsp; -import com.dispose.pojo.dto.protocol.task.TaskStartRsp; +import com.dispose.pojo.dto.protocol.task.IpTaskStartRsp; +import com.dispose.pojo.dto.protocol.task.TaskStartMulRsp; import com.dispose.pojo.dto.protocol.task.TaskStopRsp; import com.dispose.test.common.QATestItem; import com.dispose.test.common.TestPriority; @@ -212,10 +212,10 @@ public class P3All { .urlPath("/task/start") .method(RequestMethod.POST) .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":null}") - .rspClass(TaskStartRsp.class) + .rspClass(IpTaskStartRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) P3All::verifyJsonExceptionResp) + .verifyCallback((VerifyProtoRespCallback) P3All::verifyJsonExceptionResp) .build(), QATestItem.builder() @@ -225,10 +225,10 @@ public class P3All { .urlPath("/task/startMulIp") .method(RequestMethod.POST) .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":null}") - .rspClass(IpTaskStartMulRsp.class) + .rspClass(TaskStartMulRsp.class) .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) - .verifyCallback((VerifyProtoRespCallback) P3All::verifyJsonExceptionResp) + .verifyCallback((VerifyProtoRespCallback) P3All::verifyJsonExceptionResp) .build(), QATestItem.builder()