@Test
public void testCreateDeleteBasicAlertDefinitionOncein3MinDampening() throws Exception {
int definitionId=0;
try {
AlertDefinition alertDefinition = new AlertDefinition();
alertDefinition.setName("-x-test-definition");
alertDefinition.setEnabled(false);
alertDefinition.setPriority("LOW");
alertDefinition.setDampeningCategory("DURATION_COUNT");
alertDefinition.setDampeningCount(1);
alertDefinition.setDampeningPeriod(3);
alertDefinition.setDampeningUnit("minutes");
AlertDefinition result =
given()
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
.queryParam("resourceId", _platformId)
.expect()
.statusCode(201)
.body("dampeningCategory", is("DURATION_COUNT"))
.body("dampeningCount", is(1))
.body("dampeningPeriod", is(3))
.body("dampeningUnit", is("MINUTES"))
.when()
.post("/alert/definitions")
.as(AlertDefinition.class);
definitionId = result.getId();
} finally {
cleanupDefinition(definitionId);
}
}