REM:
1. 修改断言
This commit is contained in:
chenlinghy 2020-06-10 18:03:32 +08:00
parent db6ae0f3be
commit aaccebede2
2 changed files with 206 additions and 101 deletions

View File

@ -1322,14 +1322,14 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
}
/**
* d8 get capacity id Integer exception test.
* d8 get capacity id Integer exception test.该情况不能做判断 数组内部的类型
*
* @throws Exception the exception
*/
@Test
public void d8_getCapacityIntegerIdExistExceptionTest() throws Exception {
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
"\"msgContent\":\"{\\\"id\\\":1}\"}";
"\"msgContent\":\"{\\\"id\\\":[1, 2]}\"}";
String capacity = mockMvc.perform(MockMvcRequestBuilders
.post("/information/capacity")
@ -1337,17 +1337,29 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
.header("Authorization", GlobalVar.STRING_HTTP_AUTH_HEAD + getLogToken())
.content(reqData))
.andDo(print()).andExpect(status().isOk())
.andExpect(jsonPath("$.code").value(521))
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
.andReturn()
.getResponse()
.getContentAsString();
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(capacity), ReturnStatus.class);
DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(capacity), DeviceCapacityRsp.class);
deviceCapacityRsp.getItems().forEach(v -> {
Assert.assertNotNull(v.getId());
Assert.assertNotNull(v.getStatus());
Assert.assertNotNull(v.getMessage());
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());
if (v.getStatus() == 0) {
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(v.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
Assert.assertEquals(v.getMessage(), ErrorCode.ERR_NOSUCHDEVICE.getMsg());
}
if (v.getCapacity() != null) {
v.getCapacity().forEach(k -> Assert.assertNotNull(k.getType()));
}
});
}
/**
@ -1693,14 +1705,14 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
}
/**
* e8 get protection IP id Integer exception test.
* e8 get protection IP id Integer exception test. 数组内"1"和1 不能做判断
*
* @throws Exception the exception
*/
@Test
public void e8_getIpIntegerIdExistExceptionTest() throws Exception {
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," +
"\"msgContent\":\"{\\\"id\\\":1}\"}";
"\"msgContent\":\"{\\\"id\\\":[1, 2]}\"}";
String protectedIp = mockMvc.perform(MockMvcRequestBuilders
.post("/information/protected_ip")
@ -1708,17 +1720,32 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment {
.header("Authorization", GlobalVar.STRING_HTTP_AUTH_HEAD + getLogToken())
.content(reqData))
.andDo(print()).andExpect(status().isOk())
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_PARAMEXCEPTION.getHttpCode()))
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
.andReturn()
.getResponse()
.getContentAsString();
ReturnStatus returnStatus = objectMapper.readValue(verifyResp(protectedIp), ReturnStatus.class);
DeviceCapacityRsp deviceCapacityRsp = objectMapper.readValue(verifyResp(protectedIp), DeviceCapacityRsp.class);
deviceCapacityRsp.getItems().forEach(v -> {
Assert.assertNotNull(v.getId());
Assert.assertNotNull(v.getStatus());
Assert.assertNotNull(v.getMessage());
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());
if (v.getStatus() == 0) {
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(v.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertEquals(String.valueOf(v.getStatus()), String.valueOf(ErrorCode.ERR_NOSUCHDEVICE.getCode()));
Assert.assertEquals(v.getMessage(), ErrorCode.ERR_NOSUCHDEVICE.getMsg());
}
if (v.getCapacity() != null) {
v.getCapacity().forEach(k -> {
Assert.assertNotNull(k.getType());
Assert.assertNotNull(k.getDisposeIp());
});
}
});
}
/**

View File

@ -160,12 +160,18 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
for (VersionRsp versionRsp : verList
) {
Assert.assertNotNull(versionRsp);
Assert.assertNotNull(versionRsp.getId());
Assert.assertNotNull(versionRsp.getStatus());
Assert.assertNotNull(versionRsp.getMessage());
if (verifyDeviceIdExists(versionRsp.getId())) {
Assert.assertEquals(Long.valueOf(versionRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(versionRsp.getId());
Assert.assertNotNull(versionRsp.getVersion());
Assert.assertEquals(Long.valueOf(versionRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(versionRsp.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertNotEquals(Long.valueOf(versionRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(versionRsp.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -208,17 +214,22 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
for (VersionRsp versionRsp : verList
) {
Assert.assertNotNull(versionRsp);
Assert.assertNotNull(versionRsp.getId());
Assert.assertNotNull(versionRsp.getStatus());
Assert.assertNotNull(versionRsp.getMessage());
if (verifyDeviceIdExists(versionRsp.getId())) {
Assert.assertEquals(Long.valueOf(versionRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(versionRsp.getId());
Assert.assertNotNull(versionRsp.getVersion());
Assert.assertEquals(Long.valueOf(versionRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(versionRsp.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertNotEquals(Long.valueOf(versionRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(versionRsp.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
/**
* T 2 get device info.
*
@ -257,17 +268,21 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<DeviceInfoData> deviceInfoList = deviceInfoRsp.getItems();
for (DeviceInfoData d : deviceInfoList
) {
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
/**
* T 2 get device info all.
*
@ -306,17 +321,21 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<DeviceInfoData> deviceInfoList = deviceInfoRsp.getItems();
for (DeviceInfoData d : deviceInfoList
) {
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
/**
* T 3 get device capacity.
*
@ -355,18 +374,24 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<DeviceCapacityData> deviceCapacityList = deviceCapacityRsp.getItems();
for (DeviceCapacityData d : deviceCapacityList
) {
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
if (d.getCapacity().size() != 0) {
if (d.getCapacity().size() > 0) {
for (DisposeCapacity cap : d.getCapacity()
) {
Assert.assertNotNull(cap.getType());
}
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -410,18 +435,24 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<DeviceCapacityData> deviceCapacityList = deviceCapacityRsp.getItems();
for (DeviceCapacityData d : deviceCapacityList
) {
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
if (d.getCapacity().size() != 0) {
if (d.getCapacity().size() > 0) {
for (DisposeCapacity cap : d.getCapacity()
) {
Assert.assertNotNull(cap.getType());
}
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -455,7 +486,6 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
.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";
String msgContent = verifyRep(protectedIp, reqTimeStamp);
System.out.print("msgContent=" + msgContent);
@ -465,23 +495,25 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<DeviceCapacityData> deviceCapacityList = deviceCapacityRsp.getItems();
for (DeviceCapacityData d : deviceCapacityList
) {
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
if (d.getCapacity().size() != 0) {
if (d.getCapacity().size() > 0) {
for (DisposeCapacity cap : d.getCapacity()
) {
Assert.assertNotNull(cap.getType());
Assert.assertNotNull(cap.getDisposeIp());
//String[] disposeIps = cap.getDisposeIp().split(",");
//for (String disposeIp : disposeIps) {
//Assert.assertTrue(disposeIp.matches(regex));
//}
}
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -515,7 +547,6 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
.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";
String msgContent = verifyRep(protectedIpAll, reqTimeStamp);
System.out.print("msgContent=" + msgContent);
@ -525,28 +556,29 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<DeviceCapacityData> deviceCapacityList = deviceCapacityRsp.getItems();
for (DeviceCapacityData d : deviceCapacityList
) {
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
if (d.getCapacity().size() != 0) {
if (d.getCapacity().size() > 0) {
for (DisposeCapacity cap : d.getCapacity()
) {
Assert.assertNotNull(cap.getType());
Assert.assertNotNull(cap.getDisposeIp());
//String[] disposeIps = cap.getDisposeIp().split(",");
//for (String disposeIp : disposeIps) {
//Assert.assertTrue(disposeIp.matches(regex));
//}
}
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
/**
* T 3 get dispose node list.
*
@ -576,7 +608,6 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
.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";
String msgContent = verifyRep(nodeList, reqTimeStamp);
System.out.print("msgContent=" + msgContent);
@ -586,16 +617,20 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<DisposeNodeData> disposeNodeDataList = disposeNodeListRsp.getItems();
for (DisposeNodeData d : disposeNodeDataList
) {
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(String.valueOf(d.getType()));
Assert.assertNotNull(d.getIp());
Assert.assertTrue(d.getIp().matches(regex));
Assert.assertNotNull(d.getName());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -629,7 +664,6 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
.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";
String msgContent = verifyRep(nodeListAll, reqTimeStamp);
System.out.print("msgContent=" + msgContent);
@ -639,16 +673,20 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<DisposeNodeData> disposeNodeDataList = disposeNodeListRsp.getItems();
for (DisposeNodeData d : disposeNodeDataList
) {
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(String.valueOf(d.getType()));
Assert.assertNotNull(d.getIp());
Assert.assertTrue(d.getIp().matches(regex));
Assert.assertNotNull(d.getName());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -682,7 +720,6 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
.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";
String msgContent = verifyRep(disposeNodeDetails, reqTimeStamp);
System.out.print("msgContent=" + msgContent);
@ -692,21 +729,26 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<DisposeNodeData> disposeNodeDataList = nodeDetailsRsp.getItems();
for (DisposeNodeData d : disposeNodeDataList
) {
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(String.valueOf(d.getType()));
Assert.assertNotNull(d.getIp());
Assert.assertTrue(d.getIp().matches(regex));
Assert.assertNotNull(d.getName());
for (DisposeCapacity cap : d.getCapacity()
) {
Assert.assertNotNull(cap.getType());
Assert.assertNotNull(cap.getDisposeIp());
}
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -740,7 +782,6 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
.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";
String msgContent = verifyRep(disposeNodeDetailsAll, reqTimeStamp);
System.out.print("msgContent=" + msgContent);
@ -750,21 +791,26 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<DisposeNodeData> disposeNodeDataList = nodeDetailsRsp.getItems();
for (DisposeNodeData d : disposeNodeDataList
) {
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(String.valueOf(d.getType()));
Assert.assertNotNull(d.getIp());
Assert.assertTrue(d.getIp().matches(regex));
Assert.assertNotNull(d.getName());
for (DisposeCapacity cap : d.getCapacity()
) {
Assert.assertNotNull(cap.getType());
Assert.assertNotNull(cap.getDisposeIp());
}
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -796,21 +842,25 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
String msgContent = verifyRep(linkstatus, reqTimeStamp);
System.out.print("msgContent=" + msgContent);
// List<LinkStatusRsp> linkStatusList = objectMapper.readValue(msgContent, new TypeReference<List<LinkStatusRsp>>() {
// });
LinkStatusListRsp linkStatusListRsp = objectMapper.readValue(msgContent, LinkStatusListRsp.class);
List<LinkStatusRsp> linkStatusList = linkStatusListRsp.getItems();
for (LinkStatusRsp linkStatusRsp : linkStatusList
) {
Assert.assertNotNull(linkStatusRsp);
Assert.assertNotNull(linkStatusRsp.getId());
Assert.assertNotNull(String.valueOf(linkStatusRsp.getOnline()));
Assert.assertNotNull(String.valueOf(linkStatusRsp.getStatus()));
Assert.assertNotNull(linkStatusRsp.getMessage());
if (verifyDeviceIdExists(linkStatusRsp.getId())) {
Assert.assertEquals(Long.valueOf(linkStatusRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(linkStatusRsp.getId());
Assert.assertNotNull(String.valueOf(linkStatusRsp.getOnline()));
Assert.assertEquals(String.valueOf(linkStatusRsp.getOnline()), "1");
Assert.assertEquals(Long.valueOf(linkStatusRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(linkStatusRsp.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertNotEquals(Long.valueOf(linkStatusRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(String.valueOf(linkStatusRsp.getOnline()), "0");
Assert.assertNotEquals(Long.valueOf(linkStatusRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(linkStatusRsp.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -850,14 +900,20 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
for (LinkStatusRsp linkStatusRsp : linkStatusList
) {
Assert.assertNotNull(linkStatusRsp);
Assert.assertNotNull(linkStatusRsp.getId());
Assert.assertNotNull(String.valueOf(linkStatusRsp.getOnline()));
Assert.assertNotNull(String.valueOf(linkStatusRsp.getStatus()));
Assert.assertNotNull(linkStatusRsp.getMessage());
if (verifyDeviceIdExists(linkStatusRsp.getId())) {
Assert.assertEquals(Long.valueOf(linkStatusRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(linkStatusRsp.getId());
Assert.assertNotNull(String.valueOf(linkStatusRsp.getOnline()));
Assert.assertEquals(String.valueOf(linkStatusRsp.getOnline()), "1");
Assert.assertEquals(Long.valueOf(linkStatusRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(linkStatusRsp.getMessage(), ErrorCode.ERR_OK.getMsg());
} else {
Assert.assertNotEquals(Long.valueOf(linkStatusRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertEquals(String.valueOf(linkStatusRsp.getOnline()), "0");
Assert.assertNotEquals(Long.valueOf(linkStatusRsp.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(linkStatusRsp.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -894,15 +950,19 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<NodeTaskData> nodeTaskData = runTaskRsp.getItems();
for (NodeTaskData d : nodeTaskData
) {
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
// no task
if (d.getTaskArray().size() == 0) {
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} else {
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
}
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
Assert.assertNotNull(d.getTaskArray());
for (TaskInfoData task : d.getTaskArray()
@ -913,9 +973,10 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
Assert.assertNotNull(task.getDisposeTime());
Assert.assertNotNull(task.getDisposeIp());
}
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -953,15 +1014,19 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<NodeTaskData> nodeTaskData = runTaskRsp.getItems();
for (NodeTaskData d : nodeTaskData
) {
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
// no task
if (d.getTaskArray().size() == 0) {
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} else {
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
}
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
Assert.assertNotNull(d.getTaskArray());
for (TaskInfoData task : d.getTaskArray()
@ -972,9 +1037,10 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
Assert.assertNotNull(task.getDisposeTime());
Assert.assertNotNull(task.getDisposeIp());
}
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -1012,11 +1078,18 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<NodeTaskData> allTaskData = allTaskRsp.getItems();
for (NodeTaskData d : allTaskData
) {
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
// no task
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
if (d.getTaskArray().size() == 0) {
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} else {
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
}
Assert.assertNotNull(d.getTaskArray());
for (TaskInfoData task : d.getTaskArray()
@ -1029,9 +1102,8 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
Assert.assertNotNull(task.getDisposeIp());
}
} else {
Assert.assertNotNull(d.getId());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(d.getTaskArray());
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}
@ -1069,11 +1141,18 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
List<NodeTaskData> allTaskData = allTaskRsp.getItems();
for (NodeTaskData d : allTaskData
) {
if (verifyDeviceIdExists(d.getId())) {
Assert.assertNotNull(d.getId());
Assert.assertNotNull(d);
Assert.assertNotNull(d.getId());
Assert.assertNotNull(String.valueOf(d.getStatus()));
Assert.assertNotNull(d.getMessage());
if (verifyDeviceIdExists(d.getId())) {
// no task
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
if (d.getTaskArray().size() == 0) {
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} else {
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
}
Assert.assertNotNull(d.getTaskArray());
for (TaskInfoData task : d.getTaskArray()
@ -1086,9 +1165,8 @@ public class DeviceNodeInfoControllerTest extends InitTestEnvironment {
Assert.assertNotNull(task.getDisposeIp());
}
} else {
Assert.assertNotNull(d.getId());
Assert.assertEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotNull(d.getTaskArray());
Assert.assertNotEquals(Long.valueOf(d.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
Assert.assertNotEquals(d.getMessage(), ErrorCode.ERR_OK.getMsg());
}
}
}