@Test public void checkNoTenantConfigurationLoaded() throws PersistenceException { when(persistence.listConfigurations()).thenReturn(new LinkedList<>()); tenantInit.loadConfigurationOnStartup(); verify(tenantFilter, never()).forceTenantScope(any()); verify(persistence, never()).loadConfiguration(any()); }
@PostConstruct protected void loadConfigurationOnStartup() { persistence.listConfigurations().forEach(id -> { logger.info("Loading configuration for tenant '{}'", id); tenantFilter.forceTenantScope(id); EventMapper eventMapper = (EventMapper) applicationContext.getBean("eventMapper"); ComplexEventProcessor complexEventProcessor = (ComplexEventProcessor) applicationContext.getBean("complexEventProcessor"); SubscriptionManager subscriptionManager = (SubscriptionManager) applicationContext.getBean("subscriptionManager"); try { Configuration configuration = persistence.loadConfiguration(id); eventMapper.setConfiguration(configuration); complexEventProcessor.setConfiguration(configuration); subscriptionManager.setConfiguration(configuration); } catch (PersistenceException | ConfigurationException e) { logger.error("Failed to load or apply persisted configuration {}", id, e); } tenantFilter.forceTenantScope(null); }); }
TenantInit { @PostConstruct protected void loadConfigurationOnStartup() { persistence.listConfigurations().forEach(id -> { logger.info("Loading configuration for tenant '{}'", id); tenantFilter.forceTenantScope(id); EventMapper eventMapper = (EventMapper) applicationContext.getBean("eventMapper"); ComplexEventProcessor complexEventProcessor = (ComplexEventProcessor) applicationContext.getBean("complexEventProcessor"); SubscriptionManager subscriptionManager = (SubscriptionManager) applicationContext.getBean("subscriptionManager"); try { Configuration configuration = persistence.loadConfiguration(id); eventMapper.setConfiguration(configuration); complexEventProcessor.setConfiguration(configuration); subscriptionManager.setConfiguration(configuration); } catch (PersistenceException | ConfigurationException e) { logger.error("Failed to load or apply persisted configuration {}", id, e); } tenantFilter.forceTenantScope(null); }); } }
TenantInit { @PostConstruct protected void loadConfigurationOnStartup() { persistence.listConfigurations().forEach(id -> { logger.info("Loading configuration for tenant '{}'", id); tenantFilter.forceTenantScope(id); EventMapper eventMapper = (EventMapper) applicationContext.getBean("eventMapper"); ComplexEventProcessor complexEventProcessor = (ComplexEventProcessor) applicationContext.getBean("complexEventProcessor"); SubscriptionManager subscriptionManager = (SubscriptionManager) applicationContext.getBean("subscriptionManager"); try { Configuration configuration = persistence.loadConfiguration(id); eventMapper.setConfiguration(configuration); complexEventProcessor.setConfiguration(configuration); subscriptionManager.setConfiguration(configuration); } catch (PersistenceException | ConfigurationException e) { logger.error("Failed to load or apply persisted configuration {}", id, e); } tenantFilter.forceTenantScope(null); }); }  }
TenantInit { @PostConstruct protected void loadConfigurationOnStartup() { persistence.listConfigurations().forEach(id -> { logger.info("Loading configuration for tenant '{}'", id); tenantFilter.forceTenantScope(id); EventMapper eventMapper = (EventMapper) applicationContext.getBean("eventMapper"); ComplexEventProcessor complexEventProcessor = (ComplexEventProcessor) applicationContext.getBean("complexEventProcessor"); SubscriptionManager subscriptionManager = (SubscriptionManager) applicationContext.getBean("subscriptionManager"); try { Configuration configuration = persistence.loadConfiguration(id); eventMapper.setConfiguration(configuration); complexEventProcessor.setConfiguration(configuration); subscriptionManager.setConfiguration(configuration); } catch (PersistenceException | ConfigurationException e) { logger.error("Failed to load or apply persisted configuration {}", id, e); } tenantFilter.forceTenantScope(null); }); }   }
TenantInit { @PostConstruct protected void loadConfigurationOnStartup() { persistence.listConfigurations().forEach(id -> { logger.info("Loading configuration for tenant '{}'", id); tenantFilter.forceTenantScope(id); EventMapper eventMapper = (EventMapper) applicationContext.getBean("eventMapper"); ComplexEventProcessor complexEventProcessor = (ComplexEventProcessor) applicationContext.getBean("complexEventProcessor"); SubscriptionManager subscriptionManager = (SubscriptionManager) applicationContext.getBean("subscriptionManager"); try { Configuration configuration = persistence.loadConfiguration(id); eventMapper.setConfiguration(configuration); complexEventProcessor.setConfiguration(configuration); subscriptionManager.setConfiguration(configuration); } catch (PersistenceException | ConfigurationException e) { logger.error("Failed to load or apply persisted configuration {}", id, e); } tenantFilter.forceTenantScope(null); }); }    }