From c3d75b27d8d3076fa25b5d554231f11424f6ff51 Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Sun, 2 Oct 2022 15:09:32 +0200 Subject: [PATCH] re-enabling temporarily disabled tests by virtue of their move to logback-classic-blackbox Signed-off-by: Ceki Gulcu --- .../blackboxInput}/joran/evaluatorFilter.xml | 0 .../joran/evaluatorFilterWithImports.xml | 0 .../joran/issues/logback_1673.xml | 0 .../joran/issues/logback_1673bis.xml | 0 .../joran/issues/logback_1678.xml | 0 .../joran/BlackboxJoranConfiguratorTest.java | 83 ++++++++++++- .../classic/joran/JoranConfiguratorTest.java | 109 +----------------- logback-core/src/main/java/module-info.java | 5 +- 8 files changed, 86 insertions(+), 111 deletions(-) rename {logback-classic/src/test/input => logback-classic-blackbox/src/test/blackboxInput}/joran/evaluatorFilter.xml (100%) rename {logback-classic/src/test/input => logback-classic-blackbox/src/test/blackboxInput}/joran/evaluatorFilterWithImports.xml (100%) rename {logback-classic/src/test/input => logback-classic-blackbox/src/test/blackboxInput}/joran/issues/logback_1673.xml (100%) rename {logback-classic/src/test/input => logback-classic-blackbox/src/test/blackboxInput}/joran/issues/logback_1673bis.xml (100%) rename {logback-classic/src/test/input => logback-classic-blackbox/src/test/blackboxInput}/joran/issues/logback_1678.xml (100%) diff --git a/logback-classic/src/test/input/joran/evaluatorFilter.xml b/logback-classic-blackbox/src/test/blackboxInput/joran/evaluatorFilter.xml similarity index 100% rename from logback-classic/src/test/input/joran/evaluatorFilter.xml rename to logback-classic-blackbox/src/test/blackboxInput/joran/evaluatorFilter.xml diff --git a/logback-classic/src/test/input/joran/evaluatorFilterWithImports.xml b/logback-classic-blackbox/src/test/blackboxInput/joran/evaluatorFilterWithImports.xml similarity index 100% rename from logback-classic/src/test/input/joran/evaluatorFilterWithImports.xml rename to logback-classic-blackbox/src/test/blackboxInput/joran/evaluatorFilterWithImports.xml diff --git a/logback-classic/src/test/input/joran/issues/logback_1673.xml b/logback-classic-blackbox/src/test/blackboxInput/joran/issues/logback_1673.xml similarity index 100% rename from logback-classic/src/test/input/joran/issues/logback_1673.xml rename to logback-classic-blackbox/src/test/blackboxInput/joran/issues/logback_1673.xml diff --git a/logback-classic/src/test/input/joran/issues/logback_1673bis.xml b/logback-classic-blackbox/src/test/blackboxInput/joran/issues/logback_1673bis.xml similarity index 100% rename from logback-classic/src/test/input/joran/issues/logback_1673bis.xml rename to logback-classic-blackbox/src/test/blackboxInput/joran/issues/logback_1673bis.xml diff --git a/logback-classic/src/test/input/joran/issues/logback_1678.xml b/logback-classic-blackbox/src/test/blackboxInput/joran/issues/logback_1678.xml similarity index 100% rename from logback-classic/src/test/input/joran/issues/logback_1678.xml rename to logback-classic-blackbox/src/test/blackboxInput/joran/issues/logback_1678.xml diff --git a/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/joran/BlackboxJoranConfiguratorTest.java b/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/joran/BlackboxJoranConfiguratorTest.java index e548b00414..4dd4a8d69f 100644 --- a/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/joran/BlackboxJoranConfiguratorTest.java +++ b/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/joran/BlackboxJoranConfiguratorTest.java @@ -14,19 +14,22 @@ package ch.qos.logback.classic.blackbox.joran; +import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.blackbox.BlackboxClassicTestConstants; import ch.qos.logback.classic.joran.JoranConfigurator; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.joran.spi.JoranException; +import ch.qos.logback.core.read.ListAppender; import ch.qos.logback.core.testUtil.RandomUtil; import ch.qos.logback.core.testUtil.StringListAppender; -import org.junit.jupiter.api.Disabled; +import ch.qos.logback.core.util.StatusPrinter; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; public class BlackboxJoranConfiguratorTest { @@ -61,4 +64,82 @@ public void eval() throws JoranException { assertTrue(str1.contains("Caller+0")); assertTrue(str1.contains(" DEBUG - hello world")); } + + @Test + public void testEvaluatorFilter() throws JoranException { + configure(BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "evaluatorFilter.xml"); + + // StatusPrinter.print(loggerContext); + + logger.warn("hello"); + logger.error("to be ignored"); + + ListAppender listAppender = (ListAppender) root.getAppender("LIST"); + + assertNotNull(listAppender); + assertEquals(1, listAppender.list.size()); + ILoggingEvent back = listAppender.list.get(0); + assertEquals(Level.WARN, back.getLevel()); + assertEquals("hello", back.getMessage()); + } + + @Test + public void testEvaluatorFilterWithImports() throws JoranException { + configure(BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "evaluatorFilterWithImports.xml"); + + // StatusPrinter.print(loggerContext); + + logger.warn("hello"); + logger.error("to be ignored"); + + ListAppender listAppender = (ListAppender) root.getAppender("LIST"); + + assertNotNull(listAppender); + assertEquals(1, listAppender.list.size()); + ILoggingEvent back = listAppender.list.get(0); + assertEquals(Level.WARN, back.getLevel()); + assertEquals("hello", back.getMessage()); + } + + @Test + public void conditional1673() throws JoranException { + loggerContext.putProperty("EXTRA", "true"); + String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673.xml"; + configure(configFileAsStr); + } + + @Test + public void conditional1673bisWithActiveThen() throws JoranException { + loggerContext.putProperty("EXTRA", "true"); + String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673bis.xml"; + configure(configFileAsStr); + Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); + ListAppender listThen = (ListAppender) root.getAppender("LIST_THEN"); + assertNotNull(listThen); + + ListAppender listElse = (ListAppender) root.getAppender("LIST_ELSE"); + assertNull(listElse); + } + + @Test + public void conditional1673bisWithActiveElse() throws JoranException { + String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673bis.xml"; + configure(configFileAsStr); + Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); + ListAppender listThen = (ListAppender) root.getAppender("LIST_THEN"); + assertNull(listThen); + + ListAppender listElse = (ListAppender) root.getAppender("LIST_ELSE"); + assertNotNull(listElse); + } + + @Test + public void nestedIf() throws JoranException { + loggerContext.putProperty("EXTRA", "true"); + String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1678.xml"; + configure(configFileAsStr); + StatusPrinter.print(loggerContext); + + } + } diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java index f1cf09de25..825a04cafd 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java @@ -205,27 +205,6 @@ public void contextRename() throws JoranException { assertEquals("wombat", loggerContext.getName()); } - // DISABLED TEMPORARILY 2022-09-30 - @Disabled - @Test - public void eval() throws JoranException { - configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "callerData.xml"); - String msg = "hello world"; - logger.debug("toto"); - logger.debug(msg); - - StringListAppender slAppender = (StringListAppender) loggerContext - .getLogger("root").getAppender("STR_LIST"); - assertNotNull(slAppender); - assertEquals(2, slAppender.strList.size()); - assertTrue(slAppender.strList.get(0).contains(" DEBUG - toto")); - - String str1 = slAppender.strList.get(1); - assertTrue(str1.contains("Caller+0")); - assertTrue(str1.contains(" DEBUG - hello world")); - } - - @Test public void missingConfigurationElement() throws JoranException { configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "ossfuzz/noConfig.xml"); @@ -299,45 +278,7 @@ public void testLevelFilter() throws JoranException { assertEquals("hello", back.getMessage()); } - // DISABLED TEMPORARILY 2022-09-30 - @Disabled - @Test - public void testEvaluatorFilter() throws JoranException { - configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "evaluatorFilter.xml"); - - // StatusPrinter.print(loggerContext); - - logger.warn("hello"); - logger.error("to be ignored"); - - ListAppender listAppender = (ListAppender) root.getAppender("LIST"); - - assertNotNull(listAppender); - assertEquals(1, listAppender.list.size()); - ILoggingEvent back = listAppender.list.get(0); - assertEquals(Level.WARN, back.getLevel()); - assertEquals("hello", back.getMessage()); - } - - // DISABLED TEMPORARILY 2022-09-30 - @Disabled - @Test - public void testEvaluatorFilterWithImports() throws JoranException { - configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "evaluatorFilterWithImports.xml"); - - // StatusPrinter.print(loggerContext); - - logger.warn("hello"); - logger.error("to be ignored"); - ListAppender listAppender = (ListAppender) root.getAppender("LIST"); - - assertNotNull(listAppender); - assertEquals(1, listAppender.list.size()); - ILoggingEvent back = listAppender.list.get(0); - assertEquals(Level.WARN, back.getLevel()); - assertEquals("hello", back.getMessage()); - } @Test public void testTurboDynamicThreshold() throws JoranException { @@ -477,8 +418,8 @@ public void levelChangePropagator1() throws JoranException, IOException, Interru verifyJULLevel(Logger.ROOT_LOGGER_NAME, Level.TRACE); } + @Disabled // because slow @Test - @Disabled public void onConsoleRetro() throws JoranException, IOException, InterruptedException { String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "/onConsoleRetro.xml"; configure(configFileAsStr); @@ -582,54 +523,6 @@ public void shutdownHookTest() throws JoranException { assertNotNull(thread); } - // DISABLED TEMPORARILY 2022-09-30 - @Disabled - @Test - public void conditional1673() throws JoranException { - loggerContext.putProperty("EXTRA", "true"); - String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673.xml"; - configure(configFileAsStr); - } - - // DISABLED TEMPORARILY 2022-09-30 - @Disabled - @Test - public void conditional1673bisWithActiveThen() throws JoranException { - loggerContext.putProperty("EXTRA", "true"); - String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673bis.xml"; - configure(configFileAsStr); - Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); - ListAppender listThen = (ListAppender) root.getAppender("LIST_THEN"); - assertNotNull(listThen); - - ListAppender listElse = (ListAppender) root.getAppender("LIST_ELSE"); - assertNull(listElse); - } - - // DISABLED TEMPORARILY 2022-09-30 - @Disabled - @Test - public void conditional1673bisWithActiveElse() throws JoranException { - String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673bis.xml"; - configure(configFileAsStr); - Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); - ListAppender listThen = (ListAppender) root.getAppender("LIST_THEN"); - assertNull(listThen); - - ListAppender listElse = (ListAppender) root.getAppender("LIST_ELSE"); - assertNotNull(listElse); - } - - // DISABLED TEMPORARILY 2022-09-30 - @Disabled - @Test - public void nestedIf() throws JoranException { - loggerContext.putProperty("EXTRA", "true"); - String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1678.xml"; - configure(configFileAsStr); - StatusPrinter.print(loggerContext); - - } @Test public void nestedAppendersDisallowed() throws JoranException { diff --git a/logback-core/src/main/java/module-info.java b/logback-core/src/main/java/module-info.java index df87805e1c..00ae1aa4a0 100644 --- a/logback-core/src/main/java/module-info.java +++ b/logback-core/src/main/java/module-info.java @@ -4,8 +4,9 @@ requires static transitive java.xml; requires static transitive jakarta.mail; //requires static jakarta.activation; - - requires static transitive jakarta.servlet; + + // jakarta.servlet 5.0 is not modular + requires static jakarta.servlet; requires static janino; requires static commons.compiler;