@Test public void shouldNotRemoveProviderFromHandler() throws IOException { DataProviderManager mgr = new DataProviderManager(taskDataProviderService); TaskDataProvider provider = new TaskDataProvider(); provider.setId(TASK_DATA_PROVIDER_ID); when(taskDataProviderService.getProvider(TASK_DATA_PROVIDER_NAME)).thenReturn(provider); mgr.unbind(dataProvider, null); verify(taskTriggerHandler, never()).removeDataProvider(TASK_DATA_PROVIDER_NAME); }
@Override public void unbind(Object service, Map serviceProperties) { if (service instanceof DataProvider) { DataProvider provider = (DataProvider) service; taskDataProviderService.unregister(provider.getName()); if (handler != null) { handler.removeDataProvider(provider.getName()); } LOGGER.info(String.format("Removed data provider: %s", provider.getName())); } }
DataProviderManager implements OsgiServiceLifecycleListener { @Override public void unbind(Object service, Map serviceProperties) { if (service instanceof DataProvider) { DataProvider provider = (DataProvider) service; taskDataProviderService.unregister(provider.getName()); if (handler != null) { handler.removeDataProvider(provider.getName()); } LOGGER.info(String.format("Removed data provider: %s", provider.getName())); } } }
DataProviderManager implements OsgiServiceLifecycleListener { @Override public void unbind(Object service, Map serviceProperties) { if (service instanceof DataProvider) { DataProvider provider = (DataProvider) service; taskDataProviderService.unregister(provider.getName()); if (handler != null) { handler.removeDataProvider(provider.getName()); } LOGGER.info(String.format("Removed data provider: %s", provider.getName())); } } DataProviderManager(TaskDataProviderService taskDataProviderService); @Autowired  DataProviderManager(TriggerHandler handler, TaskDataProviderService taskDataProviderService); }
DataProviderManager implements OsgiServiceLifecycleListener { @Override public void unbind(Object service, Map serviceProperties) { if (service instanceof DataProvider) { DataProvider provider = (DataProvider) service; taskDataProviderService.unregister(provider.getName()); if (handler != null) { handler.removeDataProvider(provider.getName()); } LOGGER.info(String.format("Removed data provider: %s", provider.getName())); } } DataProviderManager(TaskDataProviderService taskDataProviderService); @Autowired  DataProviderManager(TriggerHandler handler, TaskDataProviderService taskDataProviderService); @Override void bind(Object service, Map serviceProperties); @Override void unbind(Object service, Map serviceProperties); }
DataProviderManager implements OsgiServiceLifecycleListener { @Override public void unbind(Object service, Map serviceProperties) { if (service instanceof DataProvider) { DataProvider provider = (DataProvider) service; taskDataProviderService.unregister(provider.getName()); if (handler != null) { handler.removeDataProvider(provider.getName()); } LOGGER.info(String.format("Removed data provider: %s", provider.getName())); } } DataProviderManager(TaskDataProviderService taskDataProviderService); @Autowired  DataProviderManager(TriggerHandler handler, TaskDataProviderService taskDataProviderService); @Override void bind(Object service, Map serviceProperties); @Override void unbind(Object service, Map serviceProperties);  }