kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 160713304998f9101d61c3e1e69341c5c9104f2886c9127dfcadfe47b1c1bbbc |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-12-02 09:35 -06:00 |
| Committer | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-12-02 09:35 -06:00 |
| Parents | c1334e48fa02 |
1 file changed
modified driver-core/src/test/java/com/datastax/driver/core/policies/TokenAwarePolicyTest.java +6 −4
| @@ -41,6 +41,7 @@ | ||
| 41 | 41 | import static com.datastax.driver.core.Assertions.assertThat; |
| 42 | 42 | import static com.datastax.driver.core.TestUtils.CREATE_KEYSPACE_SIMPLE_FORMAT; |
| 43 | 43 | import static com.datastax.driver.core.TestUtils.SIMPLE_KEYSPACE; |
| 44 | +import static com.datastax.driver.core.TestUtils.getDesiredProtocolVersion; | |
| 44 | 45 | import static com.datastax.driver.core.TestUtils.nonQuietClusterCloseOptions; |
| 45 | 46 | |
| 46 | 47 | public class TokenAwarePolicyTest { |
| @@ -95,7 +96,7 @@ | ||
| 95 | 96 | // given: A routing key that falls in the token range of node 6. |
| 96 | 97 | |
| 97 | 98 | // Encodes into murmur hash '4874351301193663061' which should belong be owned by node 6 with replicas 7 and 8. |
| 98 | - ByteBuffer routingKey = DataType.text().serialize("This is some sample text"); | |
| 99 | + ByteBuffer routingKey = DataType.text().serialize("This is some sample text", getDesiredProtocolVersion()); | |
| 99 | 100 | |
| 100 | 101 | // then: The replicas resolved from the cluster metadata must match node 6 and its replicas. |
| 101 | 102 | List<Host> replicas = Lists.newArrayList(cluster.getMetadata().getReplicas("keyspace", routingKey)); |
| @@ -161,7 +162,7 @@ | ||
| 161 | 162 | Session session = cluster.connect(); |
| 162 | 163 | |
| 163 | 164 | // Encodes into murmur hash '4557949199137838892' which should belong be owned by node 3. |
| 164 | - ByteBuffer routingKey = DataType.text().serialize("should_choose_proper_host_based_on_routing_key"); | |
| 165 | + ByteBuffer routingKey = DataType.text().serialize("should_choose_proper_host_based_on_routing_key", getDesiredProtocolVersion()); | |
| 165 | 166 | SimpleStatement statement = new SimpleStatement("select * from table where k=5") |
| 166 | 167 | .setRoutingKey(routingKey) |
| 167 | 168 | .setKeyspace("keyspace"); |
| @@ -207,7 +208,8 @@ | ||
| 207 | 208 | Session session = cluster.connect(); |
| 208 | 209 | |
| 209 | 210 | // Encodes into murmur hash '-8124212968526248339' which should belong to 1:1 in DC1 and 2:1 in DC2. |
| 210 | - ByteBuffer routingKey = DataType.text().serialize("should_choose_host_in_local_dc_when_using_network_topology_strategy_and_dc_aware"); | |
| 211 | + ByteBuffer routingKey = DataType.text().serialize("should_choose_host_in_local_dc_when_using_network_topology_strategy_and_dc_aware", | |
| 212 | + getDesiredProtocolVersion()); | |
| 211 | 213 | SimpleStatement statement = new SimpleStatement("select * from table where k=5") |
| 212 | 214 | .setRoutingKey(routingKey) |
| 213 | 215 | .setKeyspace("keyspace"); |
| @@ -250,7 +252,7 @@ | ||
| 250 | 252 | |
| 251 | 253 | // when: A query is made with a routing key and both hosts having that key's token are down. |
| 252 | 254 | // Encodes into murmur hash '6444339665561646341' which should belong to node 4. |
| 253 | - ByteBuffer routingKey = DataType.text().serialize("should_use_other_nodes_when_replicas_having_token_are_down"); | |
| 255 | + ByteBuffer routingKey = DataType.text().serialize("should_use_other_nodes_when_replicas_having_token_are_down", getDesiredProtocolVersion()); | |
| 254 | 256 | SimpleStatement statement = new SimpleStatement("select * from table where k=5") |
| 255 | 257 | .setRoutingKey(routingKey) |
| 256 | 258 | .setKeyspace("keyspace"); |