From 11c0391cef31f03a317e043e537cad86fca4393d Mon Sep 17 00:00:00 2001 From: Bjørn Christian Seime Date: Fri, 3 Jan 2020 15:54:36 +0100 Subject: Remove use of apache commons libraries in application --- application/pom.xml | 28 ---------------------- .../com/yahoo/application/ApplicationTest.java | 8 +++---- .../application/container/jersey/JerseyTest.java | 4 ++-- 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index 5a370e9ffe6..7bcda0ce386 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -96,10 +96,6 @@ - - commons-collections - commons-collections - org.antlr antlr-runtime @@ -108,10 +104,6 @@ org.antlr antlr4-runtime - - org.apache.commons - commons-exec - org.apache.opennlp opennlp-tools @@ -136,26 +128,6 @@ test - - - commons-beanutils - commons-beanutils - 1.7.0 - - - commons-beanutils - commons-beanutils-core - 1.8.0 - - - commons-configuration - commons-configuration - - - commons-digester - commons-digester - 1.8 - diff --git a/application/src/test/java/com/yahoo/application/ApplicationTest.java b/application/src/test/java/com/yahoo/application/ApplicationTest.java index d4a9c75b713..f2af5537490 100644 --- a/application/src/test/java/com/yahoo/application/ApplicationTest.java +++ b/application/src/test/java/com/yahoo/application/ApplicationTest.java @@ -22,7 +22,6 @@ import com.yahoo.jdisc.handler.RequestHandler; import com.yahoo.search.Query; import com.yahoo.search.Result; import com.yahoo.search.handler.SearchHandler; -import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; @@ -34,6 +33,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.net.ConnectException; import java.net.ServerSocket; +import java.nio.charset.StandardCharsets; import java.util.Map; import static com.yahoo.vespa.defaults.Defaults.getDefaults; @@ -223,7 +223,7 @@ public class ApplicationTest { public void document_type() throws Exception { try ( Application app = Application.fromBuilder(new Application.Builder() - .documentType("test", IOUtils.toString(this.getClass().getResourceAsStream("/test.sd"))) + .documentType("test", new String(this.getClass().getResourceAsStream("/test.sd").readAllBytes(), StandardCharsets.UTF_8)) .container("default", new Application.Builder.Container() .documentProcessor(MockDocproc.class) .config(new MockApplicationConfig(new MockApplicationConfig.Builder().mystruct(new MockApplicationConfig.Mystruct.Builder().id("foo").value("bar")))))) @@ -264,7 +264,7 @@ public class ApplicationTest { @Test public void client() throws Exception { try (ApplicationFacade app = new ApplicationFacade(Application.fromBuilder(new Application.Builder() - .documentType("test", IOUtils.toString(this.getClass().getResourceAsStream("/test.sd"))) + .documentType("test", new String(this.getClass().getResourceAsStream("/test.sd").readAllBytes(), StandardCharsets.UTF_8)) .container("default", new Application.Builder.Container() .client("mbus://*/*", MockClient.class) .documentProcessor(MockDispatchDocproc.class) @@ -320,7 +320,7 @@ public class ApplicationTest { "\n" + "") .rankExpression("re", "commonfirstphase(globalstaticrank)") - .documentType("test", IOUtils.toString(this.getClass().getResourceAsStream("/test.sd"))) + .documentType("test", new String(this.getClass().getResourceAsStream("/test.sd").readAllBytes(), StandardCharsets.UTF_8)) .container("default", new Application.Builder.Container() .search(true) ))) { diff --git a/application/src/test/java/com/yahoo/application/container/jersey/JerseyTest.java b/application/src/test/java/com/yahoo/application/container/jersey/JerseyTest.java index b2d59dbe209..0eb308f124c 100644 --- a/application/src/test/java/com/yahoo/application/container/jersey/JerseyTest.java +++ b/application/src/test/java/com/yahoo/application/container/jersey/JerseyTest.java @@ -10,7 +10,6 @@ import com.yahoo.application.container.jersey.resources.nestedpackage2.NestedTes import com.yahoo.container.test.jars.jersey.resources.TestResourceBase; import com.yahoo.osgi.maven.ProjectBundleClassPaths; import com.yahoo.osgi.maven.ProjectBundleClassPaths.BundleClasspathMapping; -import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; @@ -19,6 +18,7 @@ import org.apache.http.util.EntityUtils; import org.junit.Test; import javax.ws.rs.core.UriBuilder; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -158,7 +158,7 @@ public class JerseyTest { HttpResponse response = httpGetter.get(path(resource)); assertThat("Failed sending response to " + resource, response.getStatusLine().getStatusCode(), is(200)); - String content = IOUtils.toString(response.getEntity().getContent()); + String content = new String(response.getEntity().getContent().readAllBytes(), StandardCharsets.UTF_8); assertThat(content, is(TestResourceBase.content(resource))); } } -- cgit v1.2.3