[1/6] git commit: Fix TokenMetadataTest
Updated Branches: refs/heads/trunk 3958a0099 -> 723792d64 Fix TokenMetadataTest Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0a5a766d Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0a5a766d Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0a5a766d Branch: refs/heads/trunk Commit: 0a5a766d52f3c06399bfa8826df836b3dc070a20 Parents: 582a16e Author: Sylvain Lebresne Authored: Tue Nov 19 17:21:19 2013 +0100 Committer: Sylvain Lebresne Committed: Tue Nov 19 17:21:19 2013 +0100 -- .../cassandra/locator/TokenMetadataTest.java| 30 ++-- 1 file changed, 15 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/0a5a766d/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java -- diff --git a/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java b/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java index 9f93b2f..f2dc381 100644 --- a/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java +++ b/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java @@ -37,21 +37,20 @@ public class TokenMetadataTest public final static String ONE = "1"; public final static String SIX = "6"; -public static ArrayList RING; +static TokenMetadata tmd; @BeforeClass public static void beforeClass() throws Throwable { -TokenMetadata tmd = StorageService.instance.getTokenMetadata(); +tmd = StorageService.instance.getTokenMetadata(); tmd.updateNormalToken(token(ONE), InetAddress.getByName("127.0.0.1")); tmd.updateNormalToken(token(SIX), InetAddress.getByName("127.0.0.6")); -RING = tmd.sortedTokens(); } -private void testRingIterator(String start, boolean includeMin, String... expected) +private void testRingIterator(ArrayList ring, String start, boolean includeMin, String... expected) { ArrayList actual = new ArrayList(); -Iterators.addAll(actual, TokenMetadata.ringIterator(RING, token(start), includeMin)); +Iterators.addAll(actual, TokenMetadata.ringIterator(ring, token(start), includeMin)); assertEquals(actual.toString(), expected.length, actual.size()); for (int i = 0; i < expected.length; i++) assertEquals("Mismatch at index " + i + ": " + actual, token(expected[i]), actual.get(i)); @@ -60,25 +59,26 @@ public class TokenMetadataTest @Test public void testRingIterator() { -testRingIterator("2", false, "6", "1"); -testRingIterator("7", false, "1", "6"); -testRingIterator("0", false, "1", "6"); -testRingIterator("", false, "1", "6"); +ArrayList ring = tmd.sortedTokens(); +testRingIterator(ring, "2", false, "6", "1"); +testRingIterator(ring, "7", false, "1", "6"); +testRingIterator(ring, "0", false, "1", "6"); +testRingIterator(ring, "", false, "1", "6"); } @Test public void testRingIteratorIncludeMin() { -testRingIterator("2", true, "6", "", "1"); -testRingIterator("7", true, "", "1", "6"); -testRingIterator("0", true, "1", "6", ""); -testRingIterator("", true, "1", "6", ""); +ArrayList ring = tmd.sortedTokens(); +testRingIterator(ring, "2", true, "6", "", "1"); +testRingIterator(ring, "7", true, "", "1", "6"); +testRingIterator(ring, "0", true, "1", "6", ""); +testRingIterator(ring, "", true, "1", "6", ""); } @Test public void testRingIteratorEmptyRing() { -RING.clear(); -testRingIterator("2", false); +testRingIterator(new ArrayList(), "2", false); } }
[1/5] git commit: Fix TokenMetadataTest
Updated Branches: refs/heads/cassandra-2.0 47724e6b7 -> 6b1fb2ce7 Fix TokenMetadataTest Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0a5a766d Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0a5a766d Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0a5a766d Branch: refs/heads/cassandra-2.0 Commit: 0a5a766d52f3c06399bfa8826df836b3dc070a20 Parents: 582a16e Author: Sylvain Lebresne Authored: Tue Nov 19 17:21:19 2013 +0100 Committer: Sylvain Lebresne Committed: Tue Nov 19 17:21:19 2013 +0100 -- .../cassandra/locator/TokenMetadataTest.java| 30 ++-- 1 file changed, 15 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/0a5a766d/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java -- diff --git a/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java b/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java index 9f93b2f..f2dc381 100644 --- a/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java +++ b/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java @@ -37,21 +37,20 @@ public class TokenMetadataTest public final static String ONE = "1"; public final static String SIX = "6"; -public static ArrayList RING; +static TokenMetadata tmd; @BeforeClass public static void beforeClass() throws Throwable { -TokenMetadata tmd = StorageService.instance.getTokenMetadata(); +tmd = StorageService.instance.getTokenMetadata(); tmd.updateNormalToken(token(ONE), InetAddress.getByName("127.0.0.1")); tmd.updateNormalToken(token(SIX), InetAddress.getByName("127.0.0.6")); -RING = tmd.sortedTokens(); } -private void testRingIterator(String start, boolean includeMin, String... expected) +private void testRingIterator(ArrayList ring, String start, boolean includeMin, String... expected) { ArrayList actual = new ArrayList(); -Iterators.addAll(actual, TokenMetadata.ringIterator(RING, token(start), includeMin)); +Iterators.addAll(actual, TokenMetadata.ringIterator(ring, token(start), includeMin)); assertEquals(actual.toString(), expected.length, actual.size()); for (int i = 0; i < expected.length; i++) assertEquals("Mismatch at index " + i + ": " + actual, token(expected[i]), actual.get(i)); @@ -60,25 +59,26 @@ public class TokenMetadataTest @Test public void testRingIterator() { -testRingIterator("2", false, "6", "1"); -testRingIterator("7", false, "1", "6"); -testRingIterator("0", false, "1", "6"); -testRingIterator("", false, "1", "6"); +ArrayList ring = tmd.sortedTokens(); +testRingIterator(ring, "2", false, "6", "1"); +testRingIterator(ring, "7", false, "1", "6"); +testRingIterator(ring, "0", false, "1", "6"); +testRingIterator(ring, "", false, "1", "6"); } @Test public void testRingIteratorIncludeMin() { -testRingIterator("2", true, "6", "", "1"); -testRingIterator("7", true, "", "1", "6"); -testRingIterator("0", true, "1", "6", ""); -testRingIterator("", true, "1", "6", ""); +ArrayList ring = tmd.sortedTokens(); +testRingIterator(ring, "2", true, "6", "", "1"); +testRingIterator(ring, "7", true, "", "1", "6"); +testRingIterator(ring, "0", true, "1", "6", ""); +testRingIterator(ring, "", true, "1", "6", ""); } @Test public void testRingIteratorEmptyRing() { -RING.clear(); -testRingIterator("2", false); +testRingIterator(new ArrayList(), "2", false); } }
git commit: Fix TokenMetadataTest
Updated Branches: refs/heads/cassandra-1.2 582a16eff -> 0a5a766d5 Fix TokenMetadataTest Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0a5a766d Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0a5a766d Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0a5a766d Branch: refs/heads/cassandra-1.2 Commit: 0a5a766d52f3c06399bfa8826df836b3dc070a20 Parents: 582a16e Author: Sylvain Lebresne Authored: Tue Nov 19 17:21:19 2013 +0100 Committer: Sylvain Lebresne Committed: Tue Nov 19 17:21:19 2013 +0100 -- .../cassandra/locator/TokenMetadataTest.java| 30 ++-- 1 file changed, 15 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/0a5a766d/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java -- diff --git a/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java b/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java index 9f93b2f..f2dc381 100644 --- a/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java +++ b/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java @@ -37,21 +37,20 @@ public class TokenMetadataTest public final static String ONE = "1"; public final static String SIX = "6"; -public static ArrayList RING; +static TokenMetadata tmd; @BeforeClass public static void beforeClass() throws Throwable { -TokenMetadata tmd = StorageService.instance.getTokenMetadata(); +tmd = StorageService.instance.getTokenMetadata(); tmd.updateNormalToken(token(ONE), InetAddress.getByName("127.0.0.1")); tmd.updateNormalToken(token(SIX), InetAddress.getByName("127.0.0.6")); -RING = tmd.sortedTokens(); } -private void testRingIterator(String start, boolean includeMin, String... expected) +private void testRingIterator(ArrayList ring, String start, boolean includeMin, String... expected) { ArrayList actual = new ArrayList(); -Iterators.addAll(actual, TokenMetadata.ringIterator(RING, token(start), includeMin)); +Iterators.addAll(actual, TokenMetadata.ringIterator(ring, token(start), includeMin)); assertEquals(actual.toString(), expected.length, actual.size()); for (int i = 0; i < expected.length; i++) assertEquals("Mismatch at index " + i + ": " + actual, token(expected[i]), actual.get(i)); @@ -60,25 +59,26 @@ public class TokenMetadataTest @Test public void testRingIterator() { -testRingIterator("2", false, "6", "1"); -testRingIterator("7", false, "1", "6"); -testRingIterator("0", false, "1", "6"); -testRingIterator("", false, "1", "6"); +ArrayList ring = tmd.sortedTokens(); +testRingIterator(ring, "2", false, "6", "1"); +testRingIterator(ring, "7", false, "1", "6"); +testRingIterator(ring, "0", false, "1", "6"); +testRingIterator(ring, "", false, "1", "6"); } @Test public void testRingIteratorIncludeMin() { -testRingIterator("2", true, "6", "", "1"); -testRingIterator("7", true, "", "1", "6"); -testRingIterator("0", true, "1", "6", ""); -testRingIterator("", true, "1", "6", ""); +ArrayList ring = tmd.sortedTokens(); +testRingIterator(ring, "2", true, "6", "", "1"); +testRingIterator(ring, "7", true, "", "1", "6"); +testRingIterator(ring, "0", true, "1", "6", ""); +testRingIterator(ring, "", true, "1", "6", ""); } @Test public void testRingIteratorEmptyRing() { -RING.clear(); -testRingIterator("2", false); +testRingIterator(new ArrayList(), "2", false); } }