Skip to content

Commit

Permalink
Merge branch 'hqapi-1.0' into hqapi-2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Morgan committed Sep 25, 2009
2 parents 3700c0e + ec8b5e3 commit 10cd7d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 49 deletions.
4 changes: 2 additions & 2 deletions hqu/hqapi1/app/ApplicationController.groovy
Expand Up @@ -78,7 +78,7 @@ class ApplicationController extends ApiController {
ApplicationResponse() {
out << getFailureXML(ErrorCode.INVALID_PARAMETERS,
"Invalid resource passed to create, " +
r.name + " is not a service")
resource.name + " is not a service")
}
}
return
Expand Down Expand Up @@ -168,7 +168,7 @@ class ApplicationController extends ApiController {
ApplicationResponse() {
out << getFailureXML(ErrorCode.INVALID_PARAMETERS,
"Invalid resource passed to create, " +
r.name + " is not a service")
resource.name + " is not a service")
}
}
return
Expand Down
47 changes: 0 additions & 47 deletions src/org/hyperic/hq/hqapi1/test/ApplicationTestBase.java
Expand Up @@ -3,14 +3,7 @@
import org.hyperic.hq.hqapi1.types.Application;
import org.hyperic.hq.hqapi1.types.ApplicationResponse;
import org.hyperic.hq.hqapi1.types.Resource;
import org.hyperic.hq.hqapi1.types.Group;
import org.hyperic.hq.hqapi1.types.ResourcePrototypeResponse;
import org.hyperic.hq.hqapi1.types.ResourcesResponse;
import org.hyperic.hq.hqapi1.types.GroupResponse;
import org.hyperic.hq.hqapi1.ApplicationApi;
import org.hyperic.hq.hqapi1.HQApi;
import org.hyperic.hq.hqapi1.GroupApi;
import org.hyperic.hq.hqapi1.ResourceApi;

import java.util.Random;
import java.util.List;
Expand Down Expand Up @@ -89,44 +82,4 @@ protected Application createTestApplication(List<Resource> services)

return response.getApplication();
}

/**
* Create a compabile group of the given prototype that includes all
* resources of that type in the inventory.
*
* @param prototype The type of compatible group to create.
* @return The created Group
* @throws Exception If an error occurs creating the group
*/
protected Group createTestCompatibleGroup(String prototype) throws Exception {
HQApi api = getApi();
GroupApi groupApi = api.getGroupApi();
ResourceApi rApi = api.getResourceApi();

ResourcePrototypeResponse protoResponse =
rApi.getResourcePrototype(prototype);
hqAssertSuccess(protoResponse);

ResourcesResponse resourcesResponse =
rApi.getResources(protoResponse.getResourcePrototype(),
false, false);
hqAssertSuccess(resourcesResponse);

assertTrue("No resources of type " + prototype + " found!",
resourcesResponse.getResource().size() > 0);

Group g = new Group();
Random r = new Random();

g.setName(GROUP_NAME + r.nextInt());
g.setDescription(GROUP_DESCRIPTION);
g.setLocation(GROUP_LOCATION);
g.setResourcePrototype(protoResponse.getResourcePrototype());
g.getResource().addAll(resourcesResponse.getResource());

GroupResponse groupResponse = groupApi.createGroup(g);
hqAssertSuccess(groupResponse);

return groupResponse.getGroup();
}
}

0 comments on commit 10cd7d4

Please sign in to comment.