diff --git a/core/pom.xml b/core/pom.xml index 6eca7584d..85194c8b6 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -1,17 +1,17 @@ 4.0.0 - + io.smallrye smallrye-open-api-parent 3.7.1-SNAPSHOT - + smallrye-open-api-core SmallRye: OpenAPI Core - + src/main/java/io/smallrye/openapi/api/models/**/*.java @@ -71,12 +71,6 @@ smallrye-config test - - commons-io - commons-io - 2.14.0 - test - org.skyscreamer jsonassert diff --git a/core/src/test/java/io/smallrye/openapi/api/util/FilterUtilTest.java b/core/src/test/java/io/smallrye/openapi/api/util/FilterUtilTest.java index 51d9fb55e..0a7d41738 100644 --- a/core/src/test/java/io/smallrye/openapi/api/util/FilterUtilTest.java +++ b/core/src/test/java/io/smallrye/openapi/api/util/FilterUtilTest.java @@ -1,11 +1,10 @@ package io.smallrye.openapi.api.util; +import static io.smallrye.openapi.runtime.scanner.IndexScannerTestBase.loadResource; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import java.io.IOException; import java.net.URL; -import org.apache.commons.io.IOUtils; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.ConfigProvider; import org.eclipse.microprofile.openapi.OASFactory; @@ -30,16 +29,6 @@ */ class FilterUtilTest { - /** - * Loads a resource as a string (reads the content at the URL). - * - * @param testResource - * @throws IOException - */ - private static String loadResource(URL testResource) throws IOException { - return IOUtils.toString(testResource, "UTF-8"); - } - /** * Compares two JSON strings. * diff --git a/core/src/test/java/io/smallrye/openapi/api/util/MergeUtilTest.java b/core/src/test/java/io/smallrye/openapi/api/util/MergeUtilTest.java index d576e334b..aa0bfcbb4 100644 --- a/core/src/test/java/io/smallrye/openapi/api/util/MergeUtilTest.java +++ b/core/src/test/java/io/smallrye/openapi/api/util/MergeUtilTest.java @@ -1,10 +1,11 @@ package io.smallrye.openapi.api.util; +import static io.smallrye.openapi.runtime.scanner.IndexScannerTestBase.loadResource; + import java.io.IOException; import java.net.URL; import java.text.ParseException; -import org.apache.commons.io.IOUtils; import org.eclipse.microprofile.openapi.models.OpenAPI; import org.json.JSONException; import org.junit.jupiter.api.Test; @@ -19,16 +20,6 @@ */ class MergeUtilTest { - /** - * Loads a resource as a string (reads the content at the URL). - * - * @param testResource - * @throws IOException - */ - private static String loadResource(URL testResource) throws IOException { - return IOUtils.toString(testResource, "UTF-8"); - } - /** * Compares two JSON strings. * diff --git a/core/src/test/java/io/smallrye/openapi/runtime/io/OpenApiParserAndSerializerTest.java b/core/src/test/java/io/smallrye/openapi/runtime/io/OpenApiParserAndSerializerTest.java index 91e394536..da5741f30 100644 --- a/core/src/test/java/io/smallrye/openapi/runtime/io/OpenApiParserAndSerializerTest.java +++ b/core/src/test/java/io/smallrye/openapi/runtime/io/OpenApiParserAndSerializerTest.java @@ -1,5 +1,6 @@ package io.smallrye.openapi.runtime.io; +import static io.smallrye.openapi.runtime.scanner.IndexScannerTestBase.loadResource; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -13,7 +14,6 @@ import java.nio.file.Files; import java.nio.file.Path; -import org.apache.commons.io.IOUtils; import org.eclipse.microprofile.openapi.OASFactory; import org.eclipse.microprofile.openapi.models.OpenAPI; import org.json.JSONException; @@ -36,16 +36,6 @@ class OpenApiParserAndSerializerTest { static final int REPEAT_BODY_CONTENTS_ITERATIONS = 1536; // ~8MB? - /** - * Loads a resource as a string (reads the content at the URL). - * - * @param testResource - * @throws IOException - */ - private static String loadResource(URL testResource) throws IOException { - return IOUtils.toString(testResource, "UTF-8"); - } - /** * Compares two JSON strings. * diff --git a/core/src/test/java/io/smallrye/openapi/runtime/scanner/IndexScannerTestBase.java b/core/src/test/java/io/smallrye/openapi/runtime/scanner/IndexScannerTestBase.java index a7a98888b..028567cda 100644 --- a/core/src/test/java/io/smallrye/openapi/runtime/scanner/IndexScannerTestBase.java +++ b/core/src/test/java/io/smallrye/openapi/runtime/scanner/IndexScannerTestBase.java @@ -6,8 +6,10 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.Reader; import java.io.UncheckedIOException; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.nio.file.Paths; import java.util.Collections; import java.util.HashMap; @@ -15,7 +17,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.io.IOUtils; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.spi.ConfigSource; import org.eclipse.microprofile.openapi.models.OpenAPI; @@ -181,19 +182,23 @@ public static void assertJsonEquals(String expectedResource, Class... classes } public static String loadResource(URL testResource) throws IOException { - return IOUtils.toString(testResource, "UTF-8"); + final char[] buffer = new char[8192]; + final StringBuilder result = new StringBuilder(); + + try (Reader reader = new InputStreamReader(testResource.openStream(), StandardCharsets.UTF_8)) { + int count; + while ((count = reader.read(buffer, 0, buffer.length)) > 0) { + result.append(buffer, 0, count); + } + } + + return result.toString(); } public static OpenApiConfig emptyConfig() { return dynamicConfig(Collections.emptyMap()); } - // public static OpenApiConfig nestingSupportConfig() { - // Map config = new HashMap<>(); - // config.put(OpenApiConstants.SMALLRYE_SCHEMA_REFERENCES_ENABLE, Boolean.TRUE); - // return dynamicConfig(config); - // } - public static OpenApiConfig dynamicConfig(String key, Object value) { Map config = new HashMap<>(1); config.put(key, value.toString()); diff --git a/extension-spring/pom.xml b/extension-spring/pom.xml index 842e6d4fd..d6e7a85df 100644 --- a/extension-spring/pom.xml +++ b/extension-spring/pom.xml @@ -58,12 +58,6 @@ jsonassert test - - commons-io - commons-io - 2.14.0 - test - org.springframework spring-webmvc diff --git a/extension-vertx/pom.xml b/extension-vertx/pom.xml index 93799eeb2..860f03136 100644 --- a/extension-vertx/pom.xml +++ b/extension-vertx/pom.xml @@ -50,13 +50,6 @@ jsonassert test - - commons-io - commons-io - 2.14.0 - test - -