use of com.palantir.lock.remoting.BlockingTimeoutException in project atlasdb by palantir.
the class ConjureTimelockResourceTest method handlesBlockingTimeout.
@Test
public void handlesBlockingTimeout() {
when(resource.leaderTime(AUTH_HEADER, NAMESPACE)).thenThrow(new BlockingTimeoutException(""));
assertQosExceptionThrownBy(resource.leaderTime(AUTH_HEADER, NAMESPACE), new AssertVisitor() {
@Override
public Void visit(QosException.Throttle exception) {
assertThat(exception.getRetryAfter()).contains(Duration.ZERO);
return null;
}
});
}
use of com.palantir.lock.remoting.BlockingTimeoutException in project atlasdb by palantir.
the class MultiClientConjureTimelockResourceTest method requestHandlesExceptionAndThrowsIfAnyQueryFails.
@Test
public void requestHandlesExceptionAndThrowsIfAnyQueryFails() {
String throwingClient = "alpha";
Set<Namespace> namespaces = ImmutableSet.of(Namespace.of(throwingClient), Namespace.of("beta"));
when(getServiceForClient(throwingClient).leaderTime()).thenThrow(new BlockingTimeoutException(""));
assertThatThrownBy(() -> Futures.getUnchecked(resource.leaderTimes(AUTH_HEADER, namespaces))).hasCauseInstanceOf(Throttle.class);
}
use of com.palantir.lock.remoting.BlockingTimeoutException in project atlasdb by palantir.
the class ConjureTimelockResourceTest method jerseyPropagatesExceptions.
@Test
public void jerseyPropagatesExceptions() {
when(resource.leaderTime(AUTH_HEADER, NAMESPACE)).thenThrow(new BlockingTimeoutException(""));
assertQosExceptionThrownBy(Futures.submitAsync(() -> Futures.immediateFuture(service.leaderTime(AUTH_HEADER, NAMESPACE)), MoreExecutors.directExecutor()), new AssertVisitor() {
@Override
public Void visit(QosException.Throttle exception) {
assertThat(exception.getRetryAfter()).contains(Duration.ZERO);
return null;
}
});
}
Aggregations