test_class.declarator: LOG4J_CONFIG_FILENAME = "classpath:log4jOverridableConfigurer-log4j.xml"
test_class.modifier: private static final
test_class.original_string: private static final String LOG4J_CONFIG_FILENAME = "classpath:log4jOverridableConfigurer-log4j.xml";
test_class.type: String
test_class.var_name: LOG4J_CONFIG_FILENAME
test_class.declarator: LOG4J_CONFIG_NO_CLOB_FILENAME = "classpath:log4jOverridableConfigurerNoClob-log4j.xml"
test_class.modifier: private static final
test_class.original_string: private static final String LOG4J_CONFIG_NO_CLOB_FILENAME = "classpath:log4jOverridableConfigurerNoClob-log4j.xml";
test_class.type: String
test_class.var_name: LOG4J_CONFIG_NO_CLOB_FILENAME
test_class.declarator: LOG4J_FILENAME_TOKEN = "~log4jFileLocation~"
test_class.modifier: private static final
test_class.original_string: private static final String LOG4J_FILENAME_TOKEN = "~log4jFileLocation~";
test_class.type: String
test_class.var_name: LOG4J_FILENAME_TOKEN
test_class.declarator: LOGGER = LoggerFactory.getLogger(Log4jOverridableConfigurerTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(Log4jOverridableConfigurerTest.class);
test_class.type: Logger
test_class.var_name: LOGGER
test_class.declarator: applicationContext
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private ApplicationContext applicationContext;
test_class.type: ApplicationContext
test_class.var_name: applicationContext
test_class.file: herd-code/herd-dao/src/test/java/org/finra/herd/dao/Log4jOverridableConfigurerTest.java
test_class.identifier: Log4jOverridableConfigurerTest
test_class.superclass: extends AbstractDaoTest
test_case.body: @Test
      public void testLog4JDbWithRefreshInterval() throws Exception
      {
          Path configPath = getRandomLog4jConfigPath();
          Path outputPath = getRandomLog4jOutputPath();
  
          String configKey = null;
          try
          {
              // Create a random configuration key to use when inserting the Log4J configuration into the database.
              configKey = ConfigurationValue.LOG4J_OVERRIDE_CONFIGURATION.getKey() + UUID.randomUUID().toString().substring(0, 5);
  
              // Insert the standard JUnit Log4J configuration that won't create an output file into the database using the CLOB column.
              // We will use a monitoring interval of 1 second to ensure the watch dog thread gets executed.
              insertDbLog4JConfigurationFromResourceLocation(DaoEnvTestSpringModuleConfig.TEST_LOG4J_CONFIG_RESOURCE_LOCATION, 1, outputPath,
                  ConfigurationEntity.COLUMN_VALUE_CLOB, configKey);
  
              // Shutdown the previously configured logging so we can reinitialize it below.
              loggingHelper.shutdownLogging();
  
              // Initialize Log4J with a refresh interval of 1/2 second. This will cause Log4J to check for configuration updates every second.
              Log4jOverridableConfigurer log4jConfigurer = getLog4jOverridableConfigurerForDb(configKey);
              log4jConfigurer.postProcessBeforeInitialization(null, null);
  
              // First ensure that the Log4J output file doesn't exist.
              assertTrue("Log4J output file exists, but shouldn't.", Files.notExists(outputPath));
  
              // Update the Log4J configuration with one that will create a log file.
              updateDbLog4JConfigurationFromResourceLocation(LOG4J_CONFIG_FILENAME, outputPath, ConfigurationEntity.COLUMN_VALUE_CLOB, configKey);
  
              // Sleep 3 seconds which will give our watch dog thread and Log4J a chance to read the new configuration file which should create an output file.
              Thread.sleep(3000);
  
              // Ensure that the Log4J output file now exists.
              assertTrue("Log4J output file doesn't exist, but should.", Files.exists(outputPath));
          }
          finally
          {
              cleanup(configPath, outputPath);
              deleteDbLog4JConfiguration(configKey);
          }
      }
test_case.class_method_signature: Log4jOverridableConfigurerTest.testLog4JDbWithRefreshInterval()
test_case.full_signature: @Test public void testLog4JDbWithRefreshInterval()
test_case.identifier: testLog4JDbWithRefreshInterval
test_case.invocations: getRandomLog4jConfigPath getRandomLog4jOutputPath getKey substring toString randomUUID insertDbLog4JConfigurationFromResourceLocation shutdownLogging getLog4jOverridableConfigurerForDb postProcessBeforeInitialization assertTrue notExists updateDbLog4JConfigurationFromResourceLocation sleep assertTrue exists cleanup deleteDbLog4JConfiguration
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testLog4JDbWithRefreshInterval()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(Log4jOverridableConfigurer.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(Log4jOverridableConfigurer.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: applicationContext
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ApplicationContext applicationContext;
focal_class.type: ApplicationContext
focal_class.var_name: applicationContext
focal_class.declarator: overrideResourceLocation
focal_class.modifier: private
focal_class.original_string: private String overrideResourceLocation;
focal_class.type: String
focal_class.var_name: overrideResourceLocation
focal_class.declarator: defaultResourceLocation
focal_class.modifier: private
focal_class.original_string: private String defaultResourceLocation;
focal_class.type: String
focal_class.var_name: defaultResourceLocation
focal_class.declarator: tableName
focal_class.modifier: private
focal_class.original_string: private String tableName;
focal_class.type: String
focal_class.var_name: tableName
focal_class.declarator: selectColumn
focal_class.modifier: private
focal_class.original_string: private String selectColumn;
focal_class.type: String
focal_class.var_name: selectColumn
focal_class.declarator: whereColumn
focal_class.modifier: private
focal_class.original_string: private String whereColumn;
focal_class.type: String
focal_class.var_name: whereColumn
focal_class.declarator: whereValue
focal_class.modifier: private
focal_class.original_string: private String whereValue;
focal_class.type: String
focal_class.var_name: whereValue
focal_class.declarator: dataSource
focal_class.modifier: private
focal_class.original_string: private DataSource dataSource;
focal_class.type: DataSource
focal_class.var_name: dataSource
focal_class.declarator: loggingInitialized
focal_class.modifier: private
focal_class.original_string: private boolean loggingInitialized;
focal_class.type: boolean
focal_class.var_name: loggingInitialized
focal_class.declarator: existingDbLog4JConfiguration
focal_class.modifier: private
focal_class.original_string: private String existingDbLog4JConfiguration;
focal_class.type: String
focal_class.var_name: existingDbLog4JConfiguration
focal_class.declarator: tempFile = null
focal_class.modifier: private
focal_class.original_string: private Path tempFile = null;
focal_class.type: Path
focal_class.var_name: tempFile
focal_class.declarator: watchdog
focal_class.modifier: private
focal_class.original_string: private Log4jDbWatchdog watchdog;
focal_class.type: Log4jDbWatchdog
focal_class.var_name: watchdog
focal_class.declarator: loggerContext
focal_class.modifier: private
focal_class.original_string: private LoggerContext loggerContext;
focal_class.type: LoggerContext
focal_class.var_name: loggerContext
focal_class.file: herd-code/herd-dao/src/main/java/org/finra/herd/dao/Log4jOverridableConfigurer.java
focal_class.identifier: Log4jOverridableConfigurer
focal_class.interfaces: implements BeanPostProcessor, PriorityOrdered, ApplicationContextAware
focal_class.class_method_signature: Log4jOverridableConfigurer.postProcessBeforeInitialization(Object bean, String beanName)
focal_class.full_signature: @Override public Object postProcessBeforeInitialization(Object bean, String beanName)
focal_class.identifier: postProcessBeforeInitialization
focal_class.modifiers: @Override public
focal_class.parameters: (Object bean, String beanName)
focal_class.return: Object
focal_class.signature: Object postProcessBeforeInitialization(Object bean, String beanName)
focal_class.class_method_signature: Log4jOverridableConfigurer.postProcessAfterInitialization(Object bean, String beanName)
focal_class.full_signature: @Override public Object postProcessAfterInitialization(Object bean, String beanName)
focal_class.identifier: postProcessAfterInitialization
focal_class.modifiers: @Override public
focal_class.parameters: (Object bean, String beanName)
focal_class.return: Object
focal_class.signature: Object postProcessAfterInitialization(Object bean, String beanName)
focal_class.class_method_signature: Log4jOverridableConfigurer.initLogging()
focal_class.full_signature: @SuppressWarnings("PMD.SystemPrintln") private void initLogging()
focal_class.identifier: initLogging
focal_class.modifiers: @SuppressWarnings("PMD.SystemPrintln") private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void initLogging()
focal_class.class_method_signature: Log4jOverridableConfigurer.initializeLog4jFromResourceLocation(String resourceLocation)
focal_class.full_signature: @SuppressWarnings("PMD.SystemPrintln") private boolean initializeLog4jFromResourceLocation(String resourceLocation)
focal_class.identifier: initializeLog4jFromResourceLocation
focal_class.modifiers: @SuppressWarnings("PMD.SystemPrintln") private
focal_class.parameters: (String resourceLocation)
focal_class.return: boolean
focal_class.signature: boolean initializeLog4jFromResourceLocation(String resourceLocation)
focal_class.class_method_signature: Log4jOverridableConfigurer.initializeLog4jFromDatabase()
focal_class.full_signature: @SuppressWarnings("PMD.SystemPrintln") private boolean initializeLog4jFromDatabase()
focal_class.identifier: initializeLog4jFromDatabase
focal_class.modifiers: @SuppressWarnings("PMD.SystemPrintln") private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean initializeLog4jFromDatabase()
focal_class.class_method_signature: Log4jOverridableConfigurer.isDbConfigurationPresent()
focal_class.full_signature: private boolean isDbConfigurationPresent()
focal_class.identifier: isDbConfigurationPresent
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isDbConfigurationPresent()
focal_class.class_method_signature: Log4jOverridableConfigurer.getLog4JConfigurationRetrievalQuery(boolean isForLogging)
focal_class.full_signature: private String getLog4JConfigurationRetrievalQuery(boolean isForLogging)
focal_class.identifier: getLog4JConfigurationRetrievalQuery
focal_class.modifiers: private
focal_class.parameters: (boolean isForLogging)
focal_class.return: String
focal_class.signature: String getLog4JConfigurationRetrievalQuery(boolean isForLogging)
focal_class.class_method_signature: Log4jOverridableConfigurer.getLog4JConfigurationFromDatabase()
focal_class.full_signature: protected String getLog4JConfigurationFromDatabase()
focal_class.identifier: getLog4JConfigurationFromDatabase
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getLog4JConfigurationFromDatabase()
focal_class.class_method_signature: Log4jOverridableConfigurer.getConfigurationFromResultSet(ResultSet resultSet, String selectColumn)
focal_class.full_signature: protected String getConfigurationFromResultSet(ResultSet resultSet, String selectColumn)
focal_class.identifier: getConfigurationFromResultSet
focal_class.modifiers: protected
focal_class.parameters: (ResultSet resultSet, String selectColumn)
focal_class.return: String
focal_class.signature: String getConfigurationFromResultSet(ResultSet resultSet, String selectColumn)
focal_class.class_method_signature: Log4jOverridableConfigurer.convertClob(Clob clob)
focal_class.full_signature: protected String convertClob(Clob clob)
focal_class.identifier: convertClob
focal_class.modifiers: protected
focal_class.parameters: (Clob clob)
focal_class.return: String
focal_class.signature: String convertClob(Clob clob)
focal_class.class_method_signature: Log4jOverridableConfigurer.getOrder()
focal_class.full_signature: @Override public int getOrder()
focal_class.identifier: getOrder
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getOrder()
focal_class.class_method_signature: Log4jOverridableConfigurer.setApplicationContext(ApplicationContext applicationContext)
focal_class.full_signature: @Override public void setApplicationContext(ApplicationContext applicationContext)
focal_class.identifier: setApplicationContext
focal_class.modifiers: @Override public
focal_class.parameters: (ApplicationContext applicationContext)
focal_class.return: void
focal_class.signature: void setApplicationContext(ApplicationContext applicationContext)
focal_class.class_method_signature: Log4jOverridableConfigurer.setOverrideResourceLocation(String overrideResourceLocation)
focal_class.full_signature: public void setOverrideResourceLocation(String overrideResourceLocation)
focal_class.identifier: setOverrideResourceLocation
focal_class.modifiers: public
focal_class.parameters: (String overrideResourceLocation)
focal_class.return: void
focal_class.signature: void setOverrideResourceLocation(String overrideResourceLocation)
focal_class.class_method_signature: Log4jOverridableConfigurer.setDefaultResourceLocation(String defaultResourceLocation)
focal_class.full_signature: public void setDefaultResourceLocation(String defaultResourceLocation)
focal_class.identifier: setDefaultResourceLocation
focal_class.modifiers: public
focal_class.parameters: (String defaultResourceLocation)
focal_class.return: void
focal_class.signature: void setDefaultResourceLocation(String defaultResourceLocation)
focal_class.class_method_signature: Log4jOverridableConfigurer.setTableName(String tableName)
focal_class.full_signature: public void setTableName(String tableName)
focal_class.identifier: setTableName
focal_class.modifiers: public
focal_class.parameters: (String tableName)
focal_class.return: void
focal_class.signature: void setTableName(String tableName)
focal_class.class_method_signature: Log4jOverridableConfigurer.setSelectColumn(String selectColumn)
focal_class.full_signature: public void setSelectColumn(String selectColumn)
focal_class.identifier: setSelectColumn
focal_class.modifiers: public
focal_class.parameters: (String selectColumn)
focal_class.return: void
focal_class.signature: void setSelectColumn(String selectColumn)
focal_class.class_method_signature: Log4jOverridableConfigurer.setWhereColumn(String whereColumn)
focal_class.full_signature: public void setWhereColumn(String whereColumn)
focal_class.identifier: setWhereColumn
focal_class.modifiers: public
focal_class.parameters: (String whereColumn)
focal_class.return: void
focal_class.signature: void setWhereColumn(String whereColumn)
focal_class.class_method_signature: Log4jOverridableConfigurer.setWhereValue(String whereValue)
focal_class.full_signature: public void setWhereValue(String whereValue)
focal_class.identifier: setWhereValue
focal_class.modifiers: public
focal_class.parameters: (String whereValue)
focal_class.return: void
focal_class.signature: void setWhereValue(String whereValue)
focal_class.class_method_signature: Log4jOverridableConfigurer.setDataSource(DataSource dataSource)
focal_class.full_signature: public void setDataSource(DataSource dataSource)
focal_class.identifier: setDataSource
focal_class.modifiers: public
focal_class.parameters: (DataSource dataSource)
focal_class.return: void
focal_class.signature: void setDataSource(DataSource dataSource)
focal_class.class_method_signature: Log4jOverridableConfigurer.initializeConfiguration(String xmlConfigurationString)
focal_class.full_signature: @SuppressWarnings("PMD.SystemPrintln") private void initializeConfiguration(String xmlConfigurationString)
focal_class.identifier: initializeConfiguration
focal_class.modifiers: @SuppressWarnings("PMD.SystemPrintln") private
focal_class.parameters: (String xmlConfigurationString)
focal_class.return: void
focal_class.signature: void initializeConfiguration(String xmlConfigurationString)
focal_class.class_method_signature: Log4jOverridableConfigurer.getRefreshIntervalSeconds(String xmlConfigurationString)
focal_class.full_signature: private int getRefreshIntervalSeconds(String xmlConfigurationString)
focal_class.identifier: getRefreshIntervalSeconds
focal_class.modifiers: private
focal_class.parameters: (String xmlConfigurationString)
focal_class.return: int
focal_class.signature: int getRefreshIntervalSeconds(String xmlConfigurationString)
focal_method.body: @Override
      public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
      {
          // Perform our initialization one time even though this method will be called once for each bean being initialized.
          // The bean properties will have already been set by the time this method is called which is required for our initialization.
          if (!loggingInitialized)
          {
              initLogging();
              loggingInitialized = true;
          }
  
          // Perform the standard processing by returning the original bean.
          return bean;
      }
focal_method.class_method_signature: Log4jOverridableConfigurer.postProcessBeforeInitialization(Object bean, String beanName)
focal_method.full_signature: @Override public Object postProcessBeforeInitialization(Object bean, String beanName)
focal_method.identifier: postProcessBeforeInitialization
focal_method.invocations: initLogging
focal_method.modifiers: @Override public
focal_method.parameters: (Object bean, String beanName)
focal_method.return: Object
focal_method.signature: Object postProcessBeforeInitialization(Object bean, String beanName)