You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/05/19 15:24:59 UTC

[1/2] stratos git commit: This closes #344 on GitHub

Repository: stratos
Updated Branches:
  refs/heads/master 5470cf889 -> 55b0ac401


This closes #344 on GitHub


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/55b0ac40
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/55b0ac40
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/55b0ac40

Branch: refs/heads/master
Commit: 55b0ac401d1ad57dc0afce1aec4a5bd27290ad8b
Parents: 8bb9b01
Author: Imesh Gunaratne <im...@apache.org>
Authored: Tue May 19 18:54:53 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue May 19 18:54:53 2015 +0530

----------------------------------------------------------------------

----------------------------------------------------------------------



[2/2] stratos git commit: Fixed error messages in updating existing tenant details in cli

Posted by im...@apache.org.
Fixed error messages in updating existing tenant details in cli


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/8bb9b01f
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/8bb9b01f
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/8bb9b01f

Branch: refs/heads/master
Commit: 8bb9b01f90bf8c2892acc7eadf2650ed89dfd92d
Parents: 5470cf8
Author: Pubudu Gunatilaka <pu...@gmail.com>
Authored: Tue May 19 18:40:05 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue May 19 18:54:53 2015 +0530

----------------------------------------------------------------------
 .../java/org/apache/stratos/cli/RestCommandLineService.java  | 8 ++++++--
 .../org/apache/stratos/rest/endpoint/api/StratosApiV41.java  | 3 +++
 .../apache/stratos/rest/endpoint/api/StratosApiV41Utils.java | 8 ++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/8bb9b01f/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 30b332e..efc06d3 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
@@ -642,7 +642,10 @@ public class RestCommandLineService {
 
             int responseCode = response.getStatusLine().getStatusCode();
             if (responseCode < 200 || responseCode >= 300) {
-                CliUtils.printError(response);
+                String resultString = CliUtils.getHttpResponseString(response);
+                String errorMsg = gson.fromJson(resultString, ResponseMessageBean.class).getMessage();
+                System.out.println(errorMsg);
+
             } else {
                 System.out.println("Tenant updated successfully: " + domain);
             }
@@ -1076,7 +1079,8 @@ public class RestCommandLineService {
             array = list.toArray(array);
 
             System.out.println("Autoscaling policies found:");
-            CliUtils.printTable(array, rowMapper, "ID", "Requests In Flight", "Memory Consumption", "Load Average");
+            CliUtils.printTable(array, rowMapper, "ID", "Requests In Flight Threshold", "Memory Consumption Threshold",
+                    "Load Average Threshold");
         } catch (Exception e) {
             String message = "Could not list autoscaling policies";
             printError(message, e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/8bb9b01f/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 67e293a..5765b26 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
@@ -1488,6 +1488,9 @@ public class StratosApiV41 extends AbstractApi {
         } catch (InvalidEmailException e) {
             return Response.status(Response.Status.BAD_REQUEST).entity(new ResponseMessageBean(
                     ResponseMessageBean.ERROR, String.format("Invalid email [email] %s", tenantInfoBean.getEmail()))).build();
+        } catch (InvalidDomainException e) {
+            return Response.status(Response.Status.BAD_REQUEST).entity(new ResponseMessageBean(
+                    ResponseMessageBean.ERROR, String.format("Invalid Domain [Domain] %s", tenantInfoBean.getTenantDomain()))).build();
         } catch (Exception e) {
             String msg = "Error in updating tenant " + tenantInfoBean.getTenantDomain();
             log.error(msg, e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/8bb9b01f/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
index 70f18ef..527bdd6 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
@@ -2928,6 +2928,10 @@ public class StratosApiV41Utils {
         int tenantId;
         try {
             tenantId = tenantManager.getTenantId(tenantDomain);
+            if (tenantId == -1) {
+                String errorMsg = "The tenant with domain name: " + tenantDomain + " does not exist.";
+                throw new InvalidDomainException(errorMsg);
+            }
         } catch (UserStoreException e) {
             String msg = "Error in retrieving the tenant id for the tenant domain: " + tenantDomain + ".";
             log.error(msg, e);
@@ -2937,6 +2941,10 @@ public class StratosApiV41Utils {
         Tenant tenant;
         try {
             tenant = (Tenant) tenantManager.getTenant(tenantId);
+            if (tenant == null) {
+                String errorMsg = "The tenant with tenant id: " + tenantId + " does not exist.";
+                throw new TenantNotFoundException(errorMsg);
+            }
         } catch (UserStoreException e) {
             String msg = "Error in retrieving the tenant from tenant id: " +
                     tenantId + ".";