From c3363071fb62aefa312e8e565b283dbbc463d980 Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Sun, 2 Oct 2022 13:42:37 +0200 Subject: [PATCH] started black box testing Signed-off-by: Ceki Gulcu --- .../logback/access/joran/ConditionalTest.java | 2 +- .../access/tomcat/LogbackValveTest.java | 2 +- logback-classic-blackbox/pom.xml | 100 ++++++++++++++++++ .../test/blackboxInput/joran/callerData.xml | 29 +++++ .../BlackboxClassicTestConstants.java | 22 ++++ .../joran/BlackboxJoranConfiguratorTest.java | 64 +++++++++++ .../src/test/java/module-info.java | 11 ++ logback-classic/pom.xml | 38 ------- .../gaffer/ConfigurationDelegateTest.groovy | 2 +- logback-classic/src/test/input/fqcn.txt | 4 +- .../src/test/input/joran/callerData.xml | 2 +- .../LoggerContextConcurrentResetTest.java | 3 +- .../logback/classic/PatternLayoutTest.java | 1 - .../logback/classic/RecursiveLBAppender.java | 1 - .../boolex/GEventEvaluatorTest.DISABLEDjava | 2 +- .../encoder/LayoutInsteadOfEncoderTest.java | 2 +- .../classic/joran/JoranConfiguratorTest.java | 2 +- .../joran/ReconfigureOnChangeTaskTest.java | 2 +- .../joran/conditional/ConditionalTest.java | 2 +- ...fNestedWithinSecondPhaseElementSCTest.java | 2 +- .../pattern/CompositeConverterTest.java | 2 +- .../TimeBasedRollingWithConfigFileTest.java | 2 +- .../classic/rolling/UniqueFileTest.java | 2 +- .../classic/sift/SiftingAppenderTest.java | 3 +- .../spi/LoggerContextLifeCycleTest.java | 2 +- .../turbo/ReconfigureOnChangeTest.java | 2 +- .../classic/util/ContextInitializerTest.java | 4 - .../implTest/RecursiveInitializationTest.java | 2 +- logback-core-blackbox/pom.xml | 76 +++++++++++++ .../blackboxInput/joran/conditional/if0.xml | 14 +++ .../joran/conditional/ifSystem.xml | 12 +++ .../joran/conditional/ifWithoutElse.xml | 11 ++ .../joran/conditional/if_localProperty.xml | 15 +++ .../joran/conditional/includedA.xml | 7 ++ .../joran/conditional/includedB.xml | 6 ++ .../joran/conditional/nestedIf.xml | 26 +++++ .../joran/conditional/nestedInclude.xml | 22 ++++ .../blackbox/BlackboxCoreTestConstants.java | 23 ++++ .../joran/BlackboxSimpleConfigurator.java | 52 +++++++++ .../action/BlackboxTopElementAction.java | 24 +++++ .../joran/action/ext/BlackboxStackAction.java | 43 ++++++++ .../joran/conditional/IfThenElseTest.java | 61 ++++++----- .../PropertyEvalScriptBuilderTest.java | 9 +- .../joran/conditional/TrivialTest.java | 30 ++++++ .../blackbox/model/BlackboxStackModel.java | 26 +++++ .../core/blackbox/model/BlackboxTopModel.java | 14 +++ .../processor/BlackboxStackModelHandler.java | 52 +++++++++ .../src/test/java/module-info.java | 9 ++ .../helper/TimeBasedArchiveRemover.java | 1 + .../core/testUtil/CoreTestConstants.java | 4 +- .../core/testUtil/DelayingListAppender.java | 4 +- .../core/testUtil/EnvUtilForTests.java | 4 +- .../logback/core/testUtil/FileTestUtil.java | 12 ++- .../core/testUtil/FileToBufferUtil.java | 4 +- .../core/testUtil/MockInitialContext.java | 4 +- .../testUtil/MockInitialContextFactory.java | 4 +- .../logback/core/testUtil/NPEAppender.java | 4 +- .../qos/logback/core/testUtil/RandomUtil.java | 4 +- .../core/testUtil/StringListAppender.java | 4 +- .../core/testUtil/TeeOutputStream.java | 4 +- .../core/testUtil/TrivialStatusListener.java | 4 +- logback-core/src/main/java/module-info.java | 35 +++--- .../logback/core/AsyncAppenderBaseTest.java | 2 +- .../core/appender/AbstractAppenderTest.java | 2 +- .../core/appender/ConsoleAppenderTest.java | 2 +- .../core/appender/FileAppenderTest.java | 2 +- .../action/DefinePropertyActionTest.java | 2 +- .../core/joran/action/IncludeActionTest.java | 2 +- .../joran/event/SaxEventRecorderTest.java | 2 +- .../event/stax/StaxEventRecorderTest.java | 2 +- .../implicitAction/ImplicitActionTest.java | 2 +- ...penderWithinAppenderSanityCheckerTest.java | 2 +- .../core/joran/util/PropertySetterTest.java | 2 +- .../core/pattern/parser/CompilerTest.java | 2 +- .../core/pattern/parser/ParserTest.java | 2 +- .../parser/SamplePatternLayoutTest.java | 2 +- .../test/AbstractPatternLayoutBaseTest.java | 2 +- .../core/rolling/CollisionDetectionTest.java | 3 +- .../rolling/MultiThreadedRollingTest.java | 2 +- .../logback/core/rolling/RenameUtilTest.java | 2 +- .../core/rolling/RollingFileAppenderTest.java | 2 +- .../rolling/SizeAndTimeBasedFNATP_Test.java | 2 +- ...FileNamingAndTriggeringPolicyBaseTest.java | 2 +- ...meBasedRollingWithArchiveRemoval_Test.java | 3 +- .../core/rolling/helper/CompressTest.java | 2 +- .../{ => status}/testUtil/StatusChecker.java | 29 ++--- pom.xml | 8 +- 87 files changed, 836 insertions(+), 185 deletions(-) create mode 100644 logback-classic-blackbox/pom.xml create mode 100644 logback-classic-blackbox/src/test/blackboxInput/joran/callerData.xml create mode 100644 logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/BlackboxClassicTestConstants.java create mode 100644 logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/joran/BlackboxJoranConfiguratorTest.java create mode 100644 logback-classic-blackbox/src/test/java/module-info.java create mode 100644 logback-core-blackbox/pom.xml create mode 100644 logback-core-blackbox/src/test/blackboxInput/joran/conditional/if0.xml create mode 100644 logback-core-blackbox/src/test/blackboxInput/joran/conditional/ifSystem.xml create mode 100644 logback-core-blackbox/src/test/blackboxInput/joran/conditional/ifWithoutElse.xml create mode 100644 logback-core-blackbox/src/test/blackboxInput/joran/conditional/if_localProperty.xml create mode 100644 logback-core-blackbox/src/test/blackboxInput/joran/conditional/includedA.xml create mode 100644 logback-core-blackbox/src/test/blackboxInput/joran/conditional/includedB.xml create mode 100644 logback-core-blackbox/src/test/blackboxInput/joran/conditional/nestedIf.xml create mode 100644 logback-core-blackbox/src/test/blackboxInput/joran/conditional/nestedInclude.xml create mode 100644 logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/BlackboxCoreTestConstants.java create mode 100644 logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/BlackboxSimpleConfigurator.java create mode 100644 logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/action/BlackboxTopElementAction.java create mode 100644 logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/action/ext/BlackboxStackAction.java rename {logback-core/src/test/java/ch/qos/logback/core => logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox}/joran/conditional/IfThenElseTest.java (81%) rename {logback-core/src/test/java/ch/qos/logback/core => logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox}/joran/conditional/PropertyEvalScriptBuilderTest.java (92%) create mode 100644 logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/conditional/TrivialTest.java create mode 100644 logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/BlackboxStackModel.java create mode 100644 logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/BlackboxTopModel.java create mode 100644 logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/processor/BlackboxStackModelHandler.java create mode 100644 logback-core-blackbox/src/test/java/module-info.java rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/CoreTestConstants.java (95%) mode change 100755 => 100644 rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/DelayingListAppender.java (93%) rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/EnvUtilForTests.java (97%) rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/FileTestUtil.java (76%) rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/FileToBufferUtil.java (97%) rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/MockInitialContext.java (94%) rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/MockInitialContextFactory.java (95%) rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/NPEAppender.java (91%) rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/RandomUtil.java (93%) rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/StringListAppender.java (95%) rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/TeeOutputStream.java (95%) rename logback-core/src/{test => main}/java/ch/qos/logback/core/testUtil/TrivialStatusListener.java (94%) rename logback-core/src/test/java/ch/qos/logback/core/{ => status}/testUtil/StatusChecker.java (62%) diff --git a/logback-access/src/test/java/ch/qos/logback/access/joran/ConditionalTest.java b/logback-access/src/test/java/ch/qos/logback/access/joran/ConditionalTest.java index a8dc3f24d1..b22bb79d67 100644 --- a/logback-access/src/test/java/ch/qos/logback/access/joran/ConditionalTest.java +++ b/logback-access/src/test/java/ch/qos/logback/access/joran/ConditionalTest.java @@ -21,7 +21,7 @@ import ch.qos.logback.core.read.ListAppender; import ch.qos.logback.core.testUtil.CoreTestConstants; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/logback-access/src/test/java/ch/qos/logback/access/tomcat/LogbackValveTest.java b/logback-access/src/test/java/ch/qos/logback/access/tomcat/LogbackValveTest.java index a3513a867c..84cdad1f96 100755 --- a/logback-access/src/test/java/ch/qos/logback/access/tomcat/LogbackValveTest.java +++ b/logback-access/src/test/java/ch/qos/logback/access/tomcat/LogbackValveTest.java @@ -15,7 +15,7 @@ import ch.qos.logback.access.AccessTestConstants; import ch.qos.logback.core.status.Status; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import org.apache.catalina.LifecycleException; import org.apache.catalina.core.ContainerBase; import org.junit.jupiter.api.AfterEach; diff --git a/logback-classic-blackbox/pom.xml b/logback-classic-blackbox/pom.xml new file mode 100644 index 0000000000..41d6095eb7 --- /dev/null +++ b/logback-classic-blackbox/pom.xml @@ -0,0 +1,100 @@ + + + + 4.0.0 + + + ch.qos.logback + logback-parent + 1.4.2-SNAPSHOT + + + logback-classic-blackbox + jar + Logback Classic Blackbox Testing + Logback Classic Blackbox Testing Module + + + + ch.qos.logback + logback-classic + + + + jakarta.servlet + jakarta.servlet-api + + + + jakarta.mail + jakarta.mail-api + compile + + + + org.codehaus.janino + janino + compile + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + default-test + + + + + classes + 8 + + 1C + true + plain + false + + + true + + + + **/JaninoEventEvaluatorTest.java + **/ConditionalTest.java + + + + + + singleJVM + + test + + + 4 + false + + + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + + diff --git a/logback-classic-blackbox/src/test/blackboxInput/joran/callerData.xml b/logback-classic-blackbox/src/test/blackboxInput/joran/callerData.xml new file mode 100644 index 0000000000..560c5f4b94 --- /dev/null +++ b/logback-classic-blackbox/src/test/blackboxInput/joran/callerData.xml @@ -0,0 +1,29 @@ + + + + + + + m.matches(message) + + m + ^hello.* + false + + + + + + %caller{4, helloEval}%d %level - %m%n + + + + + + + + + + + diff --git a/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/BlackboxClassicTestConstants.java b/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/BlackboxClassicTestConstants.java new file mode 100644 index 0000000000..d0f3a47a45 --- /dev/null +++ b/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/BlackboxClassicTestConstants.java @@ -0,0 +1,22 @@ +/* + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. + * + * This program and the accompanying materials are dual-licensed under + * either the terms of the Eclipse Public License v1.0 as published by + * the Eclipse Foundation + * + * or (per the licensee's choosing) + * + * under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation. + */ + +package ch.qos.logback.classic.blackbox; + +public class BlackboxClassicTestConstants { + + public static final String TEST_SRC_PREFIX = "src/test/"; + public static final String TEST_INPUT_PREFIX = TEST_SRC_PREFIX + "blackboxInput/"; + public static final String JORAN_INPUT_PREFIX = TEST_INPUT_PREFIX + "joran/"; +} 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 new file mode 100644 index 0000000000..e548b00414 --- /dev/null +++ b/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/joran/BlackboxJoranConfiguratorTest.java @@ -0,0 +1,64 @@ +/* + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. + * + * This program and the accompanying materials are dual-licensed under + * either the terms of the Eclipse Public License v1.0 as published by + * the Eclipse Foundation + * + * or (per the licensee's choosing) + * + * under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation. + */ + +package ch.qos.logback.classic.blackbox.joran; + +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.testUtil.RandomUtil; +import ch.qos.logback.core.testUtil.StringListAppender; +import org.junit.jupiter.api.Disabled; +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.assertTrue; + +public class BlackboxJoranConfiguratorTest { + LoggerContext loggerContext = new LoggerContext(); + Logger logger = loggerContext.getLogger(this.getClass().getName()); + Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); + //StatusChecker checker = new StatusChecker(loggerContext); + int diff = RandomUtil.getPositiveInt(); + + void configure(String file) throws JoranException { + JoranConfigurator jc = new JoranConfigurator(); + jc.setContext(loggerContext); + loggerContext.putProperty("diff", "" + diff); + jc.doConfigure(file); + + } + + @Test + public void eval() throws JoranException { + configure(BlackboxClassicTestConstants.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")); + } +} diff --git a/logback-classic-blackbox/src/test/java/module-info.java b/logback-classic-blackbox/src/test/java/module-info.java new file mode 100644 index 0000000000..e60320bfa4 --- /dev/null +++ b/logback-classic-blackbox/src/test/java/module-info.java @@ -0,0 +1,11 @@ +module logback.classic.blackbox { + requires ch.qos.logback.core; + requires ch.qos.logback.classic; + requires jakarta.mail; + requires janino; + + requires org.junit.jupiter.api; + requires org.junit.jupiter.engine; + + exports ch.qos.logback.classic.blackbox.joran; +} \ No newline at end of file diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml index db4967ae8b..062cacaad7 100755 --- a/logback-classic/pom.xml +++ b/logback-classic/pom.xml @@ -375,42 +375,4 @@ - - - - - host-orion - - - - com.microsoft.sqlserver - sqljdbc4 - 2.0 - test - - - - com.oracle - ojdbc14 - 10.2.0.1 - test - - - - - - - host-hora - - - - com.oracle - ojdbc14 - 10.2.0.1 - test - - - - - diff --git a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy index b1c539c73d..3c89d71bf5 100644 --- a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy +++ b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy @@ -28,7 +28,7 @@ import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter import ch.qos.logback.classic.Level import ch.qos.logback.core.testUtil.CoreTestConstants import ch.qos.logback.core.testUtil.RandomUtil -import ch.qos.logback.core.testUtil.StatusChecker +import ch.qos.logback.core.status.testUtil.StatusChecker import ch.qos.logback.classic.Logger import ch.qos.logback.core.Appender import ch.qos.logback.core.helpers.NOPAppender diff --git a/logback-classic/src/test/input/fqcn.txt b/logback-classic/src/test/input/fqcn.txt index 333774d463..080c817c32 100644 --- a/logback-classic/src/test/input/fqcn.txt +++ b/logback-classic/src/test/input/fqcn.txt @@ -880,7 +880,7 @@ ch.qos.logback.core.joran.action.ext.TouchAction ch.qos.logback.core.joran.action.IncludeActionTest ch.qos.logback.core.joran.action.PropertyActionTest ch.qos.logback.core.joran.action.TopElementAction -ch.qos.logback.core.joran.conditional.PropertyEvalScriptBuilderTest +ch.qos.logback.core.blackbox.joran.conditional.PropertyEvalScriptBuilderTest ch.qos.logback.core.joran.event.SaxEventRecorderTest ch.qos.logback.core.joran.event.stax.StaxEventRecorderTest ch.qos.logback.core.joran.implicitAction.Cake @@ -1008,7 +1008,7 @@ ch.qos.logback.core.testUtil.FileTestUtil ch.qos.logback.core.testUtil.FileToBufferUtil ch.qos.logback.core.testUtil.NPEAppender ch.qos.logback.core.testUtil.RandomUtil -ch.qos.logback.core.testUtil.StatusChecker +ch.qos.logback.core.status.testUtil.StatusChecker ch.qos.logback.core.testUtil.StringListAppender ch.qos.logback.core.testUtil.TeeOutputStream ch.qos.logback.core.testUtil.TrivialStatusListener diff --git a/logback-classic/src/test/input/joran/callerData.xml b/logback-classic/src/test/input/joran/callerData.xml index 1c499f8acc..560c5f4b94 100644 --- a/logback-classic/src/test/input/joran/callerData.xml +++ b/logback-classic/src/test/input/joran/callerData.xml @@ -13,7 +13,7 @@ + class="ch.qos.logback.core.testUtil.StringListAppender"> %caller{4, helloEval}%d %level - %m%n diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextConcurrentResetTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextConcurrentResetTest.java index d6f5c968a9..20353c8e03 100755 --- a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextConcurrentResetTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextConcurrentResetTest.java @@ -1,14 +1,13 @@ package ch.qos.logback.classic; import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import ch.qos.logback.core.contention.AbstractMultiThreadedHarness; import ch.qos.logback.core.contention.RunnableWithCounterAndDone; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import org.junit.jupiter.api.Timeout; @Disabled diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java index 01a5f99ce7..caedbea94e 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java @@ -26,7 +26,6 @@ import ch.qos.logback.core.spi.ScanException; import ch.qos.logback.core.testUtil.StringListAppender; import ch.qos.logback.core.util.OptionHelper; -import ch.qos.logback.core.util.StatusPrinter; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.slf4j.MDC; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/RecursiveLBAppender.java b/logback-classic/src/test/java/ch/qos/logback/classic/RecursiveLBAppender.java index 6724a1aae7..e3e00cbade 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/RecursiveLBAppender.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/RecursiveLBAppender.java @@ -19,7 +19,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import ch.qos.logback.classic.PatternLayout; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.AppenderBase; import ch.qos.logback.core.testUtil.RandomUtil; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/boolex/GEventEvaluatorTest.DISABLEDjava b/logback-classic/src/test/java/ch/qos/logback/classic/boolex/GEventEvaluatorTest.DISABLEDjava index 42061de38e..2dea291c38 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/boolex/GEventEvaluatorTest.DISABLEDjava +++ b/logback-classic/src/test/java/ch/qos/logback/classic/boolex/GEventEvaluatorTest.DISABLEDjava @@ -20,7 +20,7 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.LoggingEvent; import ch.qos.logback.core.CoreConstants; import ch.qos.logback.core.boolex.EvaluationException; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.ContextUtil; import ch.qos.logback.core.util.StatusPrinter; import org.junit.Before; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java index 6a2cc3549c..afbea91b50 100755 --- a/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java @@ -29,7 +29,7 @@ import ch.qos.logback.core.encoder.LayoutWrappingEncoder; import ch.qos.logback.core.joran.spi.JoranException; import ch.qos.logback.core.status.Status; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; public class LayoutInsteadOfEncoderTest { 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 4ecbfac577..f1cf09de25 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 @@ -53,7 +53,7 @@ import ch.qos.logback.core.spi.ScanException; import ch.qos.logback.core.status.Status; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.testUtil.StringListAppender; import ch.qos.logback.core.util.CachingDateFormatter; import ch.qos.logback.core.util.StatusPrinter; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/joran/ReconfigureOnChangeTaskTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/joran/ReconfigureOnChangeTaskTest.java index b76a99527d..da54c87cfe 100755 --- a/logback-classic/src/test/java/ch/qos/logback/classic/joran/ReconfigureOnChangeTaskTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/joran/ReconfigureOnChangeTaskTest.java @@ -54,7 +54,7 @@ import ch.qos.logback.core.testUtil.CoreTestConstants; import ch.qos.logback.core.testUtil.FileTestUtil; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; import org.junit.jupiter.api.Timeout; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/joran/conditional/ConditionalTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/joran/conditional/ConditionalTest.java index ae6a991ea2..1c417d91f4 100755 --- a/logback-classic/src/test/java/ch/qos/logback/classic/joran/conditional/ConditionalTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/joran/conditional/ConditionalTest.java @@ -32,7 +32,7 @@ import ch.qos.logback.core.read.ListAppender; import ch.qos.logback.core.testUtil.CoreTestConstants; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/joran/sanity/IfNestedWithinSecondPhaseElementSCTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/joran/sanity/IfNestedWithinSecondPhaseElementSCTest.java index 5b13a0de17..a956b7eabd 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/joran/sanity/IfNestedWithinSecondPhaseElementSCTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/joran/sanity/IfNestedWithinSecondPhaseElementSCTest.java @@ -7,7 +7,7 @@ import ch.qos.logback.core.model.Model; import ch.qos.logback.core.model.conditional.IfModel; import ch.qos.logback.core.status.Status; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/CompositeConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/CompositeConverterTest.java index f3e19db5cf..7fe39ca530 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/CompositeConverterTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/CompositeConverterTest.java @@ -19,7 +19,7 @@ import ch.qos.logback.classic.PatternLayout; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.LoggingEvent; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/TimeBasedRollingWithConfigFileTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/TimeBasedRollingWithConfigFileTest.java index 91b05fc1fc..bae59eed30 100755 --- a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/TimeBasedRollingWithConfigFileTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/TimeBasedRollingWithConfigFileTest.java @@ -25,7 +25,7 @@ import ch.qos.logback.core.rolling.TimeBasedRollingPolicy; import ch.qos.logback.core.rolling.testUtil.ScaffoldingForRollingTests; import ch.qos.logback.core.status.Status; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java index ed56eb4684..18570a332e 100755 --- a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java @@ -25,7 +25,7 @@ import ch.qos.logback.core.rolling.testUtil.ScaffoldingForRollingTests; import ch.qos.logback.core.testUtil.CoreTestConstants; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.CachingDateFormatter; /** diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java index 481b20b97c..4de3f36845 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java @@ -35,9 +35,10 @@ import ch.qos.logback.core.spi.AbstractComponentTracker; import ch.qos.logback.core.spi.ComponentTracker; import ch.qos.logback.core.status.ErrorStatus; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.testUtil.CoreTestConstants; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; + import ch.qos.logback.core.testUtil.StringListAppender; import ch.qos.logback.core.util.FileSize; import org.junit.jupiter.api.AfterEach; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggerContextLifeCycleTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggerContextLifeCycleTest.java index eab3f58e72..3b7a3b47c7 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggerContextLifeCycleTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggerContextLifeCycleTest.java @@ -6,7 +6,7 @@ import ch.qos.logback.classic.joran.JoranConfigurator; import ch.qos.logback.core.joran.spi.JoranException; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import org.junit.jupiter.api.Test; import java.util.List; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java index 19bcca73de..141aa94985 100755 --- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java @@ -33,7 +33,7 @@ import ch.qos.logback.core.testUtil.EnvUtilForTests; import ch.qos.logback.core.testUtil.FileTestUtil; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java index b51b47cd2a..e0cd5f0ba5 100755 --- a/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java @@ -17,7 +17,6 @@ import ch.qos.logback.classic.ClassicTestConstants; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; -import ch.qos.logback.classic.spi.Configurator; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.Appender; import ch.qos.logback.core.ConsoleAppender; @@ -35,13 +34,10 @@ import java.io.IOException; import java.io.InputStream; -import java.lang.module.ModuleDescriptor; import java.net.MalformedURLException; import java.net.URL; import java.util.Enumeration; import java.util.List; -import java.util.ServiceLoader; -import java.util.Set; import java.util.Vector; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/logback-classic/src/test/java/org/slf4j/implTest/RecursiveInitializationTest.java b/logback-classic/src/test/java/org/slf4j/implTest/RecursiveInitializationTest.java index a9ec9693e2..fc3ed0b3db 100644 --- a/logback-classic/src/test/java/org/slf4j/implTest/RecursiveInitializationTest.java +++ b/logback-classic/src/test/java/org/slf4j/implTest/RecursiveInitializationTest.java @@ -23,7 +23,7 @@ import ch.qos.logback.classic.ClassicConstants; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; public class RecursiveInitializationTest { diff --git a/logback-core-blackbox/pom.xml b/logback-core-blackbox/pom.xml new file mode 100644 index 0000000000..25c28c5c15 --- /dev/null +++ b/logback-core-blackbox/pom.xml @@ -0,0 +1,76 @@ + + + + 4.0.0 + + + ch.qos.logback + logback-parent + 1.4.2-SNAPSHOT + + + logback-core-blackbox + jar + Logback Core Blackbox Testing + Logback Core Blackbox Testing Module + + + + + ch.qos.logback + logback-core + + + + + jakarta.servlet + jakarta.servlet-api + + + + jakarta.mail + jakarta.mail-api + compile + + + + org.codehaus.janino + janino + compile + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + default-test + + true + plain + false + + + + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + + diff --git a/logback-core-blackbox/src/test/blackboxInput/joran/conditional/if0.xml b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/if0.xml new file mode 100644 index 0000000000..aed2ac367f --- /dev/null +++ b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/if0.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/logback-core-blackbox/src/test/blackboxInput/joran/conditional/ifSystem.xml b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/ifSystem.xml new file mode 100644 index 0000000000..609a51e010 --- /dev/null +++ b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/ifSystem.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/logback-core-blackbox/src/test/blackboxInput/joran/conditional/ifWithoutElse.xml b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/ifWithoutElse.xml new file mode 100644 index 0000000000..63a02edeb1 --- /dev/null +++ b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/ifWithoutElse.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/logback-core-blackbox/src/test/blackboxInput/joran/conditional/if_localProperty.xml b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/if_localProperty.xml new file mode 100644 index 0000000000..650f9fa629 --- /dev/null +++ b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/if_localProperty.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/logback-core-blackbox/src/test/blackboxInput/joran/conditional/includedA.xml b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/includedA.xml new file mode 100644 index 0000000000..ecb4360a1c --- /dev/null +++ b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/includedA.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/logback-core-blackbox/src/test/blackboxInput/joran/conditional/includedB.xml b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/includedB.xml new file mode 100644 index 0000000000..84974b7158 --- /dev/null +++ b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/includedB.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/logback-core-blackbox/src/test/blackboxInput/joran/conditional/nestedIf.xml b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/nestedIf.xml new file mode 100644 index 0000000000..0751237770 --- /dev/null +++ b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/nestedIf.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/logback-core-blackbox/src/test/blackboxInput/joran/conditional/nestedInclude.xml b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/nestedInclude.xml new file mode 100644 index 0000000000..4aa8617701 --- /dev/null +++ b/logback-core-blackbox/src/test/blackboxInput/joran/conditional/nestedInclude.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/BlackboxCoreTestConstants.java b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/BlackboxCoreTestConstants.java new file mode 100644 index 0000000000..00aaac5f1b --- /dev/null +++ b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/BlackboxCoreTestConstants.java @@ -0,0 +1,23 @@ +/* + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. + * + * This program and the accompanying materials are dual-licensed under + * either the terms of the Eclipse Public License v1.0 as published by + * the Eclipse Foundation + * + * or (per the licensee's choosing) + * + * under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation. + */ + +package ch.qos.logback.core.blackbox; + +public class BlackboxCoreTestConstants { + + public static final String TEST_SRC_PREFIX = "src/test/"; + public static final String TEST_INPUT_PREFIX = TEST_SRC_PREFIX + "blackboxInput/"; + public static final String JORAN_INPUT_PREFIX = TEST_INPUT_PREFIX + "joran/"; + +} diff --git a/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/BlackboxSimpleConfigurator.java b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/BlackboxSimpleConfigurator.java new file mode 100644 index 0000000000..9ae22362ea --- /dev/null +++ b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/BlackboxSimpleConfigurator.java @@ -0,0 +1,52 @@ +/* + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. + * + * This program and the accompanying materials are dual-licensed under + * either the terms of the Eclipse Public License v1.0 as published by + * the Eclipse Foundation + * + * or (per the licensee's choosing) + * + * under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation. + */ + +package ch.qos.logback.core.blackbox.joran; + +import ch.qos.logback.core.joran.GenericXMLConfigurator; +import ch.qos.logback.core.joran.action.Action; +import ch.qos.logback.core.joran.action.ImplicitModelAction; +import ch.qos.logback.core.joran.spi.ElementSelector; +import ch.qos.logback.core.joran.spi.RuleStore; +import ch.qos.logback.core.joran.spi.SaxEventInterpreter; + +import java.util.HashMap; +import java.util.function.Supplier; + +public class BlackboxSimpleConfigurator extends GenericXMLConfigurator { + + + HashMap> rulesMap; + + public BlackboxSimpleConfigurator(HashMap> rules) { + this.rulesMap = rules; + } + + @Override + protected void setImplicitRuleSupplier(SaxEventInterpreter interpreter) { + interpreter.setImplicitActionSupplier(() -> new ImplicitModelAction()); + } + + public SaxEventInterpreter getInterpreter() { + return saxEventInterpreter; + } + + @Override + protected void addElementSelectorAndActionAssociations(RuleStore rs) { + for (ElementSelector elementSelector : rulesMap.keySet()) { + Supplier actionSupplier = rulesMap.get(elementSelector); + rs.addRule(elementSelector, actionSupplier); + } + } +} diff --git a/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/action/BlackboxTopElementAction.java b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/action/BlackboxTopElementAction.java new file mode 100644 index 0000000000..59f21765a5 --- /dev/null +++ b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/action/BlackboxTopElementAction.java @@ -0,0 +1,24 @@ +package ch.qos.logback.core.blackbox.joran.action; + +import ch.qos.logback.core.blackbox.model.BlackboxTopModel; +import ch.qos.logback.core.joran.action.BaseModelAction; +import org.xml.sax.Attributes; + +import ch.qos.logback.core.joran.spi.SaxEventInterpretationContext; +import ch.qos.logback.core.model.Model; + +/** + * Add a Model instance at the top of the InterpretationContext stack + * + * @author Ceki Gulcu + */ +public class BlackboxTopElementAction extends BaseModelAction { + + @Override + protected Model buildCurrentModel(SaxEventInterpretationContext interpretationContext, String name, + Attributes attributes) { + BlackboxTopModel topModel = new BlackboxTopModel(); + return topModel; + } + +} diff --git a/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/action/ext/BlackboxStackAction.java b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/action/ext/BlackboxStackAction.java new file mode 100644 index 0000000000..e2d5c8c5db --- /dev/null +++ b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/action/ext/BlackboxStackAction.java @@ -0,0 +1,43 @@ +/** + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * + * This program and the accompanying materials are dual-licensed under + * either the terms of the Eclipse Public License v1.0 as published by + * the Eclipse Foundation + * + * or (per the licensee's choosing) + * + * under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation. + */ +package ch.qos.logback.core.blackbox.joran.action.ext; + +import ch.qos.logback.core.blackbox.model.BlackboxStackModel; +import org.xml.sax.Attributes; + +import ch.qos.logback.core.joran.action.BaseModelAction; +import ch.qos.logback.core.joran.action.PreconditionValidator; +import ch.qos.logback.core.joran.spi.SaxEventInterpretationContext; +import ch.qos.logback.core.model.Model; + +public class BlackboxStackAction extends BaseModelAction { + + + @Override + protected boolean validPreconditions(SaxEventInterpretationContext ic, String name, Attributes attributes) { + PreconditionValidator validator = new PreconditionValidator(this, ic, name, attributes); + validator.validateNameAttribute(); + return validator.isValid(); + } + + @Override + protected Model buildCurrentModel(SaxEventInterpretationContext interpretationContext, String name, + Attributes attributes) { + BlackboxStackModel stackModel = new BlackboxStackModel(); + stackModel.setName(attributes.getValue(NAME_ATTRIBUTE)); + return stackModel; + } + + +} diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/IfThenElseTest.java b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/conditional/IfThenElseTest.java similarity index 81% rename from logback-core/src/test/java/ch/qos/logback/core/joran/conditional/IfThenElseTest.java rename to logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/conditional/IfThenElseTest.java index 2b465a36df..fda8d071e4 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/IfThenElseTest.java +++ b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/conditional/IfThenElseTest.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by @@ -11,32 +11,27 @@ * under the terms of the GNU Lesser General Public License version 2.1 * as published by the Free Software Foundation. */ -package ch.qos.logback.core.joran.conditional; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Stack; -import java.util.function.Supplier; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +package ch.qos.logback.core.blackbox.joran.conditional; import ch.qos.logback.core.Context; import ch.qos.logback.core.ContextBase; -import ch.qos.logback.core.joran.SimpleConfigurator; +import ch.qos.logback.core.blackbox.BlackboxCoreTestConstants; +import ch.qos.logback.core.blackbox.joran.BlackboxSimpleConfigurator; +import ch.qos.logback.core.blackbox.joran.action.BlackboxTopElementAction; +import ch.qos.logback.core.blackbox.joran.action.ext.BlackboxStackAction; +import ch.qos.logback.core.blackbox.model.BlackboxStackModel; +import ch.qos.logback.core.blackbox.model.BlackboxTopModel; +import ch.qos.logback.core.blackbox.model.processor.BlackboxStackModelHandler; import ch.qos.logback.core.joran.action.Action; import ch.qos.logback.core.joran.action.PropertyAction; -import ch.qos.logback.core.joran.action.TopElementAction; -import ch.qos.logback.core.joran.action.ext.StackAction; +import ch.qos.logback.core.joran.conditional.ElseAction; +import ch.qos.logback.core.joran.conditional.IfAction; +import ch.qos.logback.core.joran.conditional.ThenAction; import ch.qos.logback.core.joran.spi.ElementSelector; import ch.qos.logback.core.joran.spi.JoranException; import ch.qos.logback.core.joran.spi.RuleStore; import ch.qos.logback.core.model.ImplicitModel; import ch.qos.logback.core.model.PropertyModel; -import ch.qos.logback.core.model.StackModel; -import ch.qos.logback.core.model.TopModel; import ch.qos.logback.core.model.conditional.ElseModel; import ch.qos.logback.core.model.conditional.IfModel; import ch.qos.logback.core.model.conditional.ThenModel; @@ -44,22 +39,30 @@ import ch.qos.logback.core.model.processor.ImplicitModelHandler; import ch.qos.logback.core.model.processor.NOPModelHandler; import ch.qos.logback.core.model.processor.PropertyModelHandler; -import ch.qos.logback.core.model.processor.StackModelHandler; import ch.qos.logback.core.model.processor.conditional.ElseModelHandler; import ch.qos.logback.core.model.processor.conditional.IfModelHandler; import ch.qos.logback.core.model.processor.conditional.ThenModelHandler; +import ch.qos.logback.core.status.StatusUtil; import ch.qos.logback.core.testUtil.CoreTestConstants; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Stack; +import java.util.function.Supplier; public class IfThenElseTest { Context context = new ContextBase(); - StatusChecker checker = new StatusChecker(context); - SimpleConfigurator simpleConfigurator; + StatusUtil checker = new StatusUtil(context); + BlackboxSimpleConfigurator simpleConfigurator; int diff = RandomUtil.getPositiveInt(); - static final String CONDITIONAL_DIR_PREFIX = CoreTestConstants.JORAN_INPUT_PREFIX + "conditional/"; + static final String CONDITIONAL_DIR_PREFIX = BlackboxCoreTestConstants.JORAN_INPUT_PREFIX + "conditional/"; String ki1 = "ki1"; String val1 = "val1"; @@ -69,14 +72,14 @@ public class IfThenElseTest { @BeforeEach public void setUp() throws Exception { HashMap> rulesMap = new HashMap<>(); - rulesMap.put(new ElementSelector("x"), TopElementAction::new); - rulesMap.put(new ElementSelector("x/stack"), StackAction::new); + rulesMap.put(new ElementSelector("x"), BlackboxTopElementAction::new); + rulesMap.put(new ElementSelector("x/stack"), BlackboxStackAction::new); rulesMap.put(new ElementSelector("x/property"), PropertyAction::new); rulesMap.put(new ElementSelector("*/if"), IfAction::new); rulesMap.put(new ElementSelector("*/if/then"), ThenAction::new); rulesMap.put(new ElementSelector("*/if/else"), ElseAction::new); - simpleConfigurator = new SimpleConfigurator(rulesMap) { + simpleConfigurator = new BlackboxSimpleConfigurator(rulesMap) { @Override protected void addElementSelectorAndActionAssociations(RuleStore rs) { @@ -90,9 +93,9 @@ protected void addElementSelectorAndActionAssociations(RuleStore rs) { @Override protected void addModelHandlerAssociations(DefaultProcessor defaultProcessor) { - defaultProcessor.addHandler(TopModel.class, NOPModelHandler::makeInstance); + defaultProcessor.addHandler(BlackboxTopModel.class, NOPModelHandler::makeInstance); - defaultProcessor.addHandler(StackModel.class, StackModelHandler::makeInstance); + defaultProcessor.addHandler(BlackboxStackModel.class, BlackboxStackModelHandler::makeInstance); defaultProcessor.addHandler(PropertyModel.class, PropertyModelHandler::makeInstance); defaultProcessor.addHandler(ImplicitModel.class, ImplicitModelHandler::makeInstance); defaultProcessor.addHandler(IfModel.class, IfModelHandler::makeInstance); @@ -175,7 +178,7 @@ private void verifyConfig(String[] expected) { witness.addAll(Arrays.asList(expected)); @SuppressWarnings({ "unchecked", "rawtypes" }) - Stack aStack = (Stack) context.getObject(StackModelHandler.STACK_TEST); + Stack aStack = (Stack) context.getObject(BlackboxStackModelHandler.STACK_TEST); Assertions.assertEquals(witness, aStack); } diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilderTest.java b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/conditional/PropertyEvalScriptBuilderTest.java similarity index 92% rename from logback-core/src/test/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilderTest.java rename to logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/conditional/PropertyEvalScriptBuilderTest.java index 8f32ce7d46..968d074262 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilderTest.java +++ b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/conditional/PropertyEvalScriptBuilderTest.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by @@ -11,11 +11,14 @@ * under the terms of the GNU Lesser General Public License version 2.1 * as published by the Free Software Foundation. */ -package ch.qos.logback.core.joran.conditional; +package ch.qos.logback.core.blackbox.joran.conditional; +import ch.qos.logback.core.joran.conditional.Condition; +import ch.qos.logback.core.joran.conditional.PropertyEvalScriptBuilder; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import ch.qos.logback.core.Context; diff --git a/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/conditional/TrivialTest.java b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/conditional/TrivialTest.java new file mode 100644 index 0000000000..237156da8d --- /dev/null +++ b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/joran/conditional/TrivialTest.java @@ -0,0 +1,30 @@ +/* + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. + * + * This program and the accompanying materials are dual-licensed under + * either the terms of the Eclipse Public License v1.0 as published by + * the Eclipse Foundation + * + * or (per the licensee's choosing) + * + * under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation. + */ + +package ch.qos.logback.core.blackbox.joran.conditional; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.fail; + +public class TrivialTest { + + + @Disabled + @Test + public void smoke() { + fail(); + } +} diff --git a/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/BlackboxStackModel.java b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/BlackboxStackModel.java new file mode 100644 index 0000000000..e947142b35 --- /dev/null +++ b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/BlackboxStackModel.java @@ -0,0 +1,26 @@ +/** + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. + * + * This program and the accompanying materials are dual-licensed under + * either the terms of the Eclipse Public License v1.0 as published by + * the Eclipse Foundation + * + * or (per the licensee's choosing) + * + * under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation. + */ +package ch.qos.logback.core.blackbox.model; + +import ch.qos.logback.core.model.NamedModel; + +public class BlackboxStackModel extends NamedModel { + + private static final long serialVersionUID = -2623437394373933695L; + + @Override + protected BlackboxStackModel makeNewInstance() { + return new BlackboxStackModel(); + } +} diff --git a/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/BlackboxTopModel.java b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/BlackboxTopModel.java new file mode 100644 index 0000000000..bb432f4e2b --- /dev/null +++ b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/BlackboxTopModel.java @@ -0,0 +1,14 @@ +package ch.qos.logback.core.blackbox.model; + +import ch.qos.logback.core.model.Model; + +public class BlackboxTopModel extends Model { + + private static final long serialVersionUID = 6378962040610737208L; + + @Override + protected BlackboxTopModel makeNewInstance() { + return new BlackboxTopModel(); + } + +} diff --git a/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/processor/BlackboxStackModelHandler.java b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/processor/BlackboxStackModelHandler.java new file mode 100644 index 0000000000..1a3a65813f --- /dev/null +++ b/logback-core-blackbox/src/test/java/ch/qos/logback/core/blackbox/model/processor/BlackboxStackModelHandler.java @@ -0,0 +1,52 @@ +package ch.qos.logback.core.blackbox.model.processor; + +import java.util.Stack; + +import ch.qos.logback.core.Context; +import ch.qos.logback.core.ContextBase; +import ch.qos.logback.core.blackbox.model.BlackboxStackModel; +import ch.qos.logback.core.model.Model; +import ch.qos.logback.core.model.processor.ModelHandlerBase; +import ch.qos.logback.core.model.processor.ModelHandlerException; +import ch.qos.logback.core.model.processor.ModelInterpretationContext; + +public class BlackboxStackModelHandler extends ModelHandlerBase { + + static public final String STACK_TEST = "STACK_TEST"; + + public BlackboxStackModelHandler(Context context) { + super(context); + } + + static public BlackboxStackModelHandler makeInstance(Context context, ModelInterpretationContext ic) { + return new BlackboxStackModelHandler(context); + } + + @Override + protected Class getSupportedModelClass() { + return BlackboxStackModel.class; + } + + @Override + public void handle(ModelInterpretationContext mic, Model model) throws ModelHandlerException { + + BlackboxStackModel stackModel = (BlackboxStackModel) model; + + String name = stackModel.getName(); + + ContextBase contextBase = (ContextBase) context; + + @SuppressWarnings("unchecked") + Stack aStack = (Stack) context.getObject(STACK_TEST); + if(aStack == null) { + aStack = new Stack<>(); + contextBase.putObject(STACK_TEST, aStack); + } + aStack.push(name); + } + + @Override + public void postHandle(ModelInterpretationContext intercon, Model model) throws ModelHandlerException { + } + +} diff --git a/logback-core-blackbox/src/test/java/module-info.java b/logback-core-blackbox/src/test/java/module-info.java new file mode 100644 index 0000000000..f776abd590 --- /dev/null +++ b/logback-core-blackbox/src/test/java/module-info.java @@ -0,0 +1,9 @@ +module ch.qos.logback.core.blackbox { + requires ch.qos.logback.core; + + requires org.junit.jupiter.api; + requires org.junit.jupiter.engine; + requires janino; + exports ch.qos.logback.core.blackbox.joran.conditional; + exports ch.qos.logback.core.blackbox.joran; +} \ No newline at end of file diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java index 675655af58..a18bff6510 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java +++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java @@ -49,6 +49,7 @@ public TimeBasedArchiveRemover(FileNamePattern fileNamePattern, RollingCalendar int callCount = 0; + @Override public void clean(Date now) { long nowInMillis = now.getTime(); diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/CoreTestConstants.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/CoreTestConstants.java old mode 100755 new mode 100644 similarity index 95% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/CoreTestConstants.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/CoreTestConstants.java index 4c96b1ef0d..691fa5b755 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/CoreTestConstants.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/CoreTestConstants.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/DelayingListAppender.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/DelayingListAppender.java similarity index 93% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/DelayingListAppender.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/DelayingListAppender.java index 88cd662944..669244b415 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/DelayingListAppender.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/DelayingListAppender.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/EnvUtilForTests.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/EnvUtilForTests.java similarity index 97% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/EnvUtilForTests.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/EnvUtilForTests.java index 64e06d3d49..4586acaa75 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/EnvUtilForTests.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/EnvUtilForTests.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/FileTestUtil.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/FileTestUtil.java similarity index 76% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/FileTestUtil.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/FileTestUtil.java index f01d5f1261..bb2075b17e 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/FileTestUtil.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/FileTestUtil.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by @@ -13,7 +13,6 @@ */ package ch.qos.logback.core.testUtil; -import org.junit.jupiter.api.Assertions; import java.io.File; @@ -26,8 +25,11 @@ public static void makeTestOutputDir() { File target = new File(CoreTestConstants.TARGET_DIR); if (target.exists() && target.isDirectory()) { File testoutput = new File(CoreTestConstants.OUTPUT_DIR_PREFIX); - if (!testoutput.exists()) - Assertions.assertTrue(testoutput.mkdir()); + if (!testoutput.exists()) { + boolean result = testoutput.mkdir(); + if(!result) + throw new IllegalStateException("Failed to create "+testoutput); + } } else { throw new IllegalStateException(CoreTestConstants.TARGET_DIR + " does not exist"); } diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/FileToBufferUtil.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/FileToBufferUtil.java similarity index 97% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/FileToBufferUtil.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/FileToBufferUtil.java index 82f2f36164..1ed6da6dfb 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/FileToBufferUtil.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/FileToBufferUtil.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/MockInitialContext.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/MockInitialContext.java similarity index 94% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/MockInitialContext.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/MockInitialContext.java index 02c4672cd7..fefa75ca72 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/MockInitialContext.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/MockInitialContext.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/MockInitialContextFactory.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/MockInitialContextFactory.java similarity index 95% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/MockInitialContextFactory.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/MockInitialContextFactory.java index 5d4c4bbf4d..14c30f2f73 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/MockInitialContextFactory.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/MockInitialContextFactory.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/NPEAppender.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/NPEAppender.java similarity index 91% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/NPEAppender.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/NPEAppender.java index defa6f9467..2cd24c6916 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/NPEAppender.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/NPEAppender.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/RandomUtil.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/RandomUtil.java similarity index 93% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/RandomUtil.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/RandomUtil.java index 9bdff9d200..57ade4ddb9 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/RandomUtil.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/RandomUtil.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/StringListAppender.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/StringListAppender.java similarity index 95% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/StringListAppender.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/StringListAppender.java index 0a6640abbb..dc87057a72 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/StringListAppender.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/StringListAppender.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/TeeOutputStream.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/TeeOutputStream.java similarity index 95% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/TeeOutputStream.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/TeeOutputStream.java index d7a9291b88..99e9976a05 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/TeeOutputStream.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/TeeOutputStream.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/TrivialStatusListener.java b/logback-core/src/main/java/ch/qos/logback/core/testUtil/TrivialStatusListener.java similarity index 94% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/TrivialStatusListener.java rename to logback-core/src/main/java/ch/qos/logback/core/testUtil/TrivialStatusListener.java index bcc076e111..d9ff175aae 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/TrivialStatusListener.java +++ b/logback-core/src/main/java/ch/qos/logback/core/testUtil/TrivialStatusListener.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by diff --git a/logback-core/src/main/java/module-info.java b/logback-core/src/main/java/module-info.java index b488a09e83..df87805e1c 100644 --- a/logback-core/src/main/java/module-info.java +++ b/logback-core/src/main/java/module-info.java @@ -16,9 +16,6 @@ exports ch.qos.logback.core; exports ch.qos.logback.core.boolex; - exports ch.qos.logback.core.rolling; - exports ch.qos.logback.core.rolling.helper; - exports ch.qos.logback.core.util; exports ch.qos.logback.core.encoder; @@ -27,19 +24,24 @@ exports ch.qos.logback.core.filter; - exports ch.qos.logback.core.model; - exports ch.qos.logback.core.model.conditional; - exports ch.qos.logback.core.model.processor; exports ch.qos.logback.core.joran; exports ch.qos.logback.core.joran.action; + exports ch.qos.logback.core.joran.conditional; + + exports ch.qos.logback.core.joran.event; + exports ch.qos.logback.core.joran.sanity; exports ch.qos.logback.core.joran.spi; - exports ch.qos.logback.core.joran.event; exports ch.qos.logback.core.joran.util; - exports ch.qos.logback.core.joran.sanity; - exports ch.qos.logback.core.joran.conditional; exports ch.qos.logback.core.joran.util.beans; - + + exports ch.qos.logback.core.model; + exports ch.qos.logback.core.model.conditional; + exports ch.qos.logback.core.model.processor; + exports ch.qos.logback.core.model.processor.conditional; + exports ch.qos.logback.core.model.util; + + exports ch.qos.logback.core.net; exports ch.qos.logback.core.net.server; exports ch.qos.logback.core.net.ssl; @@ -47,16 +49,19 @@ exports ch.qos.logback.core.pattern; exports ch.qos.logback.core.pattern.color; exports ch.qos.logback.core.pattern.parser; - + + exports ch.qos.logback.core.recovery; + exports ch.qos.logback.core.read; + exports ch.qos.logback.core.rolling; + exports ch.qos.logback.core.rolling.helper; + exports ch.qos.logback.core.sift; exports ch.qos.logback.core.spi; exports ch.qos.logback.core.status; - exports ch.qos.logback.core.model.util; - - exports ch.qos.logback.core.recovery; + exports ch.qos.logback.core.testUtil; + exports ch.qos.logback.core.util; - exports ch.qos.logback.core.read; } diff --git a/logback-core/src/test/java/ch/qos/logback/core/AsyncAppenderBaseTest.java b/logback-core/src/test/java/ch/qos/logback/core/AsyncAppenderBaseTest.java index aabdc1ca81..2555fafd1e 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/AsyncAppenderBaseTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/AsyncAppenderBaseTest.java @@ -24,7 +24,7 @@ import ch.qos.logback.core.status.OnConsoleStatusListener; import ch.qos.logback.core.testUtil.DelayingListAppender; import ch.qos.logback.core.testUtil.NPEAppender; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import org.junit.jupiter.api.Timeout; import java.util.concurrent.TimeUnit; diff --git a/logback-core/src/test/java/ch/qos/logback/core/appender/AbstractAppenderTest.java b/logback-core/src/test/java/ch/qos/logback/core/appender/AbstractAppenderTest.java index 23aaf06a20..ce0be94140 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/appender/AbstractAppenderTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/appender/AbstractAppenderTest.java @@ -16,7 +16,7 @@ import ch.qos.logback.core.Appender; import ch.qos.logback.core.Context; import ch.qos.logback.core.ContextBase; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java b/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java index 67bc3952aa..27726045f4 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java @@ -21,7 +21,7 @@ import ch.qos.logback.core.encoder.NopEncoder; import ch.qos.logback.core.layout.DummyLayout; import ch.qos.logback.core.status.Status; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import org.fusesource.jansi.AnsiPrintStream; import org.junit.jupiter.api.AfterEach; diff --git a/logback-core/src/test/java/ch/qos/logback/core/appender/FileAppenderTest.java b/logback-core/src/test/java/ch/qos/logback/core/appender/FileAppenderTest.java index 49357f30d9..79da2568f8 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/appender/FileAppenderTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/appender/FileAppenderTest.java @@ -27,7 +27,7 @@ import ch.qos.logback.core.status.StatusManager; import ch.qos.logback.core.testUtil.CoreTestConstants; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; public class FileAppenderTest extends AbstractAppenderTest { diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/action/DefinePropertyActionTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/action/DefinePropertyActionTest.java index 478efe555b..b45ed1b373 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/action/DefinePropertyActionTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/joran/action/DefinePropertyActionTest.java @@ -36,7 +36,7 @@ import ch.qos.logback.core.model.processor.NOPModelHandler; import ch.qos.logback.core.status.Status; import ch.qos.logback.core.testUtil.CoreTestConstants; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/action/IncludeActionTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/action/IncludeActionTest.java index cdd019f634..5cbe613ce5 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/action/IncludeActionTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/joran/action/IncludeActionTest.java @@ -45,7 +45,7 @@ import ch.qos.logback.core.testUtil.CoreTestConstants; import ch.qos.logback.core.testUtil.FileTestUtil; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; public class IncludeActionTest { diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/event/SaxEventRecorderTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/event/SaxEventRecorderTest.java index 804e760cec..2dcca24c7d 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/event/SaxEventRecorderTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/joran/event/SaxEventRecorderTest.java @@ -27,7 +27,7 @@ import ch.qos.logback.core.ContextBase; import ch.qos.logback.core.status.Status; import ch.qos.logback.core.testUtil.CoreTestConstants; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; /** * Test whether SaxEventRecorder does a good job. diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/event/stax/StaxEventRecorderTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/event/stax/StaxEventRecorderTest.java index b6a951ff37..c2aab97694 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/event/stax/StaxEventRecorderTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/joran/event/stax/StaxEventRecorderTest.java @@ -22,7 +22,7 @@ import ch.qos.logback.core.ContextBase; import ch.qos.logback.core.status.Status; import ch.qos.logback.core.testUtil.CoreTestConstants; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/ImplicitActionTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/ImplicitActionTest.java index 64860be8ba..45e1f7b722 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/ImplicitActionTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/ImplicitActionTest.java @@ -32,7 +32,7 @@ import ch.qos.logback.core.model.processor.PropertyModelHandler; import ch.qos.logback.core.model.processor.StatusListenerModelHandler; import ch.qos.logback.core.testUtil.CoreTestConstants; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/sanity/AppenderWithinAppenderSanityCheckerTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/sanity/AppenderWithinAppenderSanityCheckerTest.java index d623afdd7d..99f7bd0122 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/sanity/AppenderWithinAppenderSanityCheckerTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/joran/sanity/AppenderWithinAppenderSanityCheckerTest.java @@ -5,7 +5,7 @@ import ch.qos.logback.core.model.AppenderModel; import ch.qos.logback.core.model.TopModel; import ch.qos.logback.core.status.Status; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/util/PropertySetterTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/util/PropertySetterTest.java index 299791e828..edc345cf4c 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/util/PropertySetterTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/joran/util/PropertySetterTest.java @@ -26,7 +26,7 @@ import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry; import ch.qos.logback.core.joran.util.beans.BeanDescriptionCache; import ch.qos.logback.core.spi.FilterReply; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.AggregationType; import ch.qos.logback.core.util.StatusPrinter; diff --git a/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/CompilerTest.java b/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/CompilerTest.java index 75574d2636..63793668cd 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/CompilerTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/CompilerTest.java @@ -18,7 +18,7 @@ import ch.qos.logback.core.pattern.Converter; import ch.qos.logback.core.pattern.Converter123; import ch.qos.logback.core.pattern.ConverterHello; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; //import ch.qos.logback.core.util.StatusPrinter; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/ParserTest.java b/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/ParserTest.java index 5ba0ac87de..3476ee869c 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/ParserTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/ParserTest.java @@ -23,7 +23,7 @@ import ch.qos.logback.core.ContextBase; import ch.qos.logback.core.pattern.FormatInfo; import ch.qos.logback.core.spi.ScanException; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; public class ParserTest { diff --git a/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayoutTest.java b/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayoutTest.java index 97c23720e8..61d160db03 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayoutTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayoutTest.java @@ -21,7 +21,7 @@ import ch.qos.logback.core.pattern.PatternLayoutBase; import ch.qos.logback.core.pattern.parser.test.AbstractPatternLayoutBaseTest; import ch.qos.logback.core.status.Status; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; public class SamplePatternLayoutTest extends AbstractPatternLayoutBaseTest { diff --git a/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/test/AbstractPatternLayoutBaseTest.java b/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/test/AbstractPatternLayoutBaseTest.java index c7d4e8d047..5ff543f21b 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/test/AbstractPatternLayoutBaseTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/test/AbstractPatternLayoutBaseTest.java @@ -19,7 +19,7 @@ import ch.qos.logback.core.ContextBase; import ch.qos.logback.core.pattern.ExceptionalConverter; import ch.qos.logback.core.pattern.PatternLayoutBase; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/CollisionDetectionTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/CollisionDetectionTest.java index e92e1f6430..c10a4e8813 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/rolling/CollisionDetectionTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/CollisionDetectionTest.java @@ -7,7 +7,6 @@ import java.util.Map; -import org.assertj.core.api.Assert; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -18,7 +17,7 @@ import ch.qos.logback.core.encoder.NopEncoder; import ch.qos.logback.core.status.Status; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; public class CollisionDetectionTest { diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java index 2c29115d8e..704f7f0f4f 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java @@ -37,7 +37,7 @@ import ch.qos.logback.core.encoder.EchoEncoder; import ch.qos.logback.core.encoder.Encoder; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.FileSize; import ch.qos.logback.core.util.StatusPrinter; diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/RenameUtilTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/RenameUtilTest.java index 830b0cc1d5..1460ecd77f 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/rolling/RenameUtilTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/RenameUtilTest.java @@ -20,7 +20,7 @@ import ch.qos.logback.core.rolling.helper.RenameUtil; import ch.qos.logback.core.testUtil.CoreTestConstants; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.StatusPrinter; import org.junit.jupiter.api.BeforeEach; diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/RollingFileAppenderTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/RollingFileAppenderTest.java index a9cfc676be..b9936dc8d6 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/rolling/RollingFileAppenderTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/RollingFileAppenderTest.java @@ -26,7 +26,7 @@ import ch.qos.logback.core.status.Status; import ch.qos.logback.core.testUtil.CoreTestConstants; import ch.qos.logback.core.testUtil.RandomUtil; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; //import ch.qos.logback.core.util.StatusPrinter; public class RollingFileAppenderTest extends AbstractAppenderTest { diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP_Test.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP_Test.java index 247475a813..84b84bb72b 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP_Test.java +++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP_Test.java @@ -27,7 +27,7 @@ import ch.qos.logback.core.rolling.testUtil.ScaffoldingForRollingTests; import ch.qos.logback.core.status.InfoStatus; import ch.qos.logback.core.status.StatusManager; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.FileSize; import static org.junit.jupiter.api.Assertions.assertFalse; diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicyBaseTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicyBaseTest.java index 286098a26d..a169cf1b6e 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicyBaseTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicyBaseTest.java @@ -20,7 +20,7 @@ import ch.qos.logback.core.Context; import ch.qos.logback.core.ContextBase; import ch.qos.logback.core.status.Status; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; /** * @author Ceki Gülcü diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_Test.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_Test.java index 8781c21586..9b71021844 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_Test.java +++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_Test.java @@ -37,7 +37,6 @@ //import org.joda.time.DateTimeZone; //import org.joda.time.Days; //import org.joda.time.LocalDate; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -46,7 +45,7 @@ import ch.qos.logback.core.pattern.SpacePadder; import ch.qos.logback.core.rolling.helper.RollingCalendar; import ch.qos.logback.core.rolling.testUtil.ScaffoldingForRollingTests; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.FileSize; import ch.qos.logback.core.util.FixedRateInvocationGate; diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java index eb7c533705..f7d617abba 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java @@ -27,7 +27,7 @@ import ch.qos.logback.core.Context; import ch.qos.logback.core.ContextBase; import ch.qos.logback.core.testUtil.CoreTestConstants; -import ch.qos.logback.core.testUtil.StatusChecker; +import ch.qos.logback.core.status.testUtil.StatusChecker; import ch.qos.logback.core.util.Compare; /** diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/StatusChecker.java b/logback-core/src/test/java/ch/qos/logback/core/status/testUtil/StatusChecker.java similarity index 62% rename from logback-core/src/test/java/ch/qos/logback/core/testUtil/StatusChecker.java rename to logback-core/src/test/java/ch/qos/logback/core/status/testUtil/StatusChecker.java index 1bd1076ba8..a8bb12321b 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/StatusChecker.java +++ b/logback-core/src/test/java/ch/qos/logback/core/status/testUtil/StatusChecker.java @@ -1,6 +1,6 @@ -/** +/* * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by @@ -11,16 +11,12 @@ * under the terms of the GNU Lesser General Public License version 2.1 * as published by the Free Software Foundation. */ -package ch.qos.logback.core.testUtil; +package ch.qos.logback.core.status.testUtil; import ch.qos.logback.core.Context; -import ch.qos.logback.core.status.Status; import ch.qos.logback.core.status.StatusManager; import ch.qos.logback.core.status.StatusUtil; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Assertions; /** * Extend StatusUtil with assertions. @@ -36,35 +32,32 @@ public StatusChecker(Context context) { } public void assertContainsMatch(int level, String regex) { - assertTrue(containsMatch(level, regex)); + Assertions.assertTrue(containsMatch(level, regex)); } public void assertNoMatch(String regex) { - assertFalse(containsMatch(regex)); + Assertions.assertFalse(containsMatch(regex)); } public void assertContainsMatch(String regex) { - assertTrue(containsMatch(regex)); + Assertions.assertTrue(containsMatch(regex)); } public void assertContainsException(Class scanExceptionClass) { - assertTrue(containsException(scanExceptionClass)); + Assertions.assertTrue(containsException(scanExceptionClass)); } public void assertContainsException(Class scanExceptionClass, String msg) { - assertTrue(containsException(scanExceptionClass, msg)); + Assertions.assertTrue(containsException(scanExceptionClass, msg)); } public void assertIsErrorFree() { - assertTrue(isErrorFree(0)); + Assertions.assertTrue(isErrorFree(0)); } - public void assertIsErrorCount(int count) { - assertEquals(count, levelCount(Status.ERROR, 0)); - } public void assertIsWarningOrErrorFree() { - assertTrue(isWarningOrErrorFree(0)); + Assertions.assertTrue(isWarningOrErrorFree(0)); } public void assertErrorCount(int i) { diff --git a/pom.xml b/pom.xml index 0896fcb795..948f89d8c7 100755 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,9 @@ logback-core + logback-core-blackbox logback-classic + logback-classic-blackbox logback-access logback-examples @@ -52,9 +54,9 @@ ${jdk.version} UTF-8 4.13.1 - 5.9.0 - 5.9.0 - 5.9.0 + 5.9.1 + 5.9.1 + 5.9.1 3.23.1 2.2 2.1.0