Search in sources :

Example 26 with Reply

use of joynr.Reply 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);
}
Also used : JoynrWaitExpiredException(io.joynr.exceptions.JoynrWaitExpiredException) Reply(joynr.Reply) Test(org.junit.Test)

Example 27 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithJoynrRuntimeExceptionWithCause.

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

Example 28 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithJoynrChannelNotAssignableException.

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

Example 29 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeAndDeserializeJsonReplyTest.

@Test
public void serializeAndDeserializeJsonReplyTest() throws Exception {
    GpsLocation[] GpsLocations = { new GpsLocation(1.0d, 2.0d, 0d, GpsFixEnum.MODE2D, 0d, 0d, 0d, 0d, 0l, 0l, 0), new GpsLocation(3.0d, 4.0d, 0d, GpsFixEnum.MODE2D, 0d, 0d, 0d, 0d, 0l, 0l, 0), new GpsLocation(5.0d, 6.0d, 0d, GpsFixEnum.MODE2D, 0d, 0d, 0d, 0d, 0l, 0l, 0) };
    Reply reply = new Reply(UUID.randomUUID().toString(), (Object) GpsLocations);
    String valueAsString = objectMapper.writeValueAsString(reply);
    System.out.println(valueAsString);
    Reply reply2 = objectMapper.readValue(valueAsString, Reply.class);
    assertEquals(reply, reply2);
}
Also used : GpsLocation(joynr.types.Localisation.GpsLocation) Reply(joynr.Reply) Test(org.junit.Test)

Example 30 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithMethodInvocationException.

@Test
public void serializeReplyWithMethodInvocationException() throws IOException {
    MethodInvocationException error = new MethodInvocationException("detail message: MessageInvocationException");
    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) MethodInvocationException(joynr.exceptions.MethodInvocationException) 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