Search in sources :

Example 31 with SubscriptionRequest

use of joynr.SubscriptionRequest in project joynr by bmwcarit.

the class PublicationManagerTest method addPublicationWithoutExpiryDate.

@SuppressWarnings("unchecked")
@Test(timeout = 3000)
public void addPublicationWithoutExpiryDate() throws Exception {
    int period = 200;
    PeriodicSubscriptionQos qos = new PeriodicSubscriptionQos();
    qos.setPeriodMs(period).setValidityMs(SubscriptionQos.IGNORE_VALUE);
    qos.setAlertAfterIntervalMs(500).setPublicationTtlMs(1000);
    SubscriptionRequest subscriptionRequest = new SubscriptionRequest(SUBSCRIPTION_ID, "location", qos);
    when(providerDirectory.get(eq(PROVIDER_PARTICIPANT_ID))).thenReturn(providerContainer);
    when(providerDirectory.contains(eq(PROVIDER_PARTICIPANT_ID))).thenReturn(true);
    publicationManager.addSubscriptionRequest(PROXY_PARTICIPANT_ID, PROVIDER_PARTICIPANT_ID, subscriptionRequest);
    verify(dispatcher, timeout(period * 5).times(6)).sendSubscriptionPublication(eq(PROVIDER_PARTICIPANT_ID), (Set<String>) argThat(contains(PROXY_PARTICIPANT_ID)), any(SubscriptionPublication.class), any(MessagingQos.class));
    reset(dispatcher);
    publicationManager.stopPublication(SUBSCRIPTION_ID);
    verify(dispatcher, timeout(300).times(0)).sendSubscriptionPublication(eq(PROVIDER_PARTICIPANT_ID), (Set<String>) argThat(contains(PROXY_PARTICIPANT_ID)), any(SubscriptionPublication.class), any(MessagingQos.class));
}
Also used : SubscriptionRequest(joynr.SubscriptionRequest) BroadcastSubscriptionRequest(joynr.BroadcastSubscriptionRequest) MessagingQos(io.joynr.messaging.MessagingQos) SubscriptionPublication(joynr.SubscriptionPublication) Matchers.anyString(org.mockito.Matchers.anyString) PeriodicSubscriptionQos(joynr.PeriodicSubscriptionQos) Test(org.junit.Test)

Example 32 with SubscriptionRequest

use of joynr.SubscriptionRequest in project joynr by bmwcarit.

the class PushingPublicationTest method setupMixedQos.

void setupMixedQos() {
    OnChangeWithKeepAliveSubscriptionQos qos = new OnChangeWithKeepAliveSubscriptionQos();
    qos.setMinIntervalMs(10);
    // TODO Also write this test with -1
    qos.setMaxIntervalMs(3000);
    qos.setValidityMs(19000);
    qos.setAlertAfterIntervalMs(500);
    qos.setPublicationTtlMs(1000);
    subscriptionRequest = new SubscriptionRequest(subscriptionId, attributeName, qos);
}
Also used : OnChangeWithKeepAliveSubscriptionQos(joynr.OnChangeWithKeepAliveSubscriptionQos) SubscriptionRequest(joynr.SubscriptionRequest)

Aggregations

SubscriptionRequest (joynr.SubscriptionRequest)32 BroadcastSubscriptionRequest (joynr.BroadcastSubscriptionRequest)24 Test (org.junit.Test)24 MessagingQos (io.joynr.messaging.MessagingQos)23 SubscriptionPublication (joynr.SubscriptionPublication)22 OnChangeSubscriptionQos (joynr.OnChangeSubscriptionQos)19 Matchers.anyString (org.mockito.Matchers.anyString)18 PeriodicSubscriptionQos (joynr.PeriodicSubscriptionQos)8 SubscriptionQos (io.joynr.pubsub.SubscriptionQos)7 BroadcastFilter (io.joynr.pubsub.publication.BroadcastFilter)6 joynr.tests.testLocationUpdateSelectiveBroadcastFilter (joynr.tests.testLocationUpdateSelectiveBroadcastFilter)6 joynr.tests.testLocationUpdateWithSpeedSelectiveBroadcastFilter (joynr.tests.testLocationUpdateWithSpeedSelectiveBroadcastFilter)6 ProviderDirectory (io.joynr.dispatching.ProviderDirectory)5 MulticastSubscriptionRequest (joynr.MulticastSubscriptionRequest)5 ArrayList (java.util.ArrayList)4 SubscriptionReply (joynr.SubscriptionReply)4 joynr.tests.testBroadcastInterface (joynr.tests.testBroadcastInterface)4 GpsLocation (joynr.types.Localisation.GpsLocation)4 MutableMessage (joynr.MutableMessage)3 OnChangeWithKeepAliveSubscriptionQos (joynr.OnChangeWithKeepAliveSubscriptionQos)3