use of joynr.OnChangeSubscriptionQos in project joynr by bmwcarit.
the class TtlUpliftTest method testAttributeSubscriptionWithTtlUpliftWithNoExpiryDate.
@Ignore
@SuppressWarnings("unchecked")
@Test(timeout = 3000)
public void testAttributeSubscriptionWithTtlUpliftWithNoExpiryDate() throws Exception {
long validityMs = 300;
long publicationTtlMs = 1000;
OnChangeSubscriptionQos qos = new OnChangeSubscriptionQos();
qos.setMinIntervalMs(0);
qos.setExpiryDateMs(SubscriptionQos.NO_EXPIRY_DATE);
qos.setPublicationTtlMs(publicationTtlMs);
long expectedSubscriptionReplyTtl = LARGE_EXPIRY_DATE_MS;
long expectedPublicationTtlMs = publicationTtlMs;
testAttributeSubscriptionWithTtlUplift(qos, validityMs, expectedSubscriptionReplyTtl, expectedPublicationTtlMs);
publicationManagerWithTtlUplift.attributeValueChanged(SUBSCRIPTION_ID, valueToPublish);
verify(dispatcher, timeout(300).times(1)).sendSubscriptionPublication(eq(PROVIDER_PARTICIPANT_ID), (Set<String>) argThat(contains(PROXY_PARTICIPANT_ID)), any(SubscriptionPublication.class), argThat(new MessagingQosMatcher(expectedPublicationTtlMs)));
}
use of joynr.OnChangeSubscriptionQos in project joynr by bmwcarit.
the class TtlUpliftTest method testBroadcastSubscriptionWithTtlUplift.
@SuppressWarnings("unchecked")
@Test(timeout = 3000)
public void testBroadcastSubscriptionWithTtlUplift() throws Exception {
long validityMs = 300;
long publicationTtlMs = 1000;
OnChangeSubscriptionQos qos = new OnChangeSubscriptionQos();
qos.setMinIntervalMs(0);
qos.setValidityMs(validityMs);
qos.setPublicationTtlMs(publicationTtlMs);
long expectedSubscriptionReplyTtl = validityMs;
long expectedPublicationTtlMs = publicationTtlMs;
testBroadcastSubscriptionWithTtlUplift(qos, validityMs, expectedSubscriptionReplyTtl, expectedPublicationTtlMs);
publicationManagerWithTtlUplift.broadcastOccurred(SUBSCRIPTION_ID, null, valueToPublish);
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.OnChangeSubscriptionQos in project joynr by bmwcarit.
the class TtlUpliftTest method testBroadcastSubscriptionWithTtlUpliftWithNoExpiryDate.
@Ignore
@SuppressWarnings("unchecked")
@Test(timeout = 3000)
public void testBroadcastSubscriptionWithTtlUpliftWithNoExpiryDate() throws Exception {
long validityMs = 300;
long publicationTtlMs = 1000;
OnChangeSubscriptionQos qos = new OnChangeSubscriptionQos();
qos.setMinIntervalMs(0);
qos.setExpiryDateMs(SubscriptionQos.NO_EXPIRY_DATE);
qos.setPublicationTtlMs(publicationTtlMs);
long expectedSubscriptionReplyTtl = LARGE_EXPIRY_DATE_MS;
long expectedPublicationTtlMs = publicationTtlMs;
testBroadcastSubscriptionWithTtlUplift(qos, validityMs, expectedSubscriptionReplyTtl, expectedPublicationTtlMs);
publicationManagerWithTtlUplift.broadcastOccurred(SUBSCRIPTION_ID, null, valueToPublish);
verify(dispatcher, timeout(300).times(1)).sendSubscriptionPublication(eq(PROVIDER_PARTICIPANT_ID), (Set<String>) argThat(contains(PROXY_PARTICIPANT_ID)), any(SubscriptionPublication.class), argThat(new MessagingQosMatcher(expectedPublicationTtlMs)));
}
use of joynr.OnChangeSubscriptionQos in project joynr by bmwcarit.
the class TtlUpliftTest method testAttributeSubscriptionWithoutTtlUplift.
@SuppressWarnings("unchecked")
@Test(timeout = 3000)
public void testAttributeSubscriptionWithoutTtlUplift() throws Exception {
long validityMs = 300;
long publicationTtlMs = 1000;
long toleranceMs = 50;
OnChangeSubscriptionQos qos = new OnChangeSubscriptionQos();
qos.setMinIntervalMs(0);
qos.setValidityMs(validityMs);
qos.setPublicationTtlMs(publicationTtlMs);
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);
verifySubscriptionReplyTtl(validityMs, toleranceMs);
verifyCleanupSchedulerDelay(validityMs, toleranceMs);
publicationManager.attributeValueChanged(SUBSCRIPTION_ID, valueToPublish);
// sending initial value plus the attributeValueChanged
verify(dispatcher, times(2)).sendSubscriptionPublication(eq(PROVIDER_PARTICIPANT_ID), (Set<String>) argThat(contains(PROXY_PARTICIPANT_ID)), any(SubscriptionPublication.class), argThat(new MessagingQosMatcher(publicationTtlMs)));
Thread.sleep(validityMs + toleranceMs);
reset(dispatcher);
publicationManager.attributeValueChanged(SUBSCRIPTION_ID, valueToPublish);
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.OnChangeSubscriptionQos in project joynr by bmwcarit.
the class TtlUpliftTest method testBroadcastSubscriptionWithTtlUpliftWithLargeExpiryDate.
@SuppressWarnings("unchecked")
@Test(timeout = 3000)
public void testBroadcastSubscriptionWithTtlUpliftWithLargeExpiryDate() throws Exception {
long validityMs = 300;
long publicationTtlMs = 1000;
OnChangeSubscriptionQos qos = new OnChangeSubscriptionQos();
qos.setMinIntervalMs(0);
qos.setExpiryDateMs(LARGE_EXPIRY_DATE_MS - SUBSCRIPTION_UPLIFT_MS + 1);
qos.setPublicationTtlMs(publicationTtlMs);
long expectedSubscriptionReplyTtl = qos.getExpiryDateMs() - System.currentTimeMillis();
long expectedPublicationTtlMs = publicationTtlMs;
testBroadcastSubscriptionWithTtlUplift(qos, validityMs, expectedSubscriptionReplyTtl, expectedPublicationTtlMs);
publicationManagerWithTtlUplift.broadcastOccurred(SUBSCRIPTION_ID, null, valueToPublish);
verify(dispatcher, timeout(300).times(1)).sendSubscriptionPublication(eq(PROVIDER_PARTICIPANT_ID), (Set<String>) argThat(contains(PROXY_PARTICIPANT_ID)), any(SubscriptionPublication.class), argThat(new MessagingQosMatcher(expectedPublicationTtlMs)));
}
Aggregations