From eca1a136dbd9c6beb63258f8d1ee20590a81fa77 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Fri, 14 Jan 2022 19:53:33 +0000 Subject: [PATCH] Add log4j2 agent tests Signed-off-by: Michael Jeanson --- README.md | 9 +- .../integration/context/AppContextITBase.java | 6 +- .../events/EnabledEventsITBase.java | 10 +- .../events/MultiSessionITBase.java | 12 +- .../integration/context/JulAppContextIT.java | 6 + .../events/JulEnabledEventsIT.java | 6 + .../integration/events/JulMultiSessionIT.java | 6 + lttng-ust-java-tests-log4j/pom.xml | 2 +- .../context/Log4jAppContextIT.java | 6 + .../events/Log4jEnabledEventsIT.java | 6 + .../events/Log4jMultiSessionIT.java | 6 + lttng-ust-java-tests-log4j2/.classpath | 29 ++ lttng-ust-java-tests-log4j2/.project | 23 + .../org.eclipse.core.resources.prefs | 3 + .../.settings/org.eclipse.jdt.core.prefs | 392 ++++++++++++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 62 +++ .../.settings/org.eclipse.m2e.core.prefs | 4 + lttng-ust-java-tests-log4j2/pom.xml | 67 +++ .../context/Log4j2AppContextIT.java | 101 +++++ .../context/Log4j2AppContextOrderingIT.java | 86 ++++ .../events/Log4j2EnabledEventsIT.java | 137 ++++++ .../events/Log4j2ListEventsIT.java | 143 +++++++ .../events/Log4j2MultiSessionIT.java | 123 ++++++ .../filter/Log4j2FilterListenerIT.java | 69 +++ .../Log4j2FilterListenerOrderingIT.java | 65 +++ .../ust/agent/utils/Log4j2TestContext.java | 60 +++ .../ust/agent/utils/Log4j2TestUtils.java | 91 ++++ .../resources/log4j2.Log4j2AppContextIT.xml | 16 + .../log4j2.Log4j2AppContextOrderingIT.xml | 16 + .../log4j2.Log4j2EnabledEventsIT.xml | 29 ++ .../log4j2.Log4j2FilterListenerOrderingIT.xml | 20 + .../resources/log4j2.Log4j2MultiSessionIT.xml | 31 ++ .../log4j2.testManyLoggersAllAttached.xml | 26 ++ .../log4j2.testManyLoggersNoneAttached.xml | 23 + .../log4j2.testManyLoggersSomeAttached.xml | 24 ++ pom.xml | 28 +- 36 files changed, 1727 insertions(+), 16 deletions(-) create mode 100644 lttng-ust-java-tests-log4j2/.classpath create mode 100644 lttng-ust-java-tests-log4j2/.project create mode 100644 lttng-ust-java-tests-log4j2/.settings/org.eclipse.core.resources.prefs create mode 100644 lttng-ust-java-tests-log4j2/.settings/org.eclipse.jdt.core.prefs create mode 100644 lttng-ust-java-tests-log4j2/.settings/org.eclipse.jdt.ui.prefs create mode 100644 lttng-ust-java-tests-log4j2/.settings/org.eclipse.m2e.core.prefs create mode 100644 lttng-ust-java-tests-log4j2/pom.xml create mode 100644 lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/context/Log4j2AppContextIT.java create mode 100644 lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/context/Log4j2AppContextOrderingIT.java create mode 100644 lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2EnabledEventsIT.java create mode 100644 lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2ListEventsIT.java create mode 100644 lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2MultiSessionIT.java create mode 100644 lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/filter/Log4j2FilterListenerIT.java create mode 100644 lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/filter/Log4j2FilterListenerOrderingIT.java create mode 100644 lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/utils/Log4j2TestContext.java create mode 100644 lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/utils/Log4j2TestUtils.java create mode 100644 lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2AppContextIT.xml create mode 100644 lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2AppContextOrderingIT.xml create mode 100644 lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2EnabledEventsIT.xml create mode 100644 lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2FilterListenerOrderingIT.xml create mode 100644 lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2MultiSessionIT.xml create mode 100644 lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersAllAttached.xml create mode 100644 lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersNoneAttached.xml create mode 100644 lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersSomeAttached.xml diff --git a/README.md b/README.md index cfe2c0b..6d1f5fa 100644 --- a/README.md +++ b/README.md @@ -68,10 +68,11 @@ If for example, you installed into the `/usr` prefix instead of `/usr/local`, you can use the following properties to specify different locations for the lttng-ust-agent-java jars: - mvn clean verify - -Dcommon-jar-location=/usr/share/java/lttng-ust-agent-common.jar - -Djul-jar-location=/usr/share/java/lttng-ust-agent-jul.jar - -Dlog4j-jar-location=/usr/share/java/lttng-ust-agent-log4j.jar + mvn clean verify \ + -Dcommon-jar-location=/usr/share/java/lttng-ust-agent-common.jar \ + -Djul-jar-location=/usr/share/java/lttng-ust-agent-jul.jar \ + -Dlog4j-jar-location=/usr/share/java/lttng-ust-agent-log4j.jar \ + -Dlog4j2-jar-location=/usr/share/java/lttng-ust-agent-log4j2.jar To specify a different locations for the JNI .so libraries, you can set the `-Djava.library.path` property on the JVM: diff --git a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextITBase.java b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextITBase.java index 99ba6fb..f7b3293 100644 --- a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextITBase.java +++ b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextITBase.java @@ -58,6 +58,8 @@ public abstract class AppContextITBase { protected abstract Domain getDomain(); + protected abstract boolean closeHandlers(); + protected abstract void sendEventsToLoggers(); /** @@ -81,7 +83,9 @@ public abstract class AppContextITBase { public void testTeardown() { session.close(); - logHandler.close(); + if (closeHandlers()) { + logHandler.close(); + } logHandler = null; /* In case some tests fail or forget to unregister their retrievers */ diff --git a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/EnabledEventsITBase.java b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/EnabledEventsITBase.java index 99ce2a3..7a7ce36 100644 --- a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/EnabledEventsITBase.java +++ b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/EnabledEventsITBase.java @@ -55,6 +55,8 @@ public abstract class EnabledEventsITBase { protected abstract Domain getDomain(); + protected abstract boolean closeHandlers(); + protected abstract void sendEventsToLoggers(); /** @@ -77,9 +79,11 @@ public abstract class EnabledEventsITBase { public void testTeardown() { session.close(); - handlerA.close(); - handlerB.close(); - handlerC.close(); + if (closeHandlers()) { + handlerA.close(); + handlerB.close(); + handlerC.close(); + } handlerA = null; handlerB = null; diff --git a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/MultiSessionITBase.java b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/MultiSessionITBase.java index bfaa3fc..bc75961 100644 --- a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/MultiSessionITBase.java +++ b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/events/MultiSessionITBase.java @@ -56,6 +56,8 @@ public abstract class MultiSessionITBase { protected abstract Domain getDomain(); + protected abstract boolean closeHandlers(); + protected abstract void sendEventsToLoggers(); /** @@ -77,10 +79,12 @@ public abstract class MultiSessionITBase { session2.close(); session3.close(); - handlerA.close(); - handlerB.close(); - handlerC.close(); - handlerD.close(); + if (closeHandlers()) { + handlerA.close(); + handlerB.close(); + handlerC.close(); + handlerD.close(); + } handlerA = null; handlerB = null; diff --git a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/context/JulAppContextIT.java b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/context/JulAppContextIT.java index 844acef..56e8d56 100644 --- a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/context/JulAppContextIT.java +++ b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/context/JulAppContextIT.java @@ -85,6 +85,12 @@ public class JulAppContextIT extends AppContextITBase { return DOMAIN; } + @Override + protected boolean closeHandlers() + { + return true; + } + @Override protected void sendEventsToLoggers() { JulTestUtils.send10EventsTo(logger); diff --git a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulEnabledEventsIT.java b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulEnabledEventsIT.java index 0226f7d..0cfe860 100644 --- a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulEnabledEventsIT.java +++ b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulEnabledEventsIT.java @@ -106,6 +106,12 @@ public class JulEnabledEventsIT extends EnabledEventsITBase { return DOMAIN; } + @Override + protected boolean closeHandlers() + { + return true; + } + @Override protected void sendEventsToLoggers() { JulTestUtils.send10EventsTo(loggerA); diff --git a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulMultiSessionIT.java b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulMultiSessionIT.java index 0c860bb..5ab9bf0 100644 --- a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulMultiSessionIT.java +++ b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulMultiSessionIT.java @@ -109,6 +109,12 @@ public class JulMultiSessionIT extends MultiSessionITBase { return DOMAIN; } + @Override + protected boolean closeHandlers() + { + return true; + } + @Override protected void sendEventsToLoggers() { JulTestUtils.send10EventsTo(loggerA); diff --git a/lttng-ust-java-tests-log4j/pom.xml b/lttng-ust-java-tests-log4j/pom.xml index e825443..016befa 100644 --- a/lttng-ust-java-tests-log4j/pom.xml +++ b/lttng-ust-java-tests-log4j/pom.xml @@ -31,7 +31,7 @@ lttng-ust-java-tests-log4j jar - LTTng-UST Java Agent Log4j API Integration Tests + LTTng-UST Java Agent Log4j 1.x API Integration Tests diff --git a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/context/Log4jAppContextIT.java b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/context/Log4jAppContextIT.java index 1eea96d..162d13e 100644 --- a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/context/Log4jAppContextIT.java +++ b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/context/Log4jAppContextIT.java @@ -85,6 +85,12 @@ public class Log4jAppContextIT extends AppContextITBase { return DOMAIN; } + @Override + protected boolean closeHandlers() + { + return true; + } + @Override protected void sendEventsToLoggers() { Log4jTestUtils.send10Events(logger); diff --git a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jEnabledEventsIT.java b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jEnabledEventsIT.java index 2d73217..34bfdf7 100644 --- a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jEnabledEventsIT.java +++ b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jEnabledEventsIT.java @@ -107,6 +107,12 @@ public class Log4jEnabledEventsIT extends EnabledEventsITBase { return DOMAIN; } + @Override + protected boolean closeHandlers() + { + return true; + } + @Override protected void sendEventsToLoggers() { Log4jTestUtils.send10Events(loggerA); diff --git a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jMultiSessionIT.java b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jMultiSessionIT.java index 150260a..dc654b0 100644 --- a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jMultiSessionIT.java +++ b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jMultiSessionIT.java @@ -111,6 +111,12 @@ public class Log4jMultiSessionIT extends MultiSessionITBase { return DOMAIN; } + @Override + protected boolean closeHandlers() + { + return true; + } + @Override protected void sendEventsToLoggers() { Log4jTestUtils.send10Events(loggerA); diff --git a/lttng-ust-java-tests-log4j2/.classpath b/lttng-ust-java-tests-log4j2/.classpath new file mode 100644 index 0000000..e6f72a7 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/.classpath @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lttng-ust-java-tests-log4j2/.project b/lttng-ust-java-tests-log4j2/.project new file mode 100644 index 0000000..881022c --- /dev/null +++ b/lttng-ust-java-tests-log4j2/.project @@ -0,0 +1,23 @@ + + + lttng-ust-java-tests-log4j2 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/lttng-ust-java-tests-log4j2/.settings/org.eclipse.core.resources.prefs b/lttng-ust-java-tests-log4j2/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..8dd9b1d --- /dev/null +++ b/lttng-ust-java-tests-log4j2/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/lttng-ust-java-tests-log4j2/.settings/org.eclipse.jdt.core.prefs b/lttng-ust-java-tests-log4j2/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f1acd28 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,392 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/lttng-ust-java-tests-log4j2/.settings/org.eclipse.jdt.ui.prefs b/lttng-ust-java-tests-log4j2/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..b883c15 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spaces +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=false +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_type_arguments=false diff --git a/lttng-ust-java-tests-log4j2/.settings/org.eclipse.m2e.core.prefs b/lttng-ust-java-tests-log4j2/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/lttng-ust-java-tests-log4j2/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/lttng-ust-java-tests-log4j2/pom.xml b/lttng-ust-java-tests-log4j2/pom.xml new file mode 100644 index 0000000..422ba8c --- /dev/null +++ b/lttng-ust-java-tests-log4j2/pom.xml @@ -0,0 +1,67 @@ + + + + + 4.0.0 + + + org.lttng.ust + lttng-ust-java-parent + 1.1.0-SNAPSHOT + + + lttng-ust-java-tests-log4j2 + jar + + LTTng-UST Java Agent Log4j 2.x API Integration Tests + + + + org.lttng.ust.agent + lttng-ust-agent-common + + + org.lttng.ust.agent + lttng-ust-agent-log4j2 + + + org.lttng.tools + lttng-tools-java + + + org.lttng.ust + lttng-ust-java-tests-common + + + org.apache.logging.log4j + log4j-api + + + org.apache.logging.log4j + log4j-core + + + junit + junit + + + + diff --git a/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/context/Log4j2AppContextIT.java b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/context/Log4j2AppContextIT.java new file mode 100644 index 0000000..f285b89 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/context/Log4j2AppContextIT.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2022, EfficiOS Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.context; + +import java.io.IOException; + +import org.apache.logging.log4j.core.Logger; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.ILttngHandler; +import org.lttng.ust.agent.utils.Log4j2TestContext; +import org.lttng.ust.agent.utils.Log4j2TestUtils; + +/** + * Enabled app contexts test for the LTTng-UST Log4j 2.x log handler. + */ +public class Log4j2AppContextIT extends AppContextITBase { + + private static final Domain DOMAIN = Domain.LOG4J; + + private Log4j2TestContext testContext; + private Logger logger; + + /** + * Class setup + */ + @BeforeClass + public static void log4j2ClassSetup() { + Log4j2TestUtils.testClassSetup(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void log4j2ClassCleanup() { + Log4j2TestUtils.testClassCleanup(); + } + + /** + * Test setup + * + * @throws SecurityException + * @throws IOException + */ + @Before + public void log4j2Setup() throws SecurityException, IOException { + testContext = new Log4j2TestContext("log4j2.Log4j2AppContextIT.xml"); + + testContext.beforeTest(); + + logger = testContext.getLoggerContext().getLogger(EVENT_NAME); + + logHandler = (ILttngHandler) logger.getAppenders().get("Lttng"); + } + + /** + * Test teardown + */ + @After + public void log4j2Teardown() { + testContext.afterTest(); + logger = null; + } + + @Override + protected Domain getDomain() { + return DOMAIN; + } + + @Override + protected boolean closeHandlers() + { + return false; + } + + @Override + protected void sendEventsToLoggers() { + Log4j2TestUtils.send10Events(logger); + } +} diff --git a/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/context/Log4j2AppContextOrderingIT.java b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/context/Log4j2AppContextOrderingIT.java new file mode 100644 index 0000000..9189f82 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/context/Log4j2AppContextOrderingIT.java @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2022, EfficiOS Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.context; + + +import org.apache.logging.log4j.core.Logger; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.ILttngHandler; +import org.lttng.ust.agent.utils.Log4j2TestContext; +import org.lttng.ust.agent.utils.Log4j2TestUtils; + +/** + * Implementation of {@link AppContextOrderingITBase} for the log4j API. + */ +public class Log4j2AppContextOrderingIT extends AppContextOrderingITBase { + + private Log4j2TestContext testContext; + private Logger logger; + + /** + * Class setup + */ + @BeforeClass + public static void log4j2ClassSetup() { + Log4j2TestUtils.testClassSetup(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void log4j2ClassCleanup() { + Log4j2TestUtils.testClassCleanup(); + } + + /** + * Test teardown + */ + @After + public void log4j2Teardown() { + logger = null; + logHandler = null; + + testContext.afterTest(); + } + + @Override + protected Domain getDomain() { + return Domain.LOG4J; + } + + @Override + protected void registerAgent() { + testContext = new Log4j2TestContext("log4j2.Log4j2AppContextOrderingIT.xml"); + + testContext.beforeTest(); + + logger = testContext.getLoggerContext().getLogger(EVENT_NAME); + + logHandler = (ILttngHandler) logger.getAppenders().get("Lttng"); + } + + @Override + protected void sendEventsToLoggers() { + Log4j2TestUtils.send10Events(logger); + } +} diff --git a/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2EnabledEventsIT.java b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2EnabledEventsIT.java new file mode 100644 index 0000000..bd5ad3e --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2EnabledEventsIT.java @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2022, EfficiOS Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.events; + +import java.io.IOException; +import java.util.Map; + +import org.apache.logging.log4j.core.Appender; +import org.apache.logging.log4j.core.Logger; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.ILttngHandler; +import org.lttng.ust.agent.log4j2.LttngLogAppender; +import org.lttng.ust.agent.utils.Log4j2TestContext; +import org.lttng.ust.agent.utils.Log4j2TestUtils; + +/** + * Enabled events test for the LTTng-UST Log4j log handler. + */ +public class Log4j2EnabledEventsIT extends EnabledEventsITBase { + + private static final String APPENDER_NAME_A = "LttngA"; + private static final String APPENDER_NAME_B = "LttngB"; + private static final String APPENDER_NAME_C = "LttngC"; + + private static final Domain DOMAIN = Domain.LOG4J; + + private Log4j2TestContext testContext; + + private Logger loggerA; + private Logger loggerB; + private Logger loggerC; + private Logger loggerD; + + /** + * Class setup + */ + @BeforeClass + public static void log4j2ClassSetup() { + Log4j2TestUtils.testClassSetup(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void log4j2ClassCleanup() { + Log4j2TestUtils.testClassCleanup(); + } + + /** + * Test setup + * + * @throws SecurityException + * @throws IOException + */ + @SuppressWarnings("resource") + @Before + public void log4j2Setup() throws SecurityException, IOException { + + testContext = new Log4j2TestContext("log4j2.Log4j2EnabledEventsIT.xml"); + + testContext.beforeTest(); + + loggerA = testContext.getLoggerContext().getLogger(EVENT_NAME_A); + loggerB = testContext.getLoggerContext().getLogger(EVENT_NAME_B); + loggerC = testContext.getLoggerContext().getLogger(EVENT_NAME_C); + loggerD = testContext.getLoggerContext().getLogger(EVENT_NAME_D); + + handlerA = (ILttngHandler) loggerA.getAppenders().get(APPENDER_NAME_A); + handlerB = (ILttngHandler) loggerB.getAppenders().get(APPENDER_NAME_B); + handlerC = (ILttngHandler) loggerC.getAppenders().get(APPENDER_NAME_C); + } + + /** + * Test teardown + */ + @After + public void log4j2Teardown() { + loggerA = null; + loggerB = null; + loggerC = null; + loggerD = null; + + testContext.afterTest(); + } + + @Override + protected Domain getDomain() { + return DOMAIN; + } + + @Override + protected boolean closeHandlers() + { + return false; + } + + @Override + protected void sendEventsToLoggers() { + Log4j2TestUtils.send10Events(loggerA); + Log4j2TestUtils.send10Events(loggerB); + Log4j2TestUtils.send10Events(loggerC); + Log4j2TestUtils.send10Events(loggerD); + } + + @Override + protected void sendLocalizedEvent(String rawString, Object[] params) { + throw new UnsupportedOperationException(); + } + + @Override + @Test + public void testLocalizedMessage() { + /* Does not apply to log4j 1.2.x */ + } +} diff --git a/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2ListEventsIT.java b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2ListEventsIT.java new file mode 100644 index 0000000..92eedec --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2ListEventsIT.java @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2022, EfficiOS Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.events; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.apache.logging.log4j.Logger; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.lttng.tools.ILttngSession; +import org.lttng.ust.agent.utils.Log4j2TestContext; +import org.lttng.ust.agent.utils.Log4j2TestUtils; + +/** + * Test suite for the list events command for the log4j domain + */ +public class Log4j2ListEventsIT { + + protected static final String LOGGER_NAME_1 = "org.lttng.somecomponent"; + protected static final String LOGGER_NAME_2 = "org.lttng.mycomponent"; + protected static final String LOGGER_NAME_3 = "org.lttng.myothercomponent-àéç"; + + private Logger logger1; + private Logger logger2; + private Logger logger3; + + private ILttngSession session; + private Log4j2TestContext testContext; + + @Rule + public TestName testName = new TestName(); + + /** + * Class setup + */ + @BeforeClass + public static void log4j2ClassSetup() { + Log4j2TestUtils.testClassSetup(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void log4j2ClassCleanup() { + Log4j2TestUtils.testClassCleanup(); + } + + /** + * Create a new session before each test. + */ + @Before + public void testSetup() { + session = ILttngSession.createSession("Log4j2ListEventsIT", ILttngSession.Domain.LOG4J); + + testContext = new Log4j2TestContext("log4j2." + testName.getMethodName() + ".xml"); + + testContext.beforeTest(); + + logger1 = testContext.getLoggerContext().getLogger(LOGGER_NAME_1); + logger2 = testContext.getLoggerContext().getLogger(LOGGER_NAME_2); + logger3 = testContext.getLoggerContext().getLogger(LOGGER_NAME_3); + } + + /** + * Close the current session after each test. + */ + @After + public void testTeardown() { + session.close(); + testContext.afterTest(); + } + + /** + * Test with many loggers existing, but none of them having a LTTng handler + * attached. + */ + @Test + public void testManyLoggersNoneAttached() { + + /* Don't attach anything */ + List actualEvents = session.listEvents(); + assertTrue(actualEvents.isEmpty()); + } + + /** + * Test with many loggers existing, but only a subset of them has a LTTng + * handler attached. + */ + @Test + public void testManyLoggersSomeAttached() { + + List expectedEvents = Arrays.asList(LOGGER_NAME_1); + List actualEvents = session.listEvents(); + + Collections.sort(expectedEvents); + Collections.sort(actualEvents); + + assertEquals(expectedEvents, actualEvents); + } + + /** + * Test with many loggers existing, and all of them having a LTTng handler + * attached. + */ + @Test + public void testManyLoggersAllAttached() { + + List expectedEvents = Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2, LOGGER_NAME_3); + List actualEvents = session.listEvents(); + + Collections.sort(expectedEvents); + Collections.sort(actualEvents); + + assertEquals(expectedEvents, actualEvents); + } +} diff --git a/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2MultiSessionIT.java b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2MultiSessionIT.java new file mode 100644 index 0000000..e4b29c3 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/events/Log4j2MultiSessionIT.java @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2022, EfficiOS Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.events; + +import java.io.IOException; + +import org.apache.logging.log4j.core.Logger; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.ILttngHandler; +import org.lttng.ust.agent.utils.Log4j2TestContext; +import org.lttng.ust.agent.utils.Log4j2TestUtils; + +/** + * Log4j tests for multiple concurrent tracing sessions + */ +public class Log4j2MultiSessionIT extends MultiSessionITBase { + + private static final String APPENDER_NAME_A = "LttngA"; + private static final String APPENDER_NAME_B = "LttngB"; + private static final String APPENDER_NAME_C = "LttngC"; + private static final String APPENDER_NAME_D = "LttngD"; + + private static final Domain DOMAIN = Domain.LOG4J; + + private Log4j2TestContext testContext; + + private Logger loggerA; + private Logger loggerB; + private Logger loggerC; + private Logger loggerD; + + /** + * Class setup + */ + @BeforeClass + public static void log4j2ClassSetup() { + Log4j2TestUtils.testClassSetup(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void log4j2ClassCleanup() { + Log4j2TestUtils.testClassCleanup(); + } + + /** + * Test setup + * + * @throws SecurityException + * @throws IOException + */ + @Before + public void log4j2Setup() throws SecurityException, IOException { + + testContext = new Log4j2TestContext("log4j2.Log4j2MultiSessionIT.xml"); + + testContext.beforeTest(); + + loggerA = testContext.getLoggerContext().getLogger(EVENT_NAME_A); + loggerB = testContext.getLoggerContext().getLogger(EVENT_NAME_B); + loggerC = testContext.getLoggerContext().getLogger(EVENT_NAME_C); + loggerD = testContext.getLoggerContext().getLogger(EVENT_NAME_D); + + handlerA = (ILttngHandler) loggerA.getAppenders().get(APPENDER_NAME_A); + handlerB = (ILttngHandler) loggerB.getAppenders().get(APPENDER_NAME_B); + handlerC = (ILttngHandler) loggerC.getAppenders().get(APPENDER_NAME_C); + handlerD = (ILttngHandler) loggerD.getAppenders().get(APPENDER_NAME_D); + } + + /** + * Test teardown + */ + @After + public void log4j2Teardown() { + loggerA = null; + loggerB = null; + loggerC = null; + loggerD = null; + + testContext.afterTest(); + } + + @Override + protected Domain getDomain() { + return DOMAIN; + } + + @Override + protected boolean closeHandlers() + { + return false; + } + + @Override + protected void sendEventsToLoggers() { + Log4j2TestUtils.send10Events(loggerA); + Log4j2TestUtils.send10Events(loggerB); + Log4j2TestUtils.send10Events(loggerC); + Log4j2TestUtils.send10Events(loggerD); + } +} diff --git a/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/filter/Log4j2FilterListenerIT.java b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/filter/Log4j2FilterListenerIT.java new file mode 100644 index 0000000..057e8b0 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/filter/Log4j2FilterListenerIT.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2022, EfficiOS Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.filter; + +import java.io.IOException; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.lttng.tools.ILttngSession; +import org.lttng.ust.agent.ILttngHandler; +import org.lttng.ust.agent.log4j2.LttngLogAppender; +import org.lttng.ust.agent.utils.ILogLevelStrings; +import org.lttng.ust.agent.utils.Log4j2TestUtils; + +/** + * Filter notifications tests using the log4j logging API. + * + * @author Alexandre Montplaisir + */ +public class Log4j2FilterListenerIT extends FilterListenerITBase { + + /** + * Class setup + */ + @BeforeClass + public static void log4j2ClassSetup() { + Log4j2TestUtils.testClassSetup(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void log4j2ClassCleanup() { + Log4j2TestUtils.testClassCleanup(); + } + + @Override + protected ILttngSession.Domain getSessionDomain() { + return ILttngSession.Domain.LOG4J; + } + + @Override + protected ILttngHandler getLogHandler() throws SecurityException, IOException { + return LttngLogAppender.createAppender("Log4j2FilterListenerIT", null, null); + } + + @Override + protected ILogLevelStrings getLogLevelStrings() { + return ILogLevelStrings.LOG4J_LOGLEVEL_STRINGS; + } + +} diff --git a/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/filter/Log4j2FilterListenerOrderingIT.java b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/filter/Log4j2FilterListenerOrderingIT.java new file mode 100644 index 0000000..dae9a6b --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/integration/filter/Log4j2FilterListenerOrderingIT.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2022, EfficiOS Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.filter; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.utils.Log4j2TestContext; +import org.lttng.ust.agent.utils.Log4j2TestUtils; + +/** + * Implementation of {@link FilterListenerOrderingITBase} for the log4j API. + */ +public class Log4j2FilterListenerOrderingIT extends FilterListenerOrderingITBase { + + private Log4j2TestContext testContext; + + /** + * Class setup + */ + @BeforeClass + public static void log4j2ClassSetup() { + Log4j2TestUtils.testClassSetup(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void log4j2ClassCleanup() { + Log4j2TestUtils.testClassCleanup(); + } + + @Override + protected Domain getDomain() { + return Domain.LOG4J; + } + + @Override + protected void registerAgent() { + testContext = new Log4j2TestContext("log4j2.Log4j2FilterListenerOrderingIT.xml"); + testContext.beforeTest(); + } + + @Override + protected void deregisterAgent() { + testContext.afterTest(); + } +} diff --git a/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/utils/Log4j2TestContext.java b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/utils/Log4j2TestContext.java new file mode 100644 index 0000000..96b2683 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/utils/Log4j2TestContext.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2022, EfficiOS Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.utils; + +import java.net.URI; +import java.net.URL; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.LoggerContext; + +public class Log4j2TestContext { + + private final URI configFileUri; + + private LoggerContext loggerContext; + + public Log4j2TestContext(String configFile) { + + URL resource = getClass().getClassLoader().getResource(configFile); + + if (resource == null) { + throw new IllegalArgumentException("Config file not found: " + configFile); + } + + try { + this.configFileUri = resource.toURI(); + } catch (Exception e) { + throw new IllegalArgumentException("Config file invalid URI: " + resource); + } + } + + public synchronized LoggerContext getLoggerContext() { + return loggerContext; + } + + public synchronized void beforeTest() { + loggerContext = (LoggerContext) LogManager.getContext( + ClassLoader.getSystemClassLoader(), false, configFileUri); + } + + public synchronized void afterTest() { + loggerContext.stop(); + } +} diff --git a/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/utils/Log4j2TestUtils.java b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/utils/Log4j2TestUtils.java new file mode 100644 index 0000000..948e120 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/java/org/lttng/ust/agent/utils/Log4j2TestUtils.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2022, EfficiOS Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.utils; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.IOException; + +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Logger; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.tools.LttngToolsHelper; +import org.lttng.ust.agent.log4j2.LttngLogAppender; + + +/** + * Utility methods for log4j 2.x tests + */ +public final class Log4j2TestUtils { + + private Log4j2TestUtils() { + } + + /** + * Setup method common to most log4j tests. To be called in a @BeforeClass. + */ + public static void testClassSetup() { + /* Make sure we can find the JNI library and lttng-tools */ + checkForLog4jLibrary(); + assertTrue("lttng-tools is not working properly.", LttngUtils.checkForLttngTools(Domain.LOG4J)); + + LttngToolsHelper.destroyAllSessions(); + } + + /** + * Teardown method common to most log4j tests. To be called in a @AfterClass. + */ + public static void testClassCleanup() { + LttngToolsHelper.deleteAllTraces(); + } + + /** + * Check the the Log4j native library is available, effectively allowing + * LTTng Log4j appenders to be used. + */ + private static void checkForLog4jLibrary() { + try { + LttngLogAppender testAppender = LttngLogAppender.createAppender("checkForLttngTools", null, null); + testAppender.close(); + } catch (SecurityException | IOException e) { + fail(e.getMessage()); + } + } + + /** + * Send 10 dummy events through the provided logger + * + * @param logger + * The logger to use to send events + */ + public static void send10Events(Logger logger) { + // Levels/priorities are DEBUG, ERROR, FATAL, INFO, TRACE, WARN + logger.debug("Debug message. Lost among so many."); + logger.debug("Debug message with a throwable", new IOException()); + logger.error("Error messsage. This might be bad."); + logger.error("Error message with a throwable", new IOException()); + logger.fatal("A fatal message. You are already dead."); + logger.info("A info message. Lol, who cares."); + logger.trace("A trace message. No, no *that* trace"); + logger.warn("A warn message. Yellow underline."); + logger.log(Level.DEBUG, "A debug message using .log()"); + logger.log(Level.ERROR, "A error message using .log()"); + } +} diff --git a/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2AppContextIT.xml b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2AppContextIT.xml new file mode 100644 index 0000000..11016e1 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2AppContextIT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2AppContextOrderingIT.xml b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2AppContextOrderingIT.xml new file mode 100644 index 0000000..6c812c5 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2AppContextOrderingIT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2EnabledEventsIT.xml b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2EnabledEventsIT.xml new file mode 100644 index 0000000..a55444c --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2EnabledEventsIT.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2FilterListenerOrderingIT.xml b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2FilterListenerOrderingIT.xml new file mode 100644 index 0000000..54f5ce0 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2FilterListenerOrderingIT.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2MultiSessionIT.xml b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2MultiSessionIT.xml new file mode 100644 index 0000000..22e5be1 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.Log4j2MultiSessionIT.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersAllAttached.xml b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersAllAttached.xml new file mode 100644 index 0000000..979a1e2 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersAllAttached.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersNoneAttached.xml b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersNoneAttached.xml new file mode 100644 index 0000000..ffbbd03 --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersNoneAttached.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersSomeAttached.xml b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersSomeAttached.xml new file mode 100644 index 0000000..de5e9cd --- /dev/null +++ b/lttng-ust-java-tests-log4j2/src/test/resources/log4j2.testManyLoggersSomeAttached.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index c5a354a..f2b55cb 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; only version 2.1 of the License. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -36,12 +36,13 @@ UTF-8 UTF-8 - + /usr/local/share/java/lttng-ust-agent-common-1.0.0.jar /usr/local/share/java/lttng-ust-agent-jul-1.0.0.jar /usr/local/share/java/lttng-ust-agent-log4j-1.0.0.jar + /usr/local/share/java/lttng-ust-agent-log4j2-1.0.0.jar -Djava.library.path=/usr/local/lib @@ -97,6 +98,18 @@ 1.2.17 + + org.apache.logging.log4j + log4j-api + 2.17.1 + + + + org.apache.logging.log4j + log4j-core + 2.17.1 + + junit junit @@ -129,6 +142,14 @@ ${log4j-jar-location} + + org.lttng.ust.agent + lttng-ust-agent-log4j2 + 1.0.0 + system + ${log4j2-jar-location} + + org.lttng.tools @@ -151,6 +172,7 @@ lttng-ust-java-tests-common lttng-ust-java-tests-jul lttng-ust-java-tests-log4j + lttng-ust-java-tests-log4j2 -- 2.34.1