@Test public void setConfigurationOK() throws Exception { ArgumentCaptor<Runnable> runnableArg = ArgumentCaptor.forClass(Runnable.class); when(taskScheduler.scheduleWithFixedDelay(runnableArg.capture(), anyLong())).thenReturn(Mockito.mock(ScheduledFuture.class)); ArgumentCaptor<SuccessCallback> successArg = ArgumentCaptor.forClass(SuccessCallback.class); ListenableFuture<SubscribeContextResponse> responseFuture = Mockito.mock(ListenableFuture.class); doNothing().when(responseFuture).addCallback(successArg.capture(), any()); Configuration configuration = getBasicConf(); subscriptionManager.setConfiguration(configuration); ArgumentCaptor<String> urlProviderArg = ArgumentCaptor.forClass(String.class); ArgumentCaptor<SubscribeContext> subscribeContextArg = ArgumentCaptor.forClass(SubscribeContext.class); when(ngsiClient.subscribeContext(urlProviderArg.capture(), eq(null), subscribeContextArg.capture())).thenReturn(responseFuture); runnableArg.getValue().run(); callSuccessCallback(successArg); SubscribeContext subscribeContext = subscribeContextArg.getValue(); assertEquals("S.*", subscribeContext.getEntityIdList().get(0).getId()); assertEquals("TempSensor", subscribeContext.getEntityIdList().get(0).getType()); assertEquals(true, subscribeContext.getEntityIdList().get(0).getIsPattern()); assertEquals("temp", subscribeContext.getAttributeList().get(0)); assertEquals("PT1H", subscribeContext.getDuration()); assertEquals("http: Set<Provider> providers = configuration.getEventTypeIns().get(0).getProviders(); for(Provider provider: providers) { assertEquals("12345678", provider.getSubscriptionId()); assertNotNull(provider.getSubscriptionDate()); } }
public void setConfiguration(Configuration configuration) { hostURI = configuration.getHost(); subscriptions = migrateSubscriptions(configuration); eventTypeIns = configuration.getEventTypeIns(); scheduleSubscriptionTask(); }
SubscriptionManager { public void setConfiguration(Configuration configuration) { hostURI = configuration.getHost(); subscriptions = migrateSubscriptions(configuration); eventTypeIns = configuration.getEventTypeIns(); scheduleSubscriptionTask(); } }
SubscriptionManager { public void setConfiguration(Configuration configuration) { hostURI = configuration.getHost(); subscriptions = migrateSubscriptions(configuration); eventTypeIns = configuration.getEventTypeIns(); scheduleSubscriptionTask(); }  }
SubscriptionManager { public void setConfiguration(Configuration configuration) { hostURI = configuration.getHost(); subscriptions = migrateSubscriptions(configuration); eventTypeIns = configuration.getEventTypeIns(); scheduleSubscriptionTask(); }  void setConfiguration(Configuration configuration); boolean validateSubscriptionId(String subscriptionId, String originatorUrl); @PreDestroy void shutdownGracefully(); HttpHeaders getHeadersForProvider(Provider provider); }
SubscriptionManager { public void setConfiguration(Configuration configuration) { hostURI = configuration.getHost(); subscriptions = migrateSubscriptions(configuration); eventTypeIns = configuration.getEventTypeIns(); scheduleSubscriptionTask(); }  void setConfiguration(Configuration configuration); boolean validateSubscriptionId(String subscriptionId, String originatorUrl); @PreDestroy void shutdownGracefully(); HttpHeaders getHeadersForProvider(Provider provider);  }