Search in sources :

Example 11 with TokenMap

use of com.datastax.oss.driver.api.core.metadata.TokenMap in project java-driver by datastax.

the class TokenITBase method checkRanges.

private void checkRanges(Session session) {
    assertThat(session.getMetadata().getTokenMap()).isPresent();
    TokenMap tokenMap = session.getMetadata().getTokenMap().get();
    checkRanges(tokenMap.getTokenRanges());
}
Also used : TokenMap(com.datastax.oss.driver.api.core.metadata.TokenMap)

Example 12 with TokenMap

use of com.datastax.oss.driver.api.core.metadata.TokenMap in project java-driver by datastax.

the class TokenITBase method should_create_tokens_and_ranges.

@Test
public void should_create_tokens_and_ranges() {
    TokenMap tokenMap = getTokenMap();
    // Pick a random range
    TokenRange range = tokenMap.getTokenRanges().iterator().next();
    Token start = tokenMap.parse(tokenMap.format(range.getStart()));
    Token end = tokenMap.parse(tokenMap.format(range.getEnd()));
    assertThat(tokenMap.newTokenRange(start, end)).isEqualTo(range);
}
Also used : TokenRange(com.datastax.oss.driver.api.core.metadata.token.TokenRange) Token(com.datastax.oss.driver.api.core.metadata.token.Token) TokenMap(com.datastax.oss.driver.api.core.metadata.TokenMap) Test(org.junit.Test)

Aggregations

TokenMap (com.datastax.oss.driver.api.core.metadata.TokenMap)12 Test (org.junit.Test)9 ByteBuffer (java.nio.ByteBuffer)7 Node (com.datastax.oss.driver.api.core.metadata.Node)6 CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)4 SimpleStatement (com.datastax.oss.driver.api.core.cql.SimpleStatement)4 TokenRange (com.datastax.oss.driver.api.core.metadata.token.TokenRange)4 ResultSet (com.datastax.oss.driver.api.core.cql.ResultSet)3 Statement (com.datastax.oss.driver.api.core.cql.Statement)3 EndPoint (com.datastax.oss.driver.api.core.metadata.EndPoint)3 Token (com.datastax.oss.driver.api.core.metadata.token.Token)3 CqlSession (com.datastax.oss.driver.api.core.CqlSession)2 ProtocolVersion (com.datastax.oss.driver.api.core.ProtocolVersion)2 DriverConfigLoader (com.datastax.oss.driver.api.core.config.DriverConfigLoader)2 Row (com.datastax.oss.driver.api.core.cql.Row)2 ArrayList (java.util.ArrayList)2 ConsistencyLevel (com.datastax.oss.driver.api.core.ConsistencyLevel)1 DefaultConsistencyLevel (com.datastax.oss.driver.api.core.DefaultConsistencyLevel)1 NoNodeAvailableException (com.datastax.oss.driver.api.core.NoNodeAvailableException)1 DefaultDriverOption (com.datastax.oss.driver.api.core.config.DefaultDriverOption)1