Search in sources :

Example 1 with LeasedLockToken

use of com.palantir.lock.client.LeasedLockToken in project atlasdb by palantir.

the class ClientLogEventsTest method toCommitUpdateFiltersOutLockEventsWithMatchingLockToken.

@Test
public void toCommitUpdateFiltersOutLockEventsWithMatchingLockToken() {
    // due to how the commit flow works, the filtering is only done if it is a leased lock token
    LeasedLockToken leasedLockToken = mock(LeasedLockToken.class);
    when(leasedLockToken.serverToken()).thenReturn(CONJURE_TOKEN_1);
    TimestampStateStore.CommitInfo commitInfo = TimestampStateStore.CommitInfo.of(leasedLockToken, VERSION_1);
    CommitUpdate commitUpdate = CLIENT_EVENTS_2_TO_4_NO_CLEAR_CACHE.toCommitUpdate(VERSION_1, VERSION_4, Optional.of(commitInfo));
    Set<LockDescriptor> lockDescriptors = extractLockDescriptors(commitUpdate);
    assertThat(lockDescriptors).containsExactlyInAnyOrder(DESCRIPTOR_1);
}
Also used : LockDescriptor(com.palantir.lock.LockDescriptor) StringLockDescriptor(com.palantir.lock.StringLockDescriptor) CommitUpdate(com.palantir.lock.watch.CommitUpdate) LeasedLockToken(com.palantir.lock.client.LeasedLockToken) Test(org.junit.Test)

Aggregations

LockDescriptor (com.palantir.lock.LockDescriptor)1 StringLockDescriptor (com.palantir.lock.StringLockDescriptor)1 LeasedLockToken (com.palantir.lock.client.LeasedLockToken)1 CommitUpdate (com.palantir.lock.watch.CommitUpdate)1 Test (org.junit.Test)1