From 1fea10d44cf516564f1241998de0994784a7601c Mon Sep 17 00:00:00 2001 From: Ryan Morgan Date: Thu, 25 Jun 2009 12:57:44 -0700 Subject: [PATCH] Add WADL resource definitions for AutodiscoveryApi. --- .../hqapi1/test/WADLAutodiscovery_test.java | 24 +++++++++++++ .../hyperic/hq/hqapi1/test/WADLTestBase.java | 7 ++++ xsd/HQApi1.wadl | 36 ++++++++++++++++++- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/org/hyperic/hq/hqapi1/test/WADLAutodiscovery_test.java diff --git a/src/org/hyperic/hq/hqapi1/test/WADLAutodiscovery_test.java b/src/org/hyperic/hq/hqapi1/test/WADLAutodiscovery_test.java new file mode 100644 index 00000000..aa2bf82e --- /dev/null +++ b/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. + } +} diff --git a/src/org/hyperic/hq/hqapi1/test/WADLTestBase.java b/src/org/hyperic/hq/hqapi1/test/WADLTestBase.java index 0aa4be94..d0e37240 100644 --- a/src/org/hyperic/hq/hqapi1/test/WADLTestBase.java +++ b/src/org/hyperic/hq/hqapi1/test/WADLTestBase.java @@ -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()); + } } diff --git a/xsd/HQApi1.wadl b/xsd/HQApi1.wadl index 7fe5bd6d..7fcb38ad 100644 --- a/xsd/HQApi1.wadl +++ b/xsd/HQApi1.wadl @@ -681,7 +681,41 @@ - + + + + List the Autodiscovery queue + + + + + + + + + + + + Approve a platform Resource into the inventory + + + + + + The id of the platform Resource to approve. + + + + + + + + + +