Search in sources :

Example 16 with LockWatchStateUpdate

use of com.palantir.lock.watch.LockWatchStateUpdate in project atlasdb by palantir.

the class LockWatchingServiceImplTest method assertLoggedEvents.

private void assertLoggedEvents(List<LockWatchEvent> expectedEvents) {
    LockWatchStateUpdate update = lockWatcher.getWatchStateUpdate(Optional.of(LockWatchVersion.of(LOG_ID, -1L)));
    List<LockWatchEvent> events = UpdateVisitors.assertSuccess(update).events();
    assertThat(events).containsExactlyElementsOf(expectedEvents);
}
Also used : LockWatchStateUpdate(com.palantir.lock.watch.LockWatchStateUpdate) LockWatchEvent(com.palantir.lock.watch.LockWatchEvent)

Example 17 with LockWatchStateUpdate

use of com.palantir.lock.watch.LockWatchStateUpdate in project atlasdb by palantir.

the class LockWatchEventCacheIntegrationTest method newEventsStartingWithTheSameVersionAsCurrentDoesNotThrow.

@Test
public void newEventsStartingWithTheSameVersionAsCurrentDoesNotThrow() {
    setupInitialState();
    LockWatchEvent earlyLockEvent = LockWatchCreatedEvent.builder(ImmutableSet.of(REFERENCE), ImmutableSet.of(DESCRIPTOR)).build(3L);
    LockWatchStateUpdate success = LockWatchStateUpdate.success(LEADER, 4L, ImmutableList.of(earlyLockEvent, WATCH_EVENT));
    assertThatCode(() -> eventCache.processStartTransactionsUpdate(TIMESTAMPS_2, success)).doesNotThrowAnyException();
}
Also used : LockWatchStateUpdate(com.palantir.lock.watch.LockWatchStateUpdate) LockWatchEvent(com.palantir.lock.watch.LockWatchEvent) Test(org.junit.Test)

Example 18 with LockWatchStateUpdate

use of com.palantir.lock.watch.LockWatchStateUpdate in project atlasdb by palantir.

the class AsyncLockServiceEteTest method leaderIdFromLockWatchingServiceIsSameAsLeaderClock.

@Test
public void leaderIdFromLockWatchingServiceIsSameAsLeaderClock() {
    LeaderTime leaderTime = service.leaderTime();
    LockWatchStateUpdate lockWatchUpdate = lockWatchingService.getWatchStateUpdate(Optional.empty());
    assertThat(leaderTime.id().id()).isEqualTo(lockWatchUpdate.logId());
}
Also used : LeaderTime(com.palantir.lock.v2.LeaderTime) LockWatchStateUpdate(com.palantir.lock.watch.LockWatchStateUpdate) Test(org.junit.Test)

Aggregations

LockWatchStateUpdate (com.palantir.lock.watch.LockWatchStateUpdate)18 Test (org.junit.Test)15 LockWatchReference (com.palantir.lock.watch.LockWatchReferences.LockWatchReference)5 LockWatchEvent (com.palantir.lock.watch.LockWatchEvent)3 TransactionLockWatchFailedException (com.palantir.atlasdb.transaction.api.TransactionLockWatchFailedException)2 AtlasRowLockDescriptor (com.palantir.lock.AtlasRowLockDescriptor)2 LockDescriptor (com.palantir.lock.LockDescriptor)2 Timer (com.codahale.metrics.Timer)1 LeaderTime (com.palantir.lock.v2.LeaderTime)1 TaggedMetricRegistry (com.palantir.tritium.metrics.registry.TaggedMetricRegistry)1 UUID (java.util.UUID)1