This is an automated email from the ASF dual-hosted git repository.
cbornet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-client-reactive.git
The following commit(s) were added to refs/heads/main by this push:
new 7970884 Add test-logger plugin and improve test logging config (#86)
7970884 is described below
commit 797088492fa74806ff2ca7367fd27fdef2401ff4
Author: Lari Hotari <[email protected]>
AuthorDate: Wed Dec 7 10:59:13 2022 +0200
Add test-logger plugin and improve test logging config (#86)
* Add test-logger plugin and improve test logging config
* Rename integration-test-conventions to test-conventions
* Configure log4j2-test.xml in a single location for all tests
---
buildSrc/build.gradle | 1 +
...pulsar-client-reactive.test-conventions.gradle} | 14 ++++++++++
gradle/libs.versions.toml | 2 ++
pulsar-client-reactive-adapter/build.gradle | 2 +-
.../src/intTest/resources/log4j2-test.xml | 31 ----------------------
pulsar-client-reactive-api/build.gradle | 2 +-
pulsar-client-reactive-jackson/build.gradle | 2 +-
.../log4j2-test.xml | 2 +-
8 files changed, 21 insertions(+), 35 deletions(-)
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 64f3763..bb203ab 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -30,4 +30,5 @@ repositories {
dependencies {
implementation libs.spring.javaformat.gradle.plugin
implementation libs.licenser
+ implementation libs.testlogger
}
\ No newline at end of file
diff --git
a/buildSrc/src/main/groovy/pulsar-client-reactive.integration-test-conventions.gradle
b/buildSrc/src/main/groovy/pulsar-client-reactive.test-conventions.gradle
similarity index 75%
rename from
buildSrc/src/main/groovy/pulsar-client-reactive.integration-test-conventions.gradle
rename to
buildSrc/src/main/groovy/pulsar-client-reactive.test-conventions.gradle
index bc3d28f..91c064e 100644
---
a/buildSrc/src/main/groovy/pulsar-client-reactive.integration-test-conventions.gradle
+++ b/buildSrc/src/main/groovy/pulsar-client-reactive.test-conventions.gradle
@@ -13,6 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+plugins {
+ id 'com.adarshr.test-logger'
+}
+
+testlogger {
+ showStandardStreams true
+}
sourceSets {
intTest {
@@ -26,6 +33,13 @@ configurations {
intTestRuntimeOnly.extendsFrom runtimeOnly
}
+dependencies {
+ // add shared-test-resources directory to runtime classpath
+ def sharedTestResourcesEntry = files(new File(rootDir,
"shared-test-resources"))
+ intTestRuntimeOnly sharedTestResourcesEntry
+ testRuntimeOnly sharedTestResourcesEntry
+}
+
tasks.register('integrationTest', Test) {
description = 'Runs integration tests.'
group = 'verification'
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index f5e750f..aabf3d1 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -13,6 +13,7 @@ checkstyle = '8.45.1'
spring-javaformat = '0.0.34'
licenser = "0.6.1"
mockito = "4.9.0"
+testlogger = "3.2.0"
[libraries]
pulsar-client-shaded = { module = "org.apache.pulsar:pulsar-client",
version.ref = "pulsar" }
@@ -36,6 +37,7 @@ spring-javaformat-gradle-plugin = { module =
"io.spring.javaformat:spring-javafo
licenser = { module = "gradle.plugin.org.cadixdev.gradle:licenser",
version.ref = "licenser" }
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
mockito-inline = { module = "org.mockito:mockito-inline", version.ref =
"mockito" }
+testlogger = { module = "com.adarshr:gradle-test-logger-plugin", version.ref =
"testlogger"}
[bundles]
log4j = ["log4j-api", "log4j-core", "log4j-slf4j-impl", "slf4j-api"]
diff --git a/pulsar-client-reactive-adapter/build.gradle
b/pulsar-client-reactive-adapter/build.gradle
index 7dbe369..2bdb655 100644
--- a/pulsar-client-reactive-adapter/build.gradle
+++ b/pulsar-client-reactive-adapter/build.gradle
@@ -1,7 +1,7 @@
plugins {
id 'pulsar-client-reactive.codestyle-conventions'
id 'pulsar-client-reactive.library-conventions'
- id 'pulsar-client-reactive.integration-test-conventions'
+ id 'pulsar-client-reactive.test-conventions'
}
dependencies {
diff --git
a/pulsar-client-reactive-adapter/src/intTest/resources/log4j2-test.xml
b/pulsar-client-reactive-adapter/src/intTest/resources/log4j2-test.xml
deleted file mode 100644
index 2171228..0000000
--- a/pulsar-client-reactive-adapter/src/intTest/resources/log4j2-test.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2022 the original author or authors.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- https://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<Configuration status="WARN">
- <Appenders>
- <Console name="STDOUT" target="SYSTEM_OUT">
- <PatternLayout pattern="[%d] [%t] [%c] %p %m%n"/>
- </Console>
- </Appenders>
- <Loggers>
- <Logger name="reactor" level="info"/>
- <Logger name="com.github.lhotari" level="trace"/>
- <Root level="off">
- <AppenderRef ref="STDOUT"/>
- </Root>
- </Loggers>
-</Configuration>
diff --git a/pulsar-client-reactive-api/build.gradle
b/pulsar-client-reactive-api/build.gradle
index 311ba12..86daf16 100644
--- a/pulsar-client-reactive-api/build.gradle
+++ b/pulsar-client-reactive-api/build.gradle
@@ -1,7 +1,7 @@
plugins {
id 'pulsar-client-reactive.codestyle-conventions'
id 'pulsar-client-reactive.library-conventions'
- id 'pulsar-client-reactive.integration-test-conventions'
+ id 'pulsar-client-reactive.test-conventions'
}
dependencies {
diff --git a/pulsar-client-reactive-jackson/build.gradle
b/pulsar-client-reactive-jackson/build.gradle
index 538af59..cb72470 100644
--- a/pulsar-client-reactive-jackson/build.gradle
+++ b/pulsar-client-reactive-jackson/build.gradle
@@ -1,7 +1,7 @@
plugins {
id 'pulsar-client-reactive.codestyle-conventions'
id 'pulsar-client-reactive.library-conventions'
- id 'pulsar-client-reactive.integration-test-conventions'
+ id 'pulsar-client-reactive.test-conventions'
}
dependencies {
diff --git a/pulsar-client-reactive-adapter/src/test/resources/log4j2-test.xml
b/shared-test-resources/log4j2-test.xml
similarity index 93%
rename from pulsar-client-reactive-adapter/src/test/resources/log4j2-test.xml
rename to shared-test-resources/log4j2-test.xml
index 2171228..85d56e9 100644
--- a/pulsar-client-reactive-adapter/src/test/resources/log4j2-test.xml
+++ b/shared-test-resources/log4j2-test.xml
@@ -23,7 +23,7 @@
</Appenders>
<Loggers>
<Logger name="reactor" level="info"/>
- <Logger name="com.github.lhotari" level="trace"/>
+ <Logger name="org.apache.pulsar.reactive.client" level="trace"/>
<Root level="off">
<AppenderRef ref="STDOUT"/>
</Root>