Permalink
Browse files

improved create and delete tests

  • Loading branch information...
1 parent 25cf0d7 commit da1e96cd9a0b026ef73d7ff2b336f7e2f7282966 trisberg committed Sep 17, 2009
@@ -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());
}
}
@@ -2,20 +2,37 @@
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 {
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
}
}

0 comments on commit da1e96c

Please sign in to comment.