OCT
REM: 1. 增加停止指定处置任务接口、获取指定能力节点处置任务列表接口和获取处置任务详细信息接口中入参数组重复的测试用例,结果去重
This commit is contained in:
parent
689f1ad7a0
commit
9b52449359
|
@ -469,6 +469,47 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMS.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* b5 stop task Array contains repeated elements test. 去重
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void b5_stopTaskArrayContainsRepeatedElementsTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604308040," +
|
||||
"\"msgContent\":\"{\\\"taskId\\\":[\\\"1\\\", \\\"1\\\", \\\"123\\\"]}\"}";
|
||||
|
||||
String ret = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/stop")
|
||||
.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();
|
||||
|
||||
TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(ret), TaskInfoRsp.class);
|
||||
List<TaskInfoData> taskInfoList = startTaskRsp.getItems();
|
||||
for (TaskInfoData task : taskInfoList
|
||||
) {
|
||||
Assert.assertNotNull(task.getStatus());
|
||||
Assert.assertNotNull(task.getMessage());
|
||||
|
||||
if (task.getStatus() == 0) {
|
||||
Assert.assertNotNull(task.getId());
|
||||
Assert.assertNotNull(task.getTaskId());
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
Assert.assertEquals(task.getMessage(), ErrorCode.ERR_OK.getMsg());
|
||||
} else if (task.getStatus() == 30) {
|
||||
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHTASK.getCode()));
|
||||
Assert.assertEquals(task.getMessage(), ErrorCode.ERR_NOSUCHTASK.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* c1 id null exception test.
|
||||
*
|
||||
|
@ -1106,7 +1147,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
}
|
||||
|
||||
/**
|
||||
* f1 get task information of node test.
|
||||
* f1 get node task of node test.
|
||||
*/
|
||||
@Test
|
||||
public void f1_NormalGetNodeTaskInfoTest() throws Exception {
|
||||
|
@ -1157,7 +1198,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
}
|
||||
|
||||
/**
|
||||
* id empty test.空表示所有能力节点
|
||||
*f2 get node task id empty exception test.空表示所有能力节点
|
||||
*/
|
||||
@Test
|
||||
public void f2_NormalGetNodeTaskInfoIdTest() throws Exception {
|
||||
|
@ -1208,7 +1249,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
}
|
||||
|
||||
/**
|
||||
* type null test.
|
||||
* f3 get node task type null exception test.
|
||||
*/
|
||||
@Test
|
||||
public void f3_GetNodeTaskInfoTypeNullExceptionTest() throws Exception {
|
||||
|
@ -1235,7 +1276,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
}
|
||||
|
||||
/**
|
||||
* type empty test.
|
||||
* f4 get node task type empty exception test.
|
||||
*/
|
||||
@Test
|
||||
public void f4_GetNodeTaskInfoTypeEmptyExceptionTest() throws Exception {
|
||||
|
@ -1290,7 +1331,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
}
|
||||
|
||||
/**
|
||||
* get node task Array contains empty string exception test .数组中有一个元素为空字符串表示所有能力节点
|
||||
* f6 get node task Array contains empty string exception test .数组中有一个元素为空字符串表示所有能力节点
|
||||
*/
|
||||
@Test
|
||||
public void f6_GetNodeTaskInfoArrayContainsEmptyStringExceptionTest() throws Exception {
|
||||
|
@ -1339,8 +1380,56 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* taskId empty test. 空字符串表示所有节点任务
|
||||
* f7 get node task Array contains Array contains repeated elements test . 结果去重
|
||||
*/
|
||||
@Test
|
||||
public void f7_GetNodeTaskInfoArrayContainsRepeatedElementsTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"id\\\": " +
|
||||
"[\\\"1\\\",\\\"1\\\",\\\"123\\\"], \\\"type\\\":0}\"}";
|
||||
|
||||
String ret = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/get_node")
|
||||
.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();
|
||||
|
||||
NodeTaskRsp nodeTaskRsp = objectMapper.readValue(verifyResp(ret), NodeTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(nodeTaskRsp);
|
||||
nodeTaskRsp.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(v.getStatus());
|
||||
Assert.assertNotNull(v.getMessage());
|
||||
|
||||
if (v.getStatus() == 0) {
|
||||
Assert.assertNotNull(v.getId());
|
||||
Assert.assertNotNull(v.getTaskArray());
|
||||
for (TaskInfoData taskInfoData : v.getTaskArray()
|
||||
) {
|
||||
Assert.assertNotNull(taskInfoData.getTaskId());
|
||||
Assert.assertNotNull(taskInfoData.getType());
|
||||
Assert.assertNotNull(taskInfoData.getStartTime());
|
||||
Assert.assertNotNull(taskInfoData.getDisposeTime());
|
||||
Assert.assertNotNull(taskInfoData.getDisposeIp());
|
||||
}
|
||||
|
||||
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) {
|
||||
Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHTASK.getCode()));
|
||||
Assert.assertEquals(v.getMessage(), ErrorCode.ERR_NOSUCHTASK.getMsg());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* g1 get node detailed taskId empty exception test. 空字符串表示所有节点任务
|
||||
*/
|
||||
@Test
|
||||
public void g1_NormalGetNodeDetailedInfoTest() throws Exception {
|
||||
|
@ -1374,7 +1463,7 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
}
|
||||
|
||||
/**
|
||||
* taskId null test.
|
||||
* g2 get node detailed taskId null exception test .
|
||||
*/
|
||||
@Test
|
||||
public void g2_GetNodeDetailedInfoTaskIdNullExceptionTest() throws Exception {
|
||||
|
@ -1460,4 +1549,45 @@ public class TaskControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertEquals(v.getMessage(), ErrorCode.ERR_OK.getMsg());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* g5 get node task Array contains Array contains repeated elements test .
|
||||
*/
|
||||
@Test
|
||||
public void g5_GetNodeDetailedInfoArrayContainsRepeatedElementsTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988," +
|
||||
"\"msgContent\":\"{\\\"taskId\\\":[\\\"1\\\", \\\"1\\\", \\\"123\\\"]}\"}";
|
||||
|
||||
String ret = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/task/get")
|
||||
.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();
|
||||
|
||||
TaskInfoRsp startTaskRsp = objectMapper.readValue(verifyResp(ret), TaskInfoRsp.class);
|
||||
|
||||
Assert.assertNotNull(startTaskRsp);
|
||||
startTaskRsp.getItems().forEach(v->{
|
||||
Assert.assertNotNull(v);
|
||||
Assert.assertNotNull(v.getTaskId());
|
||||
Assert.assertNotNull(v.getStatus());
|
||||
Assert.assertNotNull(v.getMessage());
|
||||
|
||||
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){
|
||||
Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHTASK.getCode()));
|
||||
Assert.assertEquals(v.getMessage(), ErrorCode.ERR_NOSUCHTASK.getMsg());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue