Search in sources :

Example 1 with AtlasDbRemoteException

use of com.palantir.atlasdb.http.errors.AtlasDbRemoteException in project atlasdb by palantir.

the class SerializableErrorDecoderTest method assertHasErrorName.

private static void assertHasErrorName(Throwable exception, String expectedErrorName) {
    AtlasDbRemoteException remoteException = (AtlasDbRemoteException) exception;
    assertThat(remoteException.getErrorName()).isEqualTo(expectedErrorName);
}
Also used : AtlasDbRemoteException(com.palantir.atlasdb.http.errors.AtlasDbRemoteException)

Example 2 with AtlasDbRemoteException

use of com.palantir.atlasdb.http.errors.AtlasDbRemoteException in project atlasdb by palantir.

the class AsyncTimelockServiceIntegrationTest method assertBadRequest.

private static void assertBadRequest(ThrowableAssert.ThrowingCallable throwingCallable) {
    assertThatThrownBy(throwingCallable).isInstanceOf(AtlasDbRemoteException.class).satisfies(remoteException -> {
        AtlasDbRemoteException atlasDbRemoteException = (AtlasDbRemoteException) remoteException;
        assertThat(atlasDbRemoteException.getErrorName()).isEqualTo(BadRequestException.class.getCanonicalName());
        assertThat(atlasDbRemoteException.getStatus()).isEqualTo(HttpStatus.BAD_REQUEST_400);
    });
}
Also used : BadRequestException(javax.ws.rs.BadRequestException) AtlasDbRemoteException(com.palantir.atlasdb.http.errors.AtlasDbRemoteException)

Example 3 with AtlasDbRemoteException

use of com.palantir.atlasdb.http.errors.AtlasDbRemoteException in project atlasdb by palantir.

the class PaxosTimeLockServerIntegrationTest method assertRemoteExceptionWithStatus.

private static void assertRemoteExceptionWithStatus(Throwable throwable, int expectedStatus) {
    assertThat(throwable).isInstanceOf(AtlasDbRemoteException.class);
    AtlasDbRemoteException remoteException = (AtlasDbRemoteException) throwable;
    assertThat(remoteException.getStatus()).isEqualTo(expectedStatus);
}
Also used : AtlasDbRemoteException(com.palantir.atlasdb.http.errors.AtlasDbRemoteException)

Example 4 with AtlasDbRemoteException

use of com.palantir.atlasdb.http.errors.AtlasDbRemoteException 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);
    });
}
Also used : LockService(com.palantir.lock.LockService) BadRequestException(javax.ws.rs.BadRequestException) AtlasDbRemoteException(com.palantir.atlasdb.http.errors.AtlasDbRemoteException) Test(org.junit.Test)

Aggregations

AtlasDbRemoteException (com.palantir.atlasdb.http.errors.AtlasDbRemoteException)4 BadRequestException (javax.ws.rs.BadRequestException)2 LockService (com.palantir.lock.LockService)1 Test (org.junit.Test)1