parent
21c04f00b6
commit
0e890ee008
|
@ -136,6 +136,52 @@ public class DeviceNodeManagerControllerSmokeTest extends InitTestEnvironment {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A 2 add Normal HaoHan DeviceNodeManager test.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void a2_addNormalHaoHanDeviceNodeManager() throws Exception {
|
||||
String reqData = "{\n" +
|
||||
"\"ver\": 2,\n" +
|
||||
"\"cryptoType\": 0,\n" +
|
||||
"\"timeStamp\": 1589437275258,\n" +
|
||||
"\"msgContent\":\"{\\\"items\\\":[{\\\"areaCode\\\":0,\\\"ipAddr\\\":\\\"10.88.77.88:18080\\\"," +
|
||||
"\\\"manufacturer\\\":\\\"HaoHan\\\",\\\"model\\\":\\\"Unknown\\\"," +
|
||||
"\\\"name\\\":\\\"中移杭研实验室浩瀚清洗设备\\\",\\\"readme\\\":\\\"实验室测试设备\\\",\\\"type\\\":1," +
|
||||
"\\\"version\\\":\\\"Unknown\\\",\\\"url\\\":\\\"http://%s/DDoSClean/clean\\\" }]}\"\n" +
|
||||
"}";
|
||||
|
||||
String ret = mockMvc.perform(MockMvcRequestBuilders
|
||||
.put("/manager/device")
|
||||
.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();
|
||||
|
||||
AddNodeRsp retStatus = objectMapper.readValue(verifyResp(ret), AddNodeRsp.class);
|
||||
List<AddNodeRetData> r = retStatus.getItems();
|
||||
for (AddNodeRetData v : r
|
||||
) {
|
||||
Assert.assertNotNull(v);
|
||||
Assert.assertNotNull(v.getIpAddr());
|
||||
Assert.assertNotNull(v.getDevId());
|
||||
Assert.assertNotNull(v.getMessage());
|
||||
Assert.assertNotNull(v.getStatus());
|
||||
|
||||
if (v.getStatus() == 0) {
|
||||
Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||
} else if (v.getStatus() == 20) {
|
||||
Assert.assertEquals(Long.valueOf(v.getStatus()), Long.valueOf(ErrorCode.ERR_DEVICEEXISTS.getCode()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* B 1 delete Normal DeviceNodeManager test.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue