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

stratos git commit: correcting startup order and scaling depends prefix validation in group deployment

Repository: stratos
Updated Branches:
  refs/heads/master 273c2e1b2 -> b946b934e


correcting startup order and scaling depends prefix validation in group deployment


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

Branch: refs/heads/master
Commit: b946b934e31bc75d2cf7bfc7b94d04c757ebaa50
Parents: 273c2e1
Author: Isuru Haththotuwa <is...@apache.org>
Authored: Mon May 11 19:09:45 2015 +0530
Committer: Isuru Haththotuwa <is...@apache.org>
Committed: Mon May 11 19:09:45 2015 +0530

----------------------------------------------------------------------
 .../services/impl/AutoscalerServiceImpl.java        |  4 ++--
 .../stratos/autoscaler/util/AutoscalerUtil.java     | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/b946b934/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
index 8b3685c..328aa26 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
@@ -615,26 +615,26 @@ public class AutoscalerServiceImpl implements AutoscalerService {
 
         if (dependencies != null) {
             String[] startupOrders = dependencies.getStartupOrders();
+            AutoscalerUtil.validateStartupOrders(groupName, startupOrders);
 
             if (log.isDebugEnabled()) {
                 log.debug("StartupOrders " + Arrays.toString(startupOrders));
 
                 if (startupOrders != null) {
                     log.debug("StartupOrder:size  " + startupOrders.length);
-                    AutoscalerUtil.validateStartupOrders(groupName, startupOrders);
                 } else {
                     log.debug("StartupOrder: is null");
                 }
             }
 
             String[] scalingDependents = dependencies.getScalingDependants();
+            AutoscalerUtil.validateScalingDependencies(groupName, scalingDependents);
 
             if (log.isDebugEnabled()) {
                 log.debug("ScalingDependent " + Arrays.toString(scalingDependents));
 
                 if (scalingDependents != null) {
                     log.debug("ScalingDependents:size " + scalingDependents.length);
-                    AutoscalerUtil.validateScalingDependencies(groupName, scalingDependents);
                 } else {
                     log.debug("ScalingDependent: is null");
                 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/b946b934/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
index b0ccf95..b38b6b5 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
@@ -857,6 +857,14 @@ public class AutoscalerUtil {
     }
 
     public static void validateStartupOrders (String groupName, String[] startupOrders) throws InvalidServiceGroupException {
+
+        if (startupOrders == null || startupOrders.length == 0) {
+            if(log.isDebugEnabled()) {
+                log.debug("No Startup Order defined for group "  + groupName);
+            }
+            return;
+        }
+
         for (String startupOrder : startupOrders) {
             // split comma separated startup orders
             String[] splittedStartupOrders = startupOrder.split(",");
@@ -871,6 +879,14 @@ public class AutoscalerUtil {
     }
 
     public static void validateScalingDependencies (String groupName, String[] scalingDependents) throws InvalidServiceGroupException {
+
+        if (scalingDependents == null || scalingDependents.length == 0) {
+            if(log.isDebugEnabled()) {
+                log.debug("No Scaling Dependents defined for group "  + groupName);
+            }
+            return;
+        }
+
         for (String scalingDependent : scalingDependents) {
             // split comma separated scaling dependents
             String[] splittedDependents = scalingDependent.split(",");