use of com.palantir.lock.v2.LockToken in project atlasdb by palantir.
the class AsyncLockServiceEteTest method timedOutRequestDoesNotHoldLocks.
@Test
@ShouldRetry
public void timedOutRequestDoesNotHoldLocks() {
LockToken lockBToken = lockSynchronously(REQUEST_1, LOCK_B);
service.lock(REQUEST_2, descriptors(LOCK_A, LOCK_B), SHORT_TIMEOUT);
waitForTimeout(SHORT_TIMEOUT);
assertNotLocked(LOCK_A);
service.unlock(lockBToken);
assertNotLocked(LOCK_B);
}
use of com.palantir.lock.v2.LockToken in project atlasdb by palantir.
the class AsyncLockServiceEteTest method cannotUnlockAfterUnlocking.
@Test
public void cannotUnlockAfterUnlocking() {
LockToken token = lockSynchronously(REQUEST_1, LOCK_A);
service.unlock(token);
assertFalse(service.unlock(token));
}
use of com.palantir.lock.v2.LockToken in project atlasdb by palantir.
the class AsyncLockServiceEteTest method locksCanBeRefreshed.
@Test
public void locksCanBeRefreshed() {
LockToken token = lockSynchronously(REQUEST_1, LOCK_A);
assertTrue(service.refresh(token));
}
use of com.palantir.lock.v2.LockToken in project atlasdb by palantir.
the class AsyncLockServiceEteTest method canWaitForMultipleLocks.
@Test
public void canWaitForMultipleLocks() {
LockToken lockAHolder = lockSynchronously(REQUEST_1, LOCK_B, LOCK_C);
AsyncResult<Void> waitResult = waitForLocks(REQUEST_2, LOCK_A, LOCK_B, LOCK_C);
assertThat(waitResult.isComplete()).isFalse();
assertNotLocked(LOCK_A);
service.unlock(lockAHolder);
assertThat(waitResult.isCompletedSuccessfully()).isTrue();
assertNotLocked(LOCK_A);
assertNotLocked(LOCK_C);
}
use of com.palantir.lock.v2.LockToken in project atlasdb by palantir.
the class AsyncLockServiceEteTest method cannotRefreshAfterUnlocking.
@Test
public void cannotRefreshAfterUnlocking() {
LockToken token = lockSynchronously(REQUEST_1, LOCK_A);
service.unlock(token);
assertFalse(service.refresh(token));
}
Aggregations