test_class.declarator: applicationContext
test_class.modifier: @Mock
test_class.original_string: @Mock
      ApplicationContext applicationContext;
test_class.type: ApplicationContext
test_class.var_name: applicationContext
test_class.declarator: eventMapper
test_class.modifier: @Mock
test_class.original_string: @Mock
      EventMapper eventMapper;
test_class.type: EventMapper
test_class.var_name: eventMapper
test_class.declarator: complexEventProcessor
test_class.modifier: @Mock
test_class.original_string: @Mock
      ComplexEventProcessor complexEventProcessor;
test_class.type: ComplexEventProcessor
test_class.var_name: complexEventProcessor
test_class.declarator: subscriptionManager
test_class.modifier: @Mock
test_class.original_string: @Mock
      SubscriptionManager subscriptionManager;
test_class.type: SubscriptionManager
test_class.var_name: subscriptionManager
test_class.declarator: persistence
test_class.modifier: @Mock
test_class.original_string: @Mock
      Persistence persistence;
test_class.type: Persistence
test_class.var_name: persistence
test_class.declarator: tenantFilter
test_class.modifier: @Mock
test_class.original_string: @Mock
      TenantFilter tenantFilter;
test_class.type: TenantFilter
test_class.var_name: tenantFilter
test_class.declarator: tenantInit
test_class.modifier: @Autowired
      @InjectMocks
      public
test_class.original_string: @Autowired
      @InjectMocks
      public TenantInit tenantInit;
test_class.type: TenantInit
test_class.var_name: tenantInit
test_class.file: cepheus-cep/src/test/java/com/orange/cepheus/cep/tenant/TenantInitTest.java
test_class.identifier: TenantInitTest
test_case.body: @Test
      public void checkNoTenantConfigurationLoaded() throws PersistenceException {
          when(persistence.listConfigurations()).thenReturn(new LinkedList<>());
          tenantInit.loadConfigurationOnStartup();
          verify(tenantFilter, never()).forceTenantScope(any());
          verify(persistence, never()).loadConfiguration(any());
      }
test_case.class_method_signature: TenantInitTest.checkNoTenantConfigurationLoaded()
test_case.full_signature: @Test public void checkNoTenantConfigurationLoaded()
test_case.identifier: checkNoTenantConfigurationLoaded
test_case.invocations: thenReturn when listConfigurations loadConfigurationOnStartup forceTenantScope verify never any loadConfiguration verify never any
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void checkNoTenantConfigurationLoaded()
focal_class.declarator: logger = LoggerFactory.getLogger(TenantInit.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger logger = LoggerFactory.getLogger(TenantInit.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: applicationContext
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected ApplicationContext applicationContext;
focal_class.type: ApplicationContext
focal_class.var_name: applicationContext
focal_class.declarator: persistence
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
      Persistence persistence;
focal_class.type: Persistence
focal_class.var_name: persistence
focal_class.declarator: tenantFilter
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
      TenantFilter tenantFilter;
focal_class.type: TenantFilter
focal_class.var_name: tenantFilter
focal_class.file: cepheus-cep/src/main/java/com/orange/cepheus/cep/tenant/TenantInit.java
focal_class.identifier: TenantInit
focal_class.class_method_signature: TenantInit.loadConfigurationOnStartup()
focal_class.full_signature: @PostConstruct protected void loadConfigurationOnStartup()
focal_class.identifier: loadConfigurationOnStartup
focal_class.modifiers: @PostConstruct protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void loadConfigurationOnStartup()
focal_method.body: @PostConstruct
      protected void loadConfigurationOnStartup() {
  
          persistence.listConfigurations().forEach(id -> {
  
              logger.info("Loading configuration for tenant '{}'", id);
  
              // Force Tenant scope context to get the correct beans
              tenantFilter.forceTenantScope(id);
  
              // Get beans needing the configuration
              EventMapper eventMapper = (EventMapper) applicationContext.getBean("eventMapper");
              ComplexEventProcessor complexEventProcessor = (ComplexEventProcessor) applicationContext.getBean("complexEventProcessor");
              SubscriptionManager subscriptionManager = (SubscriptionManager) applicationContext.getBean("subscriptionManager");
  
              // Try restoring the persisted configuration if any
              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);
              }
  
              // Remove tenant scope
              tenantFilter.forceTenantScope(null);
          });
      }
focal_method.class_method_signature: TenantInit.loadConfigurationOnStartup()
focal_method.full_signature: @PostConstruct protected void loadConfigurationOnStartup()
focal_method.identifier: loadConfigurationOnStartup
focal_method.invocations: forEach listConfigurations info forceTenantScope getBean getBean getBean loadConfiguration setConfiguration setConfiguration setConfiguration error forceTenantScope
focal_method.modifiers: @PostConstruct protected
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void loadConfigurationOnStartup()