Skip to content

Commit

Permalink
improved the create application test
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Risberg authored and Thomas Risberg committed Sep 24, 2009
1 parent a9cbe46 commit 77eec69
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/org/hyperic/hq/hqapi1/test/ApplicationCreate_test.java
Expand Up @@ -14,7 +14,6 @@ public ApplicationCreate_test(String name) {
super(name);
}

// TODO: Stub
public void testApplicationCreate() throws Exception {

ApplicationApi api = getApi().getApplicationApi();
Expand All @@ -30,21 +29,26 @@ public void testApplicationCreate() throws Exception {
Agent agent = getRunningAgent();

ResourceApi resourceApi = getApi().getResourceApi();
AgentApi agentApi = getApi().getAgentApi();
GroupApi groupApi = getApi().getGroupApi();

// TODO: This actually creates a mixed group for "Platforms, Servers & Service resource types."
// It still works for adding "Application resource types." using the API but not the GUI
Group group = new Group();
group.setName("An Application Group");
group.setDescription("Application Test Group");
group.setLocation("Anywhere");
GroupResponse newGroup = groupApi.createGroup(group);

GroupsResponse grpResponse = groupApi.getMixedGroups();
List<Group> groups = a.getGroup();
for (Group g : grpResponse.getGroup()) {
System.out.println("GROUP: " + g.getDescription() + " :: " + g.getResource());
// TODO: need a better way of finding App groups - maybe create one?
System.out.println("GROUP: " + g.getDescription() + " :: " + g.getResourcePrototype());
if (g.getDescription().contains("Application")) {
System.out.println("+> " + g.getId() + " " + g.getName());
groups.add(g);
}
}

ResourcePrototypeResponse rp = resourceApi.getResourcePrototype("");
ResourcesResponse findResponse = resourceApi.getResources(agent, true, true);
hqAssertSuccess(findResponse);

Expand All @@ -54,7 +58,6 @@ public void testApplicationCreate() throws Exception {
Resource toAdd1 = null;
Resource toAdd2 = null;
for (Resource r : findResponse.getResource().get(0).getResource()) {
boolean done = false;
System.out.println("RESOURCE: " + r.getDescription() + " :: " + r.getResourcePrototype().getName());
for (Resource r2 : r.getResource()) {
System.out.println("+> " + r2.getId() + " " + r2.getName());
Expand Down Expand Up @@ -83,5 +86,6 @@ public void testApplicationCreate() throws Exception {
hqAssertSuccess(response);

api.deleteApplication(response.getApplication().getId());
groupApi.deleteGroup(newGroup.getGroup().getId().intValue());
}
}

0 comments on commit 77eec69

Please sign in to comment.