use of joynr.MutableMessage in project joynr by bmwcarit.
the class AbstractMessageSenderTest method testLocalMessageGetsNoReplyTo.
@Test
public void testLocalMessageGetsNoReplyTo() {
MutableMessage message = createTestRequestMessage();
message.setLocalMessage(true);
subject.setReplyToAddress("someReplyTo");
subject.sendMessage(message);
ArgumentCaptor<ImmutableMessage> argCaptor = ArgumentCaptor.forClass(ImmutableMessage.class);
verify(messageRouterMock).route(argCaptor.capture());
assertEquals(null, argCaptor.getValue().getReplyTo());
}
use of joynr.MutableMessage in project joynr by bmwcarit.
the class LibJoynrMessageSenderTest method testReplyToIsSet.
@Test
public void testReplyToIsSet() {
MutableMessage message = createTestRequestMessage();
String expectedReplyTo = "expectedReplyTo";
LibJoynrMessageSender subject = new LibJoynrMessageSender(messageRouterMock);
subject.setReplyToAddress(expectedReplyTo);
subject.sendMessage(message);
ArgumentCaptor<ImmutableMessage> argCaptor = ArgumentCaptor.forClass(ImmutableMessage.class);
verify(messageRouterMock).route(argCaptor.capture());
assertEquals(expectedReplyTo, argCaptor.getValue().getReplyTo());
}
use of joynr.MutableMessage in project joynr by bmwcarit.
the class MessageSenderTestBase method createTestRequestMessage.
protected MutableMessage createTestRequestMessage() {
MutableMessage message = new MutableMessage();
message.setType(Message.VALUE_MESSAGE_TYPE_REQUEST);
message.setLocalMessage(false);
message.setSender("");
message.setRecipient("");
message.setPayload(new byte[] { 0, 1, 2 });
return message;
}
use of joynr.MutableMessage in project joynr by bmwcarit.
the class DispatcherImplTest method testHandleOneWayRequest.
@Test
public void testHandleOneWayRequest() throws Exception {
OneWayRequest request = new OneWayRequest("method", new Object[0], new Class<?>[0]);
String toParticipantId = "toParticipantId";
MessagingQos messagingQos = new MessagingQos(1000L);
MutableMessage joynrMessage = messageFactory.createOneWayRequest("fromParticipantId", toParticipantId, request, messagingQos);
fixture.messageArrived(joynrMessage.getImmutableMessage());
verify(requestReplyManagerMock).handleOneWayRequest(toParticipantId, request, joynrMessage.getTtlMs());
verify(messageSenderMock, never()).sendMessage(any(MutableMessage.class));
}
use of joynr.MutableMessage in project joynr by bmwcarit.
the class DispatcherImplTest method testPropagateCompressFlagFromRequestToRepliesImpl.
private void testPropagateCompressFlagFromRequestToRepliesImpl(final boolean compress) throws Exception {
MessagingQos messagingQos = new MessagingQos(1000L);
messagingQos.setCompress(compress);
String requestReplyId = UUID.randomUUID().toString();
Request request = new Request("methodName", new Object[] {}, new String[] {}, requestReplyId);
final String providerParticipantId = "toParticipantId";
MutableMessage joynrMessage = messageFactory.createRequest("fromParticipantId", providerParticipantId, request, messagingQos);
ImmutableMessage outgoingMessage = joynrMessage.getImmutableMessage();
fixture.messageArrived(outgoingMessage);
verify(requestReplyManagerMock).handleRequest(providerCallbackReply.capture(), eq(providerParticipantId), eq(request), eq(joynrMessage.getTtlMs()));
providerCallbackReply.getValue().onSuccess(new Reply(requestReplyId));
verify(messageSenderMock).sendMessage(argThat(new MessageIsCompressedMatcher(compress)));
}
Aggregations