use of com.palantir.timestamp.TimestampService in project atlasdb by palantir.
the class PaxosTimeLockServerIntegrationTest method timestampServiceShouldRespectDistinctClientsWhenIssuingTimestamps.
@Test
public void timestampServiceShouldRespectDistinctClientsWhenIssuingTimestamps() {
TimestampService timestampService1 = getTimestampService(CLIENT_1);
TimestampService timestampService2 = getTimestampService(CLIENT_2);
long firstServiceFirstTimestamp = timestampService1.getFreshTimestamp();
long secondServiceFirstTimestamp = timestampService2.getFreshTimestamp();
long firstServiceSecondTimestamp = timestampService1.getFreshTimestamp();
long secondServiceSecondTimestamp = timestampService2.getFreshTimestamp();
assertEquals(firstServiceFirstTimestamp + 1, firstServiceSecondTimestamp);
assertEquals(secondServiceFirstTimestamp + 1, secondServiceSecondTimestamp);
}
use of com.palantir.timestamp.TimestampService in project atlasdb by palantir.
the class SweepStatsKeyValueServiceTest method before.
@Before
public void before() {
TimestampService timestampService = mock(TimestampService.class);
kvs = SweepStatsKeyValueService.create(delegate, timestampService, () -> AtlasDbConstants.DEFAULT_SWEEP_WRITE_THRESHOLD, () -> AtlasDbConstants.DEFAULT_SWEEP_WRITE_SIZE_THRESHOLD);
}
use of com.palantir.timestamp.TimestampService in project atlasdb by palantir.
the class ServiceExposureEteTest method shouldExposeATimestampServer.
@Test
public void shouldExposeATimestampServer() {
TimestampService timestampClient = EteSetup.createClientToAllNodes(TimestampService.class);
assertThat(timestampClient.getFreshTimestamp(), is(not(nullValue())));
}
use of com.palantir.timestamp.TimestampService in project atlasdb by palantir.
the class TimeLockMigrationEteTest method automaticallyMigratesTimestampsAndFailsOnRestart.
@Test
public void automaticallyMigratesTimestampsAndFailsOnRestart() throws Exception {
TimestampService timestampClient = createEteClientFor(TimestampService.class);
TodoResource todoClient = createEteClientFor(TodoResource.class);
todoClient.addTodo(TODO);
softAssertions.assertThat(todoClient.getTodoList()).as("contains one todo pre-migration").contains(TODO);
long embeddedTimestamp = timestampClient.getFreshTimestamp();
softAssertions.assertThat(embeddedTimestamp).as("can get a timestamp before migration").isNotNull();
upgradeAtlasClientToTimelock();
assertTimeLockGivesHigherTimestampThan(embeddedTimestamp);
softAssertions.assertThat(todoClient.getTodoList()).as("can still read todo after migration to TimeLock").contains(TODO);
todoClient.addTodo(TODO_2);
softAssertions.assertThat(todoClient.getTodoList()).as("can add a new todo using TimeLock").contains(TODO, TODO_2);
assertNoLongerExposesEmbeddedTimestampService();
downgradeAtlasClientFromTimelockWithoutMigration();
assertCanNeitherReadNorWrite();
}
use of com.palantir.timestamp.TimestampService in project atlasdb by palantir.
the class TimeLockMigrationEteTest method assertNoLongerExposesEmbeddedTimestampService.
private void assertNoLongerExposesEmbeddedTimestampService() {
TimestampService timestampClient = createEteClientFor(TimestampService.class);
// as() is not compatible with assertThatThrownBy - see
// http://joel-costigliola.github.io/assertj/core/api/org/assertj/core/api/Assertions.html
softAssertions.assertThat(((AtlasDbRemoteException) catchThrowable(timestampClient::getFreshTimestamp)).getStatus()).isEqualTo(404).as("no longer exposes an embedded timestamp service");
}
Aggregations