Skip to content

Commit

Permalink
Merge branch 'wadl'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Morgan committed Jun 25, 2009
2 parents cf0e448 + 1fea10d commit 8314fc3
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -201,7 +201,7 @@
maxmemory="256M"
use="true"
packagenames="org.hyperic.*"
excludepackagenames="org.hyperic.hq.hqapi1.test.*,org.hyperic.hq.hqapi1.examples.*,org.hyperic.hq.hqapi1.tools.*"
excludepackagenames="org.hyperic.hq.hqapi1.test.*,org.hyperic.hq.hqapi1.examples.*,org.hyperic.hq.hqapi1.tools.*,org.hyperic.hq.hqapi1.wadl.*"
windowtitle="Hyperic HQ API">
<sourcepath>
<pathelement location="src"/>
Expand Down
24 changes: 24 additions & 0 deletions src/org/hyperic/hq/hqapi1/test/WADLAgent_test.java
@@ -0,0 +1,24 @@
package org.hyperic.hq.hqapi1.test;

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

public class WADLAgent_test extends WADLTestBase {

public void testAgent() throws Exception {

Endpoint.AgentGetHqu agentGet = new Endpoint.AgentGetHqu();
Endpoint.AgentListHqu agentList = new Endpoint.AgentListHqu();
Endpoint.AgentPingHqu agentPing = new Endpoint.AgentPingHqu();

AgentsResponse agents = agentList.getAsAgentsResponse();
hqAssertSuccess(agents);
assertTrue("No agents found!", agents.getAgent().size() > 0);

Agent a = agents.getAgent().get(0);
AgentResponse agent = agentGet.getAsAgentResponse(a.getId());
hqAssertSuccess(agent);

PingAgentResponse ping = agentPing.getAsPingAgentResponse(a.getId());
hqAssertSuccess(ping);
}
}
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());
}
}
91 changes: 89 additions & 2 deletions xsd/HQApi1.wadl
Expand Up @@ -553,7 +553,7 @@

<wadl:resource path="metric/getGroupData.hqu">
<wadl:doc title="HQApi Metric getGroupData command">
Get MetricData for a MetricTemplate across a compatible Group.
Get MetricData for a MetricTemplate across a compatible Group
</wadl:doc>
<wadl:method name="GET" id="MetricGetGroupData">
<wadl:request>
Expand Down Expand Up @@ -591,7 +591,7 @@

<wadl:resource path="metric/getResourceData.hqu">
<wadl:doc title="HQApi Metric getResourceData command">
Get MetricData for a list of Resource's.
Get MetricData for a list of Resource's
</wadl:doc>
<wadl:method name="GET" id="MetricGetResourceData">
<wadl:request>
Expand Down Expand Up @@ -629,6 +629,93 @@
</wadl:method>
</wadl:resource>

<wadl:resource path="agent/get.hqu">
<wadl:doc title="HQApi Agent get command">
Get an Agent
</wadl:doc>
<wadl:method name="GET" id="AgentGet">
<wadl:request>
<wadl:param name="id" style="query" required="true"
type="xs:int">
<wadl:doc>
The id of the Agent to return.
</wadl:doc>
</wadl:param>
</wadl:request>
<wadl:response>
<wadl:representation mediaType="application/xml"
element="AgentResponse"/>
</wadl:response>
</wadl:method>
</wadl:resource>

<wadl:resource path="agent/list.hqu">
<wadl:doc title="HQApi Agent list command">
List all Agents
</wadl:doc>
<wadl:method name="GET" id="AgentList">
<wadl:request/>
<wadl:response>
<wadl:representation mediaType="application/xml"
element="AgentsResponse"/>
</wadl:response>
</wadl:method>
</wadl:resource>

<wadl:resource path="agent/ping.hqu">
<wadl:doc title="HQApi Agent ping command">
Ping an Agent
</wadl:doc>
<wadl:method name="GET" id="AgentPing">
<wadl:request>
<wadl:param name="id" style="query" required="true"
type="xs:int">
<wadl:doc>
The id of the Agent to ping.
</wadl:doc>
</wadl:param>
</wadl:request>
<wadl:response>
<wadl:representation mediaType="application/xml"
element="PingAgentResponse"/>
</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 8314fc3

Please sign in to comment.