Sitelet https://github.com/qos-ch/logback/commit/56085d898665d6e99489591333a4ddf381465443
Skip to content

Commit 56085d8

Browse files
committed
fix test
Signed-off-by: ceki <ceki@qos.ch>
1 parent e7764f4 commit 56085d8

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

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

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ void configure(String file) throws JoranException {
5757
}
5858

5959

60-
6160
@Test
6261
public void eval() throws JoranException {
6362
configure(BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "callerData.xml");
@@ -115,14 +114,14 @@ public void testEvaluatorFilterWithImports() throws JoranException {
115114
}
116115

117116
@Test
118-
public void conditional1673() throws JoranException {
117+
public void conditional1673() throws JoranException {
119118
loggerContext.putProperty("EXTRA", "true");
120119
String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673.xml";
121120
configure(configFileAsStr);
122121
}
123122

124123
@Test
125-
public void conditional1673bisWithActiveThen() throws JoranException {
124+
public void conditional1673bisWithActiveThen() throws JoranException {
126125
loggerContext.putProperty("EXTRA", "true");
127126
String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673bis.xml";
128127
configure(configFileAsStr);
@@ -135,7 +134,7 @@ public void conditional1673bisWithActiveThen() throws JoranException {
135134
}
136135

137136
@Test
138-
public void conditional1673bisWithActiveElse() throws JoranException {
137+
public void conditional1673bisWithActiveElse() throws JoranException {
139138
String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1673bis.xml";
140139
configure(configFileAsStr);
141140
Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
@@ -147,7 +146,7 @@ public void conditional1673bisWithActiveElse() throws JoranException {
147146
}
148147

149148
@Test
150-
public void nestedIf() throws JoranException {
149+
public void nestedIf() throws JoranException {
151150
loggerContext.putProperty("EXTRA", "true");
152151
String configFileAsStr = BlackboxClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1678.xml";
153152
configure(configFileAsStr);
@@ -201,14 +200,30 @@ public void fileAsResource() throws JoranException, IOException, InterruptedExce
201200
JoranConfigurator joranConfigurator = new JoranConfigurator();
202201
joranConfigurator.setContext(loggerContext);
203202
ClassLoader classLoader = Loader.getClassLoaderOfObject(joranConfigurator);
203+
204+
204205
String logbackConfigFile = "asResource/topFile.xml";
206+
// asResource/topFile.xml
207+
//<configuration xscan="true" scanPeriod="50 millisecond">
208+
// <include resource="asResource/inner1.xml"/>
209+
//</configuration>
210+
211+
// inner1.xml
212+
// <included>
213+
// <root level="ERROR"/>
214+
// </included>
215+
205216
URL aURL = Loader.getResource(logbackConfigFile, classLoader);
206217
InputStream inputStream = aURL.openStream();
207218
assertNotNull(inputStream);
208219
joranConfigurator.doConfigure(inputStream);
209-
StatusPrinter.print(loggerContext);
220+
221+
assertEquals(Level.ERROR, root.getLevel());
222+
223+
//StatusPrinter.print(loggerContext);
224+
inputStream.close();
225+
checker.assertContainsMatch("Scan attribute not set or set to unrecognized value.");
210226
checker.assertIsWarningOrErrorFree();
211-
fail();
212227
}
213228

214229
}

0 commit comments

Comments
 (0)