Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes junit 4 dependency #3627

Merged
merged 4 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>io.zipkin</groupId>
<artifactId>zipkin-parent</artifactId>
<version>2.24.5-SNAPSHOT</version>
<version>2.25.0-SNAPSHOT</version>
</parent>

<artifactId>benchmarks</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 The OpenZipkin Authors
* Copyright 2015-2023 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -15,7 +15,7 @@

import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static zipkin2.TestObjects.CLIENT_SPAN;
Expand All @@ -25,12 +25,12 @@ public class JacksonSpanDecoderTest {
byte[] encoded = SpanBytesEncoder.JSON_V2.encodeList(TRACE);
byte[] encodedSpan = SpanBytesEncoder.JSON_V2.encode(CLIENT_SPAN);

@Test public void decodeList_bytes() {
@Test void decodeList_bytes() {
assertThat(JacksonSpanDecoder.decodeList(encoded))
.isEqualTo(TRACE);
}

@Test public void decodeList_byteBuffer() {
@Test void decodeList_byteBuffer() {
ByteBuf encodedBuf = PooledByteBufAllocator.DEFAULT.buffer(encoded.length);
encodedBuf.writeBytes(encoded);
try {
Expand All @@ -41,12 +41,12 @@ public class JacksonSpanDecoderTest {
}
}

@Test public void decodeOne() {
@Test void decodeOne() {
assertThat(JacksonSpanDecoder.decodeOne(encodedSpan))
.isEqualTo(CLIENT_SPAN);
}

@Test public void decodeOne_byteBuffer() {
@Test void decodeOne_byteBuffer() {
ByteBuf encodedBuf = PooledByteBufAllocator.DEFAULT.buffer(encodedSpan.length);
encodedBuf.writeBytes(encodedSpan);
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 The OpenZipkin Authors
* Copyright 2015-2023 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -15,20 +15,20 @@

import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static zipkin2.TestObjects.TRACE;

public class MoshiSpanDecoderTest {
byte[] encoded = SpanBytesEncoder.JSON_V2.encodeList(TRACE);

@Test public void decodeList_bytes() {
@Test void decodeList_bytes() {
assertThat(new MoshiSpanDecoder().decodeList(encoded))
.isEqualTo(TRACE);
}

@Test public void decodeList_byteBuffer() {
@Test void decodeList_byteBuffer() {
ByteBuf encodedBuf = PooledByteBufAllocator.DEFAULT.buffer(encoded.length);
encodedBuf.writeBytes(encoded);
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 The OpenZipkin Authors
* Copyright 2015-2023 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -19,7 +19,7 @@
import java.util.List;
import okio.ByteString;
import org.assertj.core.data.MapEntry;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import zipkin2.codec.SpanBytesDecoder;
import zipkin2.codec.SpanBytesEncoder;
import zipkin2.internal.Proto3ZipkinFields.TagField;
Expand Down Expand Up @@ -97,7 +97,7 @@ public class Proto3CodecInteropTest {
ListOfSpans PROTO_SPANS = new ListOfSpans.Builder()
.spans(Arrays.asList(PROTO_SPAN, PROTO_SPAN)).build();

@Test public void encodeIsCompatible() throws IOException {
@Test void encodeIsCompatible() throws IOException {
okio.Buffer buffer = new okio.Buffer();

Span.ADAPTER.encodeWithTag(new ProtoWriter(buffer), 1, PROTO_SPAN);
Expand All @@ -106,17 +106,17 @@ public class Proto3CodecInteropTest {
.containsExactly(buffer.readByteArray());
}

@Test public void decodeOneIsCompatible() {
@Test void decodeOneIsCompatible() {
assertThat(SpanBytesDecoder.PROTO3.decodeOne(PROTO_SPANS.encode()))
.isEqualTo(ZIPKIN_SPAN);
}

@Test public void decodeListIsCompatible() {
@Test void decodeListIsCompatible() {
assertThat(SpanBytesDecoder.PROTO3.decodeList(PROTO_SPANS.encode()))
.containsExactly(ZIPKIN_SPAN, ZIPKIN_SPAN);
}

@Test public void encodeListIsCompatible_buff() {
@Test void encodeListIsCompatible_buff() {
byte[] wireBytes = PROTO_SPANS.encode();
byte[] zipkin_buff = new byte[10 + wireBytes.length];

Expand All @@ -129,27 +129,27 @@ public class Proto3CodecInteropTest {
.endsWith(0, 0, 0, 0, 0);
}

@Test public void encodeListIsCompatible() {
@Test void encodeListIsCompatible() {
byte[] wireBytes = PROTO_SPANS.encode();

assertThat(SpanBytesEncoder.PROTO3.encodeList(ZIPKIN_SPANS))
.containsExactly(wireBytes);
}

@Test public void span_sizeInBytes_matchesWire() {
@Test void span_sizeInBytes_matchesWire() {
assertThat(SPAN.sizeInBytes(ZIPKIN_SPAN))
.isEqualTo(Span.ADAPTER.encodedSizeWithTag(SPAN.fieldNumber, PROTO_SPAN));
}

@Test public void annotation_sizeInBytes_matchesWire() {
@Test void annotation_sizeInBytes_matchesWire() {
zipkin2.Annotation zipkinAnnotation = ZIPKIN_SPAN.annotations().get(0);

assertThat(ANNOTATION.sizeInBytes(zipkinAnnotation)).isEqualTo(
Annotation.ADAPTER.encodedSizeWithTag(ANNOTATION.fieldNumber, PROTO_SPAN.annotations.get(0))
);
}

@Test public void annotation_write_matchesWire() {
@Test void annotation_write_matchesWire() {
zipkin2.Annotation zipkinAnnotation = ZIPKIN_SPAN.annotations().get(0);
Span wireSpan = new Span.Builder().annotations(PROTO_SPAN.annotations).build();

Expand All @@ -160,7 +160,7 @@ public class Proto3CodecInteropTest {
.containsExactly(wireSpan.encode());
}

@Test public void annotation_read_matchesWireEncodingWithTag() {
@Test void annotation_read_matchesWireEncodingWithTag() {
zipkin2.Annotation zipkinAnnotation = ZIPKIN_SPAN.annotations().get(0);
Span wireSpan = new Span.Builder().annotations(PROTO_SPAN.annotations).build();

Expand All @@ -174,7 +174,7 @@ public class Proto3CodecInteropTest {
.containsExactly(zipkinAnnotation);
}

@Test public void endpoint_sizeInBytes_matchesWireEncodingWithTag() {
@Test void endpoint_sizeInBytes_matchesWireEncodingWithTag() {
assertThat(LOCAL_ENDPOINT.sizeInBytes(ZIPKIN_SPAN.localEndpoint())).isEqualTo(
Endpoint.ADAPTER.encodedSizeWithTag(LOCAL_ENDPOINT.fieldNumber, PROTO_SPAN.local_endpoint)
);
Expand All @@ -184,7 +184,7 @@ public class Proto3CodecInteropTest {
);
}

@Test public void localEndpoint_write_matchesWire() {
@Test void localEndpoint_write_matchesWire() {
byte[] zipkinBytes = new byte[LOCAL_ENDPOINT.sizeInBytes(ZIPKIN_SPAN.localEndpoint())];
LOCAL_ENDPOINT.write(WriteBuffer.wrap(zipkinBytes, 0), ZIPKIN_SPAN.localEndpoint());
Span wireSpan = new Span.Builder().local_endpoint(PROTO_SPAN.local_endpoint).build();
Expand All @@ -193,7 +193,7 @@ public class Proto3CodecInteropTest {
.containsExactly(wireSpan.encode());
}

@Test public void remoteEndpoint_write_matchesWire() {
@Test void remoteEndpoint_write_matchesWire() {
byte[] zipkinBytes = new byte[REMOTE_ENDPOINT.sizeInBytes(ZIPKIN_SPAN.remoteEndpoint())];
REMOTE_ENDPOINT.write(WriteBuffer.wrap(zipkinBytes, 0), ZIPKIN_SPAN.remoteEndpoint());
Span wireSpan = new Span.Builder().remote_endpoint(PROTO_SPAN.remote_endpoint).build();
Expand All @@ -202,15 +202,15 @@ public class Proto3CodecInteropTest {
.containsExactly(wireSpan.encode());
}

@Test public void tag_sizeInBytes_matchesWire() {
@Test void tag_sizeInBytes_matchesWire() {
MapEntry<String, String> entry = entry("clnt/finagle.version", "6.45.0");
Span wireSpan = new Span.Builder().tags(singletonMap(entry.key, entry.value)).build();

assertThat(new TagField(TAG_KEY).sizeInBytes(entry))
.isEqualTo(Span.ADAPTER.encodedSize(wireSpan));
}

@Test public void writeTagField_matchesWire() {
@Test void writeTagField_matchesWire() {
MapEntry<String, String> entry = entry("clnt/finagle.version", "6.45.0");
TagField field = new TagField(TAG_KEY);
byte[] zipkinBytes = new byte[field.sizeInBytes(entry)];
Expand All @@ -221,7 +221,7 @@ public class Proto3CodecInteropTest {
.containsExactly(oneField.encode());
}

@Test public void writeTagField_matchesWire_emptyValue() {
@Test void writeTagField_matchesWire_emptyValue() {
MapEntry<String, String> entry = entry("error", "");
TagField field = new TagField(TAG_KEY);
byte[] zipkinBytes = new byte[field.sizeInBytes(entry)];
Expand Down
42 changes: 13 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@

<groupId>io.zipkin</groupId>
<artifactId>zipkin-parent</artifactId>
<version>2.24.5-SNAPSHOT</version>
<version>2.25.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
<module>zipkin</module>
<module>zipkin-tests</module>
<module>zipkin-junit</module>
<module>zipkin-junit5</module>
<module>zipkin-storage</module>
<module>zipkin-collector</module>
Expand Down Expand Up @@ -81,7 +80,6 @@
<git-commit-id.version>4.9.10</git-commit-id.version>

<!-- Test only dependencies -->
<junit.version>4.13.2</junit.version>
<junit-jupiter.version>5.10.1</junit-jupiter.version>
<mockito.version>5.8.0</mockito.version>
<assertj.version>3.24.2</assertj.version>
Expand Down Expand Up @@ -187,37 +185,14 @@
<!-- Do not add compile dependencies here. This can cause problems for libraries that depend on
io.zipkin.zipkin2:zipkin difficult to unravel. -->

<dependency>
<groupId>junit</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skimmed through a few files for kicks but this is probably the main change and if build is green then it looks like it worked well

<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<!-- Current versions of JUnit5 provide the above junit-jupiter artifact for convenience, but we
may still have transitive dependencies on these older artifacts and have to make sure
they're all using the same version. -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<!-- needed for surefire.
https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand All @@ -234,7 +209,7 @@

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -465,6 +440,15 @@
https://github.com/mockito/mockito/issues/3119#issuecomment-1732179039 -->
<argLine>-Dnet.bytebuddy.experimental=true</argLine>
</configuration>
<dependencies>
<!-- needed for surefire.
https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
</dependencies>
</plugin>

<plugin>
Expand Down
3 changes: 2 additions & 1 deletion zipkin-collector/activemq/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>io.zipkin.zipkin2</groupId>
<artifactId>zipkin-collector-parent</artifactId>
<version>2.24.5-SNAPSHOT</version>
<version>2.25.0-SNAPSHOT</version>
</parent>

<artifactId>zipkin-collector-activemq</artifactId>
Expand Down Expand Up @@ -52,6 +52,7 @@
<scope>test</scope>
</dependency>

<!-- Note: this is junit 4 -->
<dependency>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>activemq-junit</artifactId>
Expand Down
Loading
Loading