use of joynr.PeriodicSubscriptionQos in project joynr by bmwcarit.
the class PublicationManagerTest method startAndStopPeriodicPublication.
@SuppressWarnings("unchecked")
@Test(timeout = 3000)
public void startAndStopPeriodicPublication() throws Exception {
int period = 200;
int testLengthMax = 3000;
PeriodicSubscriptionQos qos = new PeriodicSubscriptionQos();
qos.setPeriodMs(200).setValidityMs(testLengthMax).setPublicationTtlMs(testLengthMax);
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(testLengthMax).times(0)).sendSubscriptionPublication(eq(PROVIDER_PARTICIPANT_ID), (Set<String>) argThat(contains(PROXY_PARTICIPANT_ID)), any(SubscriptionPublication.class), any(MessagingQos.class));
}
use of joynr.PeriodicSubscriptionQos 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));
}
use of joynr.PeriodicSubscriptionQos in project joynr by bmwcarit.
the class SubscriptionManagerTest method setUp.
@Before
public void setUp() {
subscriptionManager = new SubscriptionManagerImpl(attributeSubscriptionDirectory, broadcastSubscriptionDirectory, multicastSubscribersDirectory, subscriptionStates, missedPublicationTimers, subscriptionEndFutures, subscriptionAttributeTypes, unicastBroadcastTypes, multicastBroadcastTypes, subscriptionFutureMap, cleanupScheduler, dispatcher, multicastWildcardRegexFactory);
subscriptionId = "testSubscription";
attributeName = "testAttribute";
attributeSubscriptionCallback = new AttributeSubscriptionAdapter<Integer>();
long minInterval_ms = 100;
long maxInterval_ms = 5000;
long subscriptionDuration = 20000;
long alertInterval_ms = 6000;
long publicationTtl_ms = 1000;
qos = new PeriodicSubscriptionQos();
qos.setPeriodMs(maxInterval_ms);
qos.setValidityMs(subscriptionDuration);
qos.setAlertAfterIntervalMs(alertInterval_ms);
qos.setPublicationTtlMs(publicationTtl_ms);
onChangeQos = new OnChangeSubscriptionQos();
onChangeQos.setMinIntervalMs(minInterval_ms);
onChangeQos.setValidityMs(subscriptionDuration);
onChangeQos.setPublicationTtlMs(publicationTtl_ms);
qosWithoutExpiryDate = new PeriodicSubscriptionQos();
qosWithoutExpiryDate.setPeriodMs(maxInterval_ms);
qosWithoutExpiryDate.setValidityMs(SubscriptionQos.IGNORE_VALUE);
qosWithoutExpiryDate.setAlertAfterIntervalMs(alertInterval_ms);
qosWithoutExpiryDate.setPublicationTtlMs(publicationTtl_ms);
missedPublicationTimer = new MissedPublicationTimer(System.currentTimeMillis() + subscriptionDuration, maxInterval_ms, alertInterval_ms, attributeSubscriptionCallback, subscriptionState, subscriptionId);
qosSettings = new MessagingQos();
fromParticipantId = "fromParticipantId";
toParticipantId = "toParticipantId";
toDiscoveryEntry = new DiscoveryEntryWithMetaInfo();
toDiscoveryEntry.setParticipantId(toParticipantId);
future = new Future<String>();
}
Aggregations