@Test
public void testFromStream() throws Exception {
final InputStream is = new FileInputStream("target/test-classes/log4j2-config.xml");
final ConfigurationFactory.ConfigurationSource source =
new ConfigurationFactory.ConfigurationSource(is, "target/test-classes/log4j2-config.xml");
final LoggerContext ctx = Configurator.initialize(null, source);
final Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
Configuration config = ctx.getConfiguration();
assertNotNull("No configuration", config);
assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + " but found " + config.getName(),
CONFIG_NAME.equals(config.getName()));
final Map<String, Appender<?>> map = config.getAppenders();
assertNotNull("No Appenders", map != null && map.size() > 0);
assertTrue("Wrong configuration", map.containsKey("List"));
Configurator.shutdown(ctx);
config = ctx.getConfiguration();
assertTrue("Incorrect Configuration. Expected " + DefaultConfiguration.DEFAULT_NAME + " but found " +
config.getName(), DefaultConfiguration.DEFAULT_NAME.equals(config.getName()));
}