From 000ef2b8cf45e6da6f154dbc6b06636d7e88cc4c Mon Sep 17 00:00:00 2001 From: Patrick Nguyen Date: Thu, 11 Feb 2010 14:32:50 -0800 Subject: [PATCH 1/3] Add back "single-test" target to run a single test from the command line --- build.xml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index fb700fb3..374d3311 100644 --- a/build.xml +++ b/build.xml @@ -143,6 +143,16 @@ + + + + + + + + + @@ -157,8 +167,12 @@ - - + + + + From 90fefde97207741382efec2cf234771fcdf4e50d Mon Sep 17 00:00:00 2001 From: Patrick Nguyen Date: Thu, 11 Feb 2010 14:35:10 -0800 Subject: [PATCH 2/3] [HE-400] Add additional validation for the create and modify time --- hqu/hqapi1/app/AlertdefinitionController.groovy | 4 +++- src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java | 4 ++++ xsd/HQApi1.xsd | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hqu/hqapi1/app/AlertdefinitionController.groovy b/hqu/hqapi1/app/AlertdefinitionController.groovy index c00aa94d..0e6e4b2e 100644 --- a/hqu/hqapi1/app/AlertdefinitionController.groovy +++ b/hqu/hqapi1/app/AlertdefinitionController.groovy @@ -66,7 +66,9 @@ public class AlertdefinitionController extends ApiController { range: d.range, willRecover: d.willRecover, notifyFiltered: d.notifyFiltered, - controlFiltered: d.controlFiltered] + controlFiltered: d.controlFiltered, + ctime: d.ctime, + mtime: d.mtime] if (!excludeIds) { attrs['id'] = d.id diff --git a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java index 2921147d..17aa03de 100644 --- a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java +++ b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java @@ -59,6 +59,10 @@ protected void validateDefinition(AlertDefinition d) { d.getFrequency() >= 0 && d.getFrequency() <= 4); assertTrue("Invalid priority " + d.getPriority(), d.getPriority() >= 1 & d.getPriority() <= 3); + assertTrue("Create time must be greater than 0", + d.getCtime() > 0); + assertTrue("Modify time must be greater than 0", + d.getMtime() > 0); } protected void cleanup(List definitions) throws IOException { diff --git a/xsd/HQApi1.xsd b/xsd/HQApi1.xsd index d8c6ad0f..2aa6e8ce 100644 --- a/xsd/HQApi1.xsd +++ b/xsd/HQApi1.xsd @@ -803,6 +803,8 @@ + + From e5f92e018467eab0b2008febdabef5c1f06e9154 Mon Sep 17 00:00:00 2001 From: Patrick Nguyen Date: Fri, 12 Feb 2010 11:02:25 -0800 Subject: [PATCH 3/3] Validate the alert definition from the response (backport from master 1d1e8faf5e5d67d882c2f234f88827f7ca685d55) --- .../test/AlertDefinitionSyncBaselineCondition_test.java | 4 ++-- .../test/AlertDefinitionSyncConfigCondition_test.java | 6 +++--- .../test/AlertDefinitionSyncControlCondition_test.java | 4 ++-- .../hqapi1/test/AlertDefinitionSyncLogCondition_test.java | 4 ++-- .../test/AlertDefinitionSyncMetricChangeCondition_test.java | 4 ++-- .../test/AlertDefinitionSyncPropertyCondition_test.java | 4 ++-- .../test/AlertDefinitionSyncThresholdCondition_test.java | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncBaselineCondition_test.java b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncBaselineCondition_test.java index ffed4815..59458526 100644 --- a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncBaselineCondition_test.java +++ b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncBaselineCondition_test.java @@ -79,7 +79,7 @@ public void testValidBaselineConditon() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.BASELINE.getType()); @@ -125,7 +125,7 @@ public void testValidBaselineConditonTypeAlert() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.BASELINE.getType()); diff --git a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncConfigCondition_test.java b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncConfigCondition_test.java index bbd9ce71..2b854be7 100644 --- a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncConfigCondition_test.java +++ b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncConfigCondition_test.java @@ -64,7 +64,7 @@ public void testValidConfigCondition() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.CONFIG_CHANGE.getType()); @@ -95,7 +95,7 @@ public void testValidConfigConditionTypeAlert() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.CONFIG_CHANGE.getType()); @@ -126,7 +126,7 @@ public void testConfigConditionOptionalAttribute() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.CONFIG_CHANGE.getType()); diff --git a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncControlCondition_test.java b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncControlCondition_test.java index c73afeb6..7f14704c 100644 --- a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncControlCondition_test.java +++ b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncControlCondition_test.java @@ -67,7 +67,7 @@ public void testValidControlConditon() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.CONTROL.getType()); @@ -101,7 +101,7 @@ public void testValidControlConditonTypeAlert() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.CONTROL.getType()); diff --git a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncLogCondition_test.java b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncLogCondition_test.java index 5f74640f..e40ef65f 100644 --- a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncLogCondition_test.java +++ b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncLogCondition_test.java @@ -65,7 +65,7 @@ public void testValidPropertyConditon() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.LOG.getType()); @@ -97,7 +97,7 @@ public void testValidPropertyConditonTypeAlert() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.LOG.getType()); diff --git a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncMetricChangeCondition_test.java b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncMetricChangeCondition_test.java index d04aaff4..69d3002d 100644 --- a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncMetricChangeCondition_test.java +++ b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncMetricChangeCondition_test.java @@ -73,7 +73,7 @@ public void testValidMetricChangeConditon() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.METRIC_CHANGE.getType()); @@ -110,7 +110,7 @@ public void testValidMetricChangeConditonTypeAlert() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.METRIC_CHANGE.getType()); diff --git a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncPropertyCondition_test.java b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncPropertyCondition_test.java index b2f96f21..e002e420 100644 --- a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncPropertyCondition_test.java +++ b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncPropertyCondition_test.java @@ -64,7 +64,7 @@ public void testValidPropertyConditon() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getProperty(), PROP_NAME); @@ -94,7 +94,7 @@ public void testValidPropertyConditonTypeAlert() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getProperty(), PROP_NAME); diff --git a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncThresholdCondition_test.java b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncThresholdCondition_test.java index 4f6b849d..a7ee98a4 100644 --- a/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncThresholdCondition_test.java +++ b/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncThresholdCondition_test.java @@ -77,7 +77,7 @@ public void testValidThresholdConditon() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.THRESHOLD.getType()); @@ -120,7 +120,7 @@ public void testValidThresholdConditonTypeAlert() throws Exception { hqAssertSuccess(response); for (AlertDefinition def : response.getAlertDefinition()) { - validateDefinition(d); + validateDefinition(def); for (AlertCondition c : def.getAlertCondition()) { assertNotNull("Condition was null", c); assertEquals(c.getType(), AlertConditionType.THRESHOLD.getType());