@Test public void testInvalideSubscription() { ListenableFuture<UnsubscribeContextResponse> responseFuture = Mockito.mock(ListenableFuture.class); doNothing().when(responseFuture).addCallback(any(), any()); when(ngsiClient.unsubscribeContext(eq("http: subscriptionManager.validateSubscriptionId("9999", "http: }
public boolean validateSubscriptionId(String subscriptionId, String originatorUrl) { if (validateSubscriptionsId) { boolean isValid = subscriptions.isSubscriptionValid(subscriptionId); if (!isValid) { logger.warn("unsubscribeContext request: clean invalid subscription id {} / {}", subscriptionId, originatorUrl); ngsiClient.unsubscribeContext(originatorUrl, null, subscriptionId).addCallback( unsubscribeContextResponse -> logger.debug("unsubscribeContext completed for {}", originatorUrl), throwable -> logger.warn("unsubscribeContext failed for {}", originatorUrl, throwable) ); } return isValid; } return true; }
SubscriptionManager { public boolean validateSubscriptionId(String subscriptionId, String originatorUrl) { if (validateSubscriptionsId) { boolean isValid = subscriptions.isSubscriptionValid(subscriptionId); if (!isValid) { logger.warn("unsubscribeContext request: clean invalid subscription id {} / {}", subscriptionId, originatorUrl); ngsiClient.unsubscribeContext(originatorUrl, null, subscriptionId).addCallback( unsubscribeContextResponse -> logger.debug("unsubscribeContext completed for {}", originatorUrl), throwable -> logger.warn("unsubscribeContext failed for {}", originatorUrl, throwable) ); } return isValid; } return true; } }
SubscriptionManager { public boolean validateSubscriptionId(String subscriptionId, String originatorUrl) { if (validateSubscriptionsId) { boolean isValid = subscriptions.isSubscriptionValid(subscriptionId); if (!isValid) { logger.warn("unsubscribeContext request: clean invalid subscription id {} / {}", subscriptionId, originatorUrl); ngsiClient.unsubscribeContext(originatorUrl, null, subscriptionId).addCallback( unsubscribeContextResponse -> logger.debug("unsubscribeContext completed for {}", originatorUrl), throwable -> logger.warn("unsubscribeContext failed for {}", originatorUrl, throwable) ); } return isValid; } return true; }  }
SubscriptionManager { public boolean validateSubscriptionId(String subscriptionId, String originatorUrl) { if (validateSubscriptionsId) { boolean isValid = subscriptions.isSubscriptionValid(subscriptionId); if (!isValid) { logger.warn("unsubscribeContext request: clean invalid subscription id {} / {}", subscriptionId, originatorUrl); ngsiClient.unsubscribeContext(originatorUrl, null, subscriptionId).addCallback( unsubscribeContextResponse -> logger.debug("unsubscribeContext completed for {}", originatorUrl), throwable -> logger.warn("unsubscribeContext failed for {}", originatorUrl, throwable) ); } return isValid; } return true; }  void setConfiguration(Configuration configuration); boolean validateSubscriptionId(String subscriptionId, String originatorUrl); @PreDestroy void shutdownGracefully(); HttpHeaders getHeadersForProvider(Provider provider); }
SubscriptionManager { public boolean validateSubscriptionId(String subscriptionId, String originatorUrl) { if (validateSubscriptionsId) { boolean isValid = subscriptions.isSubscriptionValid(subscriptionId); if (!isValid) { logger.warn("unsubscribeContext request: clean invalid subscription id {} / {}", subscriptionId, originatorUrl); ngsiClient.unsubscribeContext(originatorUrl, null, subscriptionId).addCallback( unsubscribeContextResponse -> logger.debug("unsubscribeContext completed for {}", originatorUrl), throwable -> logger.warn("unsubscribeContext failed for {}", originatorUrl, throwable) ); } return isValid; } return true; }  void setConfiguration(Configuration configuration); boolean validateSubscriptionId(String subscriptionId, String originatorUrl); @PreDestroy void shutdownGracefully(); HttpHeaders getHeadersForProvider(Provider provider);  }