parent
53f6bf54b1
commit
21c2c05f0a
|
@ -239,4 +239,41 @@ public class TaskControllerSmokeTest extends InitTestEnvironment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* t6 stop all clean task test.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void t6_NormalStopAllCleanTaskTest() throws Exception {
|
||||||
|
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604296988,\"msgContent\":\"{\\\"type\\\":0}\"}";
|
||||||
|
|
||||||
|
String ret = mockMvc.perform(MockMvcRequestBuilders
|
||||||
|
.post("/task/stop_all")
|
||||||
|
.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();
|
||||||
|
|
||||||
|
TaskInfoRsp taskStopByIpRsp = objectMapper.readValue(verifyResp(ret), TaskInfoRsp.class);
|
||||||
|
|
||||||
|
List<TaskInfoData> taskInfoList = taskStopByIpRsp.getItems();
|
||||||
|
for (TaskInfoData task : taskInfoList
|
||||||
|
) {
|
||||||
|
Assert.assertNotNull(task.getStatus());
|
||||||
|
Assert.assertNotNull(task.getMessage());
|
||||||
|
|
||||||
|
if (task.getStatus() == 0) {
|
||||||
|
Assert.assertNotNull(task.getId());
|
||||||
|
Assert.assertNotNull(task.getTaskId());
|
||||||
|
Assert.assertEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||||
|
Assert.assertEquals(task.getMessage(), ErrorCode.ERR_OK.getMsg());
|
||||||
|
} else {
|
||||||
|
Assert.assertNotEquals(Long.valueOf(task.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
|
||||||
|
Assert.assertNotEquals(task.getMessage(), ErrorCode.ERR_OK.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue