OCT
REM: 1. 增加获取清洗任务的流量信息接口和获取清洗任务状态信息接口的测试用例 2. 增加迪普设备错误码 3. 修改下发清洗返回类
This commit is contained in:
parent
2c3eee5f57
commit
59f5552c4d
|
@ -33,6 +33,14 @@ public enum HaoHanErrorCode {
|
||||||
* Err no running task error code.
|
* Err no running task error code.
|
||||||
*/
|
*/
|
||||||
ERR_NORUNNINGTASK("没有正在清洗的ip"),
|
ERR_NORUNNINGTASK("没有正在清洗的ip"),
|
||||||
|
/**
|
||||||
|
* Err task does not existed or task is running error code.
|
||||||
|
*/
|
||||||
|
ERR_TASKNOEND("请检查清洗任务是否存在或清洗状态是否为结束!"),
|
||||||
|
/**
|
||||||
|
* Err task does not existed error code.
|
||||||
|
*/
|
||||||
|
ERR_NOTASK("该清洗任务不存在!"),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String errMsg;
|
private final String errMsg;
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class HaoHanInterfaceTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void c1_delTowTest() throws JsonProcessingException {
|
public void c1_allIpFlowTest() throws JsonProcessingException {
|
||||||
String jsonRequest = "{\"orderFrom\":\"hangyan\"}";
|
String jsonRequest = "{\"orderFrom\":\"hangyan\"}";
|
||||||
String svrReturn = Http.postJson("http://10.88.77.88:18080/DDoSClean/clean/allIpFlow",
|
String svrReturn = Http.postJson("http://10.88.77.88:18080/DDoSClean/clean/allIpFlow",
|
||||||
null,
|
null,
|
||||||
|
@ -207,18 +207,84 @@ public class HaoHanInterfaceTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void c2_delTowTest() throws JsonProcessingException {
|
public void c2_allIpFlowTest() throws JsonProcessingException {
|
||||||
String jsonRequest = "{\"orderFrom\":123}";
|
String jsonRequest = "{\"orderFrom\":123}";
|
||||||
String svrReturn = Http.postJson("http://10.88.77.88:18080/DDoSClean/clean/allIpFlow",
|
String svrReturn = Http.postJson("http://10.88.77.88:18080/DDoSClean/clean/allIpFlow",
|
||||||
null,
|
null,
|
||||||
jsonRequest);
|
jsonRequest);
|
||||||
|
|
||||||
|
log.info("Server Return: [{}]", svrReturn);
|
||||||
|
allIpFlowResult result = objectMapper.readValue(svrReturn, allIpFlowResult.class);
|
||||||
|
|
||||||
|
Assert.assertNotNull(result);
|
||||||
|
Assert.assertEquals(result.getMsg(), HaoHanErrorCode.ERR_ORDERFROMFORMA.getMsg());
|
||||||
|
Assert.assertEquals(result.getState(), Integer.valueOf(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void d1_cleanTaskFlowTest() throws JsonProcessingException {
|
||||||
|
String jsonRequest = "{\"cleanTaskId\":119}";
|
||||||
|
String svrReturn = Http.postJson("http://10.88.77.88:18080/DDoSClean/clean/cleanTaskFlow",
|
||||||
|
null,
|
||||||
|
jsonRequest);
|
||||||
|
|
||||||
|
log.info("Server Return: [{}]", svrReturn);
|
||||||
|
allIpFlowResult result = objectMapper.readValue(svrReturn, allIpFlowResult.class);
|
||||||
|
|
||||||
|
Assert.assertNotNull(result);
|
||||||
|
if (result.getState() == 0) {
|
||||||
|
Assert.assertEquals(result.getMsg(), HaoHanErrorCode.ERR_OK.getMsg());
|
||||||
|
for (allIpFlowData data : result.getData()
|
||||||
|
) {
|
||||||
|
Assert.assertNotNull(data.getIp());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Assert.assertEquals(result.getMsg(), HaoHanErrorCode.ERR_TASKNOEND.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void d2_cleanTaskFlowTest() throws JsonProcessingException {
|
||||||
|
String jsonRequest = "{\"cleanTaskId\":\"abc\"}";
|
||||||
|
String svrReturn = Http.postJson("http://10.88.77.88:18080/DDoSClean/clean/cleanTaskFlow",
|
||||||
|
null,
|
||||||
|
jsonRequest);
|
||||||
|
|
||||||
|
log.info("Server Return: [{}]", svrReturn);
|
||||||
|
allIpFlowResult result = objectMapper.readValue(svrReturn, allIpFlowResult.class);
|
||||||
|
Assert.assertNotNull(result);
|
||||||
|
Assert.assertEquals(result.getMsg(), HaoHanErrorCode.ERR_CLEANTASKIDFORMA.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void e1_getCleanTaskStateTest() throws JsonProcessingException {
|
||||||
|
String jsonRequest = "{\"cleanTaskId\":119}";
|
||||||
|
String svrReturn = Http.postJson("http://10.88.77.88:18080/DDoSClean/clean/getCleanTaskState",
|
||||||
|
null,
|
||||||
|
jsonRequest);
|
||||||
|
|
||||||
log.info("Server Return: [{}]", svrReturn);
|
log.info("Server Return: [{}]", svrReturn);
|
||||||
sendTowResult result = objectMapper.readValue(svrReturn, sendTowResult.class);
|
sendTowResult result = objectMapper.readValue(svrReturn, sendTowResult.class);
|
||||||
|
|
||||||
Assert.assertNotNull(result);
|
Assert.assertNotNull(result);
|
||||||
Assert.assertEquals(result.getMsg(), HaoHanErrorCode.ERR_ORDERFROMFORMA.getMsg());
|
if (result.getState() == 0) {
|
||||||
Assert.assertEquals(result.getState(), Integer.valueOf(1));
|
Assert.assertEquals(result.getMsg(), HaoHanErrorCode.ERR_OK.getMsg());
|
||||||
|
} else {
|
||||||
|
Assert.assertEquals(result.getMsg(), HaoHanErrorCode.ERR_NOTASK.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void e2_getCleanTaskStateTest() throws JsonProcessingException {
|
||||||
|
String jsonRequest = "{\"cleanTaskId\":\"adb\"}";
|
||||||
|
String svrReturn = Http.postJson("http://10.88.77.88:18080/DDoSClean/clean/getCleanTaskState",
|
||||||
|
null,
|
||||||
|
jsonRequest);
|
||||||
|
|
||||||
|
log.info("Server Return: [{}]", svrReturn);
|
||||||
|
sendTowResult result = objectMapper.readValue(svrReturn, sendTowResult.class);
|
||||||
|
Assert.assertNotNull(result);
|
||||||
|
Assert.assertEquals(result.getMsg(), HaoHanErrorCode.ERR_CLEANTASKIDFORMA.getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,5 @@ public class sendTowResult {
|
||||||
private Integer state;
|
private Integer state;
|
||||||
private String msg;
|
private String msg;
|
||||||
private Integer cleanTaskId;
|
private Integer cleanTaskId;
|
||||||
|
private Integer cleanTaskState;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue