DSpaceConfigurationService implements ConfigurationService { @Override public synchronized void reloadConfig() { try { configurationBuilder.reload(); this.configuration = configurationBuilder.getConfiguration(); setDynamicProperties(); } catch(ConfigurationException ce) { log.error("Unable to reload configurations based on definition at " + configurationBuilder.getFile().getAbsolutePath(), ce); } log.info("Reloaded configuration service: " + toString()); } DSpaceConfigurationService();  DSpaceConfigurationService(String providedHome); @Override Properties getProperties(); @Override List<String> getPropertyKeys(); @Override List<String> getPropertyKeys(String prefix); @Override Configuration getConfiguration(); @Override Object getPropertyValue(String name); @Override String getProperty(String name); @Override String getProperty(String name, String defaultValue); @Override String[] getArrayProperty(String name); @Override String[] getArrayProperty(String name, String[] defaultValue); @Override boolean getBooleanProperty(String name); @Override boolean getBooleanProperty(String name, boolean defaultValue); @Override int getIntProperty(String name); @Override int getIntProperty(String name, int defaultValue); @Override long getLongProperty(String name); @Override long getLongProperty(String name, long defaultValue); @Override T getPropertyAsType(String name, Class<T> type); @Override T getPropertyAsType(String name, T defaultValue); @Override T getPropertyAsType(String name, T defaultValue, boolean setDefaultIfNotFound); @Override boolean hasProperty(String name); @Override synchronized boolean setProperty(String name, Object value); String[] loadConfiguration(Map<String, Object> properties); boolean loadConfig(String key, Object value); void clear(); void clearConfig(String key); @Override synchronized void reloadConfig(); @Override String toString(); static final String DSPACE; static final String EXT_CONFIG; static final String DOT_CONFIG; static final String DSPACE_HOME; static final String DEFAULT_CONFIG_DIR; static final String DEFAULT_CONFIG_DEFINITION_FILE; static final String DSPACE_CONFIG_DEFINITION_PATH; static final String DSPACE_CONFIG_PATH; static final String DSPACE_SERVER_ID; }
@Test public void testReloadConfig() { DSpaceConfigurationService dscs = new DSpaceConfigurationService(); int size = dscs.getProperties().size(); System.setProperty("Hello","World"); System.setProperty("Tim", "Donohue"); assertEquals(size, dscs.getProperties().size()); dscs.reloadConfig(); assertEquals(size + 2, dscs.getProperties().size()); System.setProperty("Hello", "There"); assertEquals("World", dscs.getProperty("Hello")); dscs.reloadConfig(); assertEquals("There", dscs.getProperty("Hello")); System.clearProperty("Hello"); System.clearProperty("Tim"); assertEquals("There", dscs.getProperty("Hello")); dscs.reloadConfig(); assertNull(dscs.getProperty("Hello")); dscs.clear(); dscs = null; }