From: <rm...@hy...> - 2009-01-15 04:24:23
|
Author: rmorgan Date: 2009-01-14 20:24:11 -0800 (Wed, 14 Jan 2009) New Revision: 459 URL: http://svn.hyperic.org/?view=rev&root=HQApi&revision=459 Modified: trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSync_test.java Log: Add test for syncing many defs. Modified: trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSync_test.java =================================================================== --- trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSync_test.java 2009-01-15 04:20:32 UTC (rev 458) +++ trunk/src/org/hyperic/hq/hqapi1/test/AlertDefinitionSync_test.java 2009-01-15 04:24:11 UTC (rev 459) @@ -173,6 +173,30 @@ cleanup(response.getAlertDefinition()); } + public void testSyncMulti() throws Exception { + AlertDefinitionApi api = getApi().getAlertDefinitionApi(); + Resource platform = getLocalPlatformResource(false, false); + + final int NUM_DEFS = 10; + List<AlertDefinition> definitions = new ArrayList<AlertDefinition>(); + for (int i = 0; i < NUM_DEFS; i++) { + AlertDefinition d = createTestDefinition(); + d.setResourcePrototype(platform.getResourcePrototype()); + d.getAlertCondition().add(AlertDefinitionBuilder.createPropertyCondition(true, "myProp")); + definitions.add(d); + } + + AlertDefinitionsResponse response = api.syncAlertDefinitions(definitions); + hqAssertSuccess(response); + assertEquals(response.getAlertDefinition().size(), NUM_DEFS); + for (AlertDefinition def : response.getAlertDefinition()) { + validateDefinition(def); + } + + // Cleanup + cleanup(response.getAlertDefinition()); + } + // Escalation tests public void testSyncInvalidEscalation() throws Exception { |