From 4130dae820c583836101039dcd42235fa7e1f1d0 Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Wed, 8 Jul 2020 10:48:46 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E5=A2=9E=E5=8A=A0=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=A4=84=E7=BD=AE=E4=BB=BB=E5=8A=A1=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=9A=84=E5=85=A5=E5=8F=82=E5=88=A4=E6=96=AD=202.=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=B9=BF=E6=92=AD=E5=BD=A2=E5=BC=8F=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=A4=84=E7=BD=AE=E4=BB=BB=E5=8A=A1=E7=9A=84QA=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DisposeTaskController.java | 2 +- .../test/controller/TaskControllerQATest.java | 243 ++++++++++-------- 2 files changed, 133 insertions(+), 112 deletions(-) diff --git a/src/main/java/com/dispose/controller/DisposeTaskController.java b/src/main/java/com/dispose/controller/DisposeTaskController.java index a9317846..37ebc7a5 100644 --- a/src/main/java/com/dispose/controller/DisposeTaskController.java +++ b/src/main/java/com/dispose/controller/DisposeTaskController.java @@ -117,7 +117,7 @@ public class DisposeTaskController { return ProtocolRespDTO.result(ErrorCode.ERR_PARAMS); } - if (reqInfo.getDisposeTime() == null) { + if (reqInfo.getDisposeTime() == null || reqInfo.getDisposeTime() < 0) { log.error("Request dispose time params error, error:{} --> {}", mr.getMsgContent(), reqInfo.getDisposeTime()); return ProtocolRespDTO.result(ErrorCode.ERR_PARAMS); } diff --git a/src/test/java/com/dispose/test/controller/TaskControllerQATest.java b/src/test/java/com/dispose/test/controller/TaskControllerQATest.java index 1d78912e..ef9cd5eb 100644 --- a/src/test/java/com/dispose/test/controller/TaskControllerQATest.java +++ b/src/test/java/com/dispose/test/controller/TaskControllerQATest.java @@ -54,7 +54,7 @@ public class TaskControllerQATest extends InitTestEnvironment { @Test public void a1_NormalContainsNonEmptyTaskTest() throws Exception { - String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":1," + "\\\"type\\\":0, \\\"disposeIp\\\":\\\"192.168.5.4\\\", " + "\\\"disposeTime\\\":120, \\\"flowDirection\\\":2, \\\"attackType\\\":[0], " + "\\\"flowBandwidth\\\":1024}\"}"; @@ -85,6 +85,9 @@ public class TaskControllerQATest extends InitTestEnvironment { } else if (startTaskRsp.getStatus() == 26) { Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_TASKRUNNING.getCode())); Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_TASKRUNNING.getMsg()); + } else if (startTaskRsp.getStatus() == 19) { + Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode())); + Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_NOSUCHDEVICE.getMsg()); } } @@ -95,7 +98,7 @@ public class TaskControllerQATest extends InitTestEnvironment { */ @Test public void a2_startTaskDisPoseIpEmptyExceptionTest() throws Exception { - String reqDataNoIp = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + String reqDataNoIp = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":1," + "\\\"type\\\":0, \\\"disposeIp\\\":\\\"\\\", \\\"disposeTime\\\":120}\"}"; String ret = mockMvc.perform(MockMvcRequestBuilders @@ -125,7 +128,7 @@ public class TaskControllerQATest extends InitTestEnvironment { @Test public void a3_startTaskDisposeIpNullExceptionTest() throws Exception { //disposeIp null - String reqDataNullIp = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + String reqDataNullIp = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":1," + "\\\"type\\\":0, \\\"disposeIp\\\":null, \\\"disposeTime\\\":120}\"}"; String ret = mockMvc.perform(MockMvcRequestBuilders @@ -154,7 +157,7 @@ public class TaskControllerQATest extends InitTestEnvironment { */ @Test public void a4_startTaskDisposeIpIntegerExceptionTest() throws Exception { - String reqDataIntegerIp = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + String reqDataIntegerIp = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":1," + "\\\"type\\\":0, \\\"disposeIp\\\":192345, \\\"disposeTime\\\":120}\"}"; String ret = mockMvc.perform(MockMvcRequestBuilders @@ -212,7 +215,7 @@ public class TaskControllerQATest extends InitTestEnvironment { */ @Test public void a6_startTaskTypeEmptyExceptionTest() throws Exception { - String reqDataNoType = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + String reqDataNoType = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":1," + "\\\"type\\\":, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":120}\"}"; String ret = mockMvc.perform(MockMvcRequestBuilders @@ -241,7 +244,7 @@ public class TaskControllerQATest extends InitTestEnvironment { */ @Test public void a7_startTaskTypeNullExceptionTest() throws Exception { //null type - String reqDataNullType = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + String reqDataNullType = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":1," + "\\\"type\\\":null, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":120}\"}"; String ret = mockMvc.perform(MockMvcRequestBuilders @@ -271,7 +274,7 @@ public class TaskControllerQATest extends InitTestEnvironment { @Test public void a8_startTaskDisposeTimeEmptyExceptionTest() throws Exception { //no disposeTime - String reqDataNoDisposeTime = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + String reqDataNoDisposeTime = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":1," + "\\\"type\\\":0, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":}\"}"; String ret = mockMvc.perform(MockMvcRequestBuilders @@ -301,7 +304,7 @@ public class TaskControllerQATest extends InitTestEnvironment { @Test public void a9_startTaskDisposeTimeNullExceptionTest() throws Exception { //null disposeTime - String reqDataNullDisposeTime = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + String reqDataNullDisposeTime = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":1," + "\\\"type\\\":0, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":null}\"}"; String ret = mockMvc.perform(MockMvcRequestBuilders @@ -331,7 +334,7 @@ public class TaskControllerQATest extends InitTestEnvironment { @Test public void a10_startTaskDisposeTimeStringExceptionTest() throws Exception { //string disposeTime - String reqDataStringDisposeTime = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + String reqDataStringDisposeTime = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":1," + "\\\"type\\\":null, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":\\\"120\\\"}\"}"; String ret = mockMvc.perform(MockMvcRequestBuilders @@ -354,40 +357,12 @@ public class TaskControllerQATest extends InitTestEnvironment { } /** - * a11 id empty exception test. + * a11 id zero test. * * @throws Exception the exception */ @Test - public void a11_startTaskIdEmptyExceptionTest() throws Exception { - String reqDataIdEmpty = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":\\\"\\\"," + - "\\\"type\\\":0, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":120}\"}"; - - String ret = mockMvc.perform(MockMvcRequestBuilders - .post("/task/start") - .contentType(MediaType.APPLICATION_JSON) - .header("Authorization", GlobalVar.STRING_HTTP_AUTH_HEAD + getLogToken()) - .content(reqDataIdEmpty)) - .andDo(print()).andExpect(status().isOk()) - .andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMS.getHttpCode())) - .andReturn() - .getResponse() - .getContentAsString(); - - ReturnStatus returnStatus = objectMapper.readValue(verifyResp(ret), ReturnStatus.class); - - Assert.assertNotNull(returnStatus.getStatus()); - Assert.assertNotNull(returnStatus.getMessage()); - Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMS.getCode())); - Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMS.getMsg()); - } - /** - * a12 id zero test. - * - * @throws Exception the exception - */ - @Test - public void a12_startTaskIdZeroTest() throws Exception { + public void a11_startTaskIdZeroTest() throws Exception { String reqDataIdZero = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":\\\"0\\\"," + "\\\"type\\\":0, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":120}\"}"; @@ -407,67 +382,17 @@ public class TaskControllerQATest extends InitTestEnvironment { Assert.assertNotNull(startTaskRsp); Assert.assertNotNull(startTaskRsp.getStatus()); Assert.assertNotNull(startTaskRsp.getMessage()); - - if (startTaskRsp.getStatus() == 0) { - Assert.assertNotNull(String.valueOf(startTaskRsp.getExpireTime())); - Assert.assertNotNull(startTaskRsp.getId()); - Assert.assertNotNull(startTaskRsp.getTaskId()); - Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); - Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_OK.getMsg()); - } else if (startTaskRsp.getStatus() == 26) { - Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_TASKRUNNING.getCode())); - Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_TASKRUNNING.getMsg()); - } else if (startTaskRsp.getStatus() == 19) { - Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode())); - Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_NOSUCHDEVICE.getMsg()); - } - + Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode())); + Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_NOSUCHDEVICE.getMsg()); } + /** - * a13 id normal exception test. + * a12 type error exception test. * * @throws Exception the exception */ @Test - public void a13_startTaskIdNormalTest() throws Exception { - String reqDataIdNormal = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":\\\"1\\\"," + - "\\\"type\\\":0, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":120}\"}"; - - String ret = mockMvc.perform(MockMvcRequestBuilders - .post("/task/start") - .contentType(MediaType.APPLICATION_JSON) - .header("Authorization", GlobalVar.STRING_HTTP_AUTH_HEAD + getLogToken()) - .content(reqDataIdNormal)) - .andDo(print()).andExpect(status().isOk()) - .andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode())) - .andReturn() - .getResponse() - .getContentAsString(); - - StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(ret), StartTaskRsp.class); - - Assert.assertNotNull(startTaskRsp); - Assert.assertNotNull(startTaskRsp.getStatus()); - Assert.assertNotNull(startTaskRsp.getMessage()); - - if (startTaskRsp.getStatus() == 0) { - Assert.assertNotNull(String.valueOf(startTaskRsp.getExpireTime())); - Assert.assertNotNull(startTaskRsp.getId()); - Assert.assertNotNull(startTaskRsp.getTaskId()); - Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); - Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_OK.getMsg()); - } else if (startTaskRsp.getStatus() == 26) { - Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_TASKRUNNING.getCode())); - Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_TASKRUNNING.getMsg()); - } - } - /** - * a14 type error exception test. - * - * @throws Exception the exception - */ - @Test - public void a14_startTaskTypeErrorExceptionTest() throws Exception { + public void a12_startTaskTypeErrorExceptionTest() throws Exception { String reqDataTypeError = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + "\\\"type\\\":5, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":120}\"}"; @@ -489,16 +414,17 @@ public class TaskControllerQATest extends InitTestEnvironment { Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMS.getCode())); Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMS.getMsg()); } + /** - * a15 disposeTime negative exception test. + * a13 disposeTime negative exception test. * * @throws Exception the exception */ @Test - public void a15_startTaskDisposeTimeNegativeExceptionTest() throws Exception { + public void a13_startTaskDisposeTimeNegativeExceptionTest() throws Exception { //string disposeTime String reqDataDisposeTimeNegative = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + - "\\\"type\\\":null, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":-10}\"}"; + "\\\"type\\\":0, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":-10}\"}"; String ret = mockMvc.perform(MockMvcRequestBuilders .post("/task/start") @@ -518,22 +444,106 @@ public class TaskControllerQATest extends InitTestEnvironment { Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMS.getCode())); Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMS.getMsg()); } + /** - * a16 disposeTime zero exception test. + * a14 start dispose task Broadcast * * @throws Exception the exception */ @Test - public void a16_startTaskDisposeTimeZeroExceptionTest() throws Exception { - //string disposeTime - String reqDataDisposeTimeZero = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + - "\\\"type\\\":null, \\\"disposeIp\\\":\\\"192.168.4.2\\\", \\\"disposeTime\\\":0}\"}"; + public void a14_BroadcastNormalContainsNonEmptyTaskTest() throws Exception { + String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + "\\\"type\\\":0, \\\"disposeIp\\\":\\\"192.168.5.2\\\", " + + "\\\"disposeTime\\\":120, \\\"flowDirection\\\":2, \\\"attackType\\\":[0], " + + "\\\"flowBandwidth\\\":1024}\"}"; String ret = mockMvc.perform(MockMvcRequestBuilders .post("/task/start") .contentType(MediaType.APPLICATION_JSON) .header("Authorization", GlobalVar.STRING_HTTP_AUTH_HEAD + getLogToken()) - .content(reqDataDisposeTimeZero)) + .content(reqData)) + .andDo(print()).andExpect(status().isOk()) + .andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode())) + .andReturn() + .getResponse() + .getContentAsString(); + + StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(ret), StartTaskRsp.class); + + Assert.assertNotNull(startTaskRsp); + Assert.assertNotNull(startTaskRsp.getStatus()); + Assert.assertNotNull(startTaskRsp.getMessage()); + + if (startTaskRsp.getStatus() == 0) { + Assert.assertNotNull(String.valueOf(startTaskRsp.getExpireTime())); + Assert.assertNotNull(startTaskRsp.getId()); + Assert.assertNotNull(startTaskRsp.getTaskId()); + Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); + Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_OK.getMsg()); + } else if (startTaskRsp.getStatus() == 26) { + Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_TASKRUNNING.getCode())); + Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_TASKRUNNING.getMsg()); + } + } + + /** + * a15 start dispose task Broadcast type negative. -1代表所有任务类型 清洗高防黑洞检测 + * + * @throws Exception the exception + */ + @Test + public void a15_broadCastStartTaskTypeNegativeExceptionTest() throws Exception { + String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + "\\\"type\\\":-1, \\\"disposeIp\\\":\\\"192.168.5.2\\\", " + + "\\\"disposeTime\\\":120, \\\"flowDirection\\\":2, \\\"attackType\\\":[0], " + + "\\\"flowBandwidth\\\":1024}\"}"; + + String ret = mockMvc.perform(MockMvcRequestBuilders + .post("/task/start") + .contentType(MediaType.APPLICATION_JSON) + .header("Authorization", GlobalVar.STRING_HTTP_AUTH_HEAD + getLogToken()) + .content(reqData)) + .andDo(print()).andExpect(status().isOk()) + .andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode())) + .andReturn() + .getResponse() + .getContentAsString(); + + StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(ret), StartTaskRsp.class); + + Assert.assertNotNull(startTaskRsp); + Assert.assertNotNull(startTaskRsp.getStatus()); + Assert.assertNotNull(startTaskRsp.getMessage()); + + if (startTaskRsp.getStatus() == 0) { + Assert.assertNotNull(String.valueOf(startTaskRsp.getExpireTime())); + Assert.assertNotNull(startTaskRsp.getId()); + Assert.assertNotNull(startTaskRsp.getTaskId()); + Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); + Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_OK.getMsg()); + } else if (startTaskRsp.getStatus() == 26) { + Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_TASKRUNNING.getCode())); + Assert.assertEquals(startTaskRsp.getMessage(), ErrorCode.ERR_TASKRUNNING.getMsg()); + } + } + + /** + * a16 start dispose task Broadcast type negative. < -1 + * + * @throws Exception the exception + */ + @Test + public void a16_broadCastStartTaskTypeNegativeExceptionTest() throws Exception { + String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\":-1," + + "\\\"type\\\":-2, \\\"disposeIp\\\":\\\"192.168.5.2\\\", " + + "\\\"disposeTime\\\":120, \\\"flowDirection\\\":2, \\\"attackType\\\":[0], " + + "\\\"flowBandwidth\\\":1024}\"}"; + + String ret = mockMvc.perform(MockMvcRequestBuilders + .post("/task/start") + .contentType(MediaType.APPLICATION_JSON) + .header("Authorization", GlobalVar.STRING_HTTP_AUTH_HEAD + getLogToken()) + .content(reqData)) .andDo(print()).andExpect(status().isOk()) .andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMS.getHttpCode())) .andReturn() @@ -547,6 +557,7 @@ public class TaskControllerQATest extends InitTestEnvironment { Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMS.getCode())); Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMS.getMsg()); } + /** * b1 taskId empty exception test. 停止指定任务的时候必须指定id id不能为空字符串 * @@ -741,6 +752,7 @@ public class TaskControllerQATest extends InitTestEnvironment { } } } + /** * b7 taskId int exception test. * @@ -769,6 +781,7 @@ public class TaskControllerQATest extends InitTestEnvironment { Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode())); Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMEXCEPTION.getMsg()); } + /** * c1 id null exception test. * @@ -1000,6 +1013,7 @@ public class TaskControllerQATest extends InitTestEnvironment { Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMS.getCode())); Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMS.getMsg()); } + /** * c9 type negative exception test. */ @@ -1024,6 +1038,7 @@ public class TaskControllerQATest extends InitTestEnvironment { Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMS.getCode())); Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMS.getMsg()); } + /** * c10 normal stop tasks by dispose ip test. */ @@ -1061,6 +1076,7 @@ public class TaskControllerQATest extends InitTestEnvironment { } } } + /** * d1 stop task by single node test. */ @@ -1254,6 +1270,7 @@ public class TaskControllerQATest extends InitTestEnvironment { Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMS.getCode())); Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMS.getMsg()); } + /** * d7 type string exception test. * @@ -1492,6 +1509,7 @@ public class TaskControllerQATest extends InitTestEnvironment { } } } + /** * e7 type error exception test. * @@ -1518,6 +1536,7 @@ public class TaskControllerQATest extends InitTestEnvironment { Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMS.getCode())); Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMS.getMsg()); } + /** * f1 get node task of node test. */ @@ -1540,7 +1559,7 @@ public class TaskControllerQATest extends InitTestEnvironment { NodeTaskRsp nodeTaskRsp = objectMapper.readValue(verifyResp(ret), NodeTaskRsp.class); Assert.assertNotNull(nodeTaskRsp); - nodeTaskRsp.getItems().forEach(v->{ + nodeTaskRsp.getItems().forEach(v -> { Assert.assertNotNull(v.getStatus()); Assert.assertNotNull(v.getMessage()); @@ -1570,7 +1589,7 @@ public class TaskControllerQATest extends InitTestEnvironment { } /** - *f2 get node task id empty exception test.空表示所有能力节点 + * f2 get node task id empty exception test.空表示所有能力节点 */ @Test public void f2_NormalGetNodeTaskInfoIdTest() throws Exception { @@ -1591,7 +1610,7 @@ public class TaskControllerQATest extends InitTestEnvironment { NodeTaskRsp nodeTaskRsp = objectMapper.readValue(verifyResp(ret), NodeTaskRsp.class); Assert.assertNotNull(nodeTaskRsp); - nodeTaskRsp.getItems().forEach(v->{ + nodeTaskRsp.getItems().forEach(v -> { Assert.assertNotNull(v.getStatus()); Assert.assertNotNull(v.getMessage()); @@ -1799,6 +1818,7 @@ public class TaskControllerQATest extends InitTestEnvironment { } }); } + /** * f8 get node task Array contains character test . */ @@ -1851,7 +1871,7 @@ public class TaskControllerQATest extends InitTestEnvironment { TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(ret), TaskInfoRsp.class); Assert.assertNotNull(startTaskRsp); - startTaskRsp.getItems().forEach(v->{ + startTaskRsp.getItems().forEach(v -> { Assert.assertNotNull(v.getId()); Assert.assertNotNull(v.getTaskId()); Assert.assertNotNull(v.getStartTime()); @@ -1939,7 +1959,7 @@ public class TaskControllerQATest extends InitTestEnvironment { TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(ret), TaskInfoRsp.class); Assert.assertNotNull(startTaskRsp); - startTaskRsp.getItems().forEach(v->{ + startTaskRsp.getItems().forEach(v -> { Assert.assertNotNull(v.getId()); Assert.assertNotNull(v.getTaskId()); Assert.assertNotNull(v.getStartTime()); @@ -1973,24 +1993,25 @@ public class TaskControllerQATest extends InitTestEnvironment { TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(ret), TaskInfoRsp.class); Assert.assertNotNull(startTaskRsp); - startTaskRsp.getItems().forEach(v->{ + startTaskRsp.getItems().forEach(v -> { Assert.assertNotNull(v); Assert.assertNotNull(v.getTaskId()); Assert.assertNotNull(v.getStatus()); Assert.assertNotNull(v.getMessage()); - if(v.getStatus() == 0){ + if (v.getStatus() == 0) { Assert.assertNotNull(v.getId()); Assert.assertNotNull(v.getStartTime()); Assert.assertNotNull(v.getDisposeTime()); Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertEquals(v.getMessage(), ErrorCode.ERR_OK.getMsg()); - }else if(v.getStatus() == 30){ + } else if (v.getStatus() == 30) { Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHTASK.getCode())); Assert.assertEquals(v.getMessage(), ErrorCode.ERR_NOSUCHTASK.getMsg()); } }); } + /** * g6 get node detailed taskId int exception test . */