From: <rm...@hy...> - 2009-01-15 04:11:38
|
Author: rmorgan Date: 2009-01-14 20:11:31 -0800 (Wed, 14 Jan 2009) New Revision: 457 URL: http://svn.hyperic.org/?view=rev&root=HQApi&revision=457 Modified: trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSync_test.java trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java Log: Add methods to clean up test alert definitions. Modified: trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSync_test.java =================================================================== --- trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSync_test.java 2009-01-15 03:11:31 UTC (rev 456) +++ trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSync_test.java 2009-01-15 04:11:31 UTC (rev 457) @@ -189,6 +189,9 @@ for (AlertDefinition def : response.getAlertDefinition()) { validateDefinition(def); } + + // Cleanup + cleanup(response.getAlertDefinition()); } public void testSyncCountAndRange() throws Exception { @@ -209,6 +212,9 @@ for (AlertDefinition def : response.getAlertDefinition()) { validateDefinition(def); } + + // Cleanup + cleanup(response.getAlertDefinition()); } // AlertCondition tests Modified: trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java =================================================================== --- trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java 2009-01-15 03:11:31 UTC (rev 456) +++ trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java 2009-01-15 04:11:31 UTC (rev 457) @@ -1,7 +1,12 @@ package org.hyperic.hq.hqapi1.test; +import org.hyperic.hq.hqapi1.AlertDefinitionApi; import org.hyperic.hq.hqapi1.types.AlertDefinition; +import org.hyperic.hq.hqapi1.types.StatusResponse; +import java.io.IOException; +import java.util.List; + public class AlertDefinitionTestBase extends HQApiTestBase { public AlertDefinitionTestBase(String name) { @@ -15,4 +20,13 @@ assertTrue("Invalid priority " + d.getPriority(), d.getPriority() >= 1 & d.getPriority() <= 3); } + + protected void cleanup(List<AlertDefinition> definitions) throws IOException { + + AlertDefinitionApi api = getApi().getAlertDefinitionApi(); + for (AlertDefinition d : definitions) { + StatusResponse deleteResponse = api.deleteAlertDefinition(d.getId()); + hqAssertSuccess(deleteResponse); + } + } } |