use of org.corfudb.protocols.wireprotocol.Token in project CorfuDB by CorfuDB.
the class SequencerClientTest method checkTokenPositionWorks.
@Test
public void checkTokenPositionWorks() throws Exception {
Token token = client.nextToken(Collections.<UUID>emptySet(), 1).get().getToken();
Token token2 = client.nextToken(Collections.<UUID>emptySet(), 0).get().getToken();
assertThat(token).isEqualTo(token2);
}
use of org.corfudb.protocols.wireprotocol.Token in project CorfuDB by CorfuDB.
the class SequencerViewTest method checkStreamTokensWork.
@Test
public void checkStreamTokensWork() {
CorfuRuntime r = getDefaultRuntime();
UUID streamA = UUID.nameUUIDFromBytes("stream A".getBytes());
UUID streamB = UUID.nameUUIDFromBytes("stream B".getBytes());
assertThat(r.getSequencerView().nextToken(Collections.singleton(streamA), 1).getToken()).isEqualTo(new Token(0L, 0L));
assertThat(r.getSequencerView().nextToken(Collections.singleton(streamA), 0).getToken()).isEqualTo(new Token(0L, 0L));
assertThat(r.getSequencerView().nextToken(Collections.singleton(streamB), 1).getToken()).isEqualTo(new Token(1L, 0L));
assertThat(r.getSequencerView().nextToken(Collections.singleton(streamB), 0).getToken()).isEqualTo(new Token(1L, 0L));
assertThat(r.getSequencerView().nextToken(Collections.singleton(streamA), 0).getToken()).isEqualTo(new Token(0L, 0L));
}
use of org.corfudb.protocols.wireprotocol.Token in project CorfuDB by CorfuDB.
the class SequencerClientTest method tokensAreIncrementing.
@Test
public void tokensAreIncrementing() throws Exception {
Token token = client.nextToken(Collections.<UUID>emptySet(), 1).get().getToken();
Token token2 = client.nextToken(Collections.<UUID>emptySet(), 1).get().getToken();
assertThat(token2.getTokenValue()).isGreaterThan(token.getTokenValue());
}
Aggregations