Search in sources :

Example 6 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithJoynrRuntimeException.

@Test
public void serializeReplyWithJoynrRuntimeException() throws IOException {
    JoynrRuntimeException error = new JoynrRuntimeException("detail message: JoynrRuntimeException");
    Reply reply = new Reply(UUID.randomUUID().toString(), error);
    String writeValueAsString = objectMapper.writeValueAsString(reply);
    System.out.println(writeValueAsString);
    Reply receivedReply = objectMapper.readValue(writeValueAsString, Reply.class);
    Assert.assertEquals(reply, receivedReply);
}
Also used : Reply(joynr.Reply) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) Test(org.junit.Test)

Example 7 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithJoynrRequestInterruptedException.

@Test
public void serializeReplyWithJoynrRequestInterruptedException() throws IOException {
    JoynrRequestInterruptedException error = new JoynrRequestInterruptedException("detail message: JoynrRequestInterruptedException");
    Reply reply = new Reply(UUID.randomUUID().toString(), error);
    String writeValueAsString = objectMapper.writeValueAsString(reply);
    System.out.println(writeValueAsString);
    Reply receivedReply = objectMapper.readValue(writeValueAsString, Reply.class);
    Assert.assertEquals(reply, receivedReply);
}
Also used : Reply(joynr.Reply) JoynrRequestInterruptedException(io.joynr.exceptions.JoynrRequestInterruptedException) Test(org.junit.Test)

Example 8 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithJoynrApplicationExceptionWithoutMessage.

@Test
public void serializeReplyWithJoynrApplicationExceptionWithoutMessage() throws IOException {
    ApplicationException error = new ApplicationException(TestEnum.TWO);
    Reply reply = new Reply(UUID.randomUUID().toString(), error);
    String writeValueAsString = objectMapper.writeValueAsString(reply);
    System.out.println(writeValueAsString);
    Reply receivedReply = objectMapper.readValue(writeValueAsString, Reply.class);
    Assert.assertEquals(reply, receivedReply);
}
Also used : ApplicationException(joynr.exceptions.ApplicationException) Reply(joynr.Reply) Test(org.junit.Test)

Example 9 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class TtlUpliftTest method testTtlUpliftMs_Reply_noUplift.

@Test
public void testTtlUpliftMs_Reply_noUplift() {
    Reply reply = new Reply();
    expiryDate = DispatcherUtils.convertTtlToExpirationDate(messagingQos.getRoundTripTtl_ms());
    MutableMessage message = messageFactoryWithTtlUplift.createReply(fromParticipantId, toParticipantId, reply, messagingQos);
    long expiryDateValue = expiryDate.getValue();
    MutableMessageFactoryTest.assertExpiryDateEquals(expiryDateValue, message);
}
Also used : MutableMessage(joynr.MutableMessage) Reply(joynr.Reply) SubscriptionReply(joynr.SubscriptionReply) Test(org.junit.Test)

Example 10 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class RequestReplyManagerTest method requestReplyMessagesRemoveCallBackByTtl.

@Test
public void requestReplyMessagesRemoveCallBackByTtl() throws Exception {
    TestProvider testResponder = new TestProvider(1);
    ExpiryDate ttlReplyCaller = ExpiryDate.fromRelativeTtl(1000L);
    final ReplyCaller replyCaller = mock(ReplyCaller.class);
    replyCallerDirectory.addReplyCaller(request1.getRequestReplyId(), replyCaller, ttlReplyCaller);
    Thread.sleep(ttlReplyCaller.getRelativeTtl() + 100);
    requestReplyManager.handleReply(new Reply(request1.getRequestReplyId(), testResponder.getSentPayloadFor(request1)));
    verify(replyCaller, never()).messageCallBack(any(Reply.class));
}
Also used : ExpiryDate(io.joynr.common.ExpiryDate) Reply(joynr.Reply) ReplyCaller(io.joynr.dispatching.rpc.ReplyCaller) Test(org.junit.Test)

Aggregations

Reply (joynr.Reply)38 Test (org.junit.Test)33 Request (joynr.Request)6 SynchronizedReplyCaller (io.joynr.dispatching.rpc.SynchronizedReplyCaller)5 ApplicationException (joynr.exceptions.ApplicationException)5 Matchers.anyString (org.mockito.Matchers.anyString)5 ReplyCaller (io.joynr.dispatching.rpc.ReplyCaller)4 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)4 MessagingQos (io.joynr.messaging.MessagingQos)4 IOException (java.io.IOException)4 MutableMessage (joynr.MutableMessage)4 OneWayRequest (joynr.OneWayRequest)4 InvocationOnMock (org.mockito.invocation.InvocationOnMock)4 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)3 ImmutableMessage (joynr.ImmutableMessage)3 MulticastSubscriptionRequest (joynr.MulticastSubscriptionRequest)3 SubscriptionRequest (joynr.SubscriptionRequest)3 JsonParseException (com.fasterxml.jackson.core.JsonParseException)2 AbstractModule (com.google.inject.AbstractModule)2 TypeLiteral (com.google.inject.TypeLiteral)2