Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improved create and delete tests

  • Loading branch information...
commit da1e96cd9a0b026ef73d7ff2b336f7e2f7282966 1 parent 25cf0d7
trisberg authored
View
4 src/org/hyperic/hq/hqapi1/test/ApplicationCreate_test.java
@@ -17,7 +17,7 @@ public void testApplicationCreate() throws Exception {
Application a = new Application();
a.setName("A new app");
- a.setLocation("Doylestown");
+ a.setLocation("Tahiti");
a.setDescription("A test app created using the API");
a.setEngContact("the Engineer");
a.setBizContact("the Businessman");
@@ -27,6 +27,6 @@ public void testApplicationCreate() throws Exception {
hqAssertSuccess(response);
- System.out.println("NEW APP: " + response.getApplication().getId());
+ api.deleteApplication(response.getApplication().getId());
}
}
View
23 src/org/hyperic/hq/hqapi1/test/ApplicationDelete_test.java
@@ -2,6 +2,8 @@
import org.hyperic.hq.hqapi1.ApplicationApi;
import org.hyperic.hq.hqapi1.types.StatusResponse;
+import org.hyperic.hq.hqapi1.types.Application;
+import org.hyperic.hq.hqapi1.types.ApplicationResponse;
public class ApplicationDelete_test extends HQApiTestBase {
@@ -9,13 +11,28 @@ public ApplicationDelete_test(String name) {
super(name);
}
- // TODO: Stub
- public void testDelete() throws Exception {
+ public void testDeleteExistingApp() throws Exception {
+ ApplicationApi api = getApi().getApplicationApi();
+
+ Application a = new Application();
+ a.setName("App to delete");
+ a.setLocation("Hawaii");
+ a.setDescription("A test app created using the API");
+ a.setEngContact("the Engineer");
+ a.setBizContact("the Businessman");
+ a.setOpsContact("the Ops Man");
+ ApplicationResponse appResponse = api.createApplication(a);
+
+ StatusResponse response = api.deleteApplication(appResponse.getApplication().getId());
+ hqAssertSuccess(response);
+
+ }
+
+ public void testDeleteNonExistingApp() throws Exception {
ApplicationApi api = getApi().getApplicationApi();
StatusResponse response = api.deleteApplication(Integer.MAX_VALUE);
hqAssertFailureObjectNotFound(response);
- // TODO: add application and then delete it
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.