Skip to content

Commit

Permalink
[pinpoint-apm#8915] Cleanup junit4 dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad authored and BillionaireDY committed Dec 29, 2022
1 parent faefc4f commit 1d3faca
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 77 deletions.
5 changes: 0 additions & 5 deletions agent-plugins/proxy-apache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
5 changes: 0 additions & 5 deletions agent-plugins/proxy-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
5 changes: 0 additions & 5 deletions agent-plugins/proxy-nginx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,5 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
5 changes: 0 additions & 5 deletions agent-plugins/proxy-user/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,5 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
5 changes: 0 additions & 5 deletions grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,6 @@
<groupId>org.apache.commons</groupId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,6 @@
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
Expand Down
6 changes: 0 additions & 6 deletions profiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,6 @@
</exclusion>
</exclusions>
</dependency>-->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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
Expand All @@ -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);
}
}

Expand All @@ -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);
}
}

Expand All @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -36,7 +36,7 @@ public void emptyList() {

UrlSamplerConfig urlSamplerConfig = new UrlSamplerConfig(profilerConfig, SamplerType.COUNTING);
List<Map.Entry<Integer, UrlSamplerInfo>> entryList = urlSamplerConfig.entryList();
assertEquals(0, entryList.size());
Assertions.assertEquals(0, entryList.size());
}

@Test
Expand All @@ -51,11 +51,11 @@ public void entryList() {
UrlSamplerConfig urlSamplerConfig = new UrlSamplerConfig(profilerConfig, SamplerType.COUNTING);
List<Map.Entry<Integer, UrlSamplerInfo>> 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
Expand All @@ -68,8 +68,8 @@ public void notFoundSampler() {
UrlSamplerConfig urlSamplerConfig = new UrlSamplerConfig(profilerConfig, SamplerType.COUNTING);
List<Map.Entry<Integer, UrlSamplerInfo>> entryList = urlSamplerConfig.entryList();
UrlSamplerInfo urlInfo = entryList.get(0).getValue();
assertNull(urlInfo.getSampler());
assertFalse(urlInfo.isValid());
Assertions.assertNull(urlInfo.getSampler());
Assertions.assertFalse(urlInfo.isValid());
}

@Test
Expand All @@ -80,6 +80,6 @@ public void invalidConfig() {

UrlSamplerConfig urlSamplerConfig = new UrlSamplerConfig(profilerConfig, SamplerType.COUNTING);
List<Map.Entry<Integer, UrlSamplerInfo>> entryList = urlSamplerConfig.entryList();
assertEquals(0, entryList.size());
Assertions.assertEquals(0, entryList.size());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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/*";
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand All @@ -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");
}
}

0 comments on commit 1d3faca

Please sign in to comment.