Added deprecation warning for the old matchInfo service (#757)
Change-Id: I07309f7dba50916bfff10ad6a75f9f73592ae7c3
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java
index 21f2155..454f9ae 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java
@@ -53,6 +53,23 @@
node.at("/errors/0/1").asText());
assertTrue(node.at("/snippet").isMissingNode());
}
+
+ @Test
+ public void testUsingDeprecatedMatchInfoService () throws KustvaktException {
+ Response response = target().path(API_VERSION).path("corpus")
+ .path("GOE").path("AGA").path("01784").path("p36-100")
+ .path("matchInfo")
+ .queryParam("foundry", "*").request().get();
+ assertEquals(Status.OK.getStatusCode(), response.getStatus());
+ String entity = response.readEntity(String.class);
+ JsonNode node = JsonUtils.readTree(entity);
+ assertEquals(StatusCodes.DEPRECATED,
+ node.at("/warnings/0/0").asInt());
+ assertEquals("This service is deprecated. Please use the following "
+ + "service URL instead: {version}/corpus/{corpusId}/{docId}/"
+ + "{textId}/{matchId}",
+ node.at("/warnings/0/1").asText());
+ }
@Test
public void testGetMatchInfoWithAuthentication () throws KustvaktException {
@@ -103,6 +120,7 @@
"kustvakt2015"))
.header(HttpHeaders.X_FORWARDED_FOR, "170.27.0.32").get();
JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
+
assertEquals(StatusCodes.AUTHORIZATION_FAILED,
node.at("/errors/0/0").asInt());
assertEquals(