Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java?rev=1208993&r1=1208992&r2=1208993&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java Thu Dec 1 08:31:20 2011 @@ -59,7 +59,7 @@ public abstract class AntiEntropyService public ColumnFamilyStore store; public InetAddress LOCAL, REMOTE; - public Range local_range; + public Range<Token> local_range; private boolean initialized; @@ -140,7 +140,7 @@ public abstract class AntiEntropyService // confirm that the tree was validated Token min = validator.tree.partitioner().getMinimumToken(); - assert null != validator.tree.hash(new Range(min, min)); + assert null != validator.tree.hash(new Range<Token>(min, min)); } @Test @@ -166,9 +166,9 @@ public abstract class AntiEntropyService // generate rf+1 nodes, and ensure that all nodes are returned Set<InetAddress> expected = addTokens(1 + Table.open(tablename).getReplicationStrategy().getReplicationFactor()); expected.remove(FBUtilities.getBroadcastAddress()); - Collection<Range> ranges = StorageService.instance.getLocalRanges(tablename); + Collection<Range<Token>> ranges = StorageService.instance.getLocalRanges(tablename); Set<InetAddress> neighbors = new HashSet<InetAddress>(); - for (Range range : ranges) + for (Range<Token> range : ranges) { neighbors.addAll(AntiEntropyService.getNeighbors(tablename, range)); } @@ -184,14 +184,14 @@ public abstract class AntiEntropyService addTokens(2 * Table.open(tablename).getReplicationStrategy().getReplicationFactor()); AbstractReplicationStrategy ars = Table.open(tablename).getReplicationStrategy(); Set<InetAddress> expected = new HashSet<InetAddress>(); - for (Range replicaRange : ars.getAddressRanges().get(FBUtilities.getBroadcastAddress())) + for (Range<Token> replicaRange : ars.getAddressRanges().get(FBUtilities.getBroadcastAddress())) { expected.addAll(ars.getRangeAddresses(tmd).get(replicaRange)); } expected.remove(FBUtilities.getBroadcastAddress()); - Collection<Range> ranges = StorageService.instance.getLocalRanges(tablename); + Collection<Range<Token>> ranges = StorageService.instance.getLocalRanges(tablename); Set<InetAddress> neighbors = new HashSet<InetAddress>(); - for (Range range : ranges) + for (Range<Token> range : ranges) { neighbors.addAll(AntiEntropyService.getNeighbors(tablename, range)); }
Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java?rev=1208993&r1=1208992&r2=1208993&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java Thu Dec 1 08:31:20 2011 @@ -184,35 +184,35 @@ public class MoveTest extends CleanupHel * } */ - Multimap<InetAddress, Range> keyspace1ranges = tableStrategyMap.get("Keyspace1").getAddressRanges(); - Collection<Range> ranges1 = keyspace1ranges.get(InetAddress.getByName("127.0.0.1")); + Multimap<InetAddress, Range<Token>> keyspace1ranges = tableStrategyMap.get("Keyspace1").getAddressRanges(); + Collection<Range<Token>> ranges1 = keyspace1ranges.get(InetAddress.getByName("127.0.0.1")); assertEquals(collectionSize(ranges1), 1); assertTrue(ranges1.iterator().next().equals(generateRange(92, 0))); - Collection<Range> ranges2 = keyspace1ranges.get(InetAddress.getByName("127.0.0.2")); + Collection<Range<Token>> ranges2 = keyspace1ranges.get(InetAddress.getByName("127.0.0.2")); assertEquals(collectionSize(ranges2), 1); assertTrue(ranges2.iterator().next().equals(generateRange(0, 10))); - Collection<Range> ranges3 = keyspace1ranges.get(InetAddress.getByName("127.0.0.3")); + Collection<Range<Token>> ranges3 = keyspace1ranges.get(InetAddress.getByName("127.0.0.3")); assertEquals(collectionSize(ranges3), 1); assertTrue(ranges3.iterator().next().equals(generateRange(10, 20))); - Collection<Range> ranges4 = keyspace1ranges.get(InetAddress.getByName("127.0.0.4")); + Collection<Range<Token>> ranges4 = keyspace1ranges.get(InetAddress.getByName("127.0.0.4")); assertEquals(collectionSize(ranges4), 1); assertTrue(ranges4.iterator().next().equals(generateRange(20, 30))); - Collection<Range> ranges5 = keyspace1ranges.get(InetAddress.getByName("127.0.0.5")); + Collection<Range<Token>> ranges5 = keyspace1ranges.get(InetAddress.getByName("127.0.0.5")); assertEquals(collectionSize(ranges5), 1); assertTrue(ranges5.iterator().next().equals(generateRange(30, 40))); - Collection<Range> ranges6 = keyspace1ranges.get(InetAddress.getByName("127.0.0.6")); + Collection<Range<Token>> ranges6 = keyspace1ranges.get(InetAddress.getByName("127.0.0.6")); assertEquals(collectionSize(ranges6), 1); assertTrue(ranges6.iterator().next().equals(generateRange(40, 50))); - Collection<Range> ranges7 = keyspace1ranges.get(InetAddress.getByName("127.0.0.7")); + Collection<Range<Token>> ranges7 = keyspace1ranges.get(InetAddress.getByName("127.0.0.7")); assertEquals(collectionSize(ranges7), 1); assertTrue(ranges7.iterator().next().equals(generateRange(50, 62))); - Collection<Range> ranges8 = keyspace1ranges.get(InetAddress.getByName("127.0.0.8")); + Collection<Range<Token>> ranges8 = keyspace1ranges.get(InetAddress.getByName("127.0.0.8")); assertEquals(collectionSize(ranges8), 1); assertTrue(ranges8.iterator().next().equals(generateRange(62, 70))); - Collection<Range> ranges9 = keyspace1ranges.get(InetAddress.getByName("127.0.0.9")); + Collection<Range<Token>> ranges9 = keyspace1ranges.get(InetAddress.getByName("127.0.0.9")); assertEquals(collectionSize(ranges9), 1); assertTrue(ranges9.iterator().next().equals(generateRange(70, 82))); - Collection<Range> ranges10 = keyspace1ranges.get(InetAddress.getByName("127.0.0.10")); + Collection<Range<Token>> ranges10 = keyspace1ranges.get(InetAddress.getByName("127.0.0.10")); assertEquals(collectionSize(ranges10), 1); assertTrue(ranges10.iterator().next().equals(generateRange(82, 92))); @@ -233,7 +233,7 @@ public class MoveTest extends CleanupHel * } */ - Multimap<InetAddress, Range> keyspace3ranges = tableStrategyMap.get("Keyspace3").getAddressRanges(); + Multimap<InetAddress, Range<Token>> keyspace3ranges = tableStrategyMap.get("Keyspace3").getAddressRanges(); ranges1 = keyspace3ranges.get(InetAddress.getByName("127.0.0.1")); assertEquals(collectionSize(ranges1), 5); assertTrue(ranges1.equals(generateRanges(92, 0, 70, 82, 50, 62, 82, 92, 62, 70))); @@ -281,7 +281,7 @@ public class MoveTest extends CleanupHel * /127.0.0.10=[(70,82], (82,92], (62,70]] * } */ - Multimap<InetAddress, Range> keyspace4ranges = tableStrategyMap.get("Keyspace4").getAddressRanges(); + Multimap<InetAddress, Range<Token>> keyspace4ranges = tableStrategyMap.get("Keyspace4").getAddressRanges(); ranges1 = keyspace4ranges.get(InetAddress.getByName("127.0.0.1")); assertEquals(collectionSize(ranges1), 3); assertTrue(ranges1.equals(generateRanges(92, 0, 70, 82, 82, 92))); @@ -535,12 +535,12 @@ public class MoveTest extends CleanupHel return count; } - private Collection<Range> generateRanges(int... rangePairs) + private Collection<Range<Token>> generateRanges(int... rangePairs) { if (rangePairs.length % 2 == 1) throw new RuntimeException("generateRanges argument count should be even"); - Set<Range> ranges = new HashSet<Range>(); + Set<Range<Token>> ranges = new HashSet<Range<Token>>(); for (int i = 0; i < rangePairs.length; i+=2) { @@ -550,8 +550,8 @@ public class MoveTest extends CleanupHel return ranges; } - private Range generateRange(int left, int right) + private Range<Token> generateRange(int left, int right) { - return new Range(new BigIntegerToken(String.valueOf(left)), new BigIntegerToken(String.valueOf(right))); + return new Range<Token>(new BigIntegerToken(String.valueOf(left)), new BigIntegerToken(String.valueOf(right))); } } Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/SerializationsTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/SerializationsTest.java?rev=1208993&r1=1208992&r2=1208993&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/service/SerializationsTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/service/SerializationsTest.java Thu Dec 1 08:31:20 2011 @@ -42,7 +42,7 @@ public class SerializationsTest extends { private static MessageSerializer messageSerializer = new MessageSerializer(); - public static Range FULL_RANGE = new Range(StorageService.getPartitioner().getMinimumToken(), StorageService.getPartitioner().getMinimumToken()); + public static Range<Token> FULL_RANGE = new Range<Token>(StorageService.getPartitioner().getMinimumToken(), StorageService.getPartitioner().getMinimumToken()); private void testTreeRequestWrite() throws IOException { Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/StorageProxyTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/StorageProxyTest.java?rev=1208993&r1=1208992&r2=1208993&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/service/StorageProxyTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/service/StorageProxyTest.java Thu Dec 1 08:31:20 2011 @@ -26,15 +26,52 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; import org.apache.cassandra.CleanupHelper; -import static org.apache.cassandra.Util.range; -import static org.apache.cassandra.Util.bounds; import static org.apache.cassandra.Util.token; +import static org.apache.cassandra.Util.rp; +import org.apache.cassandra.db.DecoratedKey; +import org.apache.cassandra.db.RowPosition; import org.apache.cassandra.dht.AbstractBounds; +import org.apache.cassandra.dht.Bounds; +import org.apache.cassandra.dht.Range; +import org.apache.cassandra.dht.Token; import org.apache.cassandra.locator.TokenMetadata; +import org.apache.cassandra.utils.ByteBufferUtil; + +import java.util.Arrays; public class StorageProxyTest extends CleanupHelper { + private static Range<RowPosition> range(RowPosition left, RowPosition right) + { + return new Range<RowPosition>(left, right); + } + + private static Bounds<RowPosition> bounds(RowPosition left, RowPosition right) + { + return new Bounds<RowPosition>(left, right); + } + + private static RowPosition startOf(String key) + { + return StorageService.getPartitioner().getToken(ByteBufferUtil.bytes(key)).minKeyBound(); + } + + private static RowPosition endOf(String key) + { + return StorageService.getPartitioner().getToken(ByteBufferUtil.bytes(key)).maxKeyBound(); + } + + private static Range<Token> tokenRange(String left, String right) + { + return new Range<Token>(token(left), token(right)); + } + + private static Bounds<Token> tokenBounds(String left, String right) + { + return new Bounds<Token>(token(left), token(right)); + } + @BeforeClass public static void beforeClass() throws Throwable { @@ -43,72 +80,137 @@ public class StorageProxyTest extends Cl tmd.updateNormalToken(token("6"), InetAddress.getByName("127.0.0.6")); } - private void testGRR(AbstractBounds queryRange, AbstractBounds... expected) + // test getRestrictedRanges for token + private void testGRR(AbstractBounds<Token> queryRange, AbstractBounds<Token>... expected) { - List<AbstractBounds> restricted = StorageProxy.getRestrictedRanges(queryRange); + // Testing for tokens + List<AbstractBounds<Token>> restricted = StorageProxy.getRestrictedRanges(queryRange); assertEquals(restricted.toString(), expected.length, restricted.size()); for (int i = 0; i < expected.length; i++) assertEquals("Mismatch for index " + i + ": " + restricted, expected[i], restricted.get(i)); } + // test getRestrictedRanges for keys + private void testGRRKeys(AbstractBounds<RowPosition> queryRange, AbstractBounds<RowPosition>... expected) + { + // Testing for keys + List<AbstractBounds<RowPosition>> restrictedKeys = StorageProxy.getRestrictedRanges(queryRange); + assertEquals(restrictedKeys.toString(), expected.length, restrictedKeys.size()); + for (int i = 0; i < expected.length; i++) + assertEquals("Mismatch for index " + i + ": " + restrictedKeys, expected[i], restrictedKeys.get(i)); + + } + @Test public void testGRR() throws Throwable { // no splits - testGRR(range("2", "5"), range("2", "5")); - testGRR(bounds("2", "5"), bounds("2", "5")); + testGRR(tokenRange("2", "5"), tokenRange("2", "5")); + testGRR(tokenBounds("2", "5"), tokenBounds("2", "5")); // single split - testGRR(range("2", "7"), range("2", "6"), range("6", "7")); - testGRR(bounds("2", "7"), bounds("2", "6"), range("6", "7")); + testGRR(tokenRange("2", "7"), tokenRange("2", "6"), tokenRange("6", "7")); + testGRR(tokenBounds("2", "7"), tokenBounds("2", "6"), tokenRange("6", "7")); // single split starting from min - testGRR(range("", "2"), range("", "1"), range("1", "2")); - testGRR(bounds("", "2"), bounds("", "1"), range("1", "2")); + testGRR(tokenRange("", "2"), tokenRange("", "1"), tokenRange("1", "2")); + testGRR(tokenBounds("", "2"), tokenBounds("", "1"), tokenRange("1", "2")); // single split ending with max - testGRR(range("5", ""), range("5", "6"), range("6", "")); - testGRR(bounds("5", ""), bounds("5", "6"), range("6", "")); + testGRR(tokenRange("5", ""), tokenRange("5", "6"), tokenRange("6", "")); + testGRR(tokenBounds("5", ""), tokenBounds("5", "6"), tokenRange("6", "")); // two splits - testGRR(range("0", "7"), range("0", "1"), range("1", "6"), range("6", "7")); - testGRR(bounds("0", "7"), bounds("0", "1"), range("1", "6"), range("6", "7")); + testGRR(tokenRange("0", "7"), tokenRange("0", "1"), tokenRange("1", "6"), tokenRange("6", "7")); + testGRR(tokenBounds("0", "7"), tokenBounds("0", "1"), tokenRange("1", "6"), tokenRange("6", "7")); + + + // Keys + // no splits + testGRRKeys(range(rp("2"), rp("5")), range(rp("2"), rp("5"))); + testGRRKeys(bounds(rp("2"), rp("5")), bounds(rp("2"), rp("5"))); + // single split testGRRKeys(range("2", "7"), range(rp("2"), endOf("6")), range(endOf("6"), rp("7"))); + testGRRKeys(bounds(rp("2"), rp("7")), bounds(rp("2"), endOf("6")), range(endOf("6"), rp("7"))); + // single split starting from min + testGRRKeys(range(rp(""), rp("2")), range(rp(""), endOf("1")), range(endOf("1"), rp("2"))); + testGRRKeys(bounds(rp(""), rp("2")), bounds(rp(""), endOf("1")), range(endOf("1"), rp("2"))); + // single split ending with max + testGRRKeys(range(rp("5"), rp("")), range(rp("5"), endOf("6")), range(endOf("6"), rp(""))); + testGRRKeys(bounds(rp("5"), rp("")), bounds(rp("5"), endOf("6")), range(endOf("6"), rp(""))); + // two splits + testGRRKeys(range(rp("0"), rp("7")), range(rp("0"), endOf("1")), range(endOf("1"), endOf("6")), range(endOf("6"), rp("7"))); + testGRRKeys(bounds(rp("0"), rp("7")), bounds(rp("0"), endOf("1")), range(endOf("1"), endOf("6")), range(endOf("6"), rp("7"))); + } @Test public void testGRRExact() throws Throwable { // min - testGRR(range("1", "5"), range("1", "5")); - testGRR(bounds("1", "5"), bounds("1", "1"), range("1", "5")); + testGRR(tokenRange("1", "5"), tokenRange("1", "5")); + testGRR(tokenBounds("1", "5"), tokenBounds("1", "1"), tokenRange("1", "5")); // max - testGRR(range("2", "6"), range("2", "6")); - testGRR(bounds("2", "6"), bounds("2", "6")); + testGRR(tokenRange("2", "6"), tokenRange("2", "6")); + testGRR(tokenBounds("2", "6"), tokenBounds("2", "6")); // both - testGRR(range("1", "6"), range("1", "6")); - testGRR(bounds("1", "6"), bounds("1", "1"), range("1", "6")); + testGRR(tokenRange("1", "6"), tokenRange("1", "6")); + testGRR(tokenBounds("1", "6"), tokenBounds("1", "1"), tokenRange("1", "6")); + + + // Keys + // min + testGRRKeys(range(endOf("1"), endOf("5")), range(endOf("1"), endOf("5"))); + testGRRKeys(range(rp("1"), endOf("5")), range(rp("1"), endOf("1")), range(endOf("1"), endOf("5"))); + testGRRKeys(bounds(startOf("1"), endOf("5")), bounds(startOf("1"), endOf("1")), range(endOf("1"), endOf("5"))); + // max + testGRRKeys(range(endOf("2"), endOf("6")), range(endOf("2"), endOf("6"))); + testGRRKeys(bounds(startOf("2"), endOf("6")), bounds(startOf("2"), endOf("6"))); + // bothKeys + testGRRKeys(range(rp("1"), rp("6")), range(rp("1"), endOf("1")), range(endOf("1"), rp("6"))); + testGRRKeys(bounds(rp("1"), rp("6")), bounds(rp("1"), endOf("1")), range(endOf("1"), rp("6"))); } @Test public void testGRRWrapped() throws Throwable { // one token in wrapped range - testGRR(range("7", "0"), range("7", ""), range("", "0")); + testGRR(tokenRange("7", "0"), tokenRange("7", ""), tokenRange("", "0")); // two tokens in wrapped range - testGRR(range("5", "0"), range("5", "6"), range("6", ""), range("", "0")); - testGRR(range("7", "2"), range("7", ""), range("", "1"), range("1", "2")); + testGRR(tokenRange("5", "0"), tokenRange("5", "6"), tokenRange("6", ""), tokenRange("", "0")); + testGRR(tokenRange("7", "2"), tokenRange("7", ""), tokenRange("", "1"), tokenRange("1", "2")); // full wraps - testGRR(range("0", "0"), range("0", "1"), range("1", "6"), range("6", ""), range("", "0")); - testGRR(range("", ""), range("", "1"), range("1", "6"), range("6", "")); + testGRR(tokenRange("0", "0"), tokenRange("0", "1"), tokenRange("1", "6"), tokenRange("6", ""), tokenRange("", "0")); + testGRR(tokenRange("", ""), tokenRange("", "1"), tokenRange("1", "6"), tokenRange("6", "")); // wrap on member tokens - testGRR(range("6", "6"), range("6", ""), range("", "1"), range("1", "6")); - testGRR(range("6", "1"), range("6", ""), range("", "1")); + testGRR(tokenRange("6", "6"), tokenRange("6", ""), tokenRange("", "1"), tokenRange("1", "6")); + testGRR(tokenRange("6", "1"), tokenRange("6", ""), tokenRange("", "1")); // end wrapped - testGRR(range("5", ""), range("5", "6"), range("6", "")); + testGRR(tokenRange("5", ""), tokenRange("5", "6"), tokenRange("6", "")); + + // Keys + // one token in wrapped range + testGRRKeys(range(rp("7"), rp("0")), range(rp("7"), rp("")), range(rp(""), rp("0"))); + // two tokens in wrapped range + testGRRKeys(range(rp("5"), rp("0")), range(rp("5"), endOf("6")), range(endOf("6"), rp("")), range(rp(""), rp("0"))); + testGRRKeys(range(rp("7"), rp("2")), range(rp("7"), rp("")), range(rp(""), endOf("1")), range(endOf("1"), rp("2"))); + // full wraps + testGRRKeys(range(rp("0"), rp("0")), range(rp("0"), endOf("1")), range(endOf("1"), endOf("6")), range(endOf("6"), rp("")), range(rp(""), rp("0"))); + testGRRKeys(range(rp(""), rp("")), range(rp(""), endOf("1")), range(endOf("1"), endOf("6")), range(endOf("6"), rp(""))); + // wrap on member tokens + testGRRKeys(range(rp("6"), rp("6")), range(rp("6"), endOf("6")), range(endOf("6"), rp("")), range(rp(""), endOf("1")), range(endOf("1"), rp("6"))); + testGRRKeys(range(rp("6"), rp("1")), range(rp("6"), endOf("6")), range(endOf("6"), rp("")), range(rp(""), rp("1"))); + // end wrapped + testGRRKeys(range(rp("5"), rp("")), range(rp("5"), endOf("6")), range(endOf("6"), rp(""))); } @Test public void testGRRExactBounds() throws Throwable { // equal tokens are special cased as non-wrapping for bounds - testGRR(bounds("0", "0"), bounds("0", "0")); + testGRR(tokenBounds("0", "0"), tokenBounds("0", "0")); + // completely empty bounds match everything + testGRR(tokenBounds("", ""), tokenBounds("", "1"), tokenRange("1", "6"), tokenRange("6", "")); + + // Keys + // equal tokens are special cased as non-wrapping for bounds + testGRRKeys(bounds(rp("0"), rp("0")), bounds(rp("0"), rp("0"))); // completely empty bounds match everything - testGRR(bounds("", ""), bounds("", "1"), range("1", "6"), range("6", "")); + testGRRKeys(bounds(rp(""), rp("")), bounds(rp(""), endOf("1")), range(endOf("1"), endOf("6")), range(endOf("6"), rp(""))); } } Modified: cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java?rev=1208993&r1=1208992&r2=1208993&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java Thu Dec 1 08:31:20 2011 @@ -28,6 +28,7 @@ import org.apache.cassandra.db.Table; import org.apache.cassandra.db.filter.QueryPath; import org.apache.cassandra.dht.BytesToken; import org.apache.cassandra.dht.Range; +import org.apache.cassandra.dht.Token; import org.apache.cassandra.io.sstable.Descriptor; import org.apache.cassandra.io.sstable.SSTable; import org.apache.cassandra.io.sstable.SSTableReader; @@ -146,9 +147,9 @@ public class SerializationsTest extends private void testStreamRequestMessageWrite() throws IOException { - Collection<Range> ranges = new ArrayList<Range>(); + Collection<Range<Token>> ranges = new ArrayList<Range<Token>>(); for (int i = 0; i < 5; i++) - ranges.add(new Range(new BytesToken(ByteBufferUtil.bytes(Integer.toString(10*i))), new BytesToken(ByteBufferUtil.bytes(Integer.toString(10*i+5))))); + ranges.add(new Range<Token>(new BytesToken(ByteBufferUtil.bytes(Integer.toString(10*i))), new BytesToken(ByteBufferUtil.bytes(Integer.toString(10*i+5))))); List<ColumnFamilyStore> stores = Collections.singletonList(Table.open("Keyspace1").getColumnFamilyStore("Standard1")); StreamRequestMessage msg0 = new StreamRequestMessage(FBUtilities.getBroadcastAddress(), ranges, "Keyspace1", stores, 123L, OperationType.RESTORE_REPLICA_COUNT); StreamRequestMessage msg1 = new StreamRequestMessage(FBUtilities.getBroadcastAddress(), makePendingFile(true, 100, OperationType.BOOTSTRAP), 124L); Modified: cassandra/trunk/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java?rev=1208993&r1=1208992&r2=1208993&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java Thu Dec 1 08:31:20 2011 @@ -36,6 +36,7 @@ import org.apache.cassandra.db.filter.Qu import org.apache.cassandra.db.filter.QueryPath; import org.apache.cassandra.dht.IPartitioner; import org.apache.cassandra.dht.Range; +import org.apache.cassandra.dht.Token; import org.apache.cassandra.io.sstable.SSTableUtils; import org.apache.cassandra.io.sstable.SSTableReader; import org.apache.cassandra.service.StorageService; @@ -116,9 +117,9 @@ public class StreamingTransferTest exten private void transfer(Table table, SSTableReader sstable) throws Exception { IPartitioner p = StorageService.getPartitioner(); - List<Range> ranges = new ArrayList<Range>(); - ranges.add(new Range(p.getMinimumToken(), p.getToken(ByteBufferUtil.bytes("key1")))); - ranges.add(new Range(p.getToken(ByteBufferUtil.bytes("key2")), p.getMinimumToken())); + List<Range<Token>> ranges = new ArrayList<Range<Token>>(); + ranges.add(new Range<Token>(p.getMinimumToken(), p.getToken(ByteBufferUtil.bytes("key1")))); + ranges.add(new Range<Token>(p.getToken(ByteBufferUtil.bytes("key2")), p.getMinimumToken())); StreamOutSession session = StreamOutSession.create(table.name, LOCAL, null); StreamOut.transferSSTables(session, Arrays.asList(sstable), ranges, OperationType.BOOTSTRAP); session.await(); @@ -155,7 +156,7 @@ public class StreamingTransferTest exten ByteBufferUtil.bytes(val)); IndexClause clause = new IndexClause(Arrays.asList(expr), ByteBufferUtil.EMPTY_BYTE_BUFFER, 100); IFilter filter = new IdentityQueryFilter(); - Range range = new Range(p.getMinimumToken(), p.getMinimumToken()); + Range<RowPosition> range = Util.range("", ""); List<Row> rows = cfs.search(clause, range, filter); assertEquals(1, rows.size()); assert rows.get(0).key.key.equals(ByteBufferUtil.bytes(key)); @@ -255,9 +256,9 @@ public class StreamingTransferTest exten // transfer the first and last key IPartitioner p = StorageService.getPartitioner(); - List<Range> ranges = new ArrayList<Range>(); - ranges.add(new Range(p.getMinimumToken(), p.getToken(ByteBufferUtil.bytes("test")))); - ranges.add(new Range(p.getToken(ByteBufferUtil.bytes("transfer2")), p.getMinimumToken())); + List<Range<Token>> ranges = new ArrayList<Range<Token>>(); + ranges.add(new Range<Token>(p.getMinimumToken(), p.getToken(ByteBufferUtil.bytes("test")))); + ranges.add(new Range<Token>(p.getToken(ByteBufferUtil.bytes("transfer2")), p.getMinimumToken())); // Acquiring references, transferSSTables needs it sstable.acquireReference(); sstable2.acquireReference(); @@ -308,10 +309,10 @@ public class StreamingTransferTest exten Map.Entry<DecoratedKey,String> first = keys.firstEntry(); Map.Entry<DecoratedKey,String> last = keys.lastEntry(); Map.Entry<DecoratedKey,String> secondtolast = keys.lowerEntry(last.getKey()); - List<Range> ranges = new ArrayList<Range>(); - ranges.add(new Range(p.getMinimumToken(), first.getKey().token)); + List<Range<Token>> ranges = new ArrayList<Range<Token>>(); + ranges.add(new Range<Token>(p.getMinimumToken(), first.getKey().token)); // the left hand side of the range is exclusive, so we transfer from the second-to-last token - ranges.add(new Range(secondtolast.getKey().token, p.getMinimumToken())); + ranges.add(new Range<Token>(secondtolast.getKey().token, p.getMinimumToken())); // Acquiring references, transferSSTables needs it if (!SSTableReader.acquireReferences(ssTableReaders))