Repository: stratos
Updated Branches:
  refs/heads/master ed558da45 -> 10b52cc4a


fixing STRATOS-1387


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

Branch: refs/heads/master
Commit: 10b52cc4a6030c2fa303dd2c3f1c6886a7affbcd
Parents: b0ef0cc
Author: Isuru Haththotuwa <[email protected]>
Authored: Mon May 11 16:33:12 2015 +0530
Committer: Isuru Haththotuwa <[email protected]>
Committed: Mon May 11 16:42:55 2015 +0530

----------------------------------------------------------------------
 .../stratos/autoscaler/util/AutoscalerUtil.java | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/10b52cc4/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 3ac9f46..b0ccf95 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
@@ -858,20 +858,28 @@ public class AutoscalerUtil {
 
     public static void validateStartupOrders (String groupName, String[] 
startupOrders) throws InvalidServiceGroupException {
         for (String startupOrder : startupOrders) {
-            if (!startupOrder.startsWith("cartridge.") && 
!startupOrder.startsWith("group.")) {
-                // invalid startup order; should prefixed by either 
'cartridge.' or 'group.'
-                throw new InvalidServiceGroupException("Invalid Service Group: 
startup order [" + startupOrder +  "] for group " + groupName +
-                        ", should prefixed by either 'cartridge.' or 
'group.'");
+            // split comma separated startup orders
+            String[] splittedStartupOrders = startupOrder.split(",");
+            for (String splittedStartupOrder : splittedStartupOrders) {
+                if (!splittedStartupOrder.trim().startsWith("cartridge.") && 
!splittedStartupOrder.trim().startsWith("group.")) {
+                    // invalid startup order; should prefixed by either 
'cartridge.' or 'group.'
+                    throw new InvalidServiceGroupException("Invalid Service 
Group: startup order [" + startupOrder +  "] for group " + groupName +
+                            ", should prefixed by either 'cartridge.' or 
'group.'");
+                }
             }
         }
     }
 
     public static void validateScalingDependencies (String groupName, String[] 
scalingDependents) throws InvalidServiceGroupException {
         for (String scalingDependent : scalingDependents) {
-            if (!scalingDependent.startsWith("cartridge.") && 
!scalingDependent.startsWith("group.")) {
-                // invalid startup order; should prefixed by either 
'cartridge.' or 'group.'
-                throw new InvalidServiceGroupException("Invalid Service Group: 
Scaling Dependency [" + scalingDependent + "] for group " + groupName +
-                        ", should prefixed by either 'cartridge.' or 
'group.'");
+            // split comma separated scaling dependents
+            String[] splittedDependents = scalingDependent.split(",");
+            for (String splittedDependent : splittedDependents) {
+                if (!splittedDependent.trim().startsWith("cartridge.") && 
!splittedDependent.trim().startsWith("group.")) {
+                    // invalid startup order; should prefixed by either 
'cartridge.' or 'group.'
+                    throw new InvalidServiceGroupException("Invalid Service 
Group: Scaling Dependency [" + scalingDependent + "] for group " + groupName +
+                            ", should prefixed by either 'cartridge.' or 
'group.'");
+                }
             }
         }
     }

Reply via email to