use of com.palantir.lock.LockService in project atlasdb by palantir.
the class PaxosTimeLockServerIntegrationTest method lockServiceShouldAllowUsToTakeOutSameLockInDifferentNamespaces.
@Test
public void lockServiceShouldAllowUsToTakeOutSameLockInDifferentNamespaces() throws InterruptedException {
LockService lockService1 = getLockService(CLIENT_1);
LockService lockService2 = getLockService(CLIENT_2);
LockRefreshToken token1 = lockService1.lock(LOCK_CLIENT_NAME, com.palantir.lock.LockRequest.builder(LOCK_MAP).doNotBlock().build());
LockRefreshToken token2 = lockService2.lock(LOCK_CLIENT_NAME, com.palantir.lock.LockRequest.builder(LOCK_MAP).doNotBlock().build());
assertThat(token1).isNotNull();
assertThat(token2).isNotNull();
lockService1.unlock(token1);
lockService2.unlock(token2);
}
use of com.palantir.lock.LockService in project atlasdb by palantir.
the class PaxosTimeLockServerIntegrationTest method lockServiceShouldDisallowGettingMinLockedInVersionId.
@Test
public void lockServiceShouldDisallowGettingMinLockedInVersionId() {
LockService lockService = getLockService(CLIENT_1);
assertThatThrownBy(() -> lockService.getMinLockedInVersionId(CLIENT_1)).isInstanceOf(AtlasDbRemoteException.class).satisfies(remoteException -> {
AtlasDbRemoteException atlasDbRemoteException = (AtlasDbRemoteException) remoteException;
assertThat(atlasDbRemoteException.getErrorName()).isEqualTo(BadRequestException.class.getCanonicalName());
assertThat(atlasDbRemoteException.getStatus()).isEqualTo(HttpStatus.BAD_REQUEST_400);
});
}
Aggregations