@Override public void configurationChanged(ConfigurationEvent event) { if (event.isBeforeUpdate()) { return; } logger.log(OpLevel.DEBUG, "configurationChanged: type={0}, {1}:{2}", event.getType(), event.getPropertyName(), event.getPropertyValue()); switch (event.getType()) { case AbstractConfiguration.EVENT_ADD_PROPERTY: repListener.repositoryChanged(new TokenRepositoryEvent(event.getSource(), TokenRepository.EVENT_ADD_KEY, event.getPropertyName(), event.getPropertyValue(), null)); break; case AbstractConfiguration.EVENT_SET_PROPERTY: repListener.repositoryChanged(new TokenRepositoryEvent(event.getSource(), TokenRepository.EVENT_SET_KEY, event.getPropertyName(), event.getPropertyValue(), null)); break; case AbstractConfiguration.EVENT_CLEAR_PROPERTY: repListener.repositoryChanged(new TokenRepositoryEvent(event.getSource(), TokenRepository.EVENT_CLEAR_KEY, event.getPropertyName(), event.getPropertyValue(), null)); break; case AbstractConfiguration.EVENT_CLEAR: repListener.repositoryChanged(new TokenRepositoryEvent(event.getSource(), TokenRepository.EVENT_CLEAR, event.getPropertyName(), event.getPropertyValue(), null)); break; case AbstractFileConfiguration.EVENT_RELOAD: repListener.repositoryChanged(new TokenRepositoryEvent(event.getSource(), TokenRepository.EVENT_RELOAD, event.getPropertyName(), event.getPropertyValue(), null)); break; } }
@Test(dataProvider = "overrides") public void testFindConfigFile(String override, String expected) throws Exception { SshdSettingsBuilder testBuilder = new SshdSettingsBuilder(); Configuration config = testBuilder.findPropertiesConfiguration(override); AbstractFileConfiguration fileConfiguration = (AbstractFileConfiguration) config; // we need to create expected from a new file. // because it's a complete filename. File expectedFile = new File(expected); String expectedPath = "file://" + expectedFile.getAbsolutePath(); Assert.assertEquals(fileConfiguration.getFileName(), expectedPath); }
public void configurationChanged(ConfigurationEvent event) { if (!event.isBeforeUpdate() && event.getType() == AbstractFileConfiguration.EVENT_RELOAD) { if (m_applicationContext instanceof AbstractRefreshableApplicationContext) { ((AbstractRefreshableApplicationContext)m_applicationContext).refresh(); } } }