Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'evolution' of github.com:hyperic/hqapi into evolution
  • Loading branch information
Jennifer Hickey committed Feb 27, 2010
2 parents f9e96b3 + e5f92e0 commit 5479e69
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 18 deletions.
18 changes: 16 additions & 2 deletions build.xml
Expand Up @@ -143,6 +143,16 @@

</target>

<!-- Run a single test -->
<target name="single-test">
<fail message="Must specify a test case system property: -Dtestcase=org.hyperic.My_test"
unless="testcase"/>
<echo message="Running Single Test: ${testcase}"/>
<antcall target="test">
<param name="single.test" value="true" />
</antcall>
</target>

<!-- Run the full test suite -->
<target name="test" depends="compile">
<mkdir dir="${build.dir}/testresults"/>
Expand All @@ -157,8 +167,12 @@
<sysproperty key="clover.server" value="true"/>
<classpath refid="all.classpath"/>
<formatter type="xml"/>

<batchtest fork="no" todir="${build.dir}/testresults">

<test name="${testcase}" todir="${build.dir}/testresults"
if="single.test" />

<batchtest fork="no" todir="${build.dir}/testresults"
unless="single.test">
<fileset dir="${build.dir}/classes">
<include name="**/*_test.class"/>
<!-- temp exclude until we re-enable SSL -->
Expand Down
4 changes: 3 additions & 1 deletion hqu/hqapi1/app/AlertdefinitionController.groovy
Expand Up @@ -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
Expand Down
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
4 changes: 4 additions & 0 deletions src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java
Expand Up @@ -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<AlertDefinition> definitions) throws IOException {
Expand Down
2 changes: 2 additions & 0 deletions xsd/HQApi1.xsd
Expand Up @@ -803,6 +803,8 @@
<xs:attribute name="description" type="xs:string" use="required" />
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="id" type="xs:int" use="optional" />
<xs:attribute name="ctime" type="xs:long" use="optional" />
<xs:attribute name="mtime" type="xs:long" use="optional" />
</xs:complexType>

<xs:element name="AlertDefinitionResponse">
Expand Down

0 comments on commit 5479e69

Please sign in to comment.