summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2023-10-05 16:56:47 +0200
committerjonmv <venstad@gmail.com>2023-10-05 16:56:47 +0200
commit1031323b5f08f02e25c79a8653987ed7d70e12a6 (patch)
tree3db700aa4a8be893136dd8f87ed6f0d794561fdf /application
parent4442e0ebf35867a85128088471be38afc61e0ef0 (diff)
Isolate inner jetty server component from wrapper with filters
Diffstat (limited to 'application')
-rw-r--r--application/src/test/java/com/yahoo/application/ApplicationTest.java34
1 files changed, 13 insertions, 21 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..e22083505af 100644
--- a/application/src/test/java/com/yahoo/application/ApplicationTest.java
+++ b/application/src/test/java/com/yahoo/application/ApplicationTest.java
@@ -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() {