[7/8] curator git commit: The tests assume sequential server IDs starting at 1. Ensure this.
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 Authored: Fri Sep 11 12:06:18 2015 -0500 Committer: randgalt 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 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 specs = new HashMap<>();
curator git commit: The tests assume sequential server IDs starting at 1. Ensure this.
Repository: curator Updated Branches: refs/heads/CURATOR-261 763aa39a1 -> f6734ca18 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-261 Commit: f6734ca182bf2269fee6a639107872996ab3ab5c Parents: 763aa39 Author: randgalt Authored: Fri Sep 11 12:06:18 2015 -0500 Committer: randgalt 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 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 specs = new HashMap<>();