Skip to content

Commit

Permalink
Add WADL resource definitions for AutodiscoveryApi.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Morgan committed Jun 25, 2009
1 parent 171aab9 commit 1fea10d
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
24 changes: 24 additions & 0 deletions src/org/hyperic/hq/hqapi1/test/WADLAutodiscovery_test.java
@@ -0,0 +1,24 @@
package org.hyperic.hq.hqapi1.test;

import org.hyperic.hq.hqapi1.wadl.*;

public class WADLAutodiscovery_test extends WADLTestBase {

public void testGetQueue() throws Exception {

Endpoint.AutodiscoveryGetQueueHqu adGetQueue =
new Endpoint.AutodiscoveryGetQueueHqu();

QueueResponse queue = adGetQueue.getAsQueueResponse();
hqAssertSuccess(queue);
}

public void testApprove() throws Exception {

Endpoint.AutodiscoveryApproveHqu adApprove =
new Endpoint.AutodiscoveryApproveHqu();

StatusResponse approve = adApprove.getAsStatusResponse(Integer.MAX_VALUE);
hqAssertFailure(approve); // That id won't exist, just testing endpoints.
}
}
7 changes: 7 additions & 0 deletions src/org/hyperic/hq/hqapi1/test/WADLTestBase.java
Expand Up @@ -27,4 +27,11 @@ void hqAssertSuccess(Response response) {
response.getError().getReasonText() : "";
assertEquals(error, ResponseStatus.SUCCESS, response.getStatus());
}

// Assert FAILURE
void hqAssertFailure(Response response) {
String error = (response.getError() != null) ?
response.getError().getReasonText() : "";
assertEquals(error, ResponseStatus.FAILURE, response.getStatus());
}
}
36 changes: 35 additions & 1 deletion xsd/HQApi1.wadl
Expand Up @@ -681,7 +681,41 @@
</wadl:response>
</wadl:method>
</wadl:resource>


<wadl:resource path="autodiscovery/getQueue.hqu">
<wadl:doc title="HQApi Agent list command">
List the Autodiscovery queue
</wadl:doc>
<wadl:method name="GET" id="AutodiscoveryGetQueue">
<wadl:request/>
<wadl:response>
<wadl:representation mediaType="application/xml"
element="QueueResponse"/>
</wadl:response>
</wadl:method>
</wadl:resource>

<wadl:resource path="autodiscovery/approve.hqu">
<wadl:doc title="HQApi Autodiscovery approve command">
Approve a platform Resource into the inventory
</wadl:doc>
<wadl:method name="GET" id="AutodiscoveryApprove">
<wadl:request>
<wadl:param name="id" style="query" required="true"
type="xs:int">
<wadl:doc>
The id of the platform Resource to approve.
</wadl:doc>
</wadl:param>
</wadl:request>
<wadl:response>
<wadl:representation mediaType="application/xml"
element="StatusResponse"/>
</wadl:response>
</wadl:method>
</wadl:resource>


</wadl:resources>

</wadl:application>

0 comments on commit 1fea10d

Please sign in to comment.