summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2017-03-21 11:10:21 +0100
committerJon Bratseth <bratseth@yahoo-inc.com>2017-03-21 11:10:21 +0100
commit931775af810431727e033263e089db724bc6577b (patch)
treebbdbfa967c14a18d5a5c361dca0ae0182126586a /application
parentffabf70d741e765b653d1e23979bed510cdd9a78 (diff)
Have just one test with Netowkring.enabled
Otherwise tests may interfere with each other when running in parallel.
Diffstat (limited to 'application')
-rw-r--r--application/src/test/java/com/yahoo/application/ApplicationTest.java31
1 files changed, 10 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 7b515cb843b..1f90c195065 100644
--- a/application/src/test/java/com/yahoo/application/ApplicationTest.java
+++ b/application/src/test/java/com/yahoo/application/ApplicationTest.java
@@ -221,24 +221,6 @@ public class ApplicationTest {
}
@Test
- public void builder_with_networking() throws Exception {
- try (
- Application app = Application.fromBuilder(new Application.Builder().networking(Networking.enable).container("default", new Application.Builder.Container().handler("http://*/*", MockHttpHandler.class)))
- ) {
- DefaultHttpClient client = new DefaultHttpClient();
- HttpResponse response = client.execute(new HttpGet("http://localhost:" + getListenPort() + "/query=foo"));
- 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");
- }
- assertEquals("OK\n", sb.toString());
- }
- }
-
- @Test
public void document_type() throws Exception {
try (
Application app = Application.fromBuilder(new Application.Builder()
@@ -360,11 +342,18 @@ public class ApplicationTest {
int httpPort = getFreePort();
try (Application application = Application.fromServicesXml(servicesXmlWithServer(httpPort), Networking.enable)) {
HttpClient client = new DefaultHttpClient();
- int statusCode = client.execute(new HttpGet("http://localhost:" + httpPort)).getStatusLine().getStatusCode();
- assertEquals(200, statusCode);
+ 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"));
}
}
-
+
private static int getFreePort() throws IOException {
try (ServerSocket socket = new ServerSocket(0)) {
socket.setReuseAddress(true);