Skip to content

Commit 5cbe687

Browse files
committed
Add test run for Disruptor 4.x
An additional test run will ensure `log4j-core` works with Disruptor 4.x.
1 parent 517903e commit 5cbe687

20 files changed

+116
-10
lines changed

log4j-core-test/pom.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@
5959
java.allocation.instrumenter;substitute="java-allocation-instrumenter",
6060
spring.test;substitute="spring-test"
6161
</bnd-extra-module-options>
62+
63+
<!-- Additional version of LMAX Disruptor to test -->
64+
<disruptor4.version>4.0.0</disruptor4.version>
6265
</properties>
66+
6367
<dependencies>
6468
<!-- Pull in useful test classes from API -->
6569
<dependency>
@@ -371,6 +375,32 @@
371375
</configuration>
372376
</plugin>
373377

378+
<plugin>
379+
<groupId>org.apache.maven.plugins</groupId>
380+
<artifactId>maven-surefire-plugin</artifactId>
381+
<executions>
382+
<execution>
383+
<id>test-disruptor-4</id>
384+
<goals>
385+
<goal>test</goal>
386+
</goals>
387+
<configuration>
388+
<additionalClasspathDependencies>
389+
<dependency>
390+
<groupId>com.lmax</groupId>
391+
<artifactId>disruptor</artifactId>
392+
<version>${disruptor4.version}</version>
393+
</dependency>
394+
</additionalClasspathDependencies>
395+
<classpathDependencyExcludes>
396+
<classpathDependencyExclude>com.lmax:disruptor</classpathDependencyExclude>
397+
</classpathDependencyExcludes>
398+
<groups>org.apache.logging.log4j.core.test.categories.AsyncLoggers</groups>
399+
</configuration>
400+
</execution>
401+
</executions>
402+
</plugin>
403+
374404
</plugins>
375405
</build>
376406

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to you under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.logging.log4j.core.test.junit;
18+
19+
/**
20+
* Container for a Junit 5 tags used in tests.
21+
*/
22+
public final class Tags {
23+
24+
/**
25+
* Tests that use LMAX Disruptor. Same name as the JUnit 4 category.
26+
*/
27+
public static final String ASYNC_LOGGERS = "org.apache.logging.log4j.core.test.categories.AsyncLoggers";
28+
29+
private Tags() {}
30+
}

log4j-core-test/src/main/java/org/apache/logging/log4j/core/test/junit/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @see org.junit.rules.TestRule
2121
*/
2222
@Export
23-
@Version("2.21.1")
23+
@Version("2.23.0")
2424
package org.apache.logging.log4j.core.test.junit;
2525

2626
import org.osgi.annotation.bundle.Export;

log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerClassLoadDeadlock.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818

1919
import org.apache.logging.log4j.LogManager;
2020
import org.apache.logging.log4j.Logger;
21+
import org.apache.logging.log4j.core.test.junit.Tags;
22+
import org.junit.jupiter.api.Tag;
2123

