Skip to content

Commit

Permalink
Remove internal enabled flag from API. Active flag is used from now on.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Morgan committed May 21, 2009
1 parent 0bf5019 commit 4babc56
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
4 changes: 1 addition & 3 deletions hqu/hqapi1/app/AlertdefinitionController.groovy
Expand Up @@ -55,7 +55,6 @@ public class AlertdefinitionController extends ApiController {
description: d.description,
priority: d.priority,
active: d.active,
enabled: d.enabled,
frequency: d.frequencyType,
count: d.count,
range: d.range,
Expand Down Expand Up @@ -324,7 +323,7 @@ public class AlertdefinitionController extends ApiController {

// Required attributes, basically everything but description
['controlFiltered', 'notifyFiltered', 'willRecover', 'range', 'count',
'frequency', 'enabled', 'active', 'priority',
'frequency', 'active', 'priority',
'name'].each { attr ->
if (xmlDef."@${attr}" == null) {
failureXml = getFailureXML(ErrorCode.INVALID_PARAMETERS,
Expand Down Expand Up @@ -402,7 +401,6 @@ public class AlertdefinitionController extends ApiController {
adv.appdefType = aeid.type
adv.appdefId = aeid.id
adv.priority = xmlDef.'@priority'?.toInteger()
adv.enabled = xmlDef.'@enabled'.toBoolean()
adv.active = xmlDef.'@active'.toBoolean()
adv.willRecover = xmlDef.'@willRecover'.toBoolean()
adv.notifyFiltered = xmlDef.'@notifyFiltered'?.toBoolean()
Expand Down
10 changes: 5 additions & 5 deletions src/org/hyperic/hq/hqapi1/test/AlertDefinitionSync_test.java
Expand Up @@ -252,13 +252,13 @@ public void testSyncControlFiltered() throws Exception {
cleanup(response.getAlertDefinition());
}

public void testSyncEnable() throws Exception {
public void testSyncActive() throws Exception {

AlertDefinitionApi api = getApi().getAlertDefinitionApi();
Resource platform = getLocalPlatformResource(false, false);

AlertDefinition d = generateTestDefinition();
d.setEnabled(false);
d.setActive(false);
d.setResource(platform);
d.getAlertCondition().add(AlertDefinitionBuilder.createPropertyCondition(true, "myProp"));
List<AlertDefinition> definitions = new ArrayList<AlertDefinition>();
Expand All @@ -270,9 +270,9 @@ public void testSyncEnable() throws Exception {
assertEquals(response.getAlertDefinition().size(), 1);
d = response.getAlertDefinition().get(0);
validateDefinition(d);
assertTrue("Enabled is not false", !d.isEnabled());
assertTrue("Enabled is not false", !d.isActive());

d.setEnabled(true);
d.setActive(true);
definitions.clear();
definitions.add(d);
response = api.syncAlertDefinitions(definitions);
Expand All @@ -281,7 +281,7 @@ public void testSyncEnable() throws Exception {
assertEquals(response.getAlertDefinition().size(), 1);
d = response.getAlertDefinition().get(0);
validateDefinition(d);
assertTrue("Enabled is not true", d.isEnabled());
assertTrue("Enabled is not true", d.isActive());

// Cleanup
cleanup(response.getAlertDefinition());
Expand Down
Expand Up @@ -22,7 +22,7 @@ protected AlertDefinition generateTestDefinition() {
d.setName("Test Alert Definition" + r.nextInt());
d.setDescription("Test Alert Description");
d.setPriority(AlertPriority.MEDIUM.getPriority());
d.setEnabled(true);
d.setActive(true);
return d;
}

Expand Down
1 change: 0 additions & 1 deletion xsd/AlertDefinition.xsd
Expand Up @@ -51,7 +51,6 @@
<xs:attribute name="parent" type="xs:int" use="optional" />
<xs:attribute name="priority" type="xs:int" use="required" />
<xs:attribute name="active" type="xs:boolean" use="required" />
<xs:attribute name="enabled" type="xs:boolean" use="required" />
<xs:attribute name="frequency" type="xs:int" use="required" />
<xs:attribute name="count" type="xs:int" use="required" />
<xs:attribute name="range" type="xs:int" use="required" />
Expand Down

0 comments on commit 4babc56

Please sign in to comment.