parent
315f15386e
commit
d66e2d6f66
|
@ -2,6 +2,7 @@ package com.dispose.controller;
|
||||||
|
|
||||||
import com.dispose.Global.InitTestEnvironment;
|
import com.dispose.Global.InitTestEnvironment;
|
||||||
import com.dispose.common.ErrorCode;
|
import com.dispose.common.ErrorCode;
|
||||||
|
import com.dispose.pojo.po.ReturnStatus;
|
||||||
import com.dispose.pojo.vo.common.TaskInfoData;
|
import com.dispose.pojo.vo.common.TaskInfoData;
|
||||||
import com.dispose.pojo.vo.task.StartTaskRsp;
|
import com.dispose.pojo.vo.task.StartTaskRsp;
|
||||||
import com.dispose.pojo.vo.task.TaskInfoRsp;
|
import com.dispose.pojo.vo.task.TaskInfoRsp;
|
||||||
|
@ -95,12 +96,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
.getResponse()
|
.getResponse()
|
||||||
.getContentAsString();
|
.getContentAsString();
|
||||||
|
|
||||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||||
|
|
||||||
Assert.assertNotNull(startTaskRsp);
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,12 +121,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
.getResponse()
|
.getResponse()
|
||||||
.getContentAsString();
|
.getContentAsString();
|
||||||
|
|
||||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||||
|
|
||||||
Assert.assertNotNull(startTaskRsp);
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,6 +158,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
|
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void t5_startTaskNullIdExceptionTest() throws Exception {
|
public void t5_startTaskNullIdExceptionTest() throws Exception {
|
||||||
//Id null
|
//Id null
|
||||||
|
@ -176,12 +176,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
.getResponse()
|
.getResponse()
|
||||||
.getContentAsString();
|
.getContentAsString();
|
||||||
|
|
||||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||||
|
|
||||||
Assert.assertNotNull(startTaskRsp);
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -201,12 +200,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
.getResponse()
|
.getResponse()
|
||||||
.getContentAsString();
|
.getContentAsString();
|
||||||
|
|
||||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||||
|
|
||||||
Assert.assertNotNull(startTaskRsp);
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,12 +224,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
.getResponse()
|
.getResponse()
|
||||||
.getContentAsString();
|
.getContentAsString();
|
||||||
|
|
||||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||||
|
|
||||||
Assert.assertNotNull(startTaskRsp);
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -251,12 +248,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
.getResponse()
|
.getResponse()
|
||||||
.getContentAsString();
|
.getContentAsString();
|
||||||
|
|
||||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||||
|
|
||||||
Assert.assertNotNull(startTaskRsp);
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -277,12 +273,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
.getResponse()
|
.getResponse()
|
||||||
.getContentAsString();
|
.getContentAsString();
|
||||||
|
|
||||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||||
|
|
||||||
Assert.assertNotNull(startTaskRsp);
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -302,12 +297,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
.getResponse()
|
.getResponse()
|
||||||
.getContentAsString();
|
.getContentAsString();
|
||||||
|
|
||||||
StartTaskRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStart), StartTaskRsp.class);
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStart), ReturnStatus.class);
|
||||||
|
|
||||||
Assert.assertNotNull(startTaskRsp);
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
Assert.assertNotNull(startTaskRsp.getStatus());
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
Assert.assertNotNull(startTaskRsp.getMessage());
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
Assert.assertEquals(Long.valueOf(startTaskRsp.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -327,16 +321,11 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
.getResponse()
|
.getResponse()
|
||||||
.getContentAsString();
|
.getContentAsString();
|
||||||
|
|
||||||
TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStop), TaskInfoRsp.class);
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStop), ReturnStatus.class);
|
||||||
List<TaskInfoData> taskInfoList = startTaskRsp.getItems();
|
|
||||||
for (TaskInfoData task : taskInfoList
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
) {
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
Assert.assertNotNull(task.getId());
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
Assert.assertNotNull(task.getTaskId());
|
|
||||||
Assert.assertNotNull(task.getStatus());
|
|
||||||
Assert.assertNotNull(task.getMessage());
|
|
||||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -357,6 +346,13 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
|
|
||||||
TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStop), TaskInfoRsp.class);
|
TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStop), TaskInfoRsp.class);
|
||||||
List<TaskInfoData> taskInfoList = startTaskRsp.getItems();
|
List<TaskInfoData> taskInfoList = startTaskRsp.getItems();
|
||||||
|
|
||||||
|
if (taskInfoList.size() == 0) {
|
||||||
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStop), ReturnStatus.class);
|
||||||
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
|
} else {
|
||||||
for (TaskInfoData task : taskInfoList
|
for (TaskInfoData task : taskInfoList
|
||||||
) {
|
) {
|
||||||
Assert.assertNotNull(task.getId());
|
Assert.assertNotNull(task.getId());
|
||||||
|
@ -367,30 +363,31 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
}
|
||||||
public void t13_stopTaskIntegerTaskIdExceptionTest() throws Exception {
|
|
||||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988," +
|
|
||||||
"\"msgContent\":\"{\\\"taskId\\\":[445, 235]}\"}";
|
|
||||||
|
|
||||||
String taskStop = mockMvc.perform(MockMvcRequestBuilders
|
|
||||||
.post("/task/stop")
|
@Test
|
||||||
|
public void t13_stopTaskByIpNullIdExceptionTest() throws Exception {
|
||||||
|
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\": \"{\\\"items\\\":" +
|
||||||
|
"[{\\\"id\\\":null,\\\"type\\\":0,\\\"disposeIp\\\":\\\"192.168.3.4\\\"}]}\"}";
|
||||||
|
|
||||||
|
String taskStopByIpNullId = mockMvc.perform(MockMvcRequestBuilders
|
||||||
|
.post("/task/stop_ip")
|
||||||
.contentType(MediaType.APPLICATION_JSON)
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.header("Authorization", "Bearer " + getLogToken())
|
.header("Authorization", "Bearer " + getLogToken())
|
||||||
.content(reqData))
|
.content(reqData))
|
||||||
.andDo(print()).andExpect(status().isOk())
|
.andDo(print()).andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.code").value(200))
|
.andExpect(jsonPath("$.code").value(521))
|
||||||
.andReturn()
|
.andReturn()
|
||||||
.getResponse()
|
.getResponse()
|
||||||
.getContentAsString();
|
.getContentAsString();
|
||||||
|
|
||||||
TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(taskStop), TaskInfoRsp.class);
|
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(taskStopByIpNullId), ReturnStatus.class);
|
||||||
List<TaskInfoData> taskInfoList = startTaskRsp.getItems();
|
|
||||||
for (TaskInfoData task : taskInfoList
|
Assert.assertNotNull(returnStatus.getStatus());
|
||||||
) {
|
Assert.assertNotNull(returnStatus.getMessage());
|
||||||
Assert.assertNotNull(task.getId());
|
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||||
Assert.assertNotNull(task.getTaskId());
|
|
||||||
Assert.assertNotNull(task.getStatus());
|
|
||||||
Assert.assertNotNull(task.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue