The tests assume sequential server IDs starting at 1. Ensure this.
Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f6734ca1 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f6734ca1 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f6734ca1 Branch: refs/heads/CURATOR-3.0 Commit: f6734ca182bf2269fee6a639107872996ab3ab5c Parents: 763aa39 Author: randgalt <randg...@apache.org> Authored: Fri Sep 11 12:06:18 2015 -0500 Committer: randgalt <randg...@apache.org> Committed: Fri Sep 11 12:06:18 2015 -0500 ---------------------------------------------------------------------- .../framework/imps/TestReconfiguration.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/f6734ca1/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java index a99617b..2a616de 100644 --- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java +++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java @@ -19,6 +19,7 @@ package org.apache.curator.framework.imps; +import com.google.common.collect.ImmutableList; import org.apache.curator.ensemble.EnsembleListener; import org.apache.curator.ensemble.dynamic.DynamicEnsembleProvider; import org.apache.curator.framework.CuratorFramework; @@ -64,7 +65,13 @@ public class TestReconfiguration extends BaseClassForTests @BeforeMethod public void setup() throws Exception { - cluster = new TestingCluster(5); + ImmutableList.Builder<InstanceSpec> builder = ImmutableList.builder(); + for ( int i = 1; i <= 5; ++i ) + { + builder.add(new InstanceSpec(null, -1, -1, -1, true, i, -1, -1)); + } + + cluster = new TestingCluster(builder.build()); cluster.start(); connectionString1to5 = cluster.getConnectString(); @@ -333,14 +340,14 @@ public class TestReconfiguration extends BaseClassForTests Assert.assertEquals(qv.getAllMembers().size(), 5); } - static QuorumVerifier getQuorumVerifier(byte[] bytes) throws Exception + private static QuorumVerifier getQuorumVerifier(byte[] bytes) throws Exception { Properties properties = new Properties(); properties.load(new StringReader(new String(bytes))); return new QuorumMaj(properties); } - static InstanceSpec getInstance(TestingCluster cluster, int id) + private static InstanceSpec getInstance(TestingCluster cluster, int id) { for ( InstanceSpec spec : cluster.getInstances() ) { @@ -352,7 +359,7 @@ public class TestReconfiguration extends BaseClassForTests throw new IllegalStateException("InstanceSpec with id:" + id + " not found"); } - static String getServerString(QuorumVerifier qv, TestingCluster cluster, long id) throws Exception + private static String getServerString(QuorumVerifier qv, TestingCluster cluster, long id) throws Exception { String str = qv.getAllMembers().get(id).toString(); //check if connection string is already there. @@ -366,7 +373,7 @@ public class TestReconfiguration extends BaseClassForTests } } - static String getConnectionString(TestingCluster cluster, long... ids) throws Exception + private static String getConnectionString(TestingCluster cluster, long... ids) throws Exception { StringBuilder sb = new StringBuilder(); Map<Long, InstanceSpec> specs = new HashMap<>();