24+
@Tag(Tags.ASYNC_LOGGERS)
2225
class AsyncLoggerClassLoadDeadlock {
2326
static {
2427
final Logger log = LogManager.getLogger("com.foo.bar.deadlock");

log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@
3939
import org.apache.logging.log4j.core.config.NullConfiguration;
4040
import org.apache.logging.log4j.core.test.CoreLoggerContexts;
4141
import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
42+
import org.apache.logging.log4j.core.test.junit.Tags;
4243
import org.apache.logging.log4j.message.SimpleMessage;
4344
import org.apache.logging.log4j.test.junit.TempLoggingDir;
4445
import org.apache.logging.log4j.test.junit.UsingStatusListener;
4546
import org.junit.jupiter.api.Tag;
4647
import org.junit.jupiter.api.Test;
4748

48-
@Tag("AsyncLoggers")
49+
@Tag(Tags.ASYNC_LOGGERS)
4950
@UsingStatusListener
5051
public class AsyncLoggerConfigTest {
5152

log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerThreadContextTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.apache.logging.log4j.ThreadContext;
2727
import org.apache.logging.log4j.core.test.CoreLoggerContexts;
2828
import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
29+
import org.apache.logging.log4j.core.test.junit.Tags;
2930
import org.apache.logging.log4j.core.util.Constants;
3031
import org.apache.logging.log4j.test.TestProperties;
3132
import org.apache.logging.log4j.test.junit.TempLoggingDir;
@@ -35,7 +36,7 @@
3536
import org.junit.jupiter.api.Tag;
3637
import org.junit.jupiter.api.Test;
3738

38-
@Tag("AsyncLoggers")
39+
@Tag(Tags.ASYNC_LOGGERS)
3940
@UsingTestProperties
4041
@UsingStatusListener
4142
public class AsyncLoggerThreadContextTest {

log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggersWithAsyncAppenderTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525
import org.apache.logging.log4j.core.LoggerContext;
2626
import org.apache.logging.log4j.core.test.appender.ListAppender;
2727
import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
28+
import org.apache.logging.log4j.core.test.junit.Tags;
2829
import org.apache.logging.log4j.core.util.Constants;
2930
import org.apache.logging.log4j.test.junit.SetTestProperty;
3031
import org.apache.logging.log4j.test.junit.UsingStatusListener;
3132
import org.junit.jupiter.api.Tag;
3233
import org.junit.jupiter.api.Test;
3334

34-
@Tag("AsyncLoggers")
35+
@Tag(Tags.ASYNC_LOGGERS)
3536
@SetTestProperty(
3637
key = Constants.LOG4J_CONTEXT_SELECTOR,
3738
value = "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector")

log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AsyncThreadContextCopyOnWriteTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
package org.apache.logging.log4j.core.async;
1818

1919
import java.nio.file.Path;
20+
import org.apache.logging.log4j.core.test.junit.Tags;
2021
import org.apache.logging.log4j.test.junit.TempLoggingDir;
22+
import org.junit.jupiter.api.Tag;
2123
import org.junit.jupiter.params.ParameterizedTest;
2224
import org.junit.jupiter.params.provider.EnumSource;
2325

2426
// Note: the different ThreadContextMap implementations cannot be parameterized:
2527
// ThreadContext initialization will result in static final fields being set in various components.
2628
// To use a different ThreadContextMap, the test needs to be run in a new JVM.
29+
@Tag(Tags.ASYNC_LOGGERS)
2730
public class AsyncThreadContextCopyOnWriteTest extends AbstractAsyncThreadContextTestBase {
2831

2932
@TempLoggingDir

log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AsyncThreadContextDefaultTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
package org.apache.logging.log4j.core.async;
1818

1919
import java.nio.file.Path;
20+
import org.apache.logging.log4j.core.test.junit.Tags;
2021
import org.apache.logging.log4j.test.junit.TempLoggingDir;
22+
import org.junit.jupiter.api.Tag;
2123
import org.junit.jupiter.params.ParameterizedTest;
2224
import org.junit.jupiter.params.provider.EnumSource;
2325

2426
// Note: the different ThreadContextMap implementations cannot be parameterized:
2527
// ThreadContext initialization will result in static final fields being set in various components.
2628
// To use a different ThreadContextMap, the test needs to be run in a new JVM.
29+
@Tag(Tags.ASYNC_LOGGERS)
2730
public class AsyncThreadContextDefaultTest extends AbstractAsyncThreadContextTestBase {
2831

2932
@TempLoggingDir

log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AsyncThreadContextGarbageFreeTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
package org.apache.logging.log4j.core.async;
1818

1919
import java.nio.file.Path;
20+
import org.apache.logging.log4j.core.test.junit.Tags;
2021
import org.apache.logging.log4j.test.junit.TempLoggingDir;
22+
import org.junit.jupiter.api.Tag;
2123
import org.junit.jupiter.params.ParameterizedTest;
2224
import org.junit.jupiter.params.provider.EnumSource;
2325

2426
// Note: the different ThreadContextMap implementations cannot be parameterized:
2527
// ThreadContext initialization will result in static final fields being set in various components.
2628
// To use a different ThreadContextMap, the test needs to be run in a new JVM.
29+
@Tag(Tags.ASYNC_LOGGERS)
2730
public class AsyncThreadContextGarbageFreeTest extends AbstractAsyncThreadContextTestBase {
2831

2932
@TempLoggingDir

0 commit comments

Comments
 (0)