use of joynr.MutableMessage in project joynr by bmwcarit.
the class DispatcherImplTest method testReceiveMulticastSubscription.
@Test
public void testReceiveMulticastSubscription() throws Exception {
String from = "from";
String to = "to";
MulticastSubscriptionRequest subscriptionRequest = new MulticastSubscriptionRequest("multicastId", "subscriptionId", "multicastName", new OnChangeSubscriptionQos());
MutableMessage joynrMessage = messageFactory.createSubscriptionRequest(from, to, subscriptionRequest, new MessagingQos(1000L));
MutableMessageFactory messageFactoryMock = mock(MutableMessageFactory.class);
ObjectMapper objectMapperMock = mock(ObjectMapper.class);
when(objectMapperMock.readValue(anyString(), eq(SubscriptionRequest.class))).thenReturn(subscriptionRequest);
fixture = new DispatcherImpl(requestReplyManagerMock, subscriptionManagerMock, publicationManagerMock, messageRouterMock, messageSenderMock, messageFactoryMock, objectMapperMock);
fixture.messageArrived(joynrMessage.getImmutableMessage());
verify(publicationManagerMock).addSubscriptionRequest(eq(from), eq(to), eq(subscriptionRequest));
}
use of joynr.MutableMessage in project joynr by bmwcarit.
the class MutableMessageFactoryTest method createRequest.
@Test
public void createRequest() {
MutableMessage message = mutableMessageFactory.createRequest(fromParticipantId, toParticipantId, request, messagingQos);
assertEquals(Message.VALUE_MESSAGE_TYPE_REQUEST, message.getType());
assertEquals(fromParticipantId, message.getSender());
assertEquals(toParticipantId, message.getRecipient());
assertExpiryDateEquals(expiryDate.getValue(), message);
assertTrue(message.getPayload() != null);
}
use of joynr.MutableMessage in project joynr by bmwcarit.
the class MutableMessageFactoryTest method createPublication.
@Test
public void createPublication() {
MutableMessage message = mutableMessageFactory.createPublication(fromParticipantId, toParticipantId, publication, messagingQos);
assertEquals(Message.VALUE_MESSAGE_TYPE_PUBLICATION, message.getType());
assertEquals(fromParticipantId, message.getSender());
assertEquals(toParticipantId, message.getRecipient());
assertExpiryDateEquals(expiryDate.getValue(), message);
assertTrue(message.getPayload() != null);
}
use of joynr.MutableMessage in project joynr by bmwcarit.
the class MutableMessageFactoryTest method createSubscriptionRequest.
@Test
public void createSubscriptionRequest() {
MutableMessage message = mutableMessageFactory.createSubscriptionRequest(fromParticipantId, toParticipantId, subscriptionRequest, messagingQos);
assertEquals(Message.VALUE_MESSAGE_TYPE_SUBSCRIPTION_REQUEST, message.getType());
assertEquals(fromParticipantId, message.getSender());
assertEquals(toParticipantId, message.getRecipient());
assertExpiryDateEquals(expiryDate.getValue(), message);
assertTrue(message.getPayload() != null);
}
use of joynr.MutableMessage in project joynr by bmwcarit.
the class MutableMessageFactoryTest method createRequestWithCustomEffort.
@Test
public void createRequestWithCustomEffort() {
MessagingQos customMessagingQos = new MessagingQos();
customMessagingQos.setEffort(MessagingQosEffort.BEST_EFFORT);
MutableMessage message = mutableMessageFactory.createRequest(fromParticipantId, toParticipantId, request, customMessagingQos);
expiryDate = DispatcherUtils.convertTtlToExpirationDate(customMessagingQos.getRoundTripTtl_ms());
assertExpiryDateEquals(expiryDate.getValue(), message);
assertEquals(String.valueOf(MessagingQosEffort.BEST_EFFORT), message.getEffort());
}
Aggregations