summaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java')
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java34
1 files changed, 34 insertions, 0 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
new file mode 100644
index 00000000000..ec9cdc594e9
--- /dev/null
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java
@@ -0,0 +1,34 @@
+package com.yahoo.document.restapi;
+
+import com.yahoo.application.Application;
+import com.yahoo.application.Networking;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+
+/**
+ * @author bratseth
+ */
+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 {
+ String services =
+ "<jdisc version='1.0'>" +
+ " <http><server port=\"" + findRandomOpenPortOnAllLocalInterfaces() + "\" id=\"foobar\"/></http>" +
+ " <document-api/>" +
+ "</jdisc>";
+ 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;
+ }
+}