OCT
REM: 1. 增加数组中存在元素为null的测试用例 2. 增加数组中存在元素为空字符串的测试用例 3. 修改断言
This commit is contained in:
parent
919c1c42a2
commit
ed30556cae
|
@ -1087,7 +1087,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void d4_GetCapacityEmptyMsgExistExceptionTest() throws Exception {
|
||||
public void d4_getCapacityEmptyMsgExistExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
|
||||
"\"msgContent\":\"\"}";
|
||||
|
||||
|
@ -1116,7 +1116,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void d5_GetCapacityNullMsgExistExceptionTest() throws Exception {
|
||||
public void d5_getCapacityNullMsgExistExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
|
||||
"\"msgContent\":null}";
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void d6_GetCapacityEmptyMsgExistExceptionTest() throws Exception {
|
||||
public void d6_getCapacityEmptyMsgExistExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
|
||||
"\"msgContent\":\"{\\\"id\\\":null}\"}";
|
||||
|
||||
|
@ -1174,7 +1174,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void d7_GetCapacityErrIdExistExceptionTest() throws Exception {
|
||||
public void d7_getCapacityErrIdExistExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
|
||||
"\"msgContent\":\"{\\\"id\\\":[\\\"abc\\\"]}\"}";
|
||||
|
||||
|
@ -1211,7 +1211,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void d8_GetCapacityIntegerIdExistExceptionTest() throws Exception {
|
||||
public void d8_getCapacityIntegerIdExistExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
|
||||
"\"msgContent\":\"{\\\"id\\\":1}\"}";
|
||||
|
||||
|
@ -1269,7 +1269,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void d10_GetCapacityArrayContainsEmptyStringExceptionTest() throws Exception {
|
||||
public void d10_getCapacityArrayContainsEmptyStringExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604308040," +
|
||||
"\"msgContent\":\"{\\\"id\\\":[\\\"1\\\", \\\"123\\\", \\\"\\\"]}\"}";
|
||||
|
||||
|
@ -1428,7 +1428,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void e4_GetIpEmptyMsgExistExceptionTest() throws Exception {
|
||||
public void e4_getIpEmptyMsgExistExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
|
||||
"\"msgContent\":\"\"}";
|
||||
|
||||
|
@ -1458,7 +1458,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void e5_GetIpNullMsgExistExceptionTest() throws Exception {
|
||||
public void e5_getIpNullMsgExistExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
|
||||
"\"msgContent\":null}";
|
||||
|
||||
|
@ -1487,7 +1487,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void e6_GetIpNullMsgExistExceptionTest() throws Exception {
|
||||
public void e6_getIpNullMsgExistExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
|
||||
"\"msgContent\":\"{\\\"id\\\":null}\"}";
|
||||
|
||||
|
@ -1516,7 +1516,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void e7_GetIpErrIdExistExceptionTest() throws Exception {
|
||||
public void e7_getIpErrIdExistExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
|
||||
"\"msgContent\":\"{\\\"id\\\":\\\"abd\\\"}\"}";
|
||||
|
||||
|
@ -1546,7 +1546,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void e8_GetIpIntegerIdExistExceptionTest() throws Exception {
|
||||
public void e8_getIpIntegerIdExistExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
|
||||
"\"msgContent\":\"{\\\"id\\\":1}\"}";
|
||||
|
||||
|
@ -1576,7 +1576,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void d9_GetIpArrayContainsNullExceptionTest() throws Exception {
|
||||
public void e9_getIpArrayContainsNullExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604308040," +
|
||||
"\"msgContent\":\"{\\\"id\\\":[\\\"1\\\", \\\"123\\\", null]}\"}";
|
||||
|
||||
|
@ -1605,7 +1605,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void d10_getGetCapacityArrayContainsEmptyStringExceptionTest() throws Exception {
|
||||
public void e10_getCapacityArrayContainsEmptyStringExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604308040," +
|
||||
"\"msgContent\":\"{\\\"id\\\":[\\\"1\\\", \\\"123\\\", \\\"\\\"]}\"}";
|
||||
|
||||
|
@ -1661,34 +1661,31 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
NodeTaskRsp rspInfo = objectMapper.readValue(verifyResp(ret), NodeTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(rspInfo);
|
||||
rspInfo.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(v);
|
||||
Assert.assertNotNull(v.getStatus());
|
||||
Assert.assertNotNull(v.getMessage());
|
||||
if (v.getStatus() == 0) {
|
||||
Assert.assertNotNull(v.getId());
|
||||
Assert.assertNotNull(v.getTaskArray());
|
||||
|
||||
if (rspInfo.getItems().size() > 0) {
|
||||
for (NodeTaskData taskData : rspInfo.getItems()
|
||||
) {
|
||||
Assert.assertNotNull(taskData);
|
||||
Assert.assertNotNull(taskData.getStatus());
|
||||
Assert.assertNotNull(taskData.getMessage());
|
||||
|
||||
if (taskData.getStatus() == 0) {
|
||||
Assert.assertNotNull(taskData.getId());
|
||||
Assert.assertNotNull(taskData.getTaskArray());
|
||||
|
||||
for (TaskInfoData taskInfoData : taskData.getTaskArray()
|
||||
) {
|
||||
Assert.assertNotNull(taskInfoData);
|
||||
Assert.assertNotNull(taskInfoData.getTaskId());
|
||||
Assert.assertNotNull(taskInfoData.getType());
|
||||
Assert.assertNotNull(taskInfoData.getStartTime());
|
||||
Assert.assertNotNull(taskInfoData.getDisposeTime());
|
||||
Assert.assertNotNull(taskInfoData.getDisposeIp());
|
||||
}
|
||||
|
||||
Assert.assertEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
} else {
|
||||
Assert.assertNotEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
for (TaskInfoData taskInfoData : v.getTaskArray()
|
||||
) {
|
||||
Assert.assertNotNull(taskInfoData);
|
||||
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 {
|
||||
Assert.assertNotEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
Assert.assertNotEquals(v.getMessage(), ErrorCode.ERR_OK.getMsg());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -1716,39 +1713,36 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
NodeTaskRsp rspInfo = objectMapper.readValue(verifyResp(ret), NodeTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(rspInfo);
|
||||
rspInfo.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(v);
|
||||
Assert.assertNotNull(v.getStatus());
|
||||
Assert.assertNotNull(v.getMessage());
|
||||
if (v.getStatus() == 0) {
|
||||
Assert.assertNotNull(v.getId());
|
||||
Assert.assertNotNull(v.getTaskArray());
|
||||
|
||||
if (rspInfo.getItems().size() > 0) {
|
||||
for (NodeTaskData taskData : rspInfo.getItems()
|
||||
) {
|
||||
Assert.assertNotNull(taskData);
|
||||
Assert.assertNotNull(taskData.getStatus());
|
||||
Assert.assertNotNull(taskData.getMessage());
|
||||
|
||||
if (taskData.getStatus() == 0) {
|
||||
Assert.assertNotNull(taskData.getId());
|
||||
Assert.assertNotNull(taskData.getTaskArray());
|
||||
|
||||
for (TaskInfoData taskInfoData : taskData.getTaskArray()
|
||||
) {
|
||||
Assert.assertNotNull(taskInfoData);
|
||||
Assert.assertNotNull(taskInfoData.getTaskId());
|
||||
Assert.assertNotNull(taskInfoData.getType());
|
||||
Assert.assertNotNull(taskInfoData.getStartTime());
|
||||
Assert.assertNotNull(taskInfoData.getDisposeTime());
|
||||
Assert.assertNotNull(taskInfoData.getDisposeIp());
|
||||
}
|
||||
|
||||
Assert.assertEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
} else {
|
||||
Assert.assertNotEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
for (TaskInfoData taskInfoData : v.getTaskArray()
|
||||
) {
|
||||
Assert.assertNotNull(taskInfoData);
|
||||
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 {
|
||||
Assert.assertNotEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
Assert.assertNotEquals(v.getMessage(), ErrorCode.ERR_OK.getMsg());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* F 3 msgContent empty .
|
||||
* F 3 get running task msgContent empty exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -1773,11 +1767,12 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMEXCEPTION.getMsg());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* F 4 msgContent null .
|
||||
* F 4 get running task msgContent null exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -1802,10 +1797,11 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMEXCEPTION.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* F 5 id null .
|
||||
* F 5 get running task id null exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -1831,10 +1827,11 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMEXCEPTION.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* F 6 id does not exist "abc" .
|
||||
* F 6 get running task id does not exist "abc" exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -1857,20 +1854,93 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
NodeTaskRsp rspInfo = objectMapper.readValue(verifyResp(ret), NodeTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(rspInfo);
|
||||
|
||||
if (rspInfo.getItems().size() > 0) {
|
||||
for (NodeTaskData taskData : rspInfo.getItems()
|
||||
) {
|
||||
Assert.assertNotNull(taskData);
|
||||
Assert.assertNotNull(taskData.getId());
|
||||
Assert.assertNotNull(taskData.getStatus());
|
||||
Assert.assertNotNull(taskData.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
|
||||
Assert.assertNotNull(taskData.getTaskArray());
|
||||
}
|
||||
}
|
||||
rspInfo.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(v);
|
||||
Assert.assertNotNull(v.getId());
|
||||
Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
|
||||
Assert.assertEquals(v.getMessage(), ErrorCode.ERR_NOSUCHDEVICE.getMsg());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* F 7 get running task array contains null exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void f7_getRunTaskArrayContainsNullExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604308040," +
|
||||
"\"msgContent\":\"{\\\"id\\\":[\\\"1\\\", \\\"123\\\", null]}\"}";
|
||||
|
||||
String ret = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/information/run_task")
|
||||
.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()
|
||||
.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());
|
||||
}
|
||||
|
||||
/**
|
||||
* F 8 get running task Array contains empty string exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void f8_getRunTaskArrayContainsEmptyStringExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604308040," +
|
||||
"\"msgContent\":\"{\\\"id\\\":[\\\"1\\\", \\\"123\\\", \\\"\\\"]}\"}";
|
||||
|
||||
String ret = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/information/run_task")
|
||||
.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 rspInfo = objectMapper.readValue(verifyResp(ret), NodeTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(rspInfo);
|
||||
rspInfo.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(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);
|
||||
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 {
|
||||
Assert.assertNotEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
Assert.assertNotEquals(v.getMessage(), ErrorCode.ERR_OK.getMsg());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* G 1 get multiple node all task normal test.
|
||||
|
@ -1896,34 +1966,33 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
NodeTaskRsp rspInfo = objectMapper.readValue(verifyResp(ret), NodeTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(rspInfo);
|
||||
if (rspInfo.getItems().size() > 0) {
|
||||
for (NodeTaskData taskData : rspInfo.getItems()
|
||||
) {
|
||||
Assert.assertNotNull(taskData);
|
||||
Assert.assertNotNull(taskData.getStatus());
|
||||
Assert.assertNotNull(taskData.getMessage());
|
||||
rspInfo.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(v);
|
||||
Assert.assertNotNull(v.getStatus());
|
||||
Assert.assertNotNull(v.getMessage());
|
||||
|
||||
if (taskData.getStatus() == 0) {
|
||||
Assert.assertNotNull(taskData.getId());
|
||||
Assert.assertNotNull(taskData.getTaskArray());
|
||||
if (v.getStatus() == 0) {
|
||||
Assert.assertNotNull(v.getId());
|
||||
Assert.assertNotNull(v.getTaskArray());
|
||||
|
||||
for (TaskInfoData taskInfoData : taskData.getTaskArray()
|
||||
) {
|
||||
Assert.assertNotNull(taskInfoData);
|
||||
Assert.assertNotNull(taskInfoData.getTaskId());
|
||||
Assert.assertNotNull(taskInfoData.getCurrentStatus());
|
||||
Assert.assertNotNull(taskInfoData.getType());
|
||||
Assert.assertNotNull(taskInfoData.getStartTime());
|
||||
Assert.assertNotNull(taskInfoData.getDisposeTime());
|
||||
Assert.assertNotNull(taskInfoData.getDisposeIp());
|
||||
}
|
||||
|
||||
Assert.assertEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
} else {
|
||||
Assert.assertNotEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
for (TaskInfoData taskInfoData : v.getTaskArray()
|
||||
) {
|
||||
Assert.assertNotNull(taskInfoData);
|
||||
Assert.assertNotNull(taskInfoData.getTaskId());
|
||||
Assert.assertNotNull(taskInfoData.getCurrentStatus());
|
||||
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 {
|
||||
Assert.assertNotEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
Assert.assertNotEquals(v.getMessage(), ErrorCode.ERR_OK.getMsg());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -1951,21 +2020,16 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
NodeTaskRsp rspInfo = objectMapper.readValue(verifyResp(ret), NodeTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(rspInfo);
|
||||
if (rspInfo.getItems().size() > 0) {
|
||||
for (NodeTaskData taskData : rspInfo.getItems()
|
||||
) {
|
||||
Assert.assertNotNull(taskData);
|
||||
Assert.assertNotNull(taskData.getId());
|
||||
Assert.assertNotNull(taskData.getStatus());
|
||||
Assert.assertNotNull(taskData.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
|
||||
Assert.assertNotNull(taskData.getTaskArray());
|
||||
}
|
||||
}
|
||||
rspInfo.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(v);
|
||||
Assert.assertNotNull(v.getId());
|
||||
Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
|
||||
Assert.assertEquals(v.getMessage(), ErrorCode.ERR_NOSUCHDEVICE.getMsg());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* G 3 msgContent empty.
|
||||
* G 3 get all msgContent empty exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -1990,11 +2054,12 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMEXCEPTION.getMsg());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* G 4 msgContent null.
|
||||
* G 4 get all msgContent null exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -2019,10 +2084,11 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMEXCEPTION.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* G 5 id null.
|
||||
* G 5 get all task id null exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -2047,11 +2113,12 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
Assert.assertNotNull(returnStatus.getStatus());
|
||||
Assert.assertNotNull(returnStatus.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(returnStatus.getStatus()), Long.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()));
|
||||
Assert.assertEquals(returnStatus.getMessage(), ErrorCode.ERR_PARAMEXCEPTION.getMsg());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* G 6 get node does not exits all task normal test. "abd"
|
||||
* G 6 get all task id "abd" exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -2079,14 +2146,93 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
|
|||
) {
|
||||
Assert.assertNotNull(taskData);
|
||||
Assert.assertNotNull(taskData.getId());
|
||||
Assert.assertNotNull(taskData.getStatus());
|
||||
Assert.assertNotNull(taskData.getMessage());
|
||||
Assert.assertEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
|
||||
Assert.assertNotNull(taskData.getTaskArray());
|
||||
Assert.assertEquals(taskData.getMessage(), ErrorCode.ERR_NOSUCHDEVICE.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* G 7 get all task array contains null exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void g7_getAllTaskArrayContainsNullExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604308040," +
|
||||
"\"msgContent\":\"{\\\"id\\\":[\\\"1\\\", \\\"123\\\", null]}\"}";
|
||||
|
||||
String ret = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/information/all_task")
|
||||
.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()
|
||||
.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());
|
||||
}
|
||||
|
||||
/**
|
||||
* G 8 get all task Array contains empty string exception test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void g8_getAllTaskArrayContainsEmptyStringExceptionTest() throws Exception {
|
||||
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604308040," +
|
||||
"\"msgContent\":\"{\\\"id\\\":[\\\"1\\\", \\\"123\\\", \\\"\\\"]}\"}";
|
||||
|
||||
String ret = mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/information/all_task")
|
||||
.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 rspInfo = objectMapper.readValue(verifyResp(ret), NodeTaskRsp.class);
|
||||
|
||||
Assert.assertNotNull(rspInfo);
|
||||
rspInfo.getItems().forEach(v -> {
|
||||
Assert.assertNotNull(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);
|
||||
Assert.assertNotNull(taskInfoData.getTaskId());
|
||||
Assert.assertNotNull(taskInfoData.getCurrentStatus());
|
||||
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 {
|
||||
Assert.assertNotEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
Assert.assertNotEquals(v.getMessage(), ErrorCode.ERR_OK.getMsg());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* H 1 get node list normal test. "abd"
|
||||
|
|
Loading…
Reference in New Issue