diff --git a/dialogue-annotations-processor/build.gradle b/dialogue-annotations-processor/build.gradle index 696c30838..f24856765 100644 --- a/dialogue-annotations-processor/build.gradle +++ b/dialogue-annotations-processor/build.gradle @@ -43,7 +43,7 @@ dependencies { testImplementation 'com.google.guava:guava' testImplementation 'com.google.testing.compile:compile-testing' testImplementation 'com.palantir.safe-logging:preconditions-assertj' - testImplementation 'com.squareup.okhttp3:mockwebserver' + testImplementation 'com.squareup.okhttp3:mockwebserver3-junit5' testImplementation 'org.assertj:assertj-core' testImplementation 'org.junit.jupiter:junit-jupiter' } diff --git a/dialogue-apache-hc5-client/src/test/java/com/palantir/dialogue/hc5/ApacheHttpClientChannelsTest.java b/dialogue-apache-hc5-client/src/test/java/com/palantir/dialogue/hc5/ApacheHttpClientChannelsTest.java index 34c457b44..994640305 100644 --- a/dialogue-apache-hc5-client/src/test/java/com/palantir/dialogue/hc5/ApacheHttpClientChannelsTest.java +++ b/dialogue-apache-hc5-client/src/test/java/com/palantir/dialogue/hc5/ApacheHttpClientChannelsTest.java @@ -47,10 +47,17 @@ import java.util.Map; import java.util.Optional; import java.util.OptionalLong; -import okhttp3.mockwebserver.RecordedRequest; +import mockwebserver3.MockWebServer; +import mockwebserver3.RecordedRequest; +import mockwebserver3.junit5.internal.MockWebServerExtension; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +@ExtendWith(MockWebServerExtension.class) public final class ApacheHttpClientChannelsTest extends AbstractChannelTest { + ApacheHttpClientChannelsTest(MockWebServer server) { + super(server); + } @Override protected Channel createChannel(ClientConfiguration config) { diff --git a/dialogue-apache-hc5-client/src/test/java/com/palantir/dialogue/hc5/ApacheProxyConfigTest.java b/dialogue-apache-hc5-client/src/test/java/com/palantir/dialogue/hc5/ApacheProxyConfigTest.java index 326f7ecfe..937ec8a06 100644 --- a/dialogue-apache-hc5-client/src/test/java/com/palantir/dialogue/hc5/ApacheProxyConfigTest.java +++ b/dialogue-apache-hc5-client/src/test/java/com/palantir/dialogue/hc5/ApacheProxyConfigTest.java @@ -18,8 +18,16 @@ import com.palantir.conjure.java.client.config.ClientConfiguration; import com.palantir.dialogue.AbstractProxyConfigTest; import com.palantir.dialogue.Channel; +import mockwebserver3.MockWebServer; +import mockwebserver3.junit5.internal.MockWebServerExtension; +import org.junit.jupiter.api.extension.ExtendWith; +@ExtendWith(MockWebServerExtension.class) public final class ApacheProxyConfigTest extends AbstractProxyConfigTest { + ApacheProxyConfigTest(MockWebServer server, MockWebServer proxyServer) { + super(server, proxyServer); + } + @Override protected Channel create(ClientConfiguration config) { return ApacheHttpClientChannels.create(config); diff --git a/dialogue-test-common/build.gradle b/dialogue-test-common/build.gradle index 4477e5223..5255a5855 100644 --- a/dialogue-test-common/build.gradle +++ b/dialogue-test-common/build.gradle @@ -12,11 +12,10 @@ dependencies { api 'com.palantir.conjure.java.runtime:client-config' api 'com.palantir.conjure.java.runtime:keystores' api 'com.palantir.tracing:tracing-test-utils' - api 'com.squareup.okhttp3:mockwebserver' + api 'com.squareup.okhttp3:mockwebserver3-junit5' api 'org.assertj:assertj-core' api 'org.assertj:assertj-guava' api 'org.junit.jupiter:junit-jupiter' - api 'org.junit.jupiter:junit-jupiter-migrationsupport' api 'org.mockito:mockito-core' api 'org.mockito:mockito-junit-jupiter' api 'io.undertow:undertow-core' diff --git a/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractChannelTest.java b/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractChannelTest.java index 8d7dc4565..4571ae013 100644 --- a/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractChannelTest.java +++ b/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractChannelTest.java @@ -16,8 +16,6 @@ package com.palantir.dialogue; -// CHECKSTYLE:OFF // static import - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -38,21 +36,17 @@ import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import java.util.function.BiConsumer; +import mockwebserver3.MockResponse; +import mockwebserver3.MockWebServer; +import mockwebserver3.RecordedRequest; import okhttp3.HttpUrl; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; import okio.Buffer; import okio.GzipSink; -import org.junit.Rule; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport; -// CHECKSTYLE:ON @SuppressWarnings({"checkstyle:avoidstaticimport", "checkstyle:VisibilityModifier", "FutureReturnValueIgnored"}) -@EnableRuleMigrationSupport public abstract class AbstractChannelTest { protected static final byte[] CONTENT = "test".getBytes(StandardCharsets.UTF_8); @@ -63,9 +57,6 @@ private Channel createChannel(URL baseUrl) { return createChannel(TestConfigurations.create(baseUrl.toString())); } - @Rule - public final MockWebServer server = new MockWebServer(); - protected final RequestBody body = new RequestBody() { @Override public void writeTo(OutputStream output) throws IOException { @@ -97,6 +88,12 @@ public void close() {} protected Channel channel; + protected final MockWebServer server; + + protected AbstractChannelTest(MockWebServer server) { + this.server = server; + } + @BeforeEach public void before() { channel = createChannel(server.url("").url()); diff --git a/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractProxyConfigTest.java b/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractProxyConfigTest.java index 1299c2466..d36765958 100644 --- a/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractProxyConfigTest.java +++ b/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractProxyConfigTest.java @@ -30,14 +30,14 @@ import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.List; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.junit.Rule; +import mockwebserver3.MockResponse; +import mockwebserver3.MockWebServer; +import mockwebserver3.RecordedRequest; +import mockwebserver3.junit5.internal.MockWebServerExtension; import org.junit.jupiter.api.Test; -import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport; +import org.junit.jupiter.api.extension.ExtendWith; -@EnableRuleMigrationSupport +@ExtendWith(MockWebServerExtension.class) public abstract class AbstractProxyConfigTest { private static final Request request = Request.builder() @@ -62,11 +62,14 @@ public void close() {} }) .build(); - @Rule - public final MockWebServer server = new MockWebServer(); + private final MockWebServer server; - @Rule - public final MockWebServer proxyServer = new MockWebServer(); + private final MockWebServer proxyServer; + + protected AbstractProxyConfigTest(MockWebServer server, MockWebServer proxyServer) { + this.server = server; + this.proxyServer = proxyServer; + } protected abstract Channel create(ClientConfiguration config); diff --git a/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractSampleServiceClientTest.java b/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractSampleServiceClientTest.java index d576004b7..62765b8a9 100644 --- a/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractSampleServiceClientTest.java +++ b/dialogue-test-common/src/main/java/com/palantir/dialogue/AbstractSampleServiceClientTest.java @@ -16,8 +16,6 @@ package com.palantir.dialogue; -// CHECKSTYLE:OFF // static import - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -37,18 +35,16 @@ import java.time.OffsetDateTime; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.junit.Rule; +import mockwebserver3.MockResponse; +import mockwebserver3.MockWebServer; +import mockwebserver3.RecordedRequest; +import mockwebserver3.junit5.internal.MockWebServerExtension; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; -import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport; - -// CHECKSTYLE:ON +import org.junit.jupiter.api.extension.ExtendWith; -@EnableRuleMigrationSupport +@ExtendWith(MockWebServerExtension.class) public abstract class AbstractSampleServiceClientTest { abstract SampleServiceBlocking createBlockingClient(URL baseUrl, Duration timeout); @@ -67,8 +63,11 @@ public abstract class AbstractSampleServiceClientTest { static final SslConfiguration SSL_CONFIG = SslConfiguration.of( Paths.get("src/test/resources/trustStore.jks"), Paths.get("src/test/resources/keyStore.jks"), "keystore"); - @Rule - public final MockWebServer server = new MockWebServer(); + private final MockWebServer server; + + protected AbstractSampleServiceClientTest(MockWebServer server) { + this.server = server; + } private SampleServiceBlocking blockingClient; private SampleServiceAsync asyncClient; @@ -107,7 +106,7 @@ public abstract class AbstractSampleServiceClientTest { @BeforeEach public void before() { - server.useHttps(SslSocketFactories.createSslSocketFactory(SSL_CONFIG), false); + server.useHttps(SslSocketFactories.createSslSocketFactory(SSL_CONFIG)); blockingClient = createBlockingClient(server.url("").url(), Duration.ofSeconds(1)); asyncClient = createAsyncClient(server.url("").url(), Duration.ofSeconds(1)); } diff --git a/versions.lock b/versions.lock index ff2470174..aaaf5e54f 100644 --- a/versions.lock +++ b/versions.lock @@ -57,7 +57,7 @@ org.glassfish.hk2.external:jakarta.inject:2.6.1 (1 constraints: f410fcc2) org.glassfish.jersey.core:jersey-common:2.31 (1 constraints: da04fa30) org.hdrhistogram:HdrHistogram:2.1.12 (1 constraints: 3e103aa2) org.immutables:value:2.8.8 (1 constraints: 14051536) -org.jetbrains:annotations:23.0.0 (1 constraints: 31115ed1) +org.jetbrains:annotations:23.0.0 (2 constraints: 0f20e4ff) org.mpierce.metrics.reservoir:hdrhistogram-metrics-reservoir:1.1.3 (1 constraints: 0d10f991) org.slf4j:slf4j-api:1.7.36 (8 constraints: b280891b) @@ -71,14 +71,16 @@ com.google.truth:truth:1.1 (1 constraints: b71111d7) com.palantir.safe-logging:preconditions-assertj:3.2.0 (1 constraints: 07050036) com.palantir.tracing:tracing-test-utils:6.15.0 (1 constraints: 3e05563b) com.spotify.dataenum:dataenum:1.4.1 (1 constraints: e9105ac1) -com.squareup.okhttp3:mockwebserver:3.13.1 (1 constraints: 3a053f3b) -com.squareup.okhttp3:okhttp:3.13.1 (2 constraints: a014ba9d) -com.squareup.okio:okio:1.17.2 (1 constraints: 850cc309) +com.squareup.okhttp3:mockwebserver3:5.0.0-alpha.10 (1 constraints: b514caae) +com.squareup.okhttp3:mockwebserver3-junit5:5.0.0-alpha.10 (1 constraints: c9071c72) +com.squareup.okhttp3:okhttp:5.0.0-alpha.10 (1 constraints: 3a053f3b) +com.squareup.okhttp3:okhttp-jvm:5.0.0-alpha.10 (2 constraints: 392169c2) +com.squareup.okio:okio-jvm:3.2.0 (1 constraints: c90d9c38) commons-logging:commons-logging:1.2 (2 constraints: 8215ead1) de.erichseifert.vectorgraphics2d:VectorGraphics2D:0.13 (1 constraints: 8c0a80bb) de.rototor.pdfbox:graphics2d:0.25 (1 constraints: 8f0a84bb) io.undertow:undertow-core:2.2.18.Final (1 constraints: 57074361) -junit:junit:4.13.2 (4 constraints: 2d413ec7) +junit:junit:4.13.1 (2 constraints: dc1cc51a) net.bytebuddy:byte-buddy:1.12.16 (2 constraints: ef164566) net.bytebuddy:byte-buddy-agent:1.12.16 (1 constraints: 750baee9) net.jcip:jcip-annotations:1.0 (1 constraints: 560ff165) @@ -91,7 +93,7 @@ org.apache.logging.log4j:log4j-core:2.19.0 (2 constraints: 15169e25) org.apache.logging.log4j:log4j-slf4j-impl:2.19.0 (1 constraints: 3e054a3b) org.apache.pdfbox:fontbox:2.0.17 (1 constraints: 180b71d8) org.apache.pdfbox:pdfbox:2.0.17 (1 constraints: b40c5915) -org.apiguardian:apiguardian-api:1.1.2 (6 constraints: 24695e60) +org.apiguardian:apiguardian-api:1.1.2 (5 constraints: 105480ac) org.assertj:assertj-core:3.23.1 (3 constraints: 5025194c) org.assertj:assertj-guava:3.3.0 (1 constraints: 08050336) org.awaitility:awaitility:4.2.0 (1 constraints: 08050536) @@ -102,12 +104,15 @@ org.jboss.logging:jboss-logging:3.4.1.Final (3 constraints: f03036d7) org.jboss.threads:jboss-threads:3.1.0.Final (2 constraints: 561a9b42) org.jboss.xnio:xnio-api:3.8.7.Final (2 constraints: 771a3146) org.jboss.xnio:xnio-nio:3.8.7.Final (1 constraints: c80dcb30) +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 (3 constraints: bd2f9e82) +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 (3 constraints: 3929d928) +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 (1 constraints: e110f6d2) +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 (3 constraints: bc2d5d81) org.jmock:jmock:2.12.0 (1 constraints: 3705353b) org.jmock:jmock-testjar:2.12.0 (1 constraints: a507a272) org.junit.jupiter:junit-jupiter:5.9.1 (1 constraints: 11052036) -org.junit.jupiter:junit-jupiter-api:5.9.1 (6 constraints: 6e58d58f) +org.junit.jupiter:junit-jupiter-api:5.9.1 (6 constraints: 4b55e412) org.junit.jupiter:junit-jupiter-engine:5.9.1 (1 constraints: 0c0ee13b) -org.junit.jupiter:junit-jupiter-migrationsupport:5.9.1 (1 constraints: 11052036) org.junit.jupiter:junit-jupiter-params:5.9.1 (2 constraints: 1c13903c) org.junit.platform:junit-platform-commons:1.9.1 (2 constraints: dd200f4b) org.junit.platform:junit-platform-engine:1.9.1 (1 constraints: ab1029b4) diff --git a/versions.props b/versions.props index 1fce6ca92..fbe567b24 100644 --- a/versions.props +++ b/versions.props @@ -40,7 +40,7 @@ org.jmock:jmock = 2.12.0 org.knowm.xchart:xchart = 3.6.1 com.palantir.conjure.verification:* = 0.19.0 io.undertow:undertow-core = 2.2.18.Final -com.squareup.okhttp3:mockwebserver = 3.13.1 +com.squareup.okhttp3:mockwebserver3-junit5 = 5.0.0-alpha.10 org.openjdk.jmh:* = 1.35 # dependency-upgrader:OFF