-
Notifications
You must be signed in to change notification settings - Fork 19
/
AlertDelete_test.java
46 lines (34 loc) · 1.46 KB
/
AlertDelete_test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package org.hyperic.hq.hqapi1.test;
import org.hyperic.hq.hqapi1.types.AlertDefinition;
import org.hyperic.hq.hqapi1.types.AlertsResponse;
import org.hyperic.hq.hqapi1.types.Alert;
import org.hyperic.hq.hqapi1.types.StatusResponse;
import org.hyperic.hq.hqapi1.AlertApi;
public class AlertDelete_test extends AlertTestBase {
public AlertDelete_test(String name) {
super(name);
}
public void testDeleteAlert() throws Exception {
AlertDefinition d = generateAlerts();
AlertApi api = getAlertApi();
AlertsResponse response = api.findAlerts(0, System.currentTimeMillis(),
10, 1, false, false);
hqAssertSuccess(response);
assertTrue(response.getAlert().size() <= 10);
assertTrue(response.getAlert().size() > 0);
// Test delete
Alert a = response.getAlert().get(0);
StatusResponse deleteResponse = api.delete(a.getId());
hqAssertSuccess(deleteResponse);
// TODO: Valididate alert was deleted? Will require a getById API.
// Cleanup
StatusResponse deleteDefResponse = getApi().
getAlertDefinitionApi().deleteAlertDefinition(d.getId());
hqAssertSuccess(deleteDefResponse);
}
public void testDeleteInvalidAlert() throws Exception {
AlertApi api = getAlertApi();
StatusResponse response = api.delete(Integer.MAX_VALUE);
hqAssertFailureObjectNotFound(response);
}
}