Search in sources :

Example 31 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithJoynrCommunicationExceptionWithoutMessage.

@Test
public void serializeReplyWithJoynrCommunicationExceptionWithoutMessage() throws IOException {
    JoynrCommunicationException error = new JoynrCommunicationException();
    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) JoynrCommunicationException(io.joynr.exceptions.JoynrCommunicationException) Test(org.junit.Test)

Example 32 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithJoynrShutdownException.

@Test
public void serializeReplyWithJoynrShutdownException() throws IOException {
    JoynrShutdownException error = new JoynrShutdownException("detail message: JoynrShutdownException");
    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 : JoynrShutdownException(io.joynr.exceptions.JoynrShutdownException) Reply(joynr.Reply) Test(org.junit.Test)

Example 33 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithCapabilityInfoArray.

@Test
public void serializeReplyWithCapabilityInfoArray() throws JsonGenerationException, JsonMappingException, IOException {
    Object response = new GlobalDiscoveryEntry[] { new GlobalDiscoveryEntry(new Version(47, 11), "domain", "interface", "participantId", new ProviderQos(), System.currentTimeMillis(), expiryDateMs, publicKeyId, "channelId") };
    Reply reply = new Reply(UUID.randomUUID().toString(), response);
    String writeValueAsString = objectMapper.writeValueAsString(reply);
    Reply receivedReply = objectMapper.readValue(writeValueAsString, Reply.class);
    GlobalDiscoveryEntry[] convertValue = objectMapper.convertValue(receivedReply.getResponse()[0], GlobalDiscoveryEntry[].class);
    Assert.assertArrayEquals((GlobalDiscoveryEntry[]) reply.getResponse()[0], convertValue);
    ComplexTestType2[] complexTestType2Array = { new ComplexTestType2(3, 4), new ComplexTestType2(5, 6) };
    ArrayList<ComplexTestType2> customListParam2List = new ArrayList<ComplexTestType2>();
    customListParam2List.add(new ComplexTestType2(3, 4));
    customListParam2List.add(new ComplexTestType2(5, 6));
    ComplexTestType2[] convertValue2 = objectMapper.convertValue(customListParam2List, ComplexTestType2[].class);
    Assert.assertArrayEquals(complexTestType2Array, convertValue2);
}
Also used : Version(joynr.types.Version) GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) ArrayList(java.util.ArrayList) Reply(joynr.Reply) ComplexTestType2(joynr.tests.testTypes.ComplexTestType2) ProviderQos(joynr.types.ProviderQos) Test(org.junit.Test)

Example 34 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithJoynrRuntimeExceptionWithoutMessage.

@Test
public void serializeReplyWithJoynrRuntimeExceptionWithoutMessage() throws IOException {
    JoynrRuntimeException error = new JoynrRuntimeException();
    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) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) Test(org.junit.Test)

Example 35 with Reply

use of joynr.Reply in project joynr by bmwcarit.

the class SerializationTest method serializeReplyWithJoynrIllegalStateException.

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