Added API info web-service.
Change-Id: I8ff91cd5dccca0824146d38a361964cc284cd196
diff --git a/lite/Changes b/lite/Changes
index be5532b..291e7fe 100644
--- a/lite/Changes
+++ b/lite/Changes
@@ -5,6 +5,8 @@
- Updated Flyway (margaretha)
21/01/2021
- Fixed running pipe and updated tests with mockserver (margaretha)
+19/02/2021
+ - Enabled API info web-service (margaretha)
# version 0.62.4
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/InfoControllerTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/InfoControllerTest.java
new file mode 100644
index 0000000..53a76b4
--- /dev/null
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/InfoControllerTest.java
@@ -0,0 +1,44 @@
+package de.ids_mannheim.korap.web.service;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.ClientResponse.Status;
+
+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.utils.JsonUtils;
+import de.ids_mannheim.korap.utils.ServiceInfo;
+
+public class InfoControllerTest extends LiteJerseyTest {
+
+ @Autowired
+ private KustvaktConfiguration config;
+
+ @Test
+ public void testInfo () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION).path("info")
+ .get(ClientResponse.class);
+
+ assertEquals(Status.OK.getStatusCode(), response.getStatus());
+
+ String entity = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(entity);
+ assertEquals(config.getCurrentVersion(),
+ node.at("/latest_api_version").asText());
+ assertEquals(config.getSupportedVersions().size(),
+ node.at("/supported_api_versions").size());
+
+ assertEquals(ServiceInfo.getInfo().getVersion(),
+ node.at("/kustvakt_version").asText());
+ assertEquals(ServiceInfo.getInfo().getKrillVersion(),
+ node.at("/krill_version").asText());
+ assertEquals(ServiceInfo.getInfo().getKoralVersion(),
+ node.at("/koral_version").asText());
+ }
+}