Search in sources :

Example 11 with SubscriptionReply

use of joynr.SubscriptionReply in project joynr by bmwcarit.

the class TtlUpliftTest method testTtlUpliftMs_SubscriptionReply.

@Test
public void testTtlUpliftMs_SubscriptionReply() {
    SubscriptionReply subscriptionReply = new SubscriptionReply();
    expiryDate = DispatcherUtils.convertTtlToExpirationDate(messagingQos.getRoundTripTtl_ms());
    MutableMessage message = messageFactoryWithTtlUplift.createSubscriptionReply(fromParticipantId, toParticipantId, subscriptionReply, messagingQos);
    long expiryDateValue = expiryDate.getValue() + TTL_UPLIFT_MS;
    MutableMessageFactoryTest.assertExpiryDateEquals(expiryDateValue, message);
}
Also used : SubscriptionReply(joynr.SubscriptionReply) MutableMessage(joynr.MutableMessage) Test(org.junit.Test)

Example 12 with SubscriptionReply

use of joynr.SubscriptionReply in project joynr by bmwcarit.

the class SubscriptionManagerTest method testHandleSubscriptionReplyWithSuccessWithSubscriptionListener.

@Test
public void testHandleSubscriptionReplyWithSuccessWithSubscriptionListener() {
    SubscriptionReply subscriptionReply = new SubscriptionReply(subscriptionId);
    @SuppressWarnings("unchecked") Future<String> futureMock = mock(Future.class);
    subscriptionFutureMap.put(subscriptionId, futureMock);
    AttributeSubscriptionListener<?> subscriptionListener = mock(AttributeSubscriptionListener.class);
    attributeSubscriptionDirectory.put(subscriptionId, subscriptionListener);
    subscriptionManager.handleSubscriptionReply(subscriptionReply);
    verify(futureMock).onSuccess(eq(subscriptionId));
    verify(subscriptionListener).onSubscribed(eq(subscriptionId));
}
Also used : SubscriptionReply(joynr.SubscriptionReply) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 13 with SubscriptionReply

use of joynr.SubscriptionReply in project joynr by bmwcarit.

the class SubscriptionManagerTest method testHandleSubscriptionReplyWithSuccess.

@Test
public void testHandleSubscriptionReplyWithSuccess() {
    SubscriptionReply subscriptionReply = new SubscriptionReply(subscriptionId);
    @SuppressWarnings("unchecked") Future<String> futureMock = mock(Future.class);
    subscriptionFutureMap.put(subscriptionId, futureMock);
    subscriptionManager.handleSubscriptionReply(subscriptionReply);
    verify(futureMock).onSuccess(eq(subscriptionId));
}
Also used : SubscriptionReply(joynr.SubscriptionReply) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 14 with SubscriptionReply

use of joynr.SubscriptionReply in project joynr by bmwcarit.

the class SubscriptionManagerTest method testHandleSubscriptionReplyWithError.

@Test
public void testHandleSubscriptionReplyWithError() {
    SubscriptionException subscriptionError = new SubscriptionException(subscriptionId);
    SubscriptionReply subscriptionReply = new SubscriptionReply(subscriptionId, subscriptionError);
    @SuppressWarnings("unchecked") Future<String> futureMock = mock(Future.class);
    subscriptionFutureMap.put(subscriptionId, futureMock);
    subscriptionManager.handleSubscriptionReply(subscriptionReply);
    verify(futureMock).onFailure(eq(subscriptionError));
}
Also used : SubscriptionException(io.joynr.exceptions.SubscriptionException) SubscriptionReply(joynr.SubscriptionReply) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

SubscriptionReply (joynr.SubscriptionReply)14 Test (org.junit.Test)7 Matchers.anyString (org.mockito.Matchers.anyString)6 SubscriptionException (io.joynr.exceptions.SubscriptionException)4 MessagingQos (io.joynr.messaging.MessagingQos)4 SubscriptionQos (io.joynr.pubsub.SubscriptionQos)3 OnChangeSubscriptionQos (joynr.OnChangeSubscriptionQos)3 UnicastSubscriptionQos (joynr.UnicastSubscriptionQos)3 BroadcastSubscriptionListener (io.joynr.pubsub.subscription.BroadcastSubscriptionListener)2 HeartbeatSubscriptionInformation (io.joynr.pubsub.HeartbeatSubscriptionInformation)1 BroadcastListener (io.joynr.pubsub.publication.BroadcastListener)1 EncodingException (io.joynr.smrf.EncodingException)1 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 MulticastPublication (joynr.MulticastPublication)1 MulticastSubscriptionRequest (joynr.MulticastSubscriptionRequest)1 MutableMessage (joynr.MutableMessage)1 OneWayRequest (joynr.OneWayRequest)1 Reply (joynr.Reply)1 Request (joynr.Request)1