use of com.palantir.lock.HeldLocksToken in project atlasdb by palantir.
the class AsyncTimelockServiceIntegrationTest method getMinLockedInVersionIdReturnsValidValuesForAnonymousClient.
@Test
public void getMinLockedInVersionIdReturnsValidValuesForAnonymousClient() throws InterruptedException {
HeldLocksToken token1 = lockWithFullResponse(requestForReadLock(LOCK_A, 10L), LockClient.ANONYMOUS);
HeldLocksToken token2 = lockWithFullResponse(requestForReadLock(LOCK_B, 12L), LockClient.ANONYMOUS);
assertThat(cluster.lockService().getMinLockedInVersionId()).isEqualTo(10L);
unlock(token1, token2);
}
use of com.palantir.lock.HeldLocksToken in project atlasdb by palantir.
the class AsyncTimelockServiceIntegrationTest method getMinLockedInVersionIdReturnsNullIfNoVersionIdsAreSpecified.
@Test
public void getMinLockedInVersionIdReturnsNullIfNoVersionIdsAreSpecified() throws InterruptedException {
HeldLocksToken token = lockWithFullResponse(requestForReadLock(LOCK_A), TEST_CLIENT);
assertThat(cluster.lockService().getMinLockedInVersionId(TEST_CLIENT)).isNull();
unlock(token);
}
use of com.palantir.lock.HeldLocksToken in project atlasdb by palantir.
the class AsyncTimelockServiceIntegrationTest method canPerformLockAndUnlock.
@Test
public void canPerformLockAndUnlock() throws InterruptedException {
HeldLocksToken token1 = lockWithFullResponse(requestForWriteLock(LOCK_A), TEST_CLIENT);
cluster.lockService().unlock(token1);
HeldLocksToken token2 = lockWithFullResponse(requestForWriteLock(LOCK_A), TEST_CLIENT);
cluster.lockService().unlockSimple(SimpleHeldLocksToken.fromHeldLocksToken(token2));
}
use of com.palantir.lock.HeldLocksToken in project atlasdb by palantir.
the class AsyncTimelockServiceIntegrationTest method getMinLockedInVersionIdReturnsValidValues.
@Test
public void getMinLockedInVersionIdReturnsValidValues() throws InterruptedException {
HeldLocksToken token1 = lockWithFullResponse(requestForReadLock(LOCK_A, 10L), TEST_CLIENT);
HeldLocksToken token2 = lockWithFullResponse(requestForReadLock(LOCK_B, 12L), TEST_CLIENT);
assertThat(cluster.lockService().getMinLockedInVersionId(TEST_CLIENT)).isEqualTo(10L);
unlock(token1, token2);
}
Aggregations