Skip to content

Commit 9fc0757

Browse files
committed
use NettyLeakDetectorExtension
1 parent b24250d commit 9fc0757

File tree

9 files changed

+26
-5
lines changed

9 files changed

+26
-5
lines changed

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ ext {
129129
awaitilityVersion = '4.2.1'
130130
hoverflyJavaVersion = '0.18.1'
131131
tomcatVersion = '9.0.89'
132+
nettyLeakDetectorJunitExtensionVersion = "0.0.5"
132133
boringSslVersion = '2.0.65.Final'
133134
junitVersion = '5.10.2'
134135
junitPlatformLauncherVersion = '1.10.2'

reactor-netty-core/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ dependencies {
133133
testImplementation "org.awaitility:awaitility:$awaitilityVersion"
134134
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
135135
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
136+
testImplementation "io.github.nettyplus:netty-leak-detector-junit-extension:$nettyLeakDetectorJunitExtensionVersion"
136137
testImplementation "org.mockito:mockito-core:$mockitoVersion"
137138
testImplementation "ch.qos.logback:logback-classic:$logbackVersion"
138139
testImplementation "io.projectreactor.tools:blockhound-junit-platform:$blockHoundVersion"

reactor-netty-core/src/test/java/reactor/netty/ByteBufFluxTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017-2022 VMware, Inc. or its affiliates, All Rights Reserved.
2+
* Copyright (c) 2017-2024 VMware, Inc. or its affiliates, All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,10 +15,12 @@
1515
*/
1616
package reactor.netty;
1717

18+
import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
1819
import io.netty.buffer.ByteBuf;
1920
import org.junit.jupiter.api.AfterAll;
2021
import org.junit.jupiter.api.BeforeAll;
2122
import org.junit.jupiter.api.Test;
23+
import org.junit.jupiter.api.extension.ExtendWith;
2224
import org.reactivestreams.Publisher;
2325
import reactor.core.publisher.Flux;
2426
import reactor.core.publisher.Mono;
@@ -38,6 +40,7 @@
3840

3941
import static org.assertj.core.api.Assertions.assertThat;
4042

43+
@ExtendWith(NettyLeakDetectorExtension.class)
4144
class ByteBufFluxTest {
4245

4346
private static File temporaryDirectory;

reactor-netty-core/src/test/java/reactor/netty/ByteBufMonoTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020-2021 VMware, Inc. or its affiliates, All Rights Reserved.
2+
* Copyright (c) 2020-2024 VMware, Inc. or its affiliates, All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,7 +15,9 @@
1515
*/
1616
package reactor.netty;
1717

18+
import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
1819
import org.junit.jupiter.api.Test;
20+
import org.junit.jupiter.api.extension.ExtendWith;
1921
import org.reactivestreams.Publisher;
2022
import reactor.core.publisher.Flux;
2123
import reactor.core.publisher.Mono;
@@ -24,6 +26,7 @@
2426
import java.nio.charset.Charset;
2527
import java.time.Duration;
2628

29+
@ExtendWith(NettyLeakDetectorExtension.class)
2730
class ByteBufMonoTest {
2831

2932
@Test

reactor-netty-core/src/test/java/reactor/netty/ConnectionTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017-2023 VMware, Inc. or its affiliates, All Rights Reserved.
2+
* Copyright (c) 2017-2024 VMware, Inc. or its affiliates, All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
2020
import java.util.concurrent.atomic.AtomicReference;
2121
import java.util.function.BiConsumer;
2222

23+
import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
2324
import io.netty.channel.Channel;
2425
import io.netty.channel.ChannelHandler;
2526
import io.netty.channel.ChannelHandlerAdapter;
@@ -30,6 +31,7 @@
3031
import io.netty.handler.codec.http.websocketx.Utf8FrameValidator;
3132
import org.junit.jupiter.api.BeforeEach;
3233
import org.junit.jupiter.api.Test;
34+
import org.junit.jupiter.api.extension.ExtendWith;
3335
import reactor.core.Disposable;
3436
import reactor.core.publisher.Mono;
3537

@@ -42,6 +44,7 @@
4244
* @author Simon Baslé
4345
* @author Violeta Georgieva
4446
*/
47+
@ExtendWith(NettyLeakDetectorExtension.class)
4548
class ConnectionTest {
4649

4750
static final BiConsumer<? super ChannelHandlerContext, Object> ADD_EXTRACTOR = ChannelHandlerContext::fireChannelRead;

reactor-netty-core/src/test/java/reactor/netty/NettyOutboundTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.function.Predicate;
3434
import javax.net.ssl.SSLException;
3535

36+
import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
3637
import io.netty.buffer.ByteBuf;
3738
import io.netty.buffer.ByteBufAllocator;
3839
import io.netty.channel.ChannelFuture;
@@ -52,11 +53,13 @@
5253
import io.netty.util.ReferenceCountUtil;
5354
import org.junit.jupiter.api.BeforeAll;
5455
import org.junit.jupiter.api.Test;
56+
import org.junit.jupiter.api.extension.ExtendWith;
5557
import org.reactivestreams.Publisher;
5658
import reactor.core.publisher.Mono;
5759

5860
import static org.assertj.core.api.Assertions.assertThat;
5961

62+
@ExtendWith(NettyLeakDetectorExtension.class)
6063
class NettyOutboundTest {
6164

6265
static SelfSignedCertificate ssc;

reactor-netty-core/src/test/java/reactor/netty/ReactorNettyTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021-2023 VMware, Inc. or its affiliates, All Rights Reserved.
2+
* Copyright (c) 2021-2024 VMware, Inc. or its affiliates, All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
1515
*/
1616
package reactor.netty;
1717

18+
import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
1819
import io.netty.channel.AbstractChannel;
1920
import io.netty.channel.Channel;
2021
import io.netty.channel.ChannelConfig;
@@ -23,6 +24,7 @@
2324
import io.netty.channel.EventLoop;
2425
import io.netty.channel.embedded.EmbeddedChannel;
2526
import org.junit.jupiter.api.Test;
27+
import org.junit.jupiter.api.extension.ExtendWith;
2628
import reactor.util.annotation.Nullable;
2729

2830
import java.net.InetSocketAddress;
@@ -35,6 +37,7 @@
3537
*
3638
* @author Violeta Georgieva
3739
*/
40+
@ExtendWith(NettyLeakDetectorExtension.class)
3841
class ReactorNettyTest {
3942

4043
/*

reactor-netty-http/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ dependencies {
134134

135135
testImplementation "org.mockito:mockito-core:$mockitoVersion"
136136
testImplementation "io.specto:hoverfly-java-junit5:$hoverflyJavaVersion"
137+
testImplementation "io.github.nettyplus:netty-leak-detector-junit-extension:$nettyLeakDetectorJunitExtensionVersion"
137138
testImplementation "org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion"
138139
testImplementation "io.projectreactor:reactor-test:$testAddonVersion"
139140
testImplementation "org.assertj:assertj-core:$assertJVersion"

reactor-netty-http/src/test/java/reactor/netty/BaseHttpTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021-2022 VMware, Inc. or its affiliates, All Rights Reserved.
2+
* Copyright (c) 2021-2024 VMware, Inc. or its affiliates, All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,7 +15,9 @@
1515
*/
1616
package reactor.netty;
1717

18+
import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
1819
import org.junit.jupiter.api.AfterEach;
20+
import org.junit.jupiter.api.extension.ExtendWith;
1921
import org.junit.jupiter.params.provider.Arguments;
2022
import reactor.netty.http.HttpProtocol;
2123
import reactor.netty.http.client.HttpClient;
@@ -34,6 +36,7 @@
3436
* @author Violeta Georgieva
3537
* @since 1.0.3
3638
*/
39+
@ExtendWith(NettyLeakDetectorExtension.class)
3740
public class BaseHttpTest {
3841

3942
protected DisposableServer disposableServer;

0 commit comments

Comments
 (0)