use of io.joynr.exceptions.JoynrWaitExpiredException in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method asyncMethodCallWithTtlExpiring.
@Ignore
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void asyncMethodCallWithTtlExpiring() throws DiscoveryException, JoynrIllegalStateException, InterruptedException, ApplicationException {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
long ttl = 2000L;
MessagingQos testMessagingQos = new MessagingQos(ttl);
DiscoveryQos testDiscoveryQos = new DiscoveryQos(30000, ArbitrationStrategy.HighestPriority, Long.MAX_VALUE);
testProxy proxyShortTll = proxyBuilder.setMessagingQos(testMessagingQos).setDiscoveryQos(testDiscoveryQos).build();
// the provider waits ttl before responding, causing a ttl
boolean timeoutExceptionThrown = false;
// the ttl parameter tells the provider to wait this long before
// replying, thereby forcing a ttl exception
Future<String> waitTooLongFuture = proxyShortTll.waitTooLong(callback, ttl * 2);
try {
// should never have to wait
waitTooLongFuture.get(10 * ttl);
// this long
// the JoynWaitExpiredException should not be thrown.
} catch (JoynrWaitExpiredException e) {
timeoutExceptionThrown = false;
} catch (JoynrTimeoutException e) {
timeoutExceptionThrown = true;
}
assertEquals(true, timeoutExceptionThrown);
assertEquals(RequestStatusCode.ERROR, waitTooLongFuture.getStatus().getCode());
verify(callback).onFailure(any(JoynrRuntimeException.class));
verifyNoMoreInteractions(callback);
}
use of io.joynr.exceptions.JoynrWaitExpiredException in project joynr by bmwcarit.
the class SerializationTest method serializeReplyWithJoynrWaitExpiredException.
@Test
public void serializeReplyWithJoynrWaitExpiredException() throws IOException {
JoynrWaitExpiredException error = new JoynrWaitExpiredException();
Reply reply = new Reply(UUID.randomUUID().toString(), error);
String writeValueAsString = objectMapper.writeValueAsString(reply);
Reply receivedReply = objectMapper.readValue(writeValueAsString, Reply.class);
Assert.assertEquals(reply, receivedReply);
}
Aggregations