FlumeConfiguration { public List<FlumeConfigurationError> getConfigurationErrors() { return errors; } @Deprecated  FlumeConfiguration(Properties properties);  FlumeConfiguration(Map<String, String> properties); List<FlumeConfigurationError> getConfigurationErrors(); AgentConfiguration getConfigurationFor(String hostname); static final String NEWLINE; static final String INDENTSTEP; }
@Test public void testFlumeConfigAdsErrorOnNullName() { HashMap<String, String> properties = new HashMap<>(); properties.put(null, "something"); FlumeConfiguration config = new FlumeConfiguration(properties); List<FlumeConfigurationError> configurationErrors = config.getConfigurationErrors(); assertEquals(1, configurationErrors.size()); assertError(configurationErrors.get(0), AGENT_NAME_MISSING, "", "", ERROR); }
@Test public void testFlumeConfigAddsErrorOnNullValue() { HashMap<String, String> properties = new HashMap<>(); properties.put("something", null); FlumeConfiguration config = new FlumeConfiguration(properties); List<FlumeConfigurationError> configurationErrors = config.getConfigurationErrors(); assertEquals(1, configurationErrors.size()); assertError(configurationErrors.get(0), AGENT_NAME_MISSING, "", "", ERROR); }
@Test public void testFlumeConfigAddsErrorOnEmptyValue() { HashMap<String, String> properties = new HashMap<>(); properties.put("something", ""); FlumeConfiguration config = new FlumeConfiguration(properties); List<FlumeConfigurationError> configurationErrors = config.getConfigurationErrors(); assertEquals(1, configurationErrors.size()); assertError(configurationErrors.get(0), PROPERTY_VALUE_NULL, "something", "", ERROR); }
@Test public void testFlumeConfigAddsErrorOnNoAgentNameValue() { HashMap<String, String> properties = new HashMap<>(); properties.put("something", "value"); FlumeConfiguration config = new FlumeConfiguration(properties); List<FlumeConfigurationError> configurationErrors = config.getConfigurationErrors(); assertEquals(1, configurationErrors.size()); assertError(configurationErrors.get(0), AGENT_NAME_MISSING, "something", "", ERROR); }
@Test public void testFlumeConfigAddsErrorOnEmptyAgentNameValue() { Properties properties = new Properties(); properties.put(".something", "value"); FlumeConfiguration config = new FlumeConfiguration(properties); List<FlumeConfigurationError> configurationErrors = config.getConfigurationErrors(); assertEquals(1, configurationErrors.size()); assertError(configurationErrors.get(0), AGENT_NAME_MISSING, ".something", "", ERROR); }
@Test public void testFlumeConfigAddsErrorOnEmptyPropertyName() { HashMap<String, String> properties = new HashMap<>(); properties.put("agent.", "something"); FlumeConfiguration config = new FlumeConfiguration(properties); List<FlumeConfigurationError> configurationErrors = config.getConfigurationErrors(); assertEquals(1, configurationErrors.size()); assertError(configurationErrors.get(0), PROPERTY_NAME_NULL, "agent.", "", ERROR); }
@Test public void testFlumeConfigAddsErrorOnInvalidConfig() { HashMap<String, String> properties = new HashMap<>(); properties.put("agent.channels", "c1"); properties.put("agent.channel.c1", "cc1"); FlumeConfiguration config = new FlumeConfiguration(properties); List<FlumeConfigurationError> configurationErrors = config.getConfigurationErrors(); assertEquals(4, configurationErrors.size()); assertError(configurationErrors.get(0), INVALID_PROPERTY, "agent", "channel.c1", ERROR); assertError(configurationErrors.get(1), CONFIG_ERROR, "agent", "c1", ERROR); assertError(configurationErrors.get(2), PROPERTY_VALUE_NULL, "agent", "channels", ERROR); assertError(configurationErrors.get(3), AGENT_CONFIGURATION_INVALID, "agent", "", ERROR); }