Skip to content

Commit 1fea10d

Browse files
author
Ryan Morgan
committed
Add WADL resource definitions for AutodiscoveryApi.
1 parent 171aab9 commit 1fea10d

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.hyperic.hq.hqapi1.test;
2+
3+
import org.hyperic.hq.hqapi1.wadl.*;
4+
5+
public class WADLAutodiscovery_test extends WADLTestBase {
6+
7+
public void testGetQueue() throws Exception {
8+
9+
Endpoint.AutodiscoveryGetQueueHqu adGetQueue =
10+
new Endpoint.AutodiscoveryGetQueueHqu();
11+
12+
QueueResponse queue = adGetQueue.getAsQueueResponse();
13+
hqAssertSuccess(queue);
14+
}
15+
16+
public void testApprove() throws Exception {
17+
18+
Endpoint.AutodiscoveryApproveHqu adApprove =
19+
new Endpoint.AutodiscoveryApproveHqu();
20+
21+
StatusResponse approve = adApprove.getAsStatusResponse(Integer.MAX_VALUE);
22+
hqAssertFailure(approve); // That id won't exist, just testing endpoints.
23+
}
24+
}

src/org/hyperic/hq/hqapi1/test/WADLTestBase.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,11 @@ void hqAssertSuccess(Response response) {
2727
response.getError().getReasonText() : "";
2828
assertEquals(error, ResponseStatus.SUCCESS, response.getStatus());
2929
}
30+
31+
// Assert FAILURE
32+
void hqAssertFailure(Response response) {
33+
String error = (response.getError() != null) ?
34+
response.getError().getReasonText() : "";
35+
assertEquals(error, ResponseStatus.FAILURE, response.getStatus());
36+
}
3037
}

xsd/HQApi1.wadl

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,41 @@
681681
</wadl:response>
682682
</wadl:method>
683683
</wadl:resource>
684-
684+
685+
<wadl:resource path="autodiscovery/getQueue.hqu">
686+
<wadl:doc title="HQApi Agent list command">
687+
List the Autodiscovery queue
688+
</wadl:doc>
689+
<wadl:method name="GET" id="AutodiscoveryGetQueue">
690+
<wadl:request/>
691+
<wadl:response>
692+
<wadl:representation mediaType="application/xml"
693+
element="QueueResponse"/>
694+
</wadl:response>
695+
</wadl:method>
696+
</wadl:resource>
697+
698+
<wadl:resource path="autodiscovery/approve.hqu">
699+
<wadl:doc title="HQApi Autodiscovery approve command">
700+
Approve a platform Resource into the inventory
701+
</wadl:doc>
702+
<wadl:method name="GET" id="AutodiscoveryApprove">
703+
<wadl:request>
704+
<wadl:param name="id" style="query" required="true"
705+
type="xs:int">
706+
<wadl:doc>
707+
The id of the platform Resource to approve.
708+
</wadl:doc>
709+
</wadl:param>
710+
</wadl:request>
711+
<wadl:response>
712+
<wadl:representation mediaType="application/xml"
713+
element="StatusResponse"/>
714+
</wadl:response>
715+
</wadl:method>
716+
</wadl:resource>
717+
718+
685719
</wadl:resources>
686720

687721
</wadl:application>

0 commit comments

Comments
 (0)