From 67d79e38742130f7dcea12318161ca130b0610ff Mon Sep 17 00:00:00 2001 From: sullis Date: Thu, 22 Feb 2024 13:21:35 -0800 Subject: [PATCH] use Netty leak detector extension --- client/pom.xml | 6 ++++++ .../test/java/org/asynchttpclient/AbstractBasicTest.java | 3 +++ .../test/java/org/asynchttpclient/testserver/HttpTest.java | 3 +++ pom.xml | 5 +++++ 4 files changed, 17 insertions(+) diff --git a/client/pom.xml b/client/pom.xml index 039e5d662..7a28070c4 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -96,6 +96,12 @@ test + + io.github.nettyplus + netty-leak-detector-junit-extension + test + + org.eclipse.jetty jetty-servlet diff --git a/client/src/test/java/org/asynchttpclient/AbstractBasicTest.java b/client/src/test/java/org/asynchttpclient/AbstractBasicTest.java index f556d7486..993f87905 100644 --- a/client/src/test/java/org/asynchttpclient/AbstractBasicTest.java +++ b/client/src/test/java/org/asynchttpclient/AbstractBasicTest.java @@ -15,6 +15,7 @@ */ package org.asynchttpclient; +import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension; import org.asynchttpclient.test.EchoHandler; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; @@ -24,12 +25,14 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtendWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.asynchttpclient.test.TestUtils.addHttpConnector; @TestInstance(TestInstance.Lifecycle.PER_CLASS) +@ExtendWith(NettyLeakDetectorExtension.class) public abstract class AbstractBasicTest { protected static final Logger logger = LoggerFactory.getLogger(AbstractBasicTest.class); protected static final int TIMEOUT = 30; diff --git a/client/src/test/java/org/asynchttpclient/testserver/HttpTest.java b/client/src/test/java/org/asynchttpclient/testserver/HttpTest.java index 44d31269f..b41b6ab1b 100644 --- a/client/src/test/java/org/asynchttpclient/testserver/HttpTest.java +++ b/client/src/test/java/org/asynchttpclient/testserver/HttpTest.java @@ -15,15 +15,18 @@ */ package org.asynchttpclient.testserver; +import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension; import org.asynchttpclient.AsyncHttpClient; import org.asynchttpclient.AsyncHttpClientConfig; import org.asynchttpclient.DefaultAsyncHttpClientConfig; +import org.junit.jupiter.api.extension.ExtendWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.asynchttpclient.Dsl.asyncHttpClient; import static org.asynchttpclient.Dsl.config; +@ExtendWith(NettyLeakDetectorExtension.class) public abstract class HttpTest { protected static final String COMPLETED_EVENT = "Completed"; diff --git a/pom.xml b/pom.xml index e4aeb5388..4f017541c 100644 --- a/pom.xml +++ b/pom.xml @@ -112,6 +112,11 @@ pom import + + io.github.nettyplus + netty-leak-detector-junit-extension + 0.0.2 +