Fixed CLI command for deactivate tenant
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/2916f875 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/2916f875 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/2916f875 Branch: refs/heads/4.1.0-beta-deployment-policy-fix Commit: 2916f875656ae72c7806fa94502ecbf1bac57e96 Parents: 5b0ab68 Author: Dinithi <[email protected]> Authored: Thu Feb 19 12:56:44 2015 +0530 Committer: Imesh Gunaratne <[email protected]> Committed: Thu Feb 19 14:13:33 2015 +0530 ---------------------------------------------------------------------- .../src/main/java/org/apache/stratos/cli/RestClient.java | 2 +- .../java/org/apache/stratos/cli/RestCommandLineService.java | 6 +++--- .../org/apache/stratos/rest/endpoint/api/StratosApiV41.java | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/2916f875/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java index 7014380..404c0fa 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java @@ -187,7 +187,7 @@ public class RestClient implements GenericRestClient { int responseCode = executePut(serviceEndpoint, entityBody); if (responseCode == 404) { System.out.println(String.format("%s not found", StringUtils.capitalize(entityName))); - } else if (responseCode == 201) { + } else if (responseCode >= 200 && responseCode <300) { System.out.println(String.format("Successfully updated %s", entityName)); } } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/stratos/blob/2916f875/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java index 426be17..ff22e12 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java @@ -560,8 +560,8 @@ public class RestCommandLineService { public void deactivateTenant(String tenantDomain) throws CommandException { DefaultHttpClient httpClient = new DefaultHttpClient(); try { - HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL() - + ENDPOINT_DEACTIVATE_TENANT + "/" + tenantDomain, ""); + HttpResponse response = restClient.doPut(httpClient, restClient.getBaseURL() + + ENDPOINT_DEACTIVATE_TENANT.replace("{tenantDomain}", tenantDomain),""); String responseCode = "" + response.getStatusLine().getStatusCode(); @@ -569,7 +569,7 @@ public class RestCommandLineService { Gson gson = gsonBuilder.create(); if (responseCode.equals(CliConstants.RESPONSE_OK)) { - System.out.println("You have succesfully deactivated " + tenantDomain + " tenant"); + System.out.println("You have successfully deactivated " + tenantDomain + " tenant"); return; } else { String resultString = CliUtils.getHttpResponseString(response); http://git-wip-us.apache.org/repos/asf/stratos/blob/2916f875/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java index 9e9f356..91d63fd 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java @@ -1443,6 +1443,7 @@ public class StratosApiV41 extends AbstractApi { @PUT @Path("/tenants/deactivate/{tenantDomain}") @Consumes("application/json") + @Produces("application/json") @AuthorizationAction("/permission/protected/manage/deactivateTenant") @SuperTenantService(true) public Response deactivateTenant(@PathParam("tenantDomain") String tenantDomain) throws RestAPIException {
