use of com.palantir.timestamp.TimestampRange in project atlasdb by palantir.
the class AsyncTimelockServiceIntegrationTest method canGetBatchTimestamps.
@Test
public void canGetBatchTimestamps() {
TimestampRange range1 = cluster.getFreshTimestamps(5);
TimestampRange range2 = cluster.timelockService().getFreshTimestamps(5);
assertThat(range1.getUpperBound()).isLessThan(range2.getLowerBound());
}
use of com.palantir.timestamp.TimestampRange in project atlasdb by palantir.
the class AbstractTimestampServiceTests method canRequestTimestampRangeWithGetFreshTimestamps.
@Test
public void canRequestTimestampRangeWithGetFreshTimestamps() {
int expectedNumTimestamps = 5;
TimestampRange range = timestampService.getFreshTimestamps(expectedNumTimestamps);
Assertions.assertThat((int) range.size()).withFailMessage("Expected %d timestamps, got %d timestamps. (The returned range was: %d-%d)", expectedNumTimestamps, range.size(), range.getLowerBound(), range.getUpperBound()).isGreaterThanOrEqualTo(1).isLessThanOrEqualTo(expectedNumTimestamps);
}
use of com.palantir.timestamp.TimestampRange in project atlasdb by palantir.
the class AbstractTimestampServiceTests method timestampRangesAreReturnedInNonOverlappingOrder.
@Test
public void timestampRangesAreReturnedInNonOverlappingOrder() {
TimestampRange timestampRange1 = timestampService.getFreshTimestamps(10);
TimestampRange timestampRange2 = timestampService.getFreshTimestamps(10);
long firstUpperBound = timestampRange1.getUpperBound();
long secondLowerBound = timestampRange2.getLowerBound();
Assertions.assertThat(firstUpperBound).isLessThan(secondLowerBound);
}
use of com.palantir.timestamp.TimestampRange in project atlasdb by palantir.
the class TimestampRemotingTest method testSerializing.
@Test
public void testSerializing() {
ObjectMapper mapper = new ObjectMapper();
String uri = dropwizard.baseUri().toString();
TimestampService ts = Feign.builder().decoder(new JacksonDecoder(mapper)).encoder(new JacksonEncoder(mapper)).contract(new JAXRSContract()).target(TimestampService.class, uri);
long freshTimestamp = ts.getFreshTimestamp();
TimestampRange freshTimestamps = ts.getFreshTimestamps(100);
}
use of com.palantir.timestamp.TimestampRange in project atlasdb by palantir.
the class TimeLockClientTest method getTimestampsDelegates.
@Test
public void getTimestampsDelegates() {
int numTimestamps = 5;
TimestampRange timestamps = TimestampRange.createInclusiveRange(1L, numTimestamps);
when(delegate.getFreshTimestamps(numTimestamps)).thenReturn(timestamps);
assertThat(timelock.getFreshTimestamps(numTimestamps)).isEqualTo(timestamps);
}
Aggregations