summaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2020-10-29 16:07:33 +0100
committerMartin Polden <mpolden@mpolden.no>2020-10-29 16:10:34 +0100
commitcaa0ba721453dd0e832d6bdbb0378d330d293c40 (patch)
treec8f98fb5dec26dcfcf308dfc6016adca5eada4b9 /vespaclient-container-plugin
parente32b268ab273699a912c095af280e6c1f45e40af (diff)
Remove find free port hack from test
Diffstat (limited to 'vespaclient-container-plugin')
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java15
1 files changed, 2 insertions, 13 deletions
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java
index b303e663f32..fd45a0d5dd7 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java
@@ -5,9 +5,6 @@ import com.yahoo.application.Application;
import com.yahoo.application.Networking;
import org.junit.Test;
-import java.io.IOException;
-import java.net.ServerSocket;
-
/**
* @author bratseth
*/
@@ -15,22 +12,14 @@ public class DocumentApiApplicationTest {
/** Test that it is possible to instantiate an Application with a document-api */
@Test
- public void application_with_document_api() throws IOException {
+ public void application_with_document_api() {
String services =
"<container version='1.0'>" +
- " <http><server port=\"" + findRandomOpenPortOnAllLocalInterfaces() + "\" id=\"foobar\"/></http>" +
+ " <http><server port=\"0\" id=\"foobar\"/></http>" +
" <document-api/>" +
"</container>";
try (Application application = Application.fromServicesXml(services, Networking.enable)) {
}
}
- private int findRandomOpenPortOnAllLocalInterfaces() throws IOException {
- ServerSocket socket = new ServerSocket(0);
- socket.setReuseAddress(true);
- int port = socket.getLocalPort();
- socket.close();
- return port;
- }
-
}