Search in sources :

Example 26 with MutableMessage

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));
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) SubscriptionRequest(joynr.SubscriptionRequest) MulticastSubscriptionRequest(joynr.MulticastSubscriptionRequest) MutableMessage(joynr.MutableMessage) OnChangeSubscriptionQos(joynr.OnChangeSubscriptionQos) Matchers.anyString(org.mockito.Matchers.anyString) MulticastSubscriptionRequest(joynr.MulticastSubscriptionRequest) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 27 with MutableMessage

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);
}
Also used : MutableMessage(joynr.MutableMessage) Test(org.junit.Test)

Example 28 with MutableMessage

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);
}
Also used : MutableMessage(joynr.MutableMessage) Test(org.junit.Test)

Example 29 with MutableMessage

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);
}
Also used : MutableMessage(joynr.MutableMessage) Test(org.junit.Test)

Example 30 with MutableMessage

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());
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) MutableMessage(joynr.MutableMessage) Test(org.junit.Test)

Aggregations

MutableMessage (joynr.MutableMessage)60 Test (org.junit.Test)35 MessagingQos (io.joynr.messaging.MessagingQos)15 ImmutableMessage (joynr.ImmutableMessage)9 MulticastSubscriptionRequest (joynr.MulticastSubscriptionRequest)7 SubscriptionRequest (joynr.SubscriptionRequest)6 Request (joynr.Request)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 Reply (joynr.Reply)4 Injector (com.google.inject.Injector)3 JoynrMessageProcessor (io.joynr.messaging.JoynrMessageProcessor)3 BroadcastSubscriptionRequest (joynr.BroadcastSubscriptionRequest)3 MulticastPublication (joynr.MulticastPublication)3 OneWayRequest (joynr.OneWayRequest)3 DiscoveryEntryWithMetaInfo (joynr.types.DiscoveryEntryWithMetaInfo)3 InvocationOnMock (org.mockito.invocation.InvocationOnMock)3 AbstractModule (com.google.inject.AbstractModule)2 TypeLiteral (com.google.inject.TypeLiteral)2 Multibinder (com.google.inject.multibindings.Multibinder)2 JoynrPropertiesModule (io.joynr.common.JoynrPropertiesModule)2