Search in sources :

Example 1 with LocationUpdateSelectiveBroadcastFilterParameters

use of joynr.vehicle.NavigationBroadcastInterface.LocationUpdateSelectiveBroadcastFilterParameters in project joynr by bmwcarit.

the class ProxyTest method createProxySubscribeAndUnsubscribeFromSelectiveBroadcast.

@Test
public void createProxySubscribeAndUnsubscribeFromSelectiveBroadcast() throws Exception {
    NavigationProxy proxy = getNavigationProxy();
    long minInterval_ms = 0;
    long expiryDate = System.currentTimeMillis() + 30000;
    long publicationTtl_ms = 5000;
    OnChangeSubscriptionQos subscriptionQos = new OnChangeSubscriptionQos().setMinIntervalMs(minInterval_ms).setExpiryDateMs(expiryDate).setPublicationTtlMs(publicationTtl_ms);
    LocationUpdateSelectiveBroadcastFilterParameters filterParameter = new LocationUpdateSelectiveBroadcastFilterParameters();
    Future<String> subscriptionId = proxy.subscribeToLocationUpdateSelectiveBroadcast(mock(LocationUpdateSelectiveBroadcastListener.class), subscriptionQos, filterParameter);
    ArgumentCaptor<BroadcastSubscribeInvocation> subscriptionRequest = ArgumentCaptor.forClass(BroadcastSubscribeInvocation.class);
    verify(subscriptionManager, times(1)).registerBroadcastSubscription(eq(fromParticipantId), eq(Sets.newHashSet(toDiscoveryEntry)), subscriptionRequest.capture());
    assertEquals("locationUpdateSelective", subscriptionRequest.getValue().getBroadcastName());
    // now, let's remove the previous subscriptionRequest
    proxy.unsubscribeFromGuidanceActive(subscriptionId.get(100L));
    verify(subscriptionManager, times(1)).unregisterSubscription(eq(fromParticipantId), eq(Sets.newHashSet(toDiscoveryEntry)), eq(subscriptionId.get()), any(MessagingQos.class));
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) BroadcastSubscribeInvocation(io.joynr.proxy.invocation.BroadcastSubscribeInvocation) OnChangeSubscriptionQos(joynr.OnChangeSubscriptionQos) LocationUpdateSelectiveBroadcastListener(joynr.vehicle.NavigationBroadcastInterface.LocationUpdateSelectiveBroadcastListener) NavigationProxy(joynr.vehicle.NavigationProxy) LocationUpdateSelectiveBroadcastFilterParameters(joynr.vehicle.NavigationBroadcastInterface.LocationUpdateSelectiveBroadcastFilterParameters) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

MessagingQos (io.joynr.messaging.MessagingQos)1 BroadcastSubscribeInvocation (io.joynr.proxy.invocation.BroadcastSubscribeInvocation)1 OnChangeSubscriptionQos (joynr.OnChangeSubscriptionQos)1 LocationUpdateSelectiveBroadcastFilterParameters (joynr.vehicle.NavigationBroadcastInterface.LocationUpdateSelectiveBroadcastFilterParameters)1 LocationUpdateSelectiveBroadcastListener (joynr.vehicle.NavigationBroadcastInterface.LocationUpdateSelectiveBroadcastListener)1 NavigationProxy (joynr.vehicle.NavigationProxy)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1