Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'hqapi-2.x'

  • Loading branch information...
commit dbbefe61bb81bc5c419515d9d492acc0e079793d 2 parents dc1b253 + 528e1b8
Ryan Morgan authored
View
4 ChangeLog
@@ -44,8 +44,8 @@ Changes in HQApi 2.3
*) [HQ-3076] Add ApplicationApi.
- *) [HHQ-3422] Add support for ScriptAction AlertActions in the
- AlertDefinition API.
+ *) [HHQ-3422] Add support for AlertActions in the AlertDefinition API.
+ Supported actions include ControlAction, ScriptAction and OpenNMSAction.
Changes in HQApi 2.2
View
66 hqu/hqapi1/app/AlertdefinitionController.groovy
@@ -165,8 +165,9 @@ public class AlertdefinitionController extends ApiController {
}
for (a in d.actions) {
- // TODO: Only supporting ScriptAction for now.
- if (a.className == "com.hyperic.hq.bizapp.server.action.control.ScriptAction") {
+ // TODO: User and Role notifications only handled through Escalation
+ if (a.className == "com.hyperic.hq.bizapp.server.action.control.ScriptAction" ||
+ a.className == "org.hyperic.hq.bizapp.server.action.integrate.OpenNMSAction") {
AlertAction(id: a.id,
className: a.className) {
def config = ConfigResponse.decode(a.config)
@@ -175,6 +176,33 @@ public class AlertdefinitionController extends ApiController {
value: config.getValue(key))
}
}
+ } else if (a.className == "com.hyperic.hq.bizapp.server.action.control.ControlAction") {
+ def config = ConfigResponse.decode(a.config)
+ def appdefType = config.getValue("appdefType")?.toInteger()
+ def appdefId = config.getValue("appdefId")?.toInteger()
+ def resource
+
+ if (appdefType == 1) {
+ resource = resourceHelper.find('platform':appdefId)
+ } else if (appdefType == 2) {
+ resource = resourceHelper.find('server':appdefId)
+ } else if (appdefType == 3) {
+ resource = resourceHelper.find('service':appdefId)
+ } else {
+ log.warn("Unable to find resource appdefType=" +
+ appdefType + " appdefId=" + appdefId)
+ continue // Skip this action
+ }
+
+ if (resource) {
+ AlertAction(id: a.id,
+ className: a.className) {
+ AlertActionConfig(key: 'resourceId',
+ value: resource.id)
+ AlertActionConfig(key: 'action',
+ value: config.getValue('action'))
+ }
+ }
}
}
}
@@ -524,8 +552,38 @@ public class AlertdefinitionController extends ApiController {
def className = xmlAction.'@className'
def cfg = [:]
- for (xmlConfig in xmlAction['AlertActionConfig']) {
- cfg[xmlConfig.'@key'] = xmlConfig.'@value'
+ // Special translation for ControlActions for Resource ids
+ if (className == "com.hyperic.hq.bizapp.server.action.control.ControlAction") {
+ def rId = xmlAction['AlertActionConfig'].find {
+ it.'@key' == 'resourceId'
+ }?.'@value'?.toInteger()
+
+ def action = xmlAction['AlertActionConfig'].find {
+ it.'@key' == 'action'
+ }?.'@value'
+
+ def cResource = getResource(rId)
+ if (cResource != null && action != null) {
+ def actions = cResource.getControlActions(user)
+ if (!actions.find { it == action }) {
+ log.warn("Resource " + cResource.name + " does not " +
+ "support action " + action)
+ continue
+ }
+
+ cfg['appdefType'] = Integer.toString(cResource.entityId.type)
+ cfg['appdefId'] = Integer.toString(cResource.entityId.id)
+ cfg['action'] = action
+ } else {
+ // If the resource is not found, don't add the action
+ log.warn("Ignoring invalid ControlAction config " +
+ xmlAction['AlertActionConfig'])
+ continue
+ }
+ } else {
+ for (xmlConfig in xmlAction['AlertActionConfig']) {
+ cfg[xmlConfig.'@key'] = xmlConfig.'@value'
+ }
}
ConfigResponse configResponse = new ConfigResponse(cfg)
View
57 src/org/hyperic/hq/hqapi1/AlertDefinitionBuilder.java
@@ -31,6 +31,7 @@
import org.hyperic.hq.hqapi1.types.AlertDefinition;
import org.hyperic.hq.hqapi1.types.AlertAction;
import org.hyperic.hq.hqapi1.types.AlertActionConfig;
+import org.hyperic.hq.hqapi1.types.Resource;
/**
* This class is used to create {@link org.hyperic.hq.hqapi1.types.AlertCondition}s.
@@ -354,7 +355,7 @@ public static AlertCondition createConfigCondition(boolean required,
}
/**
- * Create a ScriptAction
+ * Create a Script AlertAction
*
* @param script The script to execute when the alert fires.
* @return An {@link org.hyperic.hq.hqapi1.types.AlertAction} that can be
@@ -371,4 +372,58 @@ public static AlertAction createScriptAction(String script) {
a.getAlertActionConfig().add(cfg);
return a;
}
+
+ /**
+ * Create a ControlAction AlertAction
+ *
+ * @param r The {@link Resource} to run the action on
+ * @param action The control action to run
+ *
+ * @return An {@link org.hyperic.hq.hqapi1.types.AlertAction} that can be
+ * included in {@link org.hyperic.hq.hqapi1.types.AlertDefinition#getAlertAction()}.
+ */
+ public static AlertAction createControlAction(Resource r, String action) {
+ AlertAction a = new AlertAction();
+ a.setClassName("com.hyperic.hq.bizapp.server.action.control.ControlAction");
+
+ AlertActionConfig resourceCfg = new AlertActionConfig();
+ resourceCfg.setKey("resourceId");
+ resourceCfg.setValue(Integer.toString(r.getId()));
+
+ AlertActionConfig actionCfg = new AlertActionConfig();
+ actionCfg.setKey("action");
+ actionCfg.setValue(action);
+
+ a.getAlertActionConfig().add(resourceCfg);
+ a.getAlertActionConfig().add(actionCfg);
+
+ return a;
+ }
+
+ /**
+ * Create an OpenNMS AlertAction
+ *
+ * @param server The address of the OpenNMS server
+ * @param port The port the OpenNMS server is listening on
+ *
+ * @return An {@link org.hyperic.hq.hqapi1.types.AlertAction} that can be
+ * included in {@link org.hyperic.hq.hqapi1.types.AlertDefinition#getAlertAction()}.
+ */
+ public static AlertAction createOpenNMSAction(String server, int port) {
+ AlertAction a = new AlertAction();
+ a.setClassName("org.hyperic.hq.bizapp.server.action.integrate.OpenNMSAction");
+
+ AlertActionConfig serverCfg = new AlertActionConfig();
+ serverCfg.setKey("server");
+ serverCfg.setValue(server);
+
+ AlertActionConfig portCfg = new AlertActionConfig();
+ portCfg.setKey("port");
+ portCfg.setValue(Integer.toString(port));
+
+ a.getAlertActionConfig().add(serverCfg);
+ a.getAlertActionConfig().add(portCfg);
+
+ return a;
+ }
}
View
91 src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncActions_test.java
@@ -0,0 +1,91 @@
+package org.hyperic.hq.hqapi1.test;
+
+import org.hyperic.hq.hqapi1.HQApi;
+import org.hyperic.hq.hqapi1.AlertDefinitionApi;
+import org.hyperic.hq.hqapi1.MetricApi;
+import org.hyperic.hq.hqapi1.AlertDefinitionBuilder;
+import org.hyperic.hq.hqapi1.types.Resource;
+import org.hyperic.hq.hqapi1.types.MetricsResponse;
+import org.hyperic.hq.hqapi1.types.Metric;
+import org.hyperic.hq.hqapi1.types.AlertDefinition;
+import org.hyperic.hq.hqapi1.types.AlertAction;
+import org.hyperic.hq.hqapi1.types.AlertDefinitionsResponse;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public class AlertDefinitionSyncActions_test extends AlertDefinitionTestBase {
+
+ public AlertDefinitionSyncActions_test(String name) {
+ super(name);
+ }
+ public void testEmptyAlertAction() throws Exception {
+ HQApi api = getApi();
+ AlertDefinitionApi defApi = api.getAlertDefinitionApi();
+ MetricApi metricApi = api.getMetricApi();
+
+ Resource platform = getLocalPlatformResource(false, false);
+
+ MetricsResponse metricsResponse = metricApi.getMetrics(platform);
+ hqAssertSuccess(metricsResponse);
+ assertTrue("No metrics found for " + platform.getName(),
+ metricsResponse.getMetric().size() > 0);
+ Metric m = metricsResponse.getMetric().get(0);
+
+ AlertDefinition d = generateTestDefinition();
+ d.setResource(platform);
+ d.getAlertCondition().add(
+ AlertDefinitionBuilder.createChangeCondition(true, m.getName()));
+
+ AlertAction action = new AlertAction();
+ d.getAlertAction().add(action);
+
+ List<AlertDefinition> definitions = new ArrayList<AlertDefinition>();
+ definitions.add(d);
+ AlertDefinitionsResponse response = defApi.syncAlertDefinitions(definitions);
+ hqAssertSuccess(response);
+
+ AlertDefinition def = response.getAlertDefinition().get(0);
+ validateDefinition(def);
+ assertEquals("Wrong number of actions found", 0, def.getAlertAction().size());
+
+ // Cleanup
+ cleanup(response.getAlertDefinition());
+ }
+
+ public void testBadClassName() throws Exception {
+
+ HQApi api = getApi();
+ AlertDefinitionApi defApi = api.getAlertDefinitionApi();
+ MetricApi metricApi = api.getMetricApi();
+
+ Resource platform = getLocalPlatformResource(false, false);
+
+ MetricsResponse metricsResponse = metricApi.getMetrics(platform);
+ hqAssertSuccess(metricsResponse);
+ assertTrue("No metrics found for " + platform.getName(),
+ metricsResponse.getMetric().size() > 0);
+ Metric m = metricsResponse.getMetric().get(0);
+
+ AlertDefinition d = generateTestDefinition();
+ d.setResource(platform);
+ d.getAlertCondition().add(
+ AlertDefinitionBuilder.createChangeCondition(true, m.getName()));
+
+ AlertAction action = new AlertAction();
+ action.setClassName("org.hyperic.bad.AlertAction");
+ d.getAlertAction().add(action);
+
+ List<AlertDefinition> definitions = new ArrayList<AlertDefinition>();
+ definitions.add(d);
+ AlertDefinitionsResponse response = defApi.syncAlertDefinitions(definitions);
+ hqAssertSuccess(response);
+
+ AlertDefinition def = response.getAlertDefinition().get(0);
+ validateDefinition(def);
+ assertEquals("Wrong number of actions found", 0, def.getAlertAction().size());
+
+ // Cleanup
+ cleanup(response.getAlertDefinition());
+ }
+}
View
224 src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncControlAction_test.java
@@ -0,0 +1,224 @@
+package org.hyperic.hq.hqapi1.test;
+
+import org.hyperic.hq.hqapi1.HQApi;
+import org.hyperic.hq.hqapi1.AlertDefinitionApi;
+import org.hyperic.hq.hqapi1.MetricApi;
+import org.hyperic.hq.hqapi1.AlertDefinitionBuilder;
+import org.hyperic.hq.hqapi1.ResourceApi;
+import org.hyperic.hq.hqapi1.types.Resource;
+import org.hyperic.hq.hqapi1.types.MetricsResponse;
+import org.hyperic.hq.hqapi1.types.Metric;
+import org.hyperic.hq.hqapi1.types.AlertDefinition;
+import org.hyperic.hq.hqapi1.types.AlertAction;
+import org.hyperic.hq.hqapi1.types.AlertDefinitionsResponse;
+import org.hyperic.hq.hqapi1.types.ResourceResponse;
+import org.hyperic.hq.hqapi1.types.ResourcePrototypeResponse;
+import org.hyperic.hq.hqapi1.types.StatusResponse;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Random;
+import java.util.HashMap;
+import java.util.Map;
+
+public class AlertDefinitionSyncControlAction_test extends AlertDefinitionTestBase {
+
+ public AlertDefinitionSyncControlAction_test(String name) {
+ super(name);
+ }
+
+ // TODO: Copied from ControlTestBase in master branch.
+ private Resource createControllableResource(HQApi api)
+ throws Exception
+ {
+ ResourceApi rApi = api.getResourceApi();
+
+ ResourcePrototypeResponse protoResponse =
+ rApi.getResourcePrototype("FileServer File");
+ hqAssertSuccess(protoResponse);
+
+ Resource localPlatform = getLocalPlatformResource(false, false);
+
+ Map<String,String> config = new HashMap<String,String>();
+ // TODO: Fix for windows
+ config.put("path", "/usr/bin/true");
+
+ Random r = new Random();
+ String name = "Controllable-Resource-" + r.nextInt();
+
+ ResourceResponse resourceCreateResponse =
+ rApi.createService(protoResponse.getResourcePrototype(),
+ localPlatform, name, config);
+
+ hqAssertSuccess(resourceCreateResponse);
+
+ return resourceCreateResponse.getResource();
+ }
+
+ public void testAddRemoveControlAction() throws Exception {
+ HQApi api = getApi();
+ AlertDefinitionApi defApi = api.getAlertDefinitionApi();
+ MetricApi metricApi = api.getMetricApi();
+
+ Resource controllableResource = createControllableResource(api);
+
+ MetricsResponse metricsResponse = metricApi.getMetrics(controllableResource);
+ hqAssertSuccess(metricsResponse);
+ assertTrue("No metrics found for " + controllableResource.getName(),
+ metricsResponse.getMetric().size() > 0);
+ Metric m = metricsResponse.getMetric().get(0);
+
+ AlertDefinition d = generateTestDefinition();
+ d.setResource(controllableResource);
+ d.getAlertCondition().add(
+ AlertDefinitionBuilder.createChangeCondition(true, m.getName()));
+
+ AlertAction action = AlertDefinitionBuilder.createControlAction(controllableResource,
+ "run");
+ d.getAlertAction().add(action);
+
+ List<AlertDefinition> definitions = new ArrayList<AlertDefinition>();
+ definitions.add(d);
+ AlertDefinitionsResponse response = defApi.syncAlertDefinitions(definitions);
+ hqAssertSuccess(response);
+
+ AlertDefinition def = response.getAlertDefinition().get(0);
+ validateDefinition(def);
+ assertEquals("Wrong number of actions found", 1, def.getAlertAction().size());
+ AlertAction syncedAction = def.getAlertAction().get(0);
+ assertEquals("Wrong action class", "com.hyperic.hq.bizapp.server.action.control.ControlAction",
+ syncedAction.getClassName());
+ assertEquals("Wrong number of configuration options",
+ 2, syncedAction.getAlertActionConfig().size());
+
+ // Clear
+ def.getAlertAction().clear();
+ definitions.clear();
+ definitions.add(def);
+
+ response = defApi.syncAlertDefinitions(definitions);
+ hqAssertSuccess(response);
+
+ def = response.getAlertDefinition().get(0);
+ validateDefinition(def);
+ assertEquals("Wrong number of actions found", 0, def.getAlertAction().size());
+
+ // Cleanup
+ cleanup(response.getAlertDefinition());
+
+ ResourceApi rApi = api.getResourceApi();
+ StatusResponse deleteResponse = rApi.deleteResource(controllableResource.getId());
+ hqAssertSuccess(deleteResponse);
+ }
+
+ public void testAddControlActionWrongAction() throws Exception {
+ HQApi api = getApi();
+ AlertDefinitionApi defApi = api.getAlertDefinitionApi();
+ MetricApi metricApi = api.getMetricApi();
+
+ Resource controllableResource = createControllableResource(api);
+
+ MetricsResponse metricsResponse = metricApi.getMetrics(controllableResource);
+ hqAssertSuccess(metricsResponse);
+ assertTrue("No metrics found for " + controllableResource.getName(),
+ metricsResponse.getMetric().size() > 0);
+ Metric m = metricsResponse.getMetric().get(0);
+
+ AlertDefinition d = generateTestDefinition();
+ d.setResource(controllableResource);
+ d.getAlertCondition().add(
+ AlertDefinitionBuilder.createChangeCondition(true, m.getName()));
+
+ AlertAction action = AlertDefinitionBuilder.createControlAction(controllableResource,
+ "nonexistantaction");
+ d.getAlertAction().add(action);
+
+ List<AlertDefinition> definitions = new ArrayList<AlertDefinition>();
+ definitions.add(d);
+ AlertDefinitionsResponse response = defApi.syncAlertDefinitions(definitions);
+ hqAssertSuccess(response);
+
+ AlertDefinition def = response.getAlertDefinition().get(0);
+ validateDefinition(def);
+ assertEquals("Wrong number of actions found", 0, def.getAlertAction().size());
+
+ // Cleanup
+ cleanup(response.getAlertDefinition());
+
+ ResourceApi rApi = api.getResourceApi();
+ StatusResponse deleteResponse = rApi.deleteResource(controllableResource.getId());
+ hqAssertSuccess(deleteResponse);
+ }
+
+ public void testAddControlActionUncontrollableResource() throws Exception {
+ HQApi api = getApi();
+ AlertDefinitionApi defApi = api.getAlertDefinitionApi();
+ MetricApi metricApi = api.getMetricApi();
+
+ Resource platform = getLocalPlatformResource(false, false);
+
+ MetricsResponse metricsResponse = metricApi.getMetrics(platform);
+ hqAssertSuccess(metricsResponse);
+ assertTrue("No metrics found for " + platform.getName(),
+ metricsResponse.getMetric().size() > 0);
+ Metric m = metricsResponse.getMetric().get(0);
+
+ AlertDefinition d = generateTestDefinition();
+ d.setResource(platform);
+ d.getAlertCondition().add(
+ AlertDefinitionBuilder.createChangeCondition(true, m.getName()));
+
+ AlertAction action = AlertDefinitionBuilder.createControlAction(platform,
+ "nonexistantaction");
+ d.getAlertAction().add(action);
+
+ List<AlertDefinition> definitions = new ArrayList<AlertDefinition>();
+ definitions.add(d);
+ AlertDefinitionsResponse response = defApi.syncAlertDefinitions(definitions);
+ hqAssertSuccess(response);
+
+ AlertDefinition def = response.getAlertDefinition().get(0);
+ validateDefinition(def);
+ assertEquals("Wrong number of actions found", 0, def.getAlertAction().size());
+
+ // Cleanup
+ cleanup(response.getAlertDefinition());
+ }
+
+ public void testAddControlActionEmptyConfiguration() throws Exception {
+ HQApi api = getApi();
+ AlertDefinitionApi defApi = api.getAlertDefinitionApi();
+ MetricApi metricApi = api.getMetricApi();
+
+ Resource platform = getLocalPlatformResource(false, false);
+
+ MetricsResponse metricsResponse = metricApi.getMetrics(platform);
+ hqAssertSuccess(metricsResponse);
+ assertTrue("No metrics found for " + platform.getName(),
+ metricsResponse.getMetric().size() > 0);
+ Metric m = metricsResponse.getMetric().get(0);
+
+ AlertDefinition d = generateTestDefinition();
+ d.setResource(platform);
+ d.getAlertCondition().add(
+ AlertDefinitionBuilder.createChangeCondition(true, m.getName()));
+
+ AlertAction action = AlertDefinitionBuilder.createControlAction(platform,
+ "nonexistantaction");
+ // Clear the config
+ action.getAlertActionConfig().clear();
+ d.getAlertAction().add(action);
+
+ List<AlertDefinition> definitions = new ArrayList<AlertDefinition>();
+ definitions.add(d);
+ AlertDefinitionsResponse response = defApi.syncAlertDefinitions(definitions);
+ hqAssertSuccess(response);
+
+ AlertDefinition def = response.getAlertDefinition().get(0);
+ validateDefinition(def);
+ assertEquals("Wrong number of actions found", 0, def.getAlertAction().size());
+
+ // Cleanup
+ cleanup(response.getAlertDefinition());
+ }
+}
View
119 src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncOpenNMSAction_test.java
@@ -0,0 +1,119 @@
+package org.hyperic.hq.hqapi1.test;
+
+import org.hyperic.hq.hqapi1.HQApi;
+import org.hyperic.hq.hqapi1.AlertDefinitionApi;
+import org.hyperic.hq.hqapi1.MetricApi;
+import org.hyperic.hq.hqapi1.AlertDefinitionBuilder;
+import org.hyperic.hq.hqapi1.ResourceApi;
+import org.hyperic.hq.hqapi1.types.Resource;
+import org.hyperic.hq.hqapi1.types.MetricsResponse;
+import org.hyperic.hq.hqapi1.types.Metric;
+import org.hyperic.hq.hqapi1.types.AlertDefinition;
+import org.hyperic.hq.hqapi1.types.AlertAction;
+import org.hyperic.hq.hqapi1.types.AlertDefinitionsResponse;
+import org.hyperic.hq.hqapi1.types.StatusResponse;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public class AlertDefinitionSyncOpenNMSAction_test extends AlertDefinitionTestBase {
+
+ public AlertDefinitionSyncOpenNMSAction_test(String name) {
+ super(name);
+ }
+
+ public void testAddRemoveOpenNMSAction() throws Exception {
+ HQApi api = getApi();
+ AlertDefinitionApi defApi = api.getAlertDefinitionApi();
+ MetricApi metricApi = api.getMetricApi();
+
+ Resource platform = getLocalPlatformResource(false, false);
+
+ MetricsResponse metricsResponse = metricApi.getMetrics(platform);
+ hqAssertSuccess(metricsResponse);
+ assertTrue("No metrics found for " + platform.getName(),
+ metricsResponse.getMetric().size() > 0);
+ Metric m = metricsResponse.getMetric().get(0);
+
+ AlertDefinition d = generateTestDefinition();
+ d.setResource(platform);
+ d.getAlertCondition().add(
+ AlertDefinitionBuilder.createChangeCondition(true, m.getName()));
+
+ AlertAction action = AlertDefinitionBuilder.createOpenNMSAction("127.0.0.1",
+ 9999);
+ d.getAlertAction().add(action);
+
+ List<AlertDefinition> definitions = new ArrayList<AlertDefinition>();
+ definitions.add(d);
+ AlertDefinitionsResponse response = defApi.syncAlertDefinitions(definitions);
+ hqAssertSuccess(response);
+
+ AlertDefinition def = response.getAlertDefinition().get(0);
+ validateDefinition(def);
+ assertEquals("Wrong number of actions found", 1, def.getAlertAction().size());
+ AlertAction syncedAction = def.getAlertAction().get(0);
+ assertEquals("Wrong action class", "org.hyperic.hq.bizapp.server.action.integrate.OpenNMSAction",
+ syncedAction.getClassName());
+ assertEquals("Wrong number of configuration options",
+ 2, syncedAction.getAlertActionConfig().size());
+
+ // Clear
+ def.getAlertAction().clear();
+ definitions.clear();
+ definitions.add(def);
+
+ response = defApi.syncAlertDefinitions(definitions);
+ hqAssertSuccess(response);
+
+ def = response.getAlertDefinition().get(0);
+ validateDefinition(def);
+ assertEquals("Wrong number of actions found", 0, def.getAlertAction().size());
+
+ // Cleanup
+ cleanup(response.getAlertDefinition());
+ }
+
+ public void testAddOpenNMSActionEmptyConfiguration() throws Exception {
+ HQApi api = getApi();
+ AlertDefinitionApi defApi = api.getAlertDefinitionApi();
+ MetricApi metricApi = api.getMetricApi();
+
+ Resource platform = getLocalPlatformResource(false, false);
+
+ MetricsResponse metricsResponse = metricApi.getMetrics(platform);
+ hqAssertSuccess(metricsResponse);
+ assertTrue("No metrics found for " + platform.getName(),
+ metricsResponse.getMetric().size() > 0);
+ Metric m = metricsResponse.getMetric().get(0);
+
+ AlertDefinition d = generateTestDefinition();
+ d.setResource(platform);
+ d.getAlertCondition().add(
+ AlertDefinitionBuilder.createChangeCondition(true, m.getName()));
+
+ AlertAction action = AlertDefinitionBuilder.createOpenNMSAction("127.0.0.1",
+ 9999);
+ // Clear the configuration
+ action.getAlertActionConfig().clear();
+ d.getAlertAction().add(action);
+
+ List<AlertDefinition> definitions = new ArrayList<AlertDefinition>();
+ definitions.add(d);
+ AlertDefinitionsResponse response = defApi.syncAlertDefinitions(definitions);
+ hqAssertSuccess(response);
+
+ AlertDefinition def = response.getAlertDefinition().get(0);
+ validateDefinition(def);
+ assertEquals("Wrong number of actions found", 1, def.getAlertAction().size());
+ AlertAction syncedAction = def.getAlertAction().get(0);
+ assertEquals("Wrong action class", "org.hyperic.hq.bizapp.server.action.integrate.OpenNMSAction",
+ syncedAction.getClassName());
+ assertEquals("Wrong number of configuration options",
+ 0, syncedAction.getAlertActionConfig().size());
+
+
+ // Cleanup
+ cleanup(response.getAlertDefinition());
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.