use of org.apache.logging.log4j.core.test.junit.LoggerContextSource in project logging-log4j2 by apache.
the class ShutdownCallbackRegistryTest method testShutdownCallbackRegistry.
@Test
@LoggerContextSource("ShutdownCallbackRegistryTest.xml")
public void testShutdownCallbackRegistry(final LoggerContext context) {
assertTrue(context.isStarted(), "LoggerContext should be started");
assertThat(Registry.CALLBACKS, hasSize(1));
Registry.shutdown();
assertTrue(context.isStopped(), "LoggerContext should be stopped");
assertThat(Registry.CALLBACKS, hasSize(0));
final ContextSelector selector = ((Log4jContextFactory) LogManager.getFactory()).getSelector();
assertThat(selector.getLoggerContexts(), not(hasItem(context)));
}
use of org.apache.logging.log4j.core.test.junit.LoggerContextSource in project logging-log4j2 by apache.
the class ConfigurationFactoryTest method xml.
@Test
@LoggerContextSource("log4j-test1.xml")
void xml(final LoggerContext context) throws IOException {
checkConfiguration(context);
final Path logFile = Paths.get("target", "test-xml.log");
checkFileLogger(context, logFile);
}
use of org.apache.logging.log4j.core.test.junit.LoggerContextSource in project logging-log4j2 by apache.
the class ConfigurationFactoryTest method yaml.
@Test
@Tag("yaml")
@LoggerContextSource("log4j-test1.yaml")
void yaml(final LoggerContext context) throws IOException {
checkConfiguration(context);
final Path logFile = Paths.get("target", "test-yaml.log");
checkFileLogger(context, logFile);
}
use of org.apache.logging.log4j.core.test.junit.LoggerContextSource in project logging-log4j2 by apache.
the class ConfigurationFactoryTest method json.
@Test
@Tag("json")
@LoggerContextSource("log4j-test1.json")
void json(final LoggerContext context) throws IOException {
checkConfiguration(context);
final Path logFile = Paths.get("target", "test-json.log");
checkFileLogger(context, logFile);
}
use of org.apache.logging.log4j.core.test.junit.LoggerContextSource in project logging-log4j2 by apache.
the class ConfigurationFactoryTest method properties.
@Test
@LoggerContextSource("log4j-test1.properties")
void properties(final LoggerContext context) throws IOException {
checkConfiguration(context);
final Path logFile = Paths.get("target", "test-properties.log");
checkFileLogger(context, logFile);
}
Aggregations