From 9283a8211cbe4f3c37ed2bcdb287714552e45567 Mon Sep 17 00:00:00 2001 From: emeroad Date: Wed, 2 Nov 2022 19:23:23 +0900 Subject: [PATCH] [#8915] Cleanup junit4 dependency --- agent-plugins/proxy-apache/pom.xml | 5 ----- agent-plugins/proxy-app/pom.xml | 5 ----- agent-plugins/proxy-nginx/pom.xml | 5 ----- agent-plugins/proxy-user/pom.xml | 5 ----- .../util/ManagedAgentLifeCycleTest.java | 3 ++- grpc/pom.xml | 5 ----- .../interceptor/data/DataSizeHelperTest.java | 5 +++-- pom.xml | 5 ----- profiler-test/pom.xml | 5 ----- profiler/pom.xml | 6 ----- .../context/CallStackFactoryV1Test.java | 6 +++-- .../context/CallStackFactoryV2Test.java | 6 +++-- .../DefaultCallStackOverflowListenerTest.java | 3 +-- ...ttledLogCallStackOverflowListenerTest.java | 3 +-- .../sampler/TraceSamplerProviderTest.java | 18 +++++++-------- .../sampler/UrlSamplerConfigTest.java | 22 +++++++++---------- .../profiler/sampler/UrlTraceSamplerTest.java | 7 ++++-- .../rpc/common/SocketStateCodeTest.java | 2 +- test/pom.xml | 11 +++++----- ...tiveThreadCountResponseAggregatorTest.java | 12 +++++----- 20 files changed, 52 insertions(+), 87 deletions(-) diff --git a/agent-plugins/proxy-apache/pom.xml b/agent-plugins/proxy-apache/pom.xml index 640896f670ad..9fdb72f8f8d0 100644 --- a/agent-plugins/proxy-apache/pom.xml +++ b/agent-plugins/proxy-apache/pom.xml @@ -31,11 +31,6 @@ ${project.version} - - junit - junit - test - \ No newline at end of file diff --git a/agent-plugins/proxy-app/pom.xml b/agent-plugins/proxy-app/pom.xml index 65b437303ada..064d4a891d71 100644 --- a/agent-plugins/proxy-app/pom.xml +++ b/agent-plugins/proxy-app/pom.xml @@ -31,11 +31,6 @@ ${project.version} - - junit - junit - test - \ No newline at end of file diff --git a/agent-plugins/proxy-nginx/pom.xml b/agent-plugins/proxy-nginx/pom.xml index 8fd292e7b883..a694ab66f288 100644 --- a/agent-plugins/proxy-nginx/pom.xml +++ b/agent-plugins/proxy-nginx/pom.xml @@ -31,10 +31,5 @@ ${project.version} - - junit - junit - test - \ No newline at end of file diff --git a/agent-plugins/proxy-user/pom.xml b/agent-plugins/proxy-user/pom.xml index 673e5ea1ad6f..1a5945f07ae7 100644 --- a/agent-plugins/proxy-user/pom.xml +++ b/agent-plugins/proxy-user/pom.xml @@ -31,10 +31,5 @@ ${project.version} - - junit - junit - test - \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/util/ManagedAgentLifeCycleTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/util/ManagedAgentLifeCycleTest.java index d0351765bd00..5b929f417668 100644 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/util/ManagedAgentLifeCycleTest.java +++ b/collector/src/test/java/com/navercorp/pinpoint/collector/util/ManagedAgentLifeCycleTest.java @@ -1,7 +1,8 @@ package com.navercorp.pinpoint.collector.util; -import org.junit.Test; + import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class ManagedAgentLifeCycleTest { diff --git a/grpc/pom.xml b/grpc/pom.xml index ff0ae2f15c16..b7a8785785f0 100644 --- a/grpc/pom.xml +++ b/grpc/pom.xml @@ -167,11 +167,6 @@ org.apache.commons test - - junit - junit - test - diff --git a/plugins/hbase/src/test/java/com/navercorp/pinpoint/plugin/hbase/interceptor/data/DataSizeHelperTest.java b/plugins/hbase/src/test/java/com/navercorp/pinpoint/plugin/hbase/interceptor/data/DataSizeHelperTest.java index 71345e9b3277..5733ac165ee3 100644 --- a/plugins/hbase/src/test/java/com/navercorp/pinpoint/plugin/hbase/interceptor/data/DataSizeHelperTest.java +++ b/plugins/hbase/src/test/java/com/navercorp/pinpoint/plugin/hbase/interceptor/data/DataSizeHelperTest.java @@ -7,14 +7,15 @@ import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.RowMutations; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class DataSizeHelperTest { diff --git a/pom.xml b/pom.xml index 672ac965fa23..6553a1e21d66 100644 --- a/pom.xml +++ b/pom.xml @@ -223,11 +223,6 @@ - - junit - junit - test - org.hamcrest hamcrest diff --git a/profiler-test/pom.xml b/profiler-test/pom.xml index c6f19c1aa03f..63cb48c58fa4 100644 --- a/profiler-test/pom.xml +++ b/profiler-test/pom.xml @@ -129,11 +129,6 @@ log4j-core - - junit - junit - compile - diff --git a/profiler/pom.xml b/profiler/pom.xml index 2567e9674182..0c9ba5d958e0 100644 --- a/profiler/pom.xml +++ b/profiler/pom.xml @@ -197,12 +197,6 @@ --> - - - junit - junit - test - diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/CallStackFactoryV1Test.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/CallStackFactoryV1Test.java index 0bfc1e6156d1..1f0204c89f31 100644 --- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/CallStackFactoryV1Test.java +++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/CallStackFactoryV1Test.java @@ -16,9 +16,11 @@ package com.navercorp.pinpoint.profiler.context; -import org.junit.Test; -import static org.junit.Assert.*; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class CallStackFactoryV1Test { diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/CallStackFactoryV2Test.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/CallStackFactoryV2Test.java index d8477e0020b6..c55ee7ddf1c1 100644 --- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/CallStackFactoryV2Test.java +++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/CallStackFactoryV2Test.java @@ -16,9 +16,11 @@ package com.navercorp.pinpoint.profiler.context; -import org.junit.Test; -import static org.junit.Assert.*; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class CallStackFactoryV2Test { diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/DefaultCallStackOverflowListenerTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/DefaultCallStackOverflowListenerTest.java index 4beed4fb7432..27a5fb13b680 100644 --- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/DefaultCallStackOverflowListenerTest.java +++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/DefaultCallStackOverflowListenerTest.java @@ -16,9 +16,8 @@ package com.navercorp.pinpoint.profiler.context; -import org.junit.Test; -import static org.junit.Assert.*; +import org.junit.jupiter.api.Test; public class DefaultCallStackOverflowListenerTest { diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/ThrottledLogCallStackOverflowListenerTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/ThrottledLogCallStackOverflowListenerTest.java index d987ce4ae1b9..51397c9ca55b 100644 --- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/ThrottledLogCallStackOverflowListenerTest.java +++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/ThrottledLogCallStackOverflowListenerTest.java @@ -16,9 +16,8 @@ package com.navercorp.pinpoint.profiler.context; -import org.junit.Test; -import static org.junit.Assert.*; +import org.junit.jupiter.api.Test; public class ThrottledLogCallStackOverflowListenerTest { diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/provider/sampler/TraceSamplerProviderTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/provider/sampler/TraceSamplerProviderTest.java index 07ba65292ffa..b31fad3405bf 100644 --- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/provider/sampler/TraceSamplerProviderTest.java +++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/provider/sampler/TraceSamplerProviderTest.java @@ -22,15 +22,13 @@ import com.navercorp.pinpoint.profiler.context.config.DefaultContextConfig; import com.navercorp.pinpoint.profiler.context.id.AtomicIdGenerator; import com.navercorp.pinpoint.profiler.sampler.BasicTraceSampler; -import com.navercorp.pinpoint.profiler.sampler.RateLimitTraceSampler; import com.navercorp.pinpoint.profiler.sampler.TrueSampler; import com.navercorp.pinpoint.profiler.sampler.UrlTraceSampler; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.util.Properties; -import static org.junit.Assert.*; public class TraceSamplerProviderTest { @@ -42,7 +40,7 @@ public void get() { TraceSamplerProvider provider = new TraceSamplerProvider(profilerConfig, new DefaultContextConfig(), TrueSampler.INSTANCE, new AtomicIdGenerator()); TraceSampler traceSampler = provider.get(); - assertNotNull(traceSampler); + Assertions.assertNotNull(traceSampler); } @Test @@ -57,7 +55,7 @@ public void getUrlSampler() { TraceSamplerProvider provider = new TraceSamplerProvider(profilerConfig, new DefaultContextConfig(), TrueSampler.INSTANCE, new AtomicIdGenerator()); TraceSampler traceSampler = provider.get(); if(Boolean.FALSE == (traceSampler instanceof UrlTraceSampler)) { - Assert.fail("Unexpected sampler type. traceSampler=" + traceSampler); + Assertions.fail("Unexpected sampler type. traceSampler=" + traceSampler); } } @@ -72,8 +70,8 @@ public void samplingEnableFalse() { TraceSamplerProvider provider = new TraceSamplerProvider(profilerConfig, new DefaultContextConfig(), TrueSampler.INSTANCE, new AtomicIdGenerator()); TraceSampler traceSampler = provider.get(); - if(Boolean.FALSE == (traceSampler instanceof BasicTraceSampler)) { - Assert.fail("Unexpected sampler type. traceSampler=" + traceSampler); + if (Boolean.FALSE == (traceSampler instanceof BasicTraceSampler)) { + Assertions.fail("Unexpected sampler type. traceSampler=" + traceSampler); } } @@ -88,8 +86,8 @@ public void urlSamplingEnableFalse() { TraceSamplerProvider provider = new TraceSamplerProvider(profilerConfig, new DefaultContextConfig(), TrueSampler.INSTANCE, new AtomicIdGenerator()); TraceSampler traceSampler = provider.get(); - if(Boolean.FALSE == (traceSampler instanceof BasicTraceSampler)) { - Assert.fail("Unexpected sampler type. traceSampler=" + traceSampler); + if (Boolean.FALSE == (traceSampler instanceof BasicTraceSampler)) { + Assertions.fail("Unexpected sampler type. traceSampler=" + traceSampler); } } } \ No newline at end of file diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/provider/sampler/UrlSamplerConfigTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/provider/sampler/UrlSamplerConfigTest.java index 5dc7759f37cb..17756b366895 100644 --- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/provider/sampler/UrlSamplerConfigTest.java +++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/provider/sampler/UrlSamplerConfigTest.java @@ -19,13 +19,13 @@ import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig; import com.navercorp.pinpoint.bootstrap.config.ProfilerConfigLoader; import com.navercorp.pinpoint.profiler.sampler.SamplerType; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.util.List; import java.util.Map; import java.util.Properties; -import static org.junit.Assert.*; public class UrlSamplerConfigTest { @@ -36,7 +36,7 @@ public void emptyList() { UrlSamplerConfig urlSamplerConfig = new UrlSamplerConfig(profilerConfig, SamplerType.COUNTING); List> entryList = urlSamplerConfig.entryList(); - assertEquals(0, entryList.size()); + Assertions.assertEquals(0, entryList.size()); } @Test @@ -51,11 +51,11 @@ public void entryList() { UrlSamplerConfig urlSamplerConfig = new UrlSamplerConfig(profilerConfig, SamplerType.COUNTING); List> entryList = urlSamplerConfig.entryList(); UrlSamplerInfo urlInfo = entryList.get(0).getValue(); - assertEquals("/foo", urlInfo.getUrlPath()); - assertNotNull(urlInfo.getSampler()); - assertEquals(0, urlInfo.getSamplingNewThroughput()); - assertEquals(0, urlInfo.getSamplingContinueThroughput()); - assertTrue(urlInfo.isValid()); + Assertions.assertEquals("/foo", urlInfo.getUrlPath()); + Assertions.assertNotNull(urlInfo.getSampler()); + Assertions.assertEquals(0, urlInfo.getSamplingNewThroughput()); + Assertions.assertEquals(0, urlInfo.getSamplingContinueThroughput()); + Assertions.assertTrue(urlInfo.isValid()); } @Test @@ -68,8 +68,8 @@ public void notFoundSampler() { UrlSamplerConfig urlSamplerConfig = new UrlSamplerConfig(profilerConfig, SamplerType.COUNTING); List> entryList = urlSamplerConfig.entryList(); UrlSamplerInfo urlInfo = entryList.get(0).getValue(); - assertNull(urlInfo.getSampler()); - assertFalse(urlInfo.isValid()); + Assertions.assertNull(urlInfo.getSampler()); + Assertions.assertFalse(urlInfo.isValid()); } @Test @@ -80,6 +80,6 @@ public void invalidConfig() { UrlSamplerConfig urlSamplerConfig = new UrlSamplerConfig(profilerConfig, SamplerType.COUNTING); List> entryList = urlSamplerConfig.entryList(); - assertEquals(0, entryList.size()); + Assertions.assertEquals(0, entryList.size()); } } \ No newline at end of file diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/sampler/UrlTraceSamplerTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/sampler/UrlTraceSamplerTest.java index 6aced1321b3f..bba472e8f446 100644 --- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/sampler/UrlTraceSamplerTest.java +++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/sampler/UrlTraceSamplerTest.java @@ -20,12 +20,15 @@ import com.navercorp.pinpoint.bootstrap.sampler.TraceSampler; import com.navercorp.pinpoint.profiler.context.id.AtomicIdGenerator; import com.navercorp.pinpoint.profiler.context.id.IdGenerator; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.LinkedHashMap; import java.util.Map; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class UrlTraceSamplerTest { static final String PATTERN1 = "/foo/*"; diff --git a/rpc/src/test/java/com/navercorp/pinpoint/rpc/common/SocketStateCodeTest.java b/rpc/src/test/java/com/navercorp/pinpoint/rpc/common/SocketStateCodeTest.java index 8dba000d411b..9a65169992c3 100644 --- a/rpc/src/test/java/com/navercorp/pinpoint/rpc/common/SocketStateCodeTest.java +++ b/rpc/src/test/java/com/navercorp/pinpoint/rpc/common/SocketStateCodeTest.java @@ -1,7 +1,7 @@ package com.navercorp.pinpoint.rpc.common; -import org.junit.Test; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class SocketStateCodeTest { diff --git a/test/pom.xml b/test/pom.xml index dba8a0a4ac0c..ae1ebeac73c2 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -21,11 +21,6 @@ com.navercorp.pinpoint pinpoint-bootstrap - - junit - junit - compile - org.apache.maven.resolver maven-resolver-api @@ -134,6 +129,12 @@ test + + junit + junit + test + + diff --git a/web/src/test/java/com/navercorp/pinpoint/web/websocket/ActiveThreadCountResponseAggregatorTest.java b/web/src/test/java/com/navercorp/pinpoint/web/websocket/ActiveThreadCountResponseAggregatorTest.java index d83e63b7cbd3..81abe4628ebc 100644 --- a/web/src/test/java/com/navercorp/pinpoint/web/websocket/ActiveThreadCountResponseAggregatorTest.java +++ b/web/src/test/java/com/navercorp/pinpoint/web/websocket/ActiveThreadCountResponseAggregatorTest.java @@ -33,7 +33,7 @@ import java.util.List; import java.util.Timer; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; @@ -87,7 +87,7 @@ public void shouldActivateWorkerByAddingFirstSession() throws Exception { aggregator.start(); aggregator.addWebSocketSession(this.session); - assertEquals("# of sessions should be 1", 1, aggregator.countWebSocketSession()); + assertEquals(1, aggregator.countWebSocketSession(), "# of sessions should be 1"); verify(this.agentService, times(1)).getRecentAgentInfoList(eq(applicationName), anyLong()); verify(this.agentService, times(1)).openStream(eq(clusterKey), any(TBase.class), any()); @@ -99,18 +99,18 @@ public void shouldDeactivateWorkerByRemovingLastSession() { aggregator.addWebSocketSession(this.session); verify(this.channel, times(0)).close(); - assertEquals("# of sessions should be 1", 1, aggregator.countWebSocketSession()); + assertEquals(1, aggregator.countWebSocketSession(), "# of sessions should be 1"); aggregator.addWebSocketSession(session); verify(this.channel, times(0)).close(); - assertEquals("# of sessions should be 2", 2, aggregator.countWebSocketSession()); + assertEquals(2, aggregator.countWebSocketSession(), "# of sessions should be 2"); aggregator.removeWebSocketSessionAndGetIsCleared(session); verify(this.channel, times(0)).close(); - assertEquals("# of sessions should be 1", 1, aggregator.countWebSocketSession()); + assertEquals(1, aggregator.countWebSocketSession(), "# of sessions should be 1"); aggregator.removeWebSocketSessionAndGetIsCleared(session); verify(this.channel, times(1)).close(); - assertEquals("# of sessions should be 0", 0, aggregator.countWebSocketSession()); + assertEquals(0, aggregator.countWebSocketSession(), "# of sessions should be 0"); } }