OCT
REM: 1. 修改TaskController QA测试中正常用例和异常用例的测试代码 2. 修改TaskController冒烟测试中正常用例的测试代码 3. 删除获取节点处置任务接口出参重复的Id字段 4. 添加根据处置IP停止清洗任务出参的Id字段和taskId字段 5. 数据库beginTime取消更新功能
This commit is contained in:
parent
d6c248fab9
commit
034a105164
|
@ -242,6 +242,8 @@ public class DisposeTaskController {
|
|||
taskData.setStatus(retError.getCode());
|
||||
taskData.setMessage(retError.getMsg());
|
||||
} else {
|
||||
taskData.setId("-1");
|
||||
taskData.setTaskId("-1");
|
||||
taskData.setStatus(k.getFirstParam().getCode());
|
||||
taskData.setMessage(k.getFirstParam().getMsg());
|
||||
}
|
||||
|
@ -420,7 +422,6 @@ public class DisposeTaskController {
|
|||
taskData.setStatus(ErrorCode.ERR_OK.getCode());
|
||||
taskData.setMessage(ErrorCode.ERR_OK.getMsg());
|
||||
} else {
|
||||
taskData.setId(v.getId().toString());
|
||||
taskData.setStatus(ErrorCode.ERR_NOSUCHTASK.getCode());
|
||||
taskData.setMessage(ErrorCode.ERR_NOSUCHTASK.getMsg());
|
||||
taskData.setTaskArray(null);
|
||||
|
|
|
@ -47,7 +47,7 @@ CREATE TABLE IF NOT EXISTS `dispose_task`
|
|||
`accountId` int(10) unsigned NOT NULL COMMENT '用户唯一标识符',
|
||||
`type` int(11) unsigned NOT NULL COMMENT '处置能力类型:0:清洗 1:高防 2:黑洞 3:检测',
|
||||
`disposeIp` varchar(128) NOT NULL COMMENT '处置IP',
|
||||
`beginTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '开始时间',
|
||||
`beginTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '开始时间',
|
||||
`planEndTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '计划结束时间',
|
||||
`endTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '实际结束时间',
|
||||
`flowDirection` int(11) DEFAULT '2' COMMENT '流量方向, 0:流入;1:流出;2:双向',
|
||||
|
|
|
@ -65,7 +65,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -107,11 +107,17 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertNotNull(startTaskRsp);
|
||||
Assert.assertNotNull(String.valueOf(startTaskRsp.getExpireTime()));
|
||||
Assert.assertNotNull(startTaskRsp.getId());
|
||||
Assert.assertEquals(startTaskRsp.getId(), "-1");
|
||||
Assert.assertNotNull(startTaskRsp.getTaskId());
|
||||
Assert.assertEquals(startTaskRsp.getTaskId(), "-1");
|
||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,11 +142,17 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertNotNull(startTaskRsp);
|
||||
Assert.assertNotNull(String.valueOf(startTaskRsp.getExpireTime()));
|
||||
Assert.assertNotNull(startTaskRsp.getId());
|
||||
Assert.assertEquals(startTaskRsp.getId(), "-1");
|
||||
Assert.assertNotNull(startTaskRsp.getTaskId());
|
||||
Assert.assertEquals(startTaskRsp.getTaskId(), "-1");
|
||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,7 +171,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqDataIntegerIp))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -193,7 +205,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqDataNullId))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -221,7 +233,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqDataNoType))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -254,11 +266,17 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertNotNull(startTaskRsp);
|
||||
Assert.assertNotNull(String.valueOf(startTaskRsp.getExpireTime()));
|
||||
Assert.assertNotNull(startTaskRsp.getId());
|
||||
Assert.assertEquals(startTaskRsp.getId(), "-1");
|
||||
Assert.assertNotNull(startTaskRsp.getTaskId());
|
||||
Assert.assertEquals(startTaskRsp.getTaskId(), "-1");
|
||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -278,7 +296,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqDataNoDisposeTime))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -312,11 +330,17 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertNotNull(startTaskRsp);
|
||||
Assert.assertNotNull(String.valueOf(startTaskRsp.getExpireTime()));
|
||||
Assert.assertNotNull(startTaskRsp.getId());
|
||||
Assert.assertEquals(startTaskRsp.getId(), "-1");
|
||||
Assert.assertNotNull(startTaskRsp.getTaskId());
|
||||
Assert.assertEquals(startTaskRsp.getTaskId(), "-1");
|
||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -341,11 +365,17 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertNotNull(startTaskRsp);
|
||||
Assert.assertNotNull(String.valueOf(startTaskRsp.getExpireTime()));
|
||||
Assert.assertNotNull(startTaskRsp.getId());
|
||||
Assert.assertEquals(startTaskRsp.getId(), "-1");
|
||||
Assert.assertNotNull(startTaskRsp.getTaskId());
|
||||
Assert.assertEquals(startTaskRsp.getTaskId(), "-1");
|
||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -356,7 +386,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void b1_stopTaskNoTaskIdExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988," +
|
||||
"\"msgContent\":\"{\\\"taskId\\\":\\\"\\\"}\"}";
|
||||
"\"msgContent\":\"{\\\"taskId\\\":[\\\"\\\"]}\"}";
|
||||
|
||||
String taskStop = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop")
|
||||
|
@ -364,7 +394,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -392,7 +422,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -433,7 +463,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -461,7 +491,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -481,7 +511,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void c3_stopTaskByIpNoDisposeIpExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"314\\\",\\\"type\\\":0,\\\"disposeIp\\\":\\\"\\\"}]}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":0,\\\"disposeIp\\\":\\\"\\\"}]}\"}";
|
||||
|
||||
String taskStopByIpNoDisposeIp = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_ip")
|
||||
|
@ -497,6 +527,8 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
TaskInfoRsp rspStatus = objectMapper.readValue(verifyResp(taskStopByIpNoDisposeIp), TaskInfoRsp.class);
|
||||
|
||||
rspStatus.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(v.getId());
|
||||
Assert.assertNotNull(v.getTaskId());
|
||||
Assert.assertNotNull(v.getStatus());
|
||||
Assert.assertNotNull(v.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
|
@ -511,7 +543,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void c4_stopTaskByIpNullDisposeIpExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"314\\\",\\\"type\\\":0,\\\"disposeIp\\\":null}]}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":0,\\\"disposeIp\\\":null}]}\"}";
|
||||
|
||||
String taskStopByIpNullDisposeIp = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_ip")
|
||||
|
@ -527,6 +559,8 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
TaskInfoRsp rspStatus = objectMapper.readValue(verifyResp(taskStopByIpNullDisposeIp), TaskInfoRsp.class);
|
||||
|
||||
rspStatus.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(v.getId());
|
||||
Assert.assertNotNull(v.getTaskId());
|
||||
Assert.assertNotNull(v.getStatus());
|
||||
Assert.assertNotNull(v.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
|
@ -541,7 +575,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void c5_stopTaskByIpErrorDisposeIpExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"314\\\",\\\"type\\\":0,\\\"disposeIp\\\":\\\"abc\\\"}]}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":0,\\\"disposeIp\\\":\\\"abc\\\"}]}\"}";
|
||||
|
||||
String taskStopByIpErrorDisposeIp = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_ip")
|
||||
|
@ -557,6 +591,8 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
TaskInfoRsp rspStatus = objectMapper.readValue(verifyResp(taskStopByIpErrorDisposeIp), TaskInfoRsp.class);
|
||||
|
||||
rspStatus.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(v.getId());
|
||||
Assert.assertNotNull(v.getTaskId());
|
||||
Assert.assertNotNull(v.getStatus());
|
||||
Assert.assertNotNull(v.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
|
@ -571,7 +607,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void c6_stopTaskByIpIntegerDisposeIpExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"314\\\",\\\"type\\\":0,\\\"disposeIp\\\":123}]}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":0,\\\"disposeIp\\\":123}]}\"}";
|
||||
|
||||
String taskStopByIpIntegerDisposeIp = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_ip")
|
||||
|
@ -587,6 +623,8 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
TaskInfoRsp rspStatus = objectMapper.readValue(verifyResp(taskStopByIpIntegerDisposeIp), TaskInfoRsp.class);
|
||||
|
||||
rspStatus.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(v.getId());
|
||||
Assert.assertNotNull(v.getTaskId());
|
||||
Assert.assertNotNull(v.getStatus());
|
||||
Assert.assertNotNull(v.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
|
@ -601,7 +639,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void c7_stopTaskByIpNoTypeExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"314\\\",\\\"type\\\":,\\\"disposeIp\\\":\\\"192.168.5.4\\\"}]}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":,\\\"disposeIp\\\":\\\"192.168.5.4\\\"}]}\"}";
|
||||
|
||||
String taskStopByIpNoType = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_ip")
|
||||
|
@ -609,7 +647,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -629,7 +667,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void c8_stopTaskByIpNullTypeExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"314\\\",\\\"type\\\":null,\\\"disposeIp\\\":\\\"192.168.5.4\\\"}]}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":null,\\\"disposeIp\\\":\\\"192.168.5.4\\\"}]}\"}";
|
||||
|
||||
String taskStopByIpNullType = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_ip")
|
||||
|
@ -637,7 +675,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -663,12 +701,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
String regex = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z";
|
||||
TaskInfoRsp taskStopByIpRsp = objectMapper.readValue(verifyResp(taskStopByNode), TaskInfoRsp.class);
|
||||
|
||||
List<TaskInfoData> taskInfoList = taskStopByIpRsp.getItems();
|
||||
|
@ -684,18 +721,6 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
} else {
|
||||
Assert.assertNotEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
}
|
||||
|
||||
if (task.getType() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getType()), -1);
|
||||
}
|
||||
|
||||
if (task.getDisposeIp() != null) {
|
||||
Assert.assertTrue(task.getDisposeIp().matches(regex));
|
||||
}
|
||||
|
||||
if (task.getDisposeTime() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getDisposeTime()), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -713,12 +738,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
String regex = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z";
|
||||
TaskInfoRsp taskStopByIpRsp = objectMapper.readValue(verifyResp(taskStopByNode), TaskInfoRsp.class);
|
||||
|
||||
List<TaskInfoData> taskInfoList = taskStopByIpRsp.getItems();
|
||||
|
@ -734,18 +758,6 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
} else {
|
||||
Assert.assertNotEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
}
|
||||
|
||||
if (task.getType() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getType()), -1);
|
||||
}
|
||||
|
||||
if (task.getDisposeIp() != null) {
|
||||
Assert.assertTrue(task.getDisposeIp().matches(regex));
|
||||
}
|
||||
|
||||
if (task.getDisposeTime() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getDisposeTime()), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -765,7 +777,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -793,7 +805,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -813,7 +825,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void d5_stopTaskByNodeNoTypeExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"472\\\",\\\"type\\\":}}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":}}\"}";
|
||||
|
||||
String taskStopByNode = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_node")
|
||||
|
@ -821,7 +833,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -841,7 +853,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void d6_stopTaskByNodeNullTypeExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"472\\\",\\\"type\\\":null}}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":null}}\"}";
|
||||
|
||||
String taskStopByNode = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_node")
|
||||
|
@ -849,7 +861,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -874,12 +886,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
String regex = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z";
|
||||
TaskInfoRsp taskStopByIpRsp = objectMapper.readValue(verifyResp(taskStopAll), TaskInfoRsp.class);
|
||||
|
||||
List<TaskInfoData> taskInfoList = taskStopByIpRsp.getItems();
|
||||
|
@ -895,18 +906,6 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
} else {
|
||||
Assert.assertNotEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
}
|
||||
|
||||
if (task.getType() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getType()), -1);
|
||||
}
|
||||
|
||||
if (task.getDisposeIp() != null) {
|
||||
Assert.assertTrue(task.getDisposeIp().matches(regex));
|
||||
}
|
||||
|
||||
if (task.getDisposeTime() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getDisposeTime()), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -923,12 +922,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
String regex = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z";
|
||||
TaskInfoRsp taskStopByIpRsp = objectMapper.readValue(verifyResp(taskStopAll), TaskInfoRsp.class);
|
||||
|
||||
List<TaskInfoData> taskInfoList = taskStopByIpRsp.getItems();
|
||||
|
@ -944,18 +942,6 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
} else {
|
||||
Assert.assertNotEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
}
|
||||
|
||||
if (task.getType() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getType()), -1);
|
||||
}
|
||||
|
||||
if (task.getDisposeIp() != null) {
|
||||
Assert.assertTrue(task.getDisposeIp().matches(regex));
|
||||
}
|
||||
|
||||
if (task.getDisposeTime() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getDisposeTime()), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -973,12 +959,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
String regex = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z";
|
||||
TaskInfoRsp taskStopByIpRsp = objectMapper.readValue(verifyResp(taskStopAll), TaskInfoRsp.class);
|
||||
|
||||
List<TaskInfoData> taskInfoList = taskStopByIpRsp.getItems();
|
||||
|
@ -994,18 +979,6 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
} else {
|
||||
Assert.assertNotEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
}
|
||||
|
||||
if (task.getType() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getType()), -1);
|
||||
}
|
||||
|
||||
if (task.getDisposeIp() != null) {
|
||||
Assert.assertTrue(task.getDisposeIp().matches(regex));
|
||||
}
|
||||
|
||||
if (task.getDisposeTime() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getDisposeTime()), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1017,7 +990,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void e4_stopTaskAllNoTypeExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"472\\\",\\\"type\\\":}}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":}}\"}";
|
||||
|
||||
String taskStopAll = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_all")
|
||||
|
@ -1025,12 +998,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
|
||||
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStopAll), ReturnStatus.class);
|
||||
|
||||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
|
@ -1046,7 +1018,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void e5_stopTaskAllNullTypeExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"472\\\",\\\"type\\\":null}}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":null}}\"}";
|
||||
|
||||
String taskStopAll = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_all")
|
||||
|
@ -1054,12 +1026,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
|
||||
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStopAll), ReturnStatus.class);
|
||||
|
||||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
|
@ -1075,7 +1046,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
@Test
|
||||
public void e6_stopTaskAllStringTypeExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||
"[{\\\"id\\\":\\\"472\\\",\\\"type\\\":\\\"0\\\"}}\"}";
|
||||
"[{\\\"id\\\":\\\"1\\\",\\\"type\\\":\\\"0\\\"}}\"}";
|
||||
|
||||
String taskStopAll = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop_all")
|
||||
|
@ -1083,12 +1054,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
|
||||
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStopAll), ReturnStatus.class);
|
||||
|
||||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
|
@ -1110,7 +1080,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -1124,11 +1094,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertNotNull(task.getId());
|
||||
Assert.assertNotNull(task.getStatus());
|
||||
Assert.assertNotNull(task.getMessage());
|
||||
if(task.getStatus() == 0){
|
||||
if (task.getStatus() == 0) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
}else if(task.getStatus() == 19){
|
||||
} else if (task.getStatus() == 19) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
|
||||
}else if(task.getStatus() == 30){
|
||||
} else if (task.getStatus() == 30) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHTASK.getCode()));
|
||||
}
|
||||
|
||||
|
@ -1159,7 +1129,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -1173,11 +1143,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertNotNull(task.getId());
|
||||
Assert.assertNotNull(task.getStatus());
|
||||
Assert.assertNotNull(task.getMessage());
|
||||
if(task.getStatus() == 0){
|
||||
if (task.getStatus() == 0) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
}else if(task.getStatus() == 19){
|
||||
} else if (task.getStatus() == 19) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
|
||||
}else if(task.getStatus() == 30){
|
||||
} else if (task.getStatus() == 30) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHTASK.getCode()));
|
||||
}
|
||||
|
||||
|
@ -1208,19 +1178,20 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(NodeTaskInfo), TaskInfoRsp.class);
|
||||
List<TaskInfoData> taskInfoList = startTaskRsp.getItems();
|
||||
for (TaskInfoData task : taskInfoList
|
||||
NodeTaskRsp nodeTaskRsp = objectMapper.readValue(verifyResp(NodeTaskInfo), NodeTaskRsp.class);
|
||||
|
||||
List<NodeTaskData> taskInfoList = nodeTaskRsp.getItems();
|
||||
for (NodeTaskData task : taskInfoList
|
||||
) {
|
||||
Assert.assertNotNull(task.getId());
|
||||
Assert.assertNotNull(task.getStatus());
|
||||
Assert.assertNotNull(task.getMessage());
|
||||
Assert.assertNotEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHTASK.getCode()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1238,7 +1209,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -1255,7 +1226,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
*/
|
||||
@Test
|
||||
public void g1_NormalGetNodeDetailedInfoTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988," +
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988," +
|
||||
"\"msgContent\":\"{\\\"taskId\\\":[]}\"}";
|
||||
|
||||
String getNodeDetailedInfo = mockMvc.perform(MockMvcRequestBuilders
|
||||
|
@ -1264,7 +1235,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -1280,12 +1251,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertNotNull(task.getDisposeTime());
|
||||
Assert.assertNotNull(task.getStatus());
|
||||
Assert.assertNotNull(task.getMessage());
|
||||
|
||||
if (task.getStatus() == 0) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
} else if (task.getStatus() == 30) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHTASK.getCode()));
|
||||
}
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1303,7 +1269,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(521))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -1314,5 +1280,4 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class TaskControllerSmokeTest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
@ -96,12 +96,11 @@ public class TaskControllerSmokeTest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
String regex = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z";
|
||||
TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStop), TaskInfoRsp.class);
|
||||
List<TaskInfoData> taskInfoList = startTaskRsp.getItems();
|
||||
for (TaskInfoData task : taskInfoList
|
||||
|
@ -116,18 +115,6 @@ public class TaskControllerSmokeTest extends InitTestEnvironment {
|
|||
} else if (task.getStatus() == 30) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHTASK.getCode()));
|
||||
}
|
||||
|
||||
if (task.getType() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getType()), -1);
|
||||
}
|
||||
|
||||
if (task.getDisposeIp() != null) {
|
||||
Assert.assertTrue(task.getDisposeIp().matches(regex));
|
||||
}
|
||||
|
||||
if (task.getDisposeTime() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getDisposeTime()), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,12 +130,11 @@ public class TaskControllerSmokeTest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
||||
String regex = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z";
|
||||
TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStopByIp), TaskInfoRsp.class);
|
||||
List<TaskInfoData> taskInfoList = startTaskRsp.getItems();
|
||||
for (TaskInfoData task : taskInfoList
|
||||
|
@ -163,18 +149,6 @@ public class TaskControllerSmokeTest extends InitTestEnvironment {
|
|||
} else if (task.getStatus() == 30) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHTASK.getCode()));
|
||||
}
|
||||
|
||||
if (task.getType() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getType()), -1);
|
||||
}
|
||||
|
||||
if (task.getDisposeIp() != null) {
|
||||
Assert.assertTrue(task.getDisposeIp().matches(regex));
|
||||
}
|
||||
|
||||
if (task.getDisposeTime() != null) {
|
||||
Assert.assertNotEquals(String.valueOf(task.getDisposeTime()), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +163,7 @@ public class TaskControllerSmokeTest extends InitTestEnvironment {
|
|||
.header("Authorization", "Bearer " + getLogToken())
|
||||
.content(reqData))
|
||||
.andDo(print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(200))
|
||||
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
|
||||
.andReturn()
|
||||
.getResponse()
|
||||
.getContentAsString();
|
||||
|
|
Loading…
Reference in New Issue