REM:
1. 修改获取能力节点信息接口测试的断言
This commit is contained in:
chenlinghy 2020-05-19 18:06:19 +08:00
parent 63ef3e0435
commit 8c116cf4e8
2 changed files with 71 additions and 57 deletions

View File

@ -771,10 +771,11 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(capacity), DeviceCapacityRsp.class); DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(capacity), DeviceCapacityRsp.class);
deviceCapacityRsp.getItems().forEach(v -> { deviceCapacityRsp.getItems().forEach(v -> {
Assert.assertNotNull(v.getId());
Assert.assertNotNull(v.getStatus()); Assert.assertNotNull(v.getStatus());
Assert.assertNotNull(v.getMessage()); Assert.assertNotNull(v.getMessage());
if (v.getStatus() == 0) { if (v.getStatus() == 0) {
Assert.assertNotNull(v.getId());
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode()));
} else { } else {
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
@ -808,10 +809,11 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(capacity), DeviceCapacityRsp.class); DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(capacity), DeviceCapacityRsp.class);
deviceCapacityRsp.getItems().forEach(v -> { deviceCapacityRsp.getItems().forEach(v -> {
Assert.assertNotNull(v.getId());
Assert.assertNotNull(v.getStatus()); Assert.assertNotNull(v.getStatus());
Assert.assertNotNull(v.getMessage()); Assert.assertNotNull(v.getMessage());
if (v.getStatus() == 0) { if (v.getStatus() == 0) {
Assert.assertNotNull(v.getId());
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode()));
} else { } else {
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
@ -845,10 +847,11 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(capacity), DeviceCapacityRsp.class); DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(capacity), DeviceCapacityRsp.class);
deviceCapacityRsp.getItems().forEach(v -> { deviceCapacityRsp.getItems().forEach(v -> {
Assert.assertNotNull(v.getId());
Assert.assertNotNull(v.getStatus()); Assert.assertNotNull(v.getStatus());
Assert.assertNotNull(v.getMessage()); Assert.assertNotNull(v.getMessage());
if (v.getStatus() == 0) { if (v.getStatus() == 0) {
Assert.assertNotNull(v.getId());
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode()));
} else { } else {
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
@ -1023,10 +1026,11 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(protectedIp), DeviceCapacityRsp.class); DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(protectedIp), DeviceCapacityRsp.class);
deviceCapacityRsp.getItems().forEach(v -> { deviceCapacityRsp.getItems().forEach(v -> {
Assert.assertNotNull(v.getId());
Assert.assertNotNull(v.getStatus()); Assert.assertNotNull(v.getStatus());
Assert.assertNotNull(v.getMessage()); Assert.assertNotNull(v.getMessage());
if (v.getStatus() == 0) { if (v.getStatus() == 0) {
Assert.assertNotNull(v.getId());
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode()));
} else { } else {
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
@ -1062,10 +1066,11 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(protectedIp), DeviceCapacityRsp.class); DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(protectedIp), DeviceCapacityRsp.class);
deviceCapacityRsp.getItems().forEach(v -> { deviceCapacityRsp.getItems().forEach(v -> {
Assert.assertNotNull(v.getId());
Assert.assertNotNull(v.getStatus()); Assert.assertNotNull(v.getStatus());
Assert.assertNotNull(v.getMessage()); Assert.assertNotNull(v.getMessage());
if (v.getStatus() == 0) { if (v.getStatus() == 0) {
Assert.assertNotNull(v.getId());
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode()));
} else { } else {
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
@ -1102,10 +1107,11 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(protectedIp), DeviceCapacityRsp.class); DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(protectedIp), DeviceCapacityRsp.class);
deviceCapacityRsp.getItems().forEach(v -> { deviceCapacityRsp.getItems().forEach(v -> {
Assert.assertNotNull(v.getId());
Assert.assertNotNull(v.getStatus()); Assert.assertNotNull(v.getStatus());
Assert.assertNotNull(v.getMessage()); Assert.assertNotNull(v.getMessage());
if (v.getStatus() == 0) { if (v.getStatus() == 0) {
Assert.assertNotNull(v.getId());
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode()));
} else { } else {
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode())); Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
@ -1291,26 +1297,27 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
for (NodeTaskData taskData : rspInfo.getItems() for (NodeTaskData taskData : rspInfo.getItems()
) { ) {
Assert.assertNotNull(taskData); Assert.assertNotNull(taskData);
Assert.assertNotNull(taskData.getId());
Assert.assertNotNull(taskData.getStatus()); Assert.assertNotNull(taskData.getStatus());
Assert.assertNotNull(taskData.getMessage()); Assert.assertNotNull(taskData.getMessage());
if (taskData.getStatus() == 0) { 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())); Assert.assertEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} else { } else {
Assert.assertNotEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertNotEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} }
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());
}
} }
} }
} }
@ -1345,26 +1352,27 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
for (NodeTaskData taskData : rspInfo.getItems() for (NodeTaskData taskData : rspInfo.getItems()
) { ) {
Assert.assertNotNull(taskData); Assert.assertNotNull(taskData);
Assert.assertNotNull(taskData.getId());
Assert.assertNotNull(taskData.getStatus()); Assert.assertNotNull(taskData.getStatus());
Assert.assertNotNull(taskData.getMessage()); Assert.assertNotNull(taskData.getMessage());
if (taskData.getStatus() == 0) { 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())); Assert.assertEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} else { } else {
Assert.assertNotEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertNotEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} }
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());
}
} }
} }
} }
@ -1523,27 +1531,28 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
for (NodeTaskData taskData : rspInfo.getItems() for (NodeTaskData taskData : rspInfo.getItems()
) { ) {
Assert.assertNotNull(taskData); Assert.assertNotNull(taskData);
Assert.assertNotNull(taskData.getId());
Assert.assertNotNull(taskData.getStatus()); Assert.assertNotNull(taskData.getStatus());
Assert.assertNotNull(taskData.getMessage()); Assert.assertNotNull(taskData.getMessage());
if (taskData.getStatus() == 0) { 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.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())); Assert.assertEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} else { } else {
Assert.assertNotEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertNotEquals(Long.valueOf(taskData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} }
Assert.assertNotNull(taskData.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());
}
} }
} }
} }
@ -1778,6 +1787,9 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
for (DisposeNodeData disposeNodeData : rspInfo.getItems() for (DisposeNodeData disposeNodeData : rspInfo.getItems()
) { ) {
Assert.assertNotNull(disposeNodeData); Assert.assertNotNull(disposeNodeData);
Assert.assertNotNull(disposeNodeData.getStatus());
Assert.assertNotNull(disposeNodeData.getMessage());
if (disposeNodeData.getStatus() == 0) { if (disposeNodeData.getStatus() == 0) {
Assert.assertEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(disposeNodeData.getId()); Assert.assertNotNull(disposeNodeData.getId());
@ -1787,8 +1799,6 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
} else { } else {
Assert.assertNotEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertNotEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} }
Assert.assertNotNull(disposeNodeData.getStatus());
Assert.assertNotNull(disposeNodeData.getMessage());
} }
} }
} }
@ -1822,6 +1832,9 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
for (DisposeNodeData disposeNodeData : rspInfo.getItems() for (DisposeNodeData disposeNodeData : rspInfo.getItems()
) { ) {
Assert.assertNotNull(disposeNodeData); Assert.assertNotNull(disposeNodeData);
Assert.assertNotNull(disposeNodeData.getStatus());
Assert.assertNotNull(disposeNodeData.getMessage());
if (disposeNodeData.getStatus() == 0) { if (disposeNodeData.getStatus() == 0) {
Assert.assertEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(disposeNodeData.getId()); Assert.assertNotNull(disposeNodeData.getId());
@ -1831,8 +1844,6 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
} else { } else {
Assert.assertNotEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertNotEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} }
Assert.assertNotNull(disposeNodeData.getStatus());
Assert.assertNotNull(disposeNodeData.getMessage());
} }
} }
} }
@ -1865,6 +1876,9 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
for (DisposeNodeData disposeNodeData : rspInfo.getItems() for (DisposeNodeData disposeNodeData : rspInfo.getItems()
) { ) {
Assert.assertNotNull(disposeNodeData); Assert.assertNotNull(disposeNodeData);
Assert.assertNotNull(disposeNodeData.getStatus());
Assert.assertNotNull(disposeNodeData.getMessage());
if (disposeNodeData.getStatus() == 0) { if (disposeNodeData.getStatus() == 0) {
Assert.assertEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(disposeNodeData.getId()); Assert.assertNotNull(disposeNodeData.getId());
@ -1874,8 +1888,6 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
} else { } else {
Assert.assertNotEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); Assert.assertNotEquals(Long.valueOf(disposeNodeData.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} }
Assert.assertNotNull(disposeNodeData.getStatus());
Assert.assertNotNull(disposeNodeData.getMessage());
} }
} }
} }

