Make API welcome message configurable
This allows flexible, informal messages and, if necessary, terms of
service to be displayed. For RKorAPClient this is nice because the
welcome message will be displayed on connect.
Change-Id: I9d3c6cef7b1f0205a23fe847909bca0de982bc0f
diff --git a/lite/src/main/resources/kustvakt-lite.conf b/lite/src/main/resources/kustvakt-lite.conf
index e78f993..9dc83b5 100644
--- a/lite/src/main/resources/kustvakt-lite.conf
+++ b/lite/src/main/resources/kustvakt-lite.conf
@@ -13,6 +13,7 @@
# Kustvakt settings
+api.welcome.message = Welcome to KorAP API!
current.api.version = v1.0
# multiple versions separated by space
supported.api.version = v1.0
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java
index 6463ce9..54367ab 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java
@@ -25,6 +25,7 @@
import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
import de.ids_mannheim.korap.config.Attributes;
+import de.ids_mannheim.korap.config.KustvaktConfiguration;
import de.ids_mannheim.korap.config.LiteJerseyTest;
import de.ids_mannheim.korap.exceptions.KustvaktException;
import de.ids_mannheim.korap.exceptions.StatusCodes;
@@ -36,7 +37,9 @@
@Autowired
private SearchKrill searchKrill;
-
+ @Autowired
+ private KustvaktConfiguration config;
+
// EM: The API is disabled
@Ignore
@Test
@@ -82,6 +85,16 @@
}
@Test
+ public void testApiWelcomeMessage () {
+ ClientResponse response = resource().path(API_VERSION).path("")
+ .get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String message = response.getEntity(String.class);
+ assertEquals(message, config.getApiWelcomeMessage());
+ }
+
+ @Test
public void testQueryGet () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")