@Test public void testInstall() { ConfigurationManager.getConfigInstance().setProperty("prop1", "abc"); assertEquals("abc", ConfigurationManager.getConfigInstance().getProperty("prop1")); assertEquals("abc", prop1.get()); BaseConfiguration newConfig = new BaseConfiguration(); newConfig.setProperty("prop1", "fromNewConfig"); ConfigurationManager.install(newConfig); assertEquals("fromNewConfig", ConfigurationManager.getConfigInstance().getProperty("prop1")); assertEquals("fromNewConfig", prop1.get()); newConfig.setProperty("prop1", "changed"); assertEquals("changed", ConfigurationManager.getConfigInstance().getProperty("prop1")); assertEquals("changed", prop1.get()); try { ConfigurationManager.install(new BaseConfiguration()); fail("IllegalStateExceptionExpected"); } catch (IllegalStateException e) { assertNotNull(e); } try { DynamicPropertyFactory.initWithConfigurationSource(new BaseConfiguration()); fail("IllegalStateExceptionExpected"); } catch (IllegalStateException e) { assertNotNull(e); } }
public static synchronized void install(AbstractConfiguration config) throws IllegalStateException { if (!customConfigurationInstalled) { setDirect(config); if (DynamicPropertyFactory.getBackingConfigurationSource() != config) { DynamicPropertyFactory.initWithConfigurationSource(config); } } else { throw new IllegalStateException("A non-default configuration is already installed"); } }
ConfigurationManager { public static synchronized void install(AbstractConfiguration config) throws IllegalStateException { if (!customConfigurationInstalled) { setDirect(config); if (DynamicPropertyFactory.getBackingConfigurationSource() != config) { DynamicPropertyFactory.initWithConfigurationSource(config); } } else { throw new IllegalStateException("A non-default configuration is already installed"); } } }
ConfigurationManager { public static synchronized void install(AbstractConfiguration config) throws IllegalStateException { if (!customConfigurationInstalled) { setDirect(config); if (DynamicPropertyFactory.getBackingConfigurationSource() != config) { DynamicPropertyFactory.initWithConfigurationSource(config); } } else { throw new IllegalStateException("A non-default configuration is already installed"); } }  }
ConfigurationManager { public static synchronized void install(AbstractConfiguration config) throws IllegalStateException { if (!customConfigurationInstalled) { setDirect(config); if (DynamicPropertyFactory.getBackingConfigurationSource() != config) { DynamicPropertyFactory.initWithConfigurationSource(config); } } else { throw new IllegalStateException("A non-default configuration is already installed"); } }  static StackTraceElement[] getStaticInitializationSource(); static Set<String> getLoadedPropertiesURLs(); static synchronized void install(AbstractConfiguration config); static synchronized boolean isConfigurationInstalled(); static AbstractConfiguration getConfigInstance(); static void loadPropertiesFromResources(String path); static void loadCascadedPropertiesFromResources(String configName); static void loadAppOverrideProperties(String appConfigName); static void loadPropertiesFromConfiguration(AbstractConfiguration config); static void loadProperties(Properties properties); static void setDeploymentContext(DeploymentContext context); static DeploymentContext getDeploymentContext(); static AbstractConfiguration getConfigFromPropertiesFile(URL startingUrl); static Properties getPropertiesFromFile(URL startingUrl); }
ConfigurationManager { public static synchronized void install(AbstractConfiguration config) throws IllegalStateException { if (!customConfigurationInstalled) { setDirect(config); if (DynamicPropertyFactory.getBackingConfigurationSource() != config) { DynamicPropertyFactory.initWithConfigurationSource(config); } } else { throw new IllegalStateException("A non-default configuration is already installed"); } }  static StackTraceElement[] getStaticInitializationSource(); static Set<String> getLoadedPropertiesURLs(); static synchronized void install(AbstractConfiguration config); static synchronized boolean isConfigurationInstalled(); static AbstractConfiguration getConfigInstance(); static void loadPropertiesFromResources(String path); static void loadCascadedPropertiesFromResources(String configName); static void loadAppOverrideProperties(String appConfigName); static void loadPropertiesFromConfiguration(AbstractConfiguration config); static void loadProperties(Properties properties); static void setDeploymentContext(DeploymentContext context); static DeploymentContext getDeploymentContext(); static AbstractConfiguration getConfigFromPropertiesFile(URL startingUrl); static Properties getPropertiesFromFile(URL startingUrl); static final String PROP_NEXT_LOAD; static final String URL_CONFIG_NAME; static final String SYS_CONFIG_NAME; static final String ENV_CONFIG_NAME; static final String DISABLE_DEFAULT_ENV_CONFIG; static final String DISABLE_DEFAULT_SYS_CONFIG; static final String APPLICATION_PROPERTIES; }