parent
0e890ee008
commit
4130dae820
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
@ -1799,6 +1818,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* f8 get node task Array contains character test .
|
||||
*/
|
||||
|
@ -1991,6 +2011,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* g6 get node detailed taskId int exception test .
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue