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));
}
Aggregations