|
@@ -49,6 +49,7 @@ public class AlertGroupControllerTest extends AbstractControllerTest {
|
|
|
paramsMap.add("groupName","cxc test group name");
|
|
|
paramsMap.add("groupType", AlertType.EMAIL.toString());
|
|
|
paramsMap.add("description","cxc junit 测试告警描述");
|
|
|
+ paramsMap.add("alertInstanceIds", "");
|
|
|
MvcResult mvcResult = mockMvc.perform(post("/alert-group/create")
|
|
|
.header("sessionId", sessionId)
|
|
|
.params(paramsMap))
|
|
@@ -93,40 +94,41 @@ public class AlertGroupControllerTest extends AbstractControllerTest {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testUpdateAlertgroup() throws Exception {
|
|
|
+ public void testQueryAlertGroupById() throws Exception {
|
|
|
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
|
|
|
paramsMap.add("id","22");
|
|
|
- paramsMap.add("groupName", "hd test group name");
|
|
|
- paramsMap.add("groupType",AlertType.EMAIL.toString());
|
|
|
- paramsMap.add("description","update alter group");
|
|
|
- MvcResult mvcResult = mockMvc.perform(post("/alert-group/update")
|
|
|
+ MvcResult mvcResult = mockMvc.perform(post("/alert-group/query")
|
|
|
.header("sessionId", sessionId)
|
|
|
.params(paramsMap))
|
|
|
.andExpect(status().isOk())
|
|
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
|
|
.andReturn();
|
|
|
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
|
|
|
- Assert.assertTrue(result != null && result.isSuccess());
|
|
|
+ Assert.assertTrue(result != null && result.isStatus(Status.ALERT_GROUP_NOT_EXIST));
|
|
|
logger.info(mvcResult.getResponse().getContentAsString());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testVerifyGroupName() throws Exception {
|
|
|
+ public void testUpdateAlertgroup() throws Exception {
|
|
|
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
|
|
|
- paramsMap.add("groupName","hd test group name");
|
|
|
- MvcResult mvcResult = mockMvc.perform(get("/alert-group/verify-group-name")
|
|
|
+ paramsMap.add("id","22");
|
|
|
+ paramsMap.add("groupName", "cxc test group name");
|
|
|
+ paramsMap.add("groupType",AlertType.EMAIL.toString());
|
|
|
+ paramsMap.add("description","update alter group");
|
|
|
+ paramsMap.add("alertInstanceIds", "");
|
|
|
+ MvcResult mvcResult = mockMvc.perform(post("/alert-group/update")
|
|
|
.header("sessionId", sessionId)
|
|
|
.params(paramsMap))
|
|
|
.andExpect(status().isOk())
|
|
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
|
|
.andReturn();
|
|
|
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
|
|
|
- Assert.assertTrue(result != null && result.isStatus(Status.ALERT_GROUP_EXIST));
|
|
|
+ Assert.assertTrue(result != null && result.isStatus(Status.ALERT_GROUP_NOT_EXIST));
|
|
|
logger.info(mvcResult.getResponse().getContentAsString());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testVerifyGroupNameNotExit() throws Exception {
|
|
|
+ public void testVerifyGroupName() throws Exception {
|
|
|
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
|
|
|
paramsMap.add("groupName","cxc test group name");
|
|
|
MvcResult mvcResult = mockMvc.perform(get("/alert-group/verify-group-name")
|
|
@@ -136,24 +138,22 @@ public class AlertGroupControllerTest extends AbstractControllerTest {
|
|
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
|
|
.andReturn();
|
|
|
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
|
|
|
- Assert.assertTrue(result != null && result.isSuccess());
|
|
|
+ Assert.assertTrue(result != null && result.isStatus(Status.ALERT_GROUP_EXIST));
|
|
|
logger.info(mvcResult.getResponse().getContentAsString());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testGrantUser() throws Exception {
|
|
|
+ public void testVerifyGroupNameNotExit() throws Exception {
|
|
|
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
|
|
|
- paramsMap.add("alertgroupId","2");
|
|
|
- paramsMap.add("userIds","2");
|
|
|
-
|
|
|
- MvcResult mvcResult = mockMvc.perform(post("/alert-group/grant-user")
|
|
|
+ paramsMap.add("groupName","cxc test group name");
|
|
|
+ MvcResult mvcResult = mockMvc.perform(get("/alert-group/verify-group-name")
|
|
|
.header("sessionId", sessionId)
|
|
|
.params(paramsMap))
|
|
|
.andExpect(status().isOk())
|
|
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
|
|
.andReturn();
|
|
|
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
|
|
|
- Assert.assertTrue(result != null && result.isSuccess());
|
|
|
+ Assert.assertTrue(result != null && result.isStatus(Status.ALERT_GROUP_EXIST));
|
|
|
logger.info(mvcResult.getResponse().getContentAsString());
|
|
|
}
|
|
|
|
|
@@ -168,7 +168,7 @@ public class AlertGroupControllerTest extends AbstractControllerTest {
|
|
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
|
|
.andReturn();
|
|
|
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
|
|
|
- Assert.assertTrue(result != null && result.isSuccess());
|
|
|
+ Assert.assertTrue(result != null && result.isStatus(Status.ALERT_GROUP_NOT_EXIST));
|
|
|
logger.info(mvcResult.getResponse().getContentAsString());
|
|
|
}
|
|
|
}
|