REM:
1.修改添加新的浩瀚能力节点冒烟测试
This commit is contained in:
lijinxing 2020-07-08 09:54:01 +08:00
parent 21c04f00b6
commit 0e890ee008
1 changed files with 46 additions and 0 deletions

View File

@ -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.
*