Fix cluster activation assertion in Stratos integration tests
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/6bdde45e Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/6bdde45e Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/6bdde45e Branch: refs/heads/master Commit: 6bdde45e9d48f350a84168a00dec989572b307a1 Parents: d72139d Author: Akila Perera <[email protected]> Authored: Wed Aug 26 19:51:22 2015 +0530 Committer: Akila Perera <[email protected]> Committed: Wed Aug 26 19:51:22 2015 +0530 ---------------------------------------------------------------------- .../stratos/integration/tests/TopologyHandler.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/6bdde45e/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java index 85f7817..5c911e9 100644 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java +++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java @@ -226,9 +226,9 @@ public class TopologyHandler { assertNotNull(String.format("Cluster is not found: [application-id] %s [service] %s [cluster-id] %s", applicationName, serviceName, clusterId), cluster); boolean clusterActive = false; - + int activeInstances = 0; for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) { - int activeInstances = 0; + activeInstances = 0; for (Member member : cluster.getMembers()) { if (member.getClusterInstanceId().equals(instance.getInstanceId())) { if (member.getStatus().equals(MemberStatus.Active)) { @@ -236,16 +236,11 @@ public class TopologyHandler { } } } - clusterActive = activeInstances >= clusterDataHolder.getMinInstances(); - - if (!clusterActive) { - break; - } } - assertEquals(String.format("Cluster status did not change to active: [cluster-id] %s", clusterId), - clusterActive, true); + clusterActive = (activeInstances >= clusterDataHolder.getMinInstances()); + assertTrue(String.format("Cluster status did not change to active: [cluster-id] %s", clusterId), + clusterActive); } - } /**