View File

@ -23,6 +23,7 @@ import com.dispose.pojo.vo.information.VersionListRsp;
import com.dispose.pojo.vo.information.VersionRsp; import com.dispose.pojo.vo.information.VersionRsp;
import com.dispose.service.DisposeNodeManager; import com.dispose.service.DisposeNodeManager;
import com.dispose.service.UserAccountService; import com.dispose.service.UserAccountService;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Assert; import org.junit.Assert;
import org.junit.FixMethodOrder; import org.junit.FixMethodOrder;
@ -155,10 +156,10 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
System.out.print("msgContent=" + msgContent); System.out.print("msgContent=" + msgContent);
//将json字符串转为VersionRsp类 //将json字符串转为VersionRsp类
// List<VersionRsp> verList = objectMapper.readValue(msgContent, new TypeReference<List<VersionRsp>>() { List<VersionRsp> verList = objectMapper.readValue(msgContent, new TypeReference<List<VersionRsp>>() {
// }); });
VersionListRsp versionListRsp = objectMapper.readValue(msgContent, VersionListRsp.class); //VersionListRsp versionListRsp = objectMapper.readValue(msgContent, VersionListRsp.class);
List<VersionRsp> verList = versionListRsp.getItems(); //List<VersionRsp> verList = versionListRsp.getItems();
for (VersionRsp versionRsp : verList for (VersionRsp versionRsp : verList
) { ) {
@ -206,10 +207,11 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
String msgContent = verifyRep(verAll, reqTimeStamp); String msgContent = verifyRep(verAll, reqTimeStamp);
System.out.print("msgContent=" + msgContent); System.out.print("msgContent=" + msgContent);
// List<VersionRsp> verList = objectMapper.readValue(msgContent, new TypeReference<List<VersionRsp>>() { List<VersionRsp> verList = objectMapper.readValue(msgContent, new TypeReference<List<VersionRsp>>() {
// }); });
VersionListRsp versionListRsp = objectMapper.readValue(msgContent, VersionListRsp.class);
List<VersionRsp> verList = versionListRsp.getItems(); //VersionListRsp versionListRsp = objectMapper.readValue(msgContent, VersionListRsp.class);
//List<VersionRsp> verList = versionListRsp.getItems();
for (VersionRsp versionRsp : verList for (VersionRsp versionRsp : verList
) { ) {