Repository: stratos
Updated Branches:
  refs/heads/master b29385025 -> 473b89069


Refining logic while validating App policy against application


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

Branch: refs/heads/master
Commit: 473b8906973ebd4b49f9ef56cc3f5a661a25fcf1
Parents: b293850
Author: lasinducharith <[email protected]>
Authored: Wed Jun 24 10:39:18 2015 +0530
Committer: lasinducharith <[email protected]>
Committed: Wed Jun 24 10:39:18 2015 +0530

----------------------------------------------------------------------
 .../org/apache/stratos/autoscaler/util/AutoscalerUtil.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/473b8906/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 e71017f..7af7533 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
@@ -761,8 +761,8 @@ public class AutoscalerUtil {
             return false;
         }
 
+        int referencesOfNetworkPartition = 0;
         for (String deploymentPolicyIDReferredInApp : 
deploymentPolicyIdsReferredInApplication) {
-            int referencesOfNetworkPartition = 0;
             try {
                 DeploymentPolicy deploymentPolicyInApp = 
PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyIDReferredInApp);
                 if (deploymentPolicyInApp != null) {
@@ -781,9 +781,10 @@ public class AutoscalerUtil {
                 log.error(msg, e);
                 throw new AutoScalerException(msg, e);
             }
-            if (deploymentPolicyIdsReferredInApplication.size() == 
referencesOfNetworkPartition) {
-                return true;
-            }
+        }
+        //If network-partition referred in application policy is found in all 
the deployment policies of application, return true
+        if (deploymentPolicyIdsReferredInApplication.size() == 
referencesOfNetworkPartition) {
+            return true;
         }
         return false;
     }

Reply via email to