Skip to content

Commit c3d75b2

Browse files
committed
re-enabling temporarily disabled tests by virtue of their move to logback-classic-blackbox
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
1 parent c336307 commit c3d75b2

File tree

8 files changed

+86
-111
lines changed

8 files changed

+86
-111
lines changed

logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/joran/BlackboxJoranConfiguratorTest.java

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,22 @@
1414

1515
package ch.qos.logback.classic.blackbox.joran;
1616

17+
import ch.qos.logback.classic.Level;
1718
import ch.qos.logback.classic.Logger;
1819
import ch.qos.logback.classic.LoggerContext;
1920
import ch.qos.logback.classic.blackbox.BlackboxClassicTestConstants;
2021
import ch.qos.logback.classic.joran.JoranConfigurator;
2122
import ch.qos.logback.classic.spi.ILoggingEvent;
2223
import ch.qos.logback.core.joran.spi.JoranException;
24+
import ch.qos.logback.core.read.ListAppender;
2325
import ch.qos.logback.core.testUtil.RandomUtil;
2426
import ch.qos.logback.core.testUtil.StringListAppender;
25-
import org.junit.jupiter.api.Disabled;
27+
import ch.qos.logback.core.util.StatusPrinter;
2628
import org.junit.jupiter.api.Test;
2729

2830
import static org.junit.jupiter.api.Assertions.assertEquals;
2931
import static org.junit.jupiter.api.Assertions.assertNotNull;
32+
import static org.junit.jupiter.api.Assertions.assertNull;
3033
import static org.junit.jupiter.api.Assertions.assertTrue;
3134

3235
public class BlackboxJoranConfiguratorTest {
@@ -61,4 +64,82 @@ public void eval() throws JoranException {
6164
assertTrue(str1.contains("Caller+0"));
6265
assertTrue(str1.contains(" DEBUG - hello world"));
6366
}
67+
68+
@Test
69+
public void testEvaluatorFilter() throws JoranException {
70+
configure(BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "evaluatorFilter.xml");
71+
72+
// StatusPrinter.print(loggerContext);
73+
74+
logger.warn("hello");
75+
logger.error("to be ignored");
76+
77+
ListAppender<ILoggingEvent> listAppender = (ListAppender<ILoggingEvent>) root.getAppender("LIST");
78+
79+
assertNotNull(listAppender);
80+
assertEquals(1, listAppender.list.size());
81+
ILoggingEvent back = listAppender.list.get(0);
82+
assertEquals(Level.WARN, back.getLevel());
83+
assertEquals("hello", back.getMessage());
84+
}
85+
86+
@Test
87+
public void testEvaluatorFilterWithImports() throws JoranException {
88+
configure(BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "evaluatorFilterWithImports.xml");
89+
90+
// StatusPrinter.print(loggerContext);
91+
92+
logger.warn("hello");
93+
logger.error("to be ignored");
94+
95+
ListAppender<ILoggingEvent> listAppender = (ListAppender<ILoggingEvent>) root.getAppender("LIST");
96+
97+
assertNotNull(listAppender);
98+
assertEquals(1, listAppender.list.size());
99+
ILoggingEvent back = listAppender.list.get(0);
100+
assertEquals(Level.WARN, back.getLevel());
101+
assertEquals("hello", back.getMessage());
102+
}
103+
104+
@Test
105+
public void conditional1673() throws JoranException {
106+
loggerContext.putProperty("EXTRA", "true");
107+
String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673.xml";
108+
configure(configFileAsStr);
109+
}
110+
111+
@Test
112+
public void conditional1673bisWithActiveThen() throws JoranException {
113+
loggerContext.putProperty("EXTRA", "true");
114+
String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673bis.xml";
115+
configure(configFileAsStr);
116+
Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
117+
ListAppender<ILoggingEvent> listThen = (ListAppender<ILoggingEvent>) root.getAppender("LIST_THEN");
118+
assertNotNull(listThen);
119+
120+
ListAppender<ILoggingEvent> listElse = (ListAppender<ILoggingEvent>) root.getAppender("LIST_ELSE");
121+
assertNull(listElse);
122+
}
123+
124+
@Test
125+
public void conditional1673bisWithActiveElse() throws JoranException {
126+
String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673bis.xml";
127+
configure(configFileAsStr);
128+
Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
129+
ListAppender<ILoggingEvent> listThen = (ListAppender<ILoggingEvent>) root.getAppender("LIST_THEN");
130+
assertNull(listThen);
131+
132+
ListAppender<ILoggingEvent> listElse = (ListAppender<ILoggingEvent>) root.getAppender("LIST_ELSE");
133+
assertNotNull(listElse);
134+
}
135+
136+
@Test
137+
public void nestedIf() throws JoranException {
138+
loggerContext.putProperty("EXTRA", "true");
139+
String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1678.xml";
140+
configure(configFileAsStr);
141+
StatusPrinter.print(loggerContext);
142+
143+
}
144+
64145
}

logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java

Lines changed: 1 addition & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -205,27 +205,6 @@ public void contextRename() throws JoranException {
205205
assertEquals("wombat", loggerContext.getName());
206206
}
207207

