Skip to content

Commit

Permalink
[HE-400] Add additional validation for the create and modify time
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Nguyen committed Feb 11, 2010
1 parent 000ef2b commit 90fefde
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
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
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 90fefde

Please sign in to comment.