diff options
author | Haakon Dybdahl <dybdahl@yahoo-inc.com> | 2016-10-07 13:05:20 +0200 |
---|---|---|
committer | Haakon Dybdahl <dybdahl@yahoo-inc.com> | 2016-10-07 13:05:20 +0200 |
commit | 47ec9114b868972d1a1c0f95a05eb110438f3568 (patch) | |
tree | 5f22dfd9bdcf5fdcf0a5cd7f29ea528e93b6ca35 /vespaclient-container-plugin | |
parent | c47e1670f3592ef9601ae124fe771e2cd1eb53bd (diff) |
Make test not require port 4080 to be available.
Diffstat (limited to 'vespaclient-container-plugin')
-rw-r--r-- | vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java | 13 |
1 files changed, 10 insertions, 3 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 42ec41bd107..71b9411cb30 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 @@ -4,6 +4,9 @@ import com.yahoo.application.Application; import com.yahoo.application.Networking; import org.junit.Test; +import java.io.IOException; +import java.net.ServerSocket; + /** * @author bratseth */ @@ -11,13 +14,17 @@ public class DocumentApiApplicationTest { /** Test that it is possible to instantiate an Application with a document-api */ @Test - public void application_with_document_api() { + public void application_with_document_api() throws IOException { String services = - "<container version='1.0'>" + + "<jdisc version='1.0'>" + + " <http><server port=\"" + findRandomOpenPortOnAllLocalInterfaces() + "\" id=\"foobar\"/></http>" + " <document-api/>" + - "</container>"; + "</jdisc>"; try (Application application = Application.fromServicesXml(services, Networking.enable)) { } } + private int findRandomOpenPortOnAllLocalInterfaces() throws IOException { + return new ServerSocket(0).getLocalPort(); + } } |