Skip to content

Commit

Permalink
Clean up response objects, remove redundancy from CLI command names.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Morgan committed Jul 8, 2009
1 parent a7f11e2 commit 699835b
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion hqu/hqapi1/app/ServerconfigController.groovy
Expand Up @@ -10,7 +10,7 @@ class ServerconfigController extends ApiController {
def props = _serverMan.config

renderXml() {
ServerConfigsResponse() {
ServerConfigResponse() {
if (!user.isSuperUser()) {
out << getFailureXML(ErrorCode.PERMISSION_DENIED,
"User " + user.name + " is not superuser")
Expand Down
6 changes: 3 additions & 3 deletions src/org/hyperic/hq/hqapi1/ServerConfigApi.java
@@ -1,6 +1,6 @@
package org.hyperic.hq.hqapi1;

import org.hyperic.hq.hqapi1.types.ServerConfigsResponse;
import org.hyperic.hq.hqapi1.types.ServerConfigResponse;
import org.hyperic.hq.hqapi1.types.ServerConfig;
import org.hyperic.hq.hqapi1.types.ServerConfigRequest;
import org.hyperic.hq.hqapi1.types.StatusResponse;
Expand All @@ -26,9 +26,9 @@ public class ServerConfigApi extends BaseApi {
*
* @throws IOException If a network error occurs while making the request.
*/
public ServerConfigsResponse getConfig() throws IOException {
public ServerConfigResponse getConfig() throws IOException {
return doGet("serverconfig/getConfig.hqu", new HashMap<String, String[]>(),
ServerConfigsResponse.class);
ServerConfigResponse.class);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/org/hyperic/hq/hqapi1/test/ServerConfigGet_test.java
Expand Up @@ -3,7 +3,7 @@
import org.hyperic.hq.hqapi1.ServerConfigApi;
import org.hyperic.hq.hqapi1.HQApi;
import org.hyperic.hq.hqapi1.UserApi;
import org.hyperic.hq.hqapi1.types.ServerConfigsResponse;
import org.hyperic.hq.hqapi1.types.ServerConfigResponse;
import org.hyperic.hq.hqapi1.types.User;
import org.hyperic.hq.hqapi1.types.StatusResponse;
import org.hyperic.hq.hqapi1.types.UserResponse;
Expand All @@ -20,7 +20,7 @@ public void testGetConfig() throws Exception {

ServerConfigApi sApi = getApi().getServerConfigApi();

ServerConfigsResponse response = sApi.getConfig();
ServerConfigResponse response = sApi.getConfig();
hqAssertSuccess(response);
assertTrue("No server configuration settings found",
response.getServerConfig().size() > 0);
Expand All @@ -46,7 +46,7 @@ public void testGetConfigInvalidUser() throws Exception {

ServerConfigApi sApi = getApi(user.getName(), "test").getServerConfigApi();

ServerConfigsResponse response = sApi.getConfig();
ServerConfigResponse response = sApi.getConfig();
hqAssertFailurePermissionDenied(response);

// Cleanup
Expand Down
8 changes: 4 additions & 4 deletions src/org/hyperic/hq/hqapi1/test/ServerConfigSet_test.java
Expand Up @@ -2,7 +2,7 @@

import org.hyperic.hq.hqapi1.ServerConfigApi;
import org.hyperic.hq.hqapi1.HQApi;
import org.hyperic.hq.hqapi1.types.ServerConfigsResponse;
import org.hyperic.hq.hqapi1.types.ServerConfigResponse;
import org.hyperic.hq.hqapi1.types.StatusResponse;
import org.hyperic.hq.hqapi1.types.User;
import org.hyperic.hq.hqapi1.types.UserResponse;
Expand All @@ -22,7 +22,7 @@ public void testSetAllConfig() throws Exception {

ServerConfigApi sApi = getApi().getServerConfigApi();

ServerConfigsResponse configResponse = sApi.getConfig();
ServerConfigResponse configResponse = sApi.getConfig();
hqAssertSuccess(configResponse);

StatusResponse response = sApi.setConfig(configResponse.getServerConfig());
Expand All @@ -33,7 +33,7 @@ public void testSetSingleConfig() throws Exception {

ServerConfigApi sApi = getApi().getServerConfigApi();

ServerConfigsResponse configResponse = sApi.getConfig();
ServerConfigResponse configResponse = sApi.getConfig();
hqAssertSuccess(configResponse);

List<ServerConfig> configs = configResponse.getServerConfig();
Expand Down Expand Up @@ -91,7 +91,7 @@ public void testSetConfigInvalidUser() throws Exception {
api.getUserApi().createUser(user, "test"); // Create test user w/o Admin
hqAssertSuccess(userCreateResponse);

ServerConfigsResponse response = api.getServerConfigApi().getConfig();
ServerConfigResponse response = api.getServerConfigApi().getConfig();
hqAssertSuccess(response);

// Re-sync with invalid user
Expand Down
4 changes: 2 additions & 2 deletions src/org/hyperic/hq/hqapi1/test/WADLServerConfig_test.java
Expand Up @@ -8,7 +8,7 @@ public void testGet() throws Exception {
Endpoint.ServerConfigGetConfigHqu get =
new Endpoint.ServerConfigGetConfigHqu();

ServerConfigsResponse response = get.getAsServerConfigsResponse();
ServerConfigResponse response = get.getAsServerConfigResponse();
hqAssertSuccess(response);
}

Expand All @@ -18,7 +18,7 @@ public void testSet() throws Exception {
Endpoint.ServerConfigSetConfigHqu set =
new Endpoint.ServerConfigSetConfigHqu();

ServerConfigsResponse response = get.getAsServerConfigsResponse();
ServerConfigResponse response = get.getAsServerConfigResponse();
hqAssertSuccess(response);

ServerConfigRequest request = new ServerConfigRequest();
Expand Down
18 changes: 9 additions & 9 deletions src/org/hyperic/hq/hqapi1/tools/ServerConfigCommand.java
Expand Up @@ -10,16 +10,16 @@
import org.hyperic.hq.hqapi1.HQApi;
import org.hyperic.hq.hqapi1.XmlUtil;
import org.hyperic.hq.hqapi1.ServerConfigApi;
import org.hyperic.hq.hqapi1.types.ServerConfigsResponse;
import org.hyperic.hq.hqapi1.types.ServerConfigResponse;
import org.hyperic.hq.hqapi1.types.ServerConfig;
import org.hyperic.hq.hqapi1.types.StatusResponse;

public class ServerConfigCommand extends Command {

private static String CMD_GET = "getConfig";
private static String CMD_GET_PARAMETER = "getConfigParameter";
private static String CMD_SET = "setConfig";
private static String CMD_SET_PARAMETER = "setConfigParameter";
private static String CMD_GET = "get";
private static String CMD_GET_PARAMETER = "getParameter";
private static String CMD_SET = "set";
private static String CMD_SET_PARAMETER = "setParameter";

private static String[] COMMANDS = { CMD_GET, CMD_GET_PARAMETER,
CMD_SET, CMD_SET_PARAMETER};
Expand Down Expand Up @@ -60,7 +60,7 @@ private void get(String[] args) throws Exception {
HQApi api = getApi(options);
ServerConfigApi configApi = api.getServerConfigApi();

ServerConfigsResponse response = configApi.getConfig();
ServerConfigResponse response = configApi.getConfig();
checkSuccess(response);

XmlUtil.serialize(response, System.out, Boolean.TRUE);
Expand All @@ -80,7 +80,7 @@ private void getParameter(String[] args) throws Exception {

String key = (String)getRequired(options, OPT_KEY);

ServerConfigsResponse response = configApi.getConfig();
ServerConfigResponse response = configApi.getConfig();
checkSuccess(response);

for (ServerConfig c : response.getServerConfig()) {
Expand All @@ -102,7 +102,7 @@ private void set(String[] args) throws Exception {
ServerConfigApi serverConfigApi = api.getServerConfigApi();

InputStream is = getInputStream(options);
ServerConfigsResponse resp = XmlUtil.deserialize(ServerConfigsResponse.class, is);
ServerConfigResponse resp = XmlUtil.deserialize(ServerConfigResponse.class, is);
List<ServerConfig> config = resp.getServerConfig();

StatusResponse response = serverConfigApi.setConfig(config);
Expand All @@ -127,7 +127,7 @@ private void setParameter(String[] args) throws Exception {
String key = (String)getRequired(options, OPT_KEY);
String value = (String)getRequired(options, OPT_VALUE);

ServerConfigsResponse response = configApi.getConfig();
ServerConfigResponse response = configApi.getConfig();
checkSuccess(response);

List<ServerConfig> config = response.getServerConfig();
Expand Down
2 changes: 1 addition & 1 deletion xsd/HQApi1.wadl
Expand Up @@ -1124,7 +1124,7 @@
<wadl:request/>
<wadl:response>
<wadl:representation mediaType="application/xml"
element="ServerConfigsResponse"/>
element="ServerConfigResponse"/>
</wadl:response>
</wadl:method>
</wadl:resource>
Expand Down
2 changes: 1 addition & 1 deletion xsd/HQApi1.xsd
Expand Up @@ -874,7 +874,7 @@

<!-- Server Config Response objects -->

<xs:element name="ServerConfigsResponse">
<xs:element name="ServerConfigResponse">
<xs:complexType>
<xs:complexContent>
<xs:extension base="Response">
Expand Down

0 comments on commit 699835b

Please sign in to comment.