diff options
author | bjormel <bjormel@yahooinc.com> | 2023-10-26 13:59:28 +0000 |
---|---|---|
committer | bjormel <bjormel@yahooinc.com> | 2023-10-26 13:59:28 +0000 |
commit | 567be9a1f6353cec41c23bfd1fcd46b4b2a4d2d7 (patch) | |
tree | 4664a743e166a5e11aee7b9acd70ad8ee2617612 /application/src/test/java/com/yahoo/application/ApplicationTest.java | |
parent | e9058b555d4dfea2f6c872d9a677e8678b569569 (diff) | |
parent | bce3b8e926bf9da880172acbe1ba4b12d5e026d6 (diff) |
Merge branch 'master' into bjormel/aws-main-controllerbjormel/aws-main-controller
Diffstat (limited to 'application/src/test/java/com/yahoo/application/ApplicationTest.java')
-rw-r--r-- | application/src/test/java/com/yahoo/application/ApplicationTest.java | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/application/src/test/java/com/yahoo/application/ApplicationTest.java b/application/src/test/java/com/yahoo/application/ApplicationTest.java index 6b394cdebd9..ae52672af15 100644 --- a/application/src/test/java/com/yahoo/application/ApplicationTest.java +++ b/application/src/test/java/com/yahoo/application/ApplicationTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.application; import com.yahoo.application.container.MockServer; @@ -24,6 +24,7 @@ import com.yahoo.search.handler.SearchHandler; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; import org.junit.jupiter.api.Test; import java.io.BufferedReader; @@ -50,9 +51,7 @@ public class ApplicationTest { @Test void minimal_application_can_be_constructed() { - try (Application application = Application.fromServicesXml("<container version=\"1.0\"/>", Networking.disable)) { - Application unused = application; - } + try (Application application = Application.fromServicesXml("<container version=\"1.0\"/>", Networking.disable)) { } } /** Tests that an application with search chains referencing a content cluster can be constructed. */ @@ -80,10 +79,6 @@ public class ApplicationTest { assertEquals("select * from sources * where weakAnd(substring contains \"foobar\") limit 2 timeout 20000000", result.getQuery().yqlRepresentation(true)); } } - private void printTrace(Result result) { - for (String message : result.getQuery().getContext(true).getTrace().traceNode().descendants(String.class)) - System.out.println(message); - } @Test void empty_container() throws Exception { @@ -348,17 +343,17 @@ public class ApplicationTest { void http_interface_is_on_when_networking_is_enabled() throws Exception { int httpPort = getFreePort(); try (Application application = Application.fromServicesXml(servicesXmlWithServer(httpPort), Networking.enable)) { - HttpClient client = new org.apache.http.impl.client.DefaultHttpClient(); - HttpResponse response = client.execute(new HttpGet("http://localhost:" + httpPort)); - assertEquals(200, response.getStatusLine().getStatusCode()); - BufferedReader r = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); - String line; - StringBuilder sb = new StringBuilder(); - while ((line = r.readLine()) != null) { - sb.append(line).append("\n"); + try (DefaultHttpClient client = new org.apache.http.impl.client.DefaultHttpClient()) { + HttpResponse response = client.execute(new HttpGet("http://localhost:" + httpPort)); + assertEquals(200, response.getStatusLine().getStatusCode()); + BufferedReader r = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); + String line; + StringBuilder sb = new StringBuilder(); + while ((line = r.readLine()) != null) { + sb.append(line).append("\n"); + } + assertTrue(sb.toString().contains("Handler")); } - assertTrue(sb.toString().contains("Handler")); - Application unused = application; } } @@ -366,7 +361,6 @@ public class ApplicationTest { void athenz_in_deployment_xml() { try (Application application = Application.fromApplicationPackage(new File("src/test/app-packages/athenz-in-deployment-xml/"), Networking.disable)) { // Deployment succeeded - Application unused = application; } } @@ -386,9 +380,7 @@ public class ApplicationTest { @Test void application_with_access_control_can_be_constructed() { - try (Application application = Application.fromServicesXml(servicesXmlWithAccessControl(), Networking.disable)) { - Application unused = application; - } + try (Application application = Application.fromServicesXml(servicesXmlWithAccessControl(), Networking.disable)) { } } private static String servicesXmlWithAccessControl() { |