Fixed supported versions in the configs & changed delimiter to comma.
Change-Id: I91f001dcee42ff8b86520a6dfecaa17a2d1cb6e1
diff --git a/src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java b/src/test/java/de/ids_mannheim/korap/web/APIVersionTest.java
similarity index 72%
rename from src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java
rename to src/test/java/de/ids_mannheim/korap/web/APIVersionTest.java
index 9e138fa..0c1dce0 100644
--- a/src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/APIVersionTest.java
@@ -3,10 +3,13 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.net.URI;
+import java.util.Set;
import org.eclipse.jetty.http.HttpStatus;
import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import de.ids_mannheim.korap.config.KustvaktConfiguration;
import de.ids_mannheim.korap.config.SpringJerseyTest;
import de.ids_mannheim.korap.exceptions.KustvaktException;
import jakarta.ws.rs.core.MediaType;
@@ -15,8 +18,11 @@
/**
* @author margaretha
*/
-public class ApiVersionTest extends SpringJerseyTest {
+public class APIVersionTest extends SpringJerseyTest {
+ @Autowired
+ private KustvaktConfiguration config;
+
@Test
public void testSearchWithoutVersion () throws KustvaktException {
Response response = target().path("api").path("search")
@@ -36,4 +42,13 @@
URI location = response.getLocation();
assertEquals("/api/" + API_VERSION + "/search", location.getPath());
}
+
+ @Test
+ public void testSupportedVersions () {
+ Set<String> versions = config.getSupportedVersions();
+ assertEquals(2, versions.size());
+
+ String version = versions.stream().findFirst().orElse("");
+ assertEquals(4, version.length());
+ }
}
diff --git a/src/test/resources/kustvakt-dnb.conf b/src/test/resources/kustvakt-dnb.conf
index c6dbdf1..54e0edf 100644
--- a/src/test/resources/kustvakt-dnb.conf
+++ b/src/test/resources/kustvakt-dnb.conf
@@ -21,9 +21,9 @@
# Kustvakt versions
#
-# multiple versions separated by space
+# multiple versions comma separated
current.api.version = v1.0
-supported.api.version = v0.1 v1.0
+supported.api.versions = v1.0
# Server
#
diff --git a/src/test/resources/kustvakt-icc.conf b/src/test/resources/kustvakt-icc.conf
index 965eb4c..354022e 100644
--- a/src/test/resources/kustvakt-icc.conf
+++ b/src/test/resources/kustvakt-icc.conf
@@ -13,9 +13,9 @@
ldap.config = src/test/resources/test-ldap.conf
# Kustvakt
-# multiple versions separated by space
+# multiple versions comma separated
current.api.version = v1.0
-supported.api.version = v0.1 v1.0
+supported.api.versions = v1.0
# server
server.port=8089
diff --git a/src/test/resources/kustvakt-test.conf b/src/test/resources/kustvakt-test.conf
index eb94008..f10d3e8 100644
--- a/src/test/resources/kustvakt-test.conf
+++ b/src/test/resources/kustvakt-test.conf
@@ -19,9 +19,9 @@
# Kustvakt versions
#
-# multiple versions separated by space
+# multiple versions comma separated
current.api.version = v1.0
-supported.api.version = v0.1 v1.0
+supported.api.versions = v0.1, v1.0
# Server
#