208-
// DISABLED TEMPORARILY 2022-09-30
209-
@Disabled
210-
@Test
211-
public void eval() throws JoranException {
212-
configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "callerData.xml");
213-
String msg = "hello world";
214-
logger.debug("toto");
215-
logger.debug(msg);
216-
217-
StringListAppender<ILoggingEvent> slAppender = (StringListAppender<ILoggingEvent>) loggerContext
218-
.getLogger("root").getAppender("STR_LIST");
219-
assertNotNull(slAppender);
220-
assertEquals(2, slAppender.strList.size());
221-
assertTrue(slAppender.strList.get(0).contains(" DEBUG - toto"));
222-
223-
String str1 = slAppender.strList.get(1);
224-
assertTrue(str1.contains("Caller+0"));
225-
assertTrue(str1.contains(" DEBUG - hello world"));
226-
}
227-
228-
229208
@Test
230209
public void missingConfigurationElement() throws JoranException {
231210
configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "ossfuzz/noConfig.xml");
@@ -299,45 +278,7 @@ public void testLevelFilter() throws JoranException {
299278
assertEquals("hello", back.getMessage());
300279
}
301280

302-
// DISABLED TEMPORARILY 2022-09-30
303-
@Disabled
304-
@Test
305-
public void testEvaluatorFilter() throws JoranException {
306-
configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "evaluatorFilter.xml");
307-
308-
// StatusPrinter.print(loggerContext);
309-
310-
logger.warn("hello");
311-
logger.error("to be ignored");
312-
313-
ListAppender<ILoggingEvent> listAppender = (ListAppender<ILoggingEvent>) root.getAppender("LIST");
314-
315-
assertNotNull(listAppender);
316-
assertEquals(1, listAppender.list.size());
317-
ILoggingEvent back = listAppender.list.get(0);
318-
assertEquals(Level.WARN, back.getLevel());
319-
assertEquals("hello", back.getMessage());
320-
}
321-
322-
// DISABLED TEMPORARILY 2022-09-30
323-
@Disabled
324-
@Test
325-
public void testEvaluatorFilterWithImports() throws JoranException {
326-
configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "evaluatorFilterWithImports.xml");
327-
328-
// StatusPrinter.print(loggerContext);
329-
330-
logger.warn("hello");
331-
logger.error("to be ignored");
332281

333-
ListAppender<ILoggingEvent> listAppender = (ListAppender<ILoggingEvent>) root.getAppender("LIST");
334-
335-
assertNotNull(listAppender);
336-
assertEquals(1, listAppender.list.size());
337-
ILoggingEvent back = listAppender.list.get(0);
338-
assertEquals(Level.WARN, back.getLevel());
339-
assertEquals("hello", back.getMessage());
340-
}
341282

342283
@Test
343284
public void testTurboDynamicThreshold() throws JoranException {
@@ -477,8 +418,8 @@ public void levelChangePropagator1() throws JoranException, IOException, Interru
477418
verifyJULLevel(Logger.ROOT_LOGGER_NAME, Level.TRACE);
478419
}
479420

421+
@Disabled // because slow
480422
@Test
481-
@Disabled
482423
public void onConsoleRetro() throws JoranException, IOException, InterruptedException {
483424
String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "/onConsoleRetro.xml";
484425
configure(configFileAsStr);
@@ -582,54 +523,6 @@ public void shutdownHookTest() throws JoranException {
582523
assertNotNull(thread);
583524
}
584525

585-
// DISABLED TEMPORARILY 2022-09-30
586-
@Disabled
587-
@Test
588-
public void conditional1673() throws JoranException {
589-
loggerContext.putProperty("EXTRA", "true");
590-
String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673.xml";
591-
configure(configFileAsStr);
592-
}
593-
594-
// DISABLED TEMPORARILY 2022-09-30
595-
@Disabled
596-
@Test
597-
public void conditional1673bisWithActiveThen() throws JoranException {
598-
loggerContext.putProperty("EXTRA", "true");
599-
String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673bis.xml";
600-
configure(configFileAsStr);
601-
Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
602-
ListAppender<ILoggingEvent> listThen = (ListAppender<ILoggingEvent>) root.getAppender("LIST_THEN");
603-
assertNotNull(listThen);
604-
605-
ListAppender<ILoggingEvent> listElse = (ListAppender<ILoggingEvent>) root.getAppender("LIST_ELSE");
606-
assertNull(listElse);
607-
}
608-
609-
// DISABLED TEMPORARILY 2022-09-30
610-
@Disabled
611-
@Test
612-
public void conditional1673bisWithActiveElse() throws JoranException {
613-
String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673bis.xml";
614-
configure(configFileAsStr);
615-
Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
616-
ListAppender<ILoggingEvent> listThen = (ListAppender<ILoggingEvent>) root.getAppender("LIST_THEN");
617-
assertNull(listThen);
618-
619-
ListAppender<ILoggingEvent> listElse = (ListAppender<ILoggingEvent>) root.getAppender("LIST_ELSE");
620-
assertNotNull(listElse);
621-
}
622-
623-
// DISABLED TEMPORARILY 2022-09-30
624-
@Disabled
625-
@Test
626-
public void nestedIf() throws JoranException {
627-
loggerContext.putProperty("EXTRA", "true");
628-
String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1678.xml";
629-
configure(configFileAsStr);
630-
StatusPrinter.print(loggerContext);
631-
632-
}
633526

634527
@Test
635528
public void nestedAppendersDisallowed() throws JoranException {

logback-core/src/main/java/module-info.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
requires static transitive java.xml;
55
requires static transitive jakarta.mail;
66
//requires static jakarta.activation;
7-
8-
requires static transitive jakarta.servlet;
7+
8+
// jakarta.servlet 5.0 is not modular
9+
requires static jakarta.servlet;
910
requires static janino;
1011
requires static commons.compiler;
1112

0 commit comments

Comments
 (0)