@Override protected void onInit() throws Exception { getEventsHandler().addListener(this); // The controller is started *after* all other components, causing it to miss the initial configuration-update // event, hence we need to get the configuration ourselves for the first time... ConfigurationHandler config = getConfigurationHandler(); m_updateStreaming.set(config.getBoolean(CONFIG_CONTROLLER_STREAMING, m_updateStreaming.get())); m_fixPackage.set(config.getBoolean(CONFIG_CONTROLLER_FIXPACKAGES, m_fixPackage.get())); m_interval.set(config.getLong(CONFIG_CONTROLLER_SYNCINTERVAL, m_interval.get())); m_syncDelay.set(config.getLong(CONFIG_CONTROLLER_SYNCDELAY, m_syncDelay.get())); m_maxRetries.set(config.getLong(CONFIG_CONTROLLER_RETRIES, m_maxRetries.get())); logDebug("Config initialized: update: %s, fixPkg: %s, syncDelay: %d, syncInterval: %d, maxRetries: %d", m_updateStreaming.get(), m_fixPackage.get(), m_syncDelay.get(), m_interval.get(), m_maxRetries.get()); }
@Test public void testConfigBooleanProps() throws Exception { ConfigurationHandler configurationHandler = new ConfigurationHandlerImpl(m_context); resetConfigurationHandler(configurationHandler); configurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class); configureAgent(configurationHandler, "boolean1", "true", "boolean2", "false"); assertEquals(configurationHandler.getBoolean("boolean1", false), true); assertEquals(configurationHandler.getBoolean("boolean2", true), false); assertEquals(configurationHandler.getBoolean("booleanX", true), true); assertEquals(configurationHandler.getBoolean("booleanY", false), false); }
@Override protected void onInit() throws Exception { String urls = getConfigurationHandler().get(CONFIG_DISCOVERY_SERVERURLS, mergeUrls(m_defaultServerURLs)); boolean checkServerURLs = getConfigurationHandler().getBoolean(CONFIG_DISCOVERY_CHECKING, DEFAULT_CHECK_SERVER_URLS); m_defaultServerURLs = m_serverURLs = splitUrls(urls); // ACE-520 - checking URLs only makes sense if there is more than one URL available... m_defaultCheckURLs = m_checkURLs = checkServerURLs && m_defaultServerURLs.size() > 1; getEventsHandler().addListener(this); }