@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 testConfigLongProps() throws Exception { ConfigurationHandler configurationHandler = new ConfigurationHandlerImpl(m_context); resetConfigurationHandler(configurationHandler); configurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class); configureAgent(configurationHandler, "long1", "42", "long2", "4"); assertEquals(configurationHandler.getLong("long1", 0l), 42); assertEquals(configurationHandler.getLong("long2", 0l), 4l); assertEquals(configurationHandler.getLong("longX", 42l), 42l); }