From 8ad7531753a5b2155b69c43fd47b1f444e298d11 Mon Sep 17 00:00:00 2001 From: Nicolas Pepin-Perreault Date: Wed, 9 Feb 2022 10:28:48 +0100 Subject: [PATCH] test: remove dependency on shaded class --- .../zeebe/containers/ZeebeBrokerNodeTest.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/test/java/io/zeebe/containers/ZeebeBrokerNodeTest.java b/src/test/java/io/zeebe/containers/ZeebeBrokerNodeTest.java index 9b3662e2..4c135f46 100644 --- a/src/test/java/io/zeebe/containers/ZeebeBrokerNodeTest.java +++ b/src/test/java/io/zeebe/containers/ZeebeBrokerNodeTest.java @@ -26,6 +26,8 @@ import io.zeebe.containers.util.TestUtils; import io.zeebe.containers.util.TopologyAssert; import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; import java.nio.file.Path; import java.time.Duration; import java.util.Arrays; @@ -43,9 +45,6 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.testcontainers.containers.GenericContainer; -import org.testcontainers.shaded.okhttp3.OkHttpClient; -import org.testcontainers.shaded.okhttp3.Request.Builder; -import org.testcontainers.shaded.okhttp3.Response; class ZeebeBrokerNodeTest { @SuppressWarnings("unused") @@ -55,23 +54,24 @@ class ZeebeBrokerNodeTest { void shouldBeReadyOnStart(final String testName, final ZeebeBrokerNode node) throws IOException { // given - final Response response; + final int statusCode; try (final GenericContainer container = node.self()) { - final OkHttpClient httpClient = new OkHttpClient(); - // when container.start(); - response = - httpClient - .newCall( - new Builder() - .get() - .url(String.format("http://%s/ready", node.getExternalMonitoringAddress())) - .build()) - .execute(); + + // when + final URL monitoringUrl = + new URL(String.format("http://%s/ready", node.getExternalMonitoringAddress())); + final HttpURLConnection connection = (HttpURLConnection) monitoringUrl.openConnection(); + try { + connection.connect(); + statusCode = connection.getResponseCode(); + } finally { + connection.disconnect(); + } } // then - assertThat(response.code()) + assertThat(statusCode) .as("the broker ready check should return 204 when the container is started") .isEqualTo(204); }