Jersey 2: Use WebTarget.request() where necessary
When building a client request, the method WebTarget.request() must be used
to make a builder that provides the following methods:
- accept()
- header()
- method()
- get()
- post()
- put()
- delete()
Reference: https://jakartaee.github.io/rest/apidocs/2.1.6/javax/ws/rs/client/WebTarget.html#request()
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java b/core/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
index 7ff806d..8bf4d7f 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
@@ -31,7 +31,7 @@
public String getResponse (String path, String key, Object value)
throws KustvaktException {
try {
- return service.path(path).queryParam(key, value).get(String.class);
+ return service.path(path).queryParam(key, value).request().get(String.class);
}
catch (UniformInterfaceException e) {
throw new KustvaktException(StatusCodes.REQUEST_INVALID);
@@ -49,7 +49,7 @@
for (String value : e.getValue())
resource = resource.queryParam(e.getKey(), value);
}
- return resource.get(String.class);
+ return resource.request().get(String.class);
}
catch (UniformInterfaceException e) {
throw new KustvaktException(StatusCodes.REQUEST_INVALID);
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
index 84d27eb..5a9f19a 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
@@ -84,6 +84,7 @@
.queryParam("r", String.valueOf(random.nextDouble()))
.queryParam("action_name",
request.getUriInfo().getRequestUri().toASCIIString())
+ .request()
.accept("text/html")
.header("Host", request.getHeaderString("Host"))
.header("User-Agent", request.getHeaderString("User-Agent"))
diff --git a/full/src/test/java/de/ids_mannheim/korap/authentication/AuthenticationFilterTest.java b/full/src/test/java/de/ids_mannheim/korap/authentication/AuthenticationFilterTest.java
index 37db9b4..449268b 100644
--- a/full/src/test/java/de/ids_mannheim/korap/authentication/AuthenticationFilterTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/authentication/AuthenticationFilterTest.java
@@ -19,6 +19,7 @@
throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=die]").queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION, "Blah blah")
.get(ClientResponse.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java b/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java
index 48f6193..5e531e4 100644
--- a/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java
+++ b/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java
@@ -128,6 +128,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("register")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
.entity(json).post(ClientResponse.class);
@@ -152,6 +153,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("register")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
.entity(json).post(ClientResponse.class);
@@ -173,6 +175,7 @@
.queryParam("response_type", "code")
.queryParam("client_id", clientId)
.queryParam("client_secret", clientSecret)
+ .request()
.header(Attributes.AUTHORIZATION, authHeader)
.get(ClientResponse.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java
index ce2f6ad..4d91607 100644
--- a/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java
@@ -51,6 +51,7 @@
String pathUsername = "~" + username;
ClientResponse response = resource().path(API_VERSION)
.path(pathUsername).path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.type(MediaType.APPLICATION_JSON).entity(json)
@@ -61,6 +62,7 @@
// search
response = resource().path(API_VERSION).path("search")
.queryParam("q", "[pos=ADJA]").queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/rewrite/QueryRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/QueryRewriteTest.java
index dd7e295..6f22b3a 100644
--- a/full/src/test/java/de/ids_mannheim/korap/rewrite/QueryRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/QueryRewriteTest.java
@@ -26,6 +26,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]{%23examplequery} Baum")
.queryParam("ql", "poliqarp")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -41,6 +42,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]{%23system-q} Baum")
.queryParam("ql", "poliqarp")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -56,6 +58,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]{%23dory/dory-q} Baum")
.queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.get(ClientResponse.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
index 4d2f684..f0b771e 100644
--- a/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
@@ -45,6 +45,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo named-vc1")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -70,6 +71,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"system/named-vc1\"")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -90,6 +92,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"system-vc\"")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -115,6 +118,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"system/system-vc\"")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("user", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -140,6 +144,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "Fisch").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"dory/dory-vc\"")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.get(ClientResponse.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java b/full/src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java
index 87d62ad..e5f9eb9 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java
@@ -24,6 +24,7 @@
public void testSearchWithoutVersion () throws KustvaktException {
ClientResponse response = resource().path("api").path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
+ .request()
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
URI location = response.getLocation();
@@ -34,7 +35,9 @@
public void testSearchWrongVersion () throws KustvaktException {
ClientResponse response = resource().path("api").path("v0.2")
.path("search").queryParam("q", "[orth=der]")
- .queryParam("ql", "poliqarp").accept(MediaType.APPLICATION_JSON)
+ .queryParam("ql", "poliqarp")
+ .request()
+ .accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
URI location = response.getLocation();
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/AnnotationControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/AnnotationControllerTest.java
index ae52237..caec944 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/AnnotationControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/AnnotationControllerTest.java
@@ -21,7 +21,9 @@
@Test
public void testAnnotationLayers () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION)
- .path("annotation").path("layers").get(ClientResponse.class);
+ .path("annotation").path("layers")
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode n = JsonUtils.readTree(entity);
@@ -41,6 +43,7 @@
resource().path(API_VERSION).path("annotation")
.path("description").type(MediaType.APPLICATION_JSON)
.entity("{\"codes\":[\"opennlp/*\"], \"language\":\"en\"}")
+ .request()
.post(ClientResponse.class);
String entity = response.getEntity(String.class);
@@ -68,6 +71,7 @@
resource().path(API_VERSION).path("annotation")
.path("description").type(MediaType.APPLICATION_JSON)
.entity("{\"codes\":[\"mate/m\"], \"language\":\"en\"}")
+ .request()
.post(ClientResponse.class);
String entity = response.getEntity(String.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java
index d5f4aeb..80bd635 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java
@@ -36,6 +36,7 @@
credentials[0], credentials[1]);
ClientResponse response = resource().path("auth")
.path("sessionToken").header(Attributes.AUTHORIZATION, auth)
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -53,6 +54,7 @@
response = resource().path("user")
.path("info").header(Attributes.AUTHORIZATION, token_type + " "+ token)
+ .request()
.get(ClientResponse.class);
en = response.getEntity(String.class);
@@ -60,7 +62,9 @@
response.getStatus());
response = resource().path("auth")
- .path("logout").header(Attributes.AUTHORIZATION, token_type + " "+ token)
+ .path("logout")
+ .request()
+ .header(Attributes.AUTHORIZATION, token_type + " "+ token)
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -73,6 +77,7 @@
credentials[0], credentials[1]);
ClientResponse response = resource().path("auth")
.path("sessionToken").header(Attributes.AUTHORIZATION, auth)
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -92,7 +97,9 @@
break;
}
response = resource().path("user")
- .path("info").header(Attributes.AUTHORIZATION, token_type + " "+ token)
+ .path("info")
+ .request()
+ .header(Attributes.AUTHORIZATION, token_type + " "+ token)
.get(ClientResponse.class);
en = response.getEntity(String.class);
node = JsonUtils.readTree(en);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java
index 6d3816f..6e49b48 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java
@@ -140,6 +140,7 @@
private ClientResponse searchQuery (String collectionQuery) {
return resource().path(API_VERSION).path("search").queryParam("q", "[orth=das]")
.queryParam("ql", "poliqarp").queryParam("cq", collectionQuery)
+ .request()
.get(ClientResponse.class);
}
@@ -149,6 +150,7 @@
KustvaktException {
return resource().path(API_VERSION).path("search").queryParam("q", "[orth=das]")
.queryParam("ql", "poliqarp").queryParam("cq", collectionQuery)
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/FreeResourceControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/FreeResourceControllerTest.java
index 1d9ad73..d684c94 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/FreeResourceControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/FreeResourceControllerTest.java
@@ -18,7 +18,9 @@
@Test
public void testResource () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION)
- .path("resource").get(ClientResponse.class);
+ .path("resource")
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode n = JsonUtils.readTree(entity).get(0);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/IndexControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/IndexControllerTest.java
index ceaf422..80587f6 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/IndexControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/IndexControllerTest.java
@@ -62,6 +62,7 @@
ClientResponse response = resource().path(API_VERSION).path("index")
.path("close").type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.post(ClientResponse.class, m);
assertEquals(HttpStatus.SC_OK, response.getStatus());
@@ -74,12 +75,14 @@
response = resource().path(API_VERSION).path("vc").path("~system")
.path("named-vc1")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("admin", "pass"))
.delete(ClientResponse.class);
response = resource().path(API_VERSION).path("vc").path("~system")
.path("named-vc1")
+ .request()
.get(ClientResponse.class);
String entity = response.getEntity(String.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/InfoControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/InfoControllerTest.java
index 68b7f3b..a1a83b7 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/InfoControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/InfoControllerTest.java
@@ -27,6 +27,7 @@
@Test
public void testInfo () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("info")
+ .request()
.get(ClientResponse.class);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java
index 6209b23..cd62baf 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java
@@ -25,6 +25,7 @@
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGA").path("01784").path("p36-100")
.path("matchInfo").queryParam("foundry", "*")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -48,6 +49,7 @@
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGI").path("04846").path("p36875-36876")
.path("matchInfo").queryParam("foundry", "*")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
@@ -69,6 +71,7 @@
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGI").path("04846").path("p36875-36876")
.path("matchInfo").queryParam("foundry", "*")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -99,6 +102,7 @@
public void testAvailabilityAll () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGD").path("00000").path("p75-76")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -114,6 +118,7 @@
public void testAvailabilityAllUnauthorized () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGD").path("00000").path("p75-76")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/MetadataControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/MetadataControllerTest.java
index 661cad1..5d6ddeb 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/MetadataControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/MetadataControllerTest.java
@@ -23,7 +23,9 @@
public void testRetrieveMetadataWithField () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGA").path("01784")
- .queryParam("fields", "author").get(ClientResponse.class);
+ .queryParam("fields", "author")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -38,7 +40,9 @@
public void testRetrieveMetadataWithMultipleFields () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGA").path("01784")
- .queryParam("fields", "author,title").get(ClientResponse.class);
+ .queryParam("fields", "author,title")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -54,6 +58,7 @@
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGA").path("01784")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -72,6 +77,7 @@
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGI").path("04846")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
@@ -91,6 +97,7 @@
public void testMetadataWithAuthentication () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGI").path("04846")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -106,6 +113,7 @@
public void testMetadataAvailabilityAll () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGI").path("00000")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -124,6 +132,7 @@
throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("corpus")
.path("GOE").path("AGD").path("00000")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/MultipleCorpusQueryTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/MultipleCorpusQueryTest.java
index 1692fdc..6f2a5f0 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/MultipleCorpusQueryTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/MultipleCorpusQueryTest.java
@@ -23,6 +23,7 @@
.queryParam("q", "das").queryParam("ql", "poliqarp")
.queryParam("cq", "pubPlace=München")
.queryParam("cq", "textSigle=\"GOE/AGA/01784\"")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -47,6 +48,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("statistics").queryParam("cq", "textType=Abhandlung")
.queryParam("cq", "corpusSigle=GOE")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -68,6 +70,7 @@
resource().path(API_VERSION).path("statistics")
.queryParam("corpusQuery", "textType=Autobiographie")
.queryParam("corpusQuery", "corpusSigle=GOE")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AccessTokenTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AccessTokenTest.java
index 2473d21..d7b11a5 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AccessTokenTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AccessTokenTest.java
@@ -53,6 +53,7 @@
// test list user group
response = resource().path(API_VERSION).path("group")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
.get(ClientResponse.class);
@@ -83,6 +84,7 @@
// test list vc using the token
response = resource().path(API_VERSION).path("vc")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer " + token)
.get(ClientResponse.class);
@@ -108,6 +110,7 @@
private void testScopeNotAuthorized (String accessToken)
throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
.get(ClientResponse.class);
@@ -125,6 +128,7 @@
throws KustvaktException {
ClientResponse response =
resource().path(API_VERSION).path("vc").path("access")
+ .request()
.header(Attributes.AUTHORIZATION,
"Bearer " + accessToken)
.get(ClientResponse.class);
@@ -170,6 +174,7 @@
form.add("client_secret", "secret");
ClientResponse response = resource().path(API_VERSION).path("oauth2").path("revoke")
+ .request()
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
.entity(form).post(ClientResponse.class);
@@ -211,6 +216,7 @@
form.add("refresh_token", refreshToken);
ClientResponse response = resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java
index 789c2d9..7049ad6 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java
@@ -49,6 +49,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("admin").path("client").path("privilege")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.CONTENT_TYPE,
@@ -85,7 +86,9 @@
assertTrue(accessTokensBefore > 0);
resource().path(API_VERSION).path("oauth2").path("admin").path("token")
- .path("clean").header(Attributes.AUTHORIZATION, adminAuthHeader)
+ .path("clean")
+ .request()
+ .header(Attributes.AUTHORIZATION, adminAuthHeader)
.get(ClientResponse.class);
assertEquals(0, refreshDao.retrieveInvalidRefreshTokens().size());
@@ -110,7 +113,9 @@
assertEquals(accessTokensAfter, accessTokensBefore + 1);
resource().path(API_VERSION).path("oauth2").path("admin").path("token")
- .path("clean").header(Attributes.AUTHORIZATION, adminAuthHeader)
+ .path("clean")
+ .request()
+ .header(Attributes.AUTHORIZATION, adminAuthHeader)
.get(ClientResponse.class);
assertEquals(0, accessDao.retrieveInvalidAccessTokens().size());
@@ -150,6 +155,7 @@
// list vc
ClientResponse response = resource().path(API_VERSION).path("vc")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
.get(ClientResponse.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AuthorizationPostTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AuthorizationPostTest.java
index 7501798..f58126d 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AuthorizationPostTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AuthorizationPostTest.java
@@ -39,6 +39,7 @@
throws KustvaktException {
return resource().path(API_VERSION).path("oauth2").path("authorize")
+ .request()
.header(Attributes.AUTHORIZATION, authHeader)
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
index 02b9ba1..d52bba7 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
@@ -360,6 +360,7 @@
response = resource().path(API_VERSION).path("oauth2").path("client")
.path("register")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
.entity(clientJson).post(ClientResponse.class);
@@ -384,6 +385,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("register")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username,
@@ -503,6 +505,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("deregister").path(clientId)
+ .request()
.delete(ClientResponse.class);
assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -519,6 +522,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("deregister")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.delete(ClientResponse.class);
@@ -533,6 +537,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("deregister").path(clientId)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.delete(ClientResponse.class);
@@ -548,6 +553,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("reset")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.CONTENT_TYPE,
@@ -571,6 +577,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("reset")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.CONTENT_TYPE,
@@ -596,6 +603,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("list")
+ .request()
.header(Attributes.AUTHORIZATION, userAuthHeader)
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
@@ -777,6 +785,7 @@
response = resource().path(API_VERSION).path("oauth2").path("revoke")
.path("super").path("all")
+ .request()
.header(Attributes.AUTHORIZATION, userAuthHeader)
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java
index 82caebe..38ed47c 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java
@@ -500,6 +500,7 @@
ClientResponse response =
resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.AUTHORIZATION,
"Basic ZkNCYlFrQXlZekk0TnpVeE1nOnNlY3JldA==")
.header(HttpHeaders.CONTENT_TYPE,
@@ -531,6 +532,7 @@
ClientResponse response =
resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.AUTHORIZATION,
"Basic ZkNCYlFrQXlZekk0TnpVeE1nOnNlY3JldA==")
.header(HttpHeaders.CONTENT_TYPE,
@@ -663,6 +665,7 @@
ClientResponse response =
resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
@@ -689,6 +692,7 @@
ClientResponse response =
resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
@@ -709,6 +713,7 @@
ClientResponse response =
resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
@@ -746,6 +751,7 @@
ClientResponse response =
resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
@@ -766,6 +772,7 @@
ClientResponse response =
resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
@@ -789,6 +796,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("token").path("list")
+ .request()
.header(Attributes.AUTHORIZATION, userAuthHeader)
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2OpenIdControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2OpenIdControllerTest.java
index da625bd..0f83a0e 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2OpenIdControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2OpenIdControllerTest.java
@@ -55,6 +55,7 @@
private ClientResponse sendAuthorizationRequest (
MultivaluedMap<String, String> form) throws KustvaktException {
return resource().path(API_VERSION).path("oauth2").path("openid").path("authorize")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username,
@@ -68,6 +69,7 @@
private ClientResponse sendTokenRequest (
MultivaluedMap<String, String> form) throws KustvaktException {
return resource().path(API_VERSION).path("oauth2").path("openid").path("token")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
@@ -400,7 +402,9 @@
@Test
public void testPublicKeyAPI () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("oauth2").path("openid")
- .path("jwks").get(ClientResponse.class);
+ .path("jwks")
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(entity);
assertEquals(1, node.at("/keys").size());
@@ -414,7 +418,9 @@
@Test
public void testOpenIDConfiguration () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("oauth2").path("openid")
- .path("config").get(ClientResponse.class);
+ .path("config")
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(entity);
assertNotNull(node.at("/issuer"));
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java
index 7e3b093..bbc6cf7 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java
@@ -162,6 +162,7 @@
form.add("super_client_id", confidentialClientId);
ClientResponse response = resource().path(API_VERSION).path("plugins")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.CONTENT_TYPE,
@@ -182,6 +183,7 @@
throws UniformInterfaceException, ClientHandlerException,
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("plugins")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.CONTENT_TYPE,
@@ -204,6 +206,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("plugins")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer blahblah")
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
@@ -243,6 +246,7 @@
form.add("permitted_only", Boolean.toString(permitted_only));
}
ClientResponse response = resource().path(API_VERSION).path("plugins")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.CONTENT_TYPE,
@@ -413,6 +417,7 @@
throws UniformInterfaceException, ClientHandlerException,
KustvaktException {
return resource().path(API_VERSION).path("plugins").path("install")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.CONTENT_TYPE,
@@ -428,6 +433,7 @@
form.add("client_id", clientId);
return resource().path(API_VERSION).path("plugins").path("uninstall")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.CONTENT_TYPE,
@@ -514,6 +520,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("plugins")
.path("installed")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.CONTENT_TYPE,
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java
index 9b3d506..452066c 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java
@@ -101,7 +101,7 @@
request = request.queryParam("state", state);
}
- return request.header(Attributes.AUTHORIZATION, authHeader)
+ return request.request().header(Attributes.AUTHORIZATION, authHeader)
.get(ClientResponse.class);
}
@@ -135,6 +135,7 @@
protected ClientResponse requestToken (MultivaluedMap<String, String> form)
throws KustvaktException {
return resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
@@ -153,6 +154,7 @@
form.add("code", code);
return resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
.entity(form).post(ClientResponse.class);
@@ -172,6 +174,7 @@
}
return resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
.entity(form).post(ClientResponse.class);
@@ -187,7 +190,9 @@
form.add("code", code);
ClientResponse response = resource().path(API_VERSION).path("oauth2")
- .path("token").header(Attributes.AUTHORIZATION, authHeader)
+ .path("token")
+ .request()
+ .header(Attributes.AUTHORIZATION, authHeader)
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
.entity(form).post(ClientResponse.class);
@@ -228,6 +233,7 @@
ClientResponse response =
resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
@@ -245,6 +251,7 @@
ClientHandlerException, KustvaktException {
return resource().path(API_VERSION).path("oauth2").path("client")
.path("register")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username,
@@ -295,6 +302,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("deregister").path(clientId)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.delete(ClientResponse.class);
@@ -307,6 +315,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path(clientId)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.get(ClientResponse.class);
@@ -320,6 +329,7 @@
protected ClientResponse searchWithAccessToken (String accessToken) {
return resource().path(API_VERSION).path("search")
.queryParam("q", "Wasser").queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.get(ClientResponse.class);
@@ -360,6 +370,7 @@
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("revoke").path("super")
+ .request()
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
.header(Attributes.AUTHORIZATION, userAuthHeader).entity(form)
@@ -381,6 +392,7 @@
ClientResponse response =
resource().path(API_VERSION).path("oauth2").path("revoke")
+ .request()
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
.entity(form).post(ClientResponse.class);
@@ -394,6 +406,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("oauth2")
.path("client").path("list")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pwd"))
.header(HttpHeaders.CONTENT_TYPE,
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java
index 5c20c5e..d8c67a5 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java
@@ -33,6 +33,7 @@
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~" + queryCreator).path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.get(ClientResponse.class);
@@ -59,6 +60,7 @@
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~"+qCreator).path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -79,6 +81,7 @@
String qName = "new_query";
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~" + testUser).path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -103,6 +106,7 @@
String qName = "publish_query";
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~" + testUser).path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -127,6 +131,7 @@
String qName = "marlin-query";
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~marlin").path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -150,6 +155,7 @@
String qName = "system-query";
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~system").path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -172,6 +178,7 @@
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~"+testUser).path("system-query")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -196,6 +203,7 @@
String qName = "new_query";
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~" + testUser).path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -217,6 +225,7 @@
String qName = "new_query";
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~" + testUser).path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -240,6 +249,7 @@
String qName = "new_query";
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~" + testUser).path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -262,6 +272,7 @@
String qName = "new_query";
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~" + testUser).path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -280,6 +291,7 @@
throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~" + qCreator).path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.delete(ClientResponse.class);
@@ -291,6 +303,7 @@
public void testDeleteQueryUnauthorized () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~dory").path("dory-q")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.delete(ClientResponse.class);
@@ -308,6 +321,7 @@
private void testDeleteSystemQueryUnauthorized (String qName) throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~system").path(qName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.delete(ClientResponse.class);
@@ -326,6 +340,7 @@
public void testDeleteNonExistingQuery () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("query")
.path("~dory").path("non-existing-query")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.delete(ClientResponse.class);
@@ -372,6 +387,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("query")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java
index 198a1cb..2d872ee 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java
@@ -36,6 +36,7 @@
.path("corpus/WPD13/query").queryParam("q", "[orth=der]")
.queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -54,6 +55,7 @@
ClientResponse response = resource().path(API_VERSION).path("corpus/ZUW19/query")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("context", "base/s:s")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
response.getStatus());
@@ -72,6 +74,7 @@
.path("corpus/BRZ10/query").queryParam("q", "[orth=der]")
.queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
response.getStatus());
@@ -90,6 +93,7 @@
.path("corpus/BRZ10/query").queryParam("q", "[orth=der]")
.queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -117,6 +121,7 @@
"creationDate since 1775 & corpusSigle=GOE")
.queryParam("name", "Weimarer Werke")
.queryParam("description", "Goethe-Werke in Weimar (seit 1775)")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -136,6 +141,7 @@
response = resource().path(API_VERSION)
.path("collection")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -163,6 +169,7 @@
.path("collection").path(id).path("query")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("context", "base/s:s")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -202,6 +209,7 @@
.path("collection/GOE-VC/query").queryParam("q", "[orth=der]")
.queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -231,6 +239,7 @@
.queryParam("count", "20").queryParam("page", "5")
.queryParam("cutoff", "true").queryParam("q", "[pos=ADJA]")
.queryParam("ql", "poliqarp")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(response.getStatus(),
ClientResponse.Status.OK.getStatusCode());
@@ -259,6 +268,7 @@
.queryParam("count", "20").queryParam("page", "5")
.queryParam("offset", "2").queryParam("cutoff", "true")
.queryParam("q", "[pos=ADJA]").queryParam("ql", "poliqarp")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(response.getStatus(),
ClientResponse.Status.OK.getStatusCode());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java
index 3e38c9a..11e8976 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java
@@ -28,7 +28,9 @@
@Test
public void testGetPublicVirtualCollectionInfo () throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
- .path("collection").get(ClientResponse.class);
+ .path("collection")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
String entity = response.getEntity(String.class);
@@ -43,6 +45,7 @@
throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
.path("collection")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -61,7 +64,9 @@
@Test
public void testGetVirtualCollectionInfoById () throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
- .path("collection").path("GOE-VC").get(ClientResponse.class);
+ .path("collection").path("GOE-VC")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
@@ -77,7 +82,9 @@
public void testGetVirtualCollectionInfoByIdUnauthorized ()
throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
- .path("collection").path("WPD15-VC").get(ClientResponse.class);
+ .path("collection").path("WPD15-VC")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
@@ -93,7 +100,9 @@
@Test
public void testGetPublicCorporaInfo () throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
- .path("corpus").get(ClientResponse.class);
+ .path("corpus")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
@@ -107,7 +116,9 @@
@Test
public void testGetCorpusInfoById () throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
- .path("corpus").path("WPD13").get(ClientResponse.class);
+ .path("corpus").path("WPD13")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -123,7 +134,9 @@
@Test
public void testGetCorpusInfoById2 () throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
- .path("corpus").path("GOE").get(ClientResponse.class);
+ .path("corpus").path("GOE")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
@@ -137,7 +150,9 @@
@Test
public void testGetPublicFoundriesInfo () throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
- .path("foundry").get(ClientResponse.class);
+ .path("foundry")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
@@ -151,7 +166,9 @@
@Test
public void testGetFoundryInfoById () throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
- .path("foundry").path("tt").get(ClientResponse.class);
+ .path("foundry").path("tt")
+ .request()
+ .get(ClientResponse.class);
String ent = response.getEntity(String.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -165,7 +182,9 @@
@Test
public void testGetUnexistingCorpusInfo () throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
- .path("corpus").path("ZUW19").get(ClientResponse.class);
+ .path("corpus").path("ZUW19")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
@@ -185,7 +204,9 @@
@Test
public void testGetUnauthorizedCorpusInfo () throws KustvaktException {
ClientResponse response = resource().path(getAPIVersion())
- .path("corpus").path("BRZ10").get(ClientResponse.class);
+ .path("corpus").path("BRZ10")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java
index 5b6cdb2..facf1b0 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java
@@ -40,6 +40,7 @@
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("fields", fields)
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -59,6 +60,7 @@
@Test
public void testApiWelcomeMessage () {
ClientResponse response = resource().path(API_VERSION).path("")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -91,6 +93,7 @@
public void testSearchQueryPublicCorpora () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
+ .request()
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -111,7 +114,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der").queryParam("ql", "poliqarp")
.queryParam("cq", "corpusSigle=WPD | corpusSigle=GOE")
- .queryParam("count", "13").accept(MediaType.APPLICATION_JSON)
+ .queryParam("count", "13")
+ .request()
+ .accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
response.getStatus());
@@ -132,6 +137,7 @@
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cutoff", "true").queryParam("count", "5")
.queryParam("page", "1").queryParam("context", "40-t,30-t")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -151,6 +157,7 @@
public void testSearchQueryFreeExtern () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=die]").queryParam("ql", "poliqarp")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -172,6 +179,7 @@
public void testSearchQueryFreeIntern () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=die]").queryParam("ql", "poliqarp")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "172.27.0.32")
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -193,6 +201,7 @@
public void testSearchQueryExternAuthorized () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=die]").queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -224,6 +233,7 @@
public void testSearchQueryInternAuthorized () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=die]").queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -261,6 +271,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("cq", "textClass=politik & corpusSigle=BRZ10")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -291,6 +302,7 @@
public void testSearchQueryAuthorizedWithoutIP () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=die]").queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("kustvakt",
@@ -316,6 +328,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=die]").queryParam("ql", "poliqarp")
.queryParam("page", "0")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
response.getStatus());
@@ -329,7 +342,9 @@
public void testSearchSentenceMeta () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("context", "sentence").get(ClientResponse.class);
+ .queryParam("context", "sentence")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
@@ -347,6 +362,7 @@
s.setQuery("(der) or (das)", "CQL");
ClientResponse response = resource().path(API_VERSION).path("search")
+ .request()
.post(ClientResponse.class, s.toJSON());
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -363,6 +379,7 @@
@Ignore
public void testSearchRawQuery () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
+ .request()
.post(ClientResponse.class, createJsonQuery());
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -381,6 +398,7 @@
@Ignore
public void testSearchPostAll () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "10.27.0.32")
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
@@ -404,6 +422,7 @@
@Ignore
public void testSearchPostPublic () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchNetworkEndpointTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchNetworkEndpointTest.java
index 27e6695..51c3eab 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchNetworkEndpointTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchNetworkEndpointTest.java
@@ -77,7 +77,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("engine", "network").get(ClientResponse.class);
+ .queryParam("engine", "network")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -95,7 +97,9 @@
config.setNetworkEndpointURL("http://localhost:1040/search");
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("engine", "network").get(ClientResponse.class);
+ .queryParam("engine", "network")
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(entity);
@@ -111,7 +115,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("engine", "network").get(ClientResponse.class);
+ .queryParam("engine", "network")
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(entity);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java
index 2d95b19..3940708 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java
@@ -113,7 +113,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", glemmUri).get(ClientResponse.class);
+ .queryParam("pipes", glemmUri)
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -159,7 +161,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", glemmUri).get(ClientResponse.class);
+ .queryParam("pipes", glemmUri)
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(entity);
@@ -184,6 +188,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("pipes", glemmUri + "," + glemmUri2)
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -201,7 +206,9 @@
resource().getURI().toString() + API_VERSION + "/test/tralala";
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", url).get(ClientResponse.class);
+ .queryParam("pipes", url)
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -216,7 +223,9 @@
public void testSearchWithUnknownHost () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", "http://glemm").get(ClientResponse.class);
+ .queryParam("pipes", "http://glemm")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -238,7 +247,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", pipeUri).get(ClientResponse.class);
+ .queryParam("pipes", pipeUri)
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -257,6 +268,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("pipes", url + "," + "http://glemm")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -291,7 +303,9 @@
String pipeUri = "http://localhost:"+port+"/invalid-response";
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", pipeUri).get(ClientResponse.class);
+ .queryParam("pipes", pipeUri)
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
@@ -315,7 +329,9 @@
String pipeUri = "http://localhost:"+port+"/plain-text";
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", pipeUri).get(ClientResponse.class);
+ .queryParam("pipes", pipeUri)
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
@@ -344,6 +360,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("pipes", "http://unknown" + "," + glemmUri)
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -357,6 +374,7 @@
response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("pipes", glemmUri + ",http://unknown")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java
index 3050ff6..def3be9 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java
@@ -24,6 +24,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "Sonne").queryParam("ql", "poliqarp")
.queryParam("access-rewrite-disabled", "true")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -41,6 +42,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "Sonne").queryParam("ql", "poliqarp")
.queryParam("access-rewrite-disabled", "true")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -60,6 +62,7 @@
.queryParam("q", "Sonne").queryParam("ql", "poliqarp")
.queryParam("fields", "author,title")
.queryParam("access-rewrite-disabled", "true")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -83,6 +86,7 @@
.queryParam("q", "Sonne").queryParam("ql", "poliqarp")
.queryParam("fields", "author,title,snippet")
.queryParam("access-rewrite-disabled", "true")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -111,6 +115,7 @@
s.setMeta(meta);
ClientResponse response = resource().path(API_VERSION).path("search")
+ .request()
.post(ClientResponse.class, s.toJSON());
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -130,6 +135,7 @@
.queryParam("q", "Sonne").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo system-vc")
.queryParam("access-rewrite-disabled", "true")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -164,6 +170,7 @@
.queryParam("q", "Sonne").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"dory/dory-vc\"")
.queryParam("access-rewrite-disabled", "true")
+ .request()
.get(ClientResponse.class);
String entity = response.getEntity(String.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchTokenSnippetTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchTokenSnippetTest.java
index c04f8a2..49a5b9d 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchTokenSnippetTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchTokenSnippetTest.java
@@ -22,6 +22,7 @@
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("show-tokens", "true")
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -42,6 +43,7 @@
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("show-tokens", "false")
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -61,6 +63,7 @@
.queryParam("access-rewrite-disabled", "true")
.queryParam("show-tokens", "true")
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java
index 9d9e2c3..6e8e0e4 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java
@@ -53,6 +53,7 @@
public void loginHTTP() throws KustvaktException {
String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
ClientResponse response = resource().path("user").path("info")
+ .request()
.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
}
@@ -64,6 +65,7 @@
String en = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
/* lauffähige Version von Hanl: */
ClientResponse response = resource().path("auth").path("apiToken")
+ .request()
.header(Attributes.AUTHORIZATION, en).get(ClientResponse.class);
/**/
/*
@@ -93,6 +95,7 @@
String en = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
ClientResponse response = resource().path("auth").path("apiToken")
+ .request()
.header(Attributes.AUTHORIZATION, en).get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
@@ -112,6 +115,7 @@
}
response = resource().path("user").path("info")
+ .request()
.header(Attributes.AUTHORIZATION, "api_token " + token).get(ClientResponse.class);
assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -121,6 +125,7 @@
public void testGetUserDetails() throws KustvaktException {
String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
ClientResponse response = resource().path("user").path("details")
+ .request()
.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
}
@@ -132,11 +137,13 @@
m.put("test", "[100, \"error message\", true, \"another message\"]");
ClientResponse response = resource().path("user").path("details")
+ .request()
.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
.post(ClientResponse.class, m);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
response = resource().path("user").path("details").queryParam("pointer", "test")
+ .request()
.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
String ent = response.getEntity(String.class);
@@ -150,11 +157,14 @@
m.put("test", "test value 1");
ClientResponse response = resource().path("user").path("details")
+ .request()
.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
.post(ClientResponse.class, m);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
- response = resource().path("user").path("details").header(Attributes.AUTHORIZATION, enc)
+ response = resource().path("user").path("details")
+ .request()
+ .header(Attributes.AUTHORIZATION, enc)
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
String ent = response.getEntity(String.class);
@@ -169,7 +179,10 @@
public void testGetUserDetailsPointer() throws KustvaktException {
String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
ClientResponse response = resource().path("user").path("details")
- .queryParam("pointer", "email").header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
+ .queryParam("pointer", "email")
+ .request()
+ .header(Attributes.AUTHORIZATION, enc)
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
String ent = response.getEntity(String.class);
assertEquals("test@ids-mannheim.de", ent);
@@ -181,6 +194,7 @@
String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue("userservicetest", "servicepass");
ClientResponse response = resource().path("user").path("details")
+ .request()
.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
String entity = response.getEntity(String.class);
@@ -194,6 +208,7 @@
public void testGetUserSettings() throws KustvaktException {
String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
ClientResponse response = resource().path("user").path("settings")
+ .request()
.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
}
@@ -207,11 +222,14 @@
m.put("email", "newtest@ids-mannheim.de");
ClientResponse response = resource().path("user").path("details")
+ .request()
.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
.post(ClientResponse.class, m);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
- response = resource().path("user").path("details").header(Attributes.AUTHORIZATION, enc)
+ response = resource().path("user").path("details")
+ .request()
+ .header(Attributes.AUTHORIZATION, enc)
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
@@ -227,7 +245,9 @@
m.put("lastName", "user");
m.put("email", "test@ids-mannheim.de");
- response = resource().path("user").path("details").header(Attributes.AUTHORIZATION, enc)
+ response = resource().path("user").path("details")
+ .request()
+ .header(Attributes.AUTHORIZATION, enc)
.header("Content-Type", MediaType.APPLICATION_JSON).post(ClientResponse.class, m);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
}
@@ -241,6 +261,7 @@
m.putSingle("pageLength", "200");
ClientResponse response = resource().path("user").path("settings")
+ .request()
.header(Attributes.AUTHORIZATION, enc).header("Content-Type", "application/x-www-form-urlencodeBase64d")
.get(ClientResponse.class);
@@ -254,11 +275,15 @@
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
- response = resource().path("user").path("settings").header(Attributes.AUTHORIZATION, enc)
- .header("Content-Type", "application/x-www-form-urlencodeBase64d").post(ClientResponse.class, m);
+ response = resource().path("user").path("settings")
+ .request()
+ .header(Attributes.AUTHORIZATION, enc)
+ .header("Content-Type", "application/x-www-form-urlencodeBase64d")
+ .post(ClientResponse.class, m);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
response = resource().path("user").path("settings").header(Attributes.AUTHORIZATION, enc)
+ .request()
.header("Content-Type", "application/x-www-form-urlencodeBase64d").get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
@@ -280,6 +305,7 @@
m.put("setting_1", "value_1");
ClientResponse response = resource().path("user").path("settings")
+ .request()
.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
@@ -293,11 +319,16 @@
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
- response = resource().path("user").path("settings").header(Attributes.AUTHORIZATION, enc)
- .header("Content-Type", MediaType.APPLICATION_JSON).post(ClientResponse.class, m);
+ response = resource().path("user").path("settings")
+ .request()
+ .header(Attributes.AUTHORIZATION, enc)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .post(ClientResponse.class, m);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
- response = resource().path("user").path("settings").header(Attributes.AUTHORIZATION, enc)
+ response = resource().path("user").path("settings")
+ .request()
+ .header(Attributes.AUTHORIZATION, enc)
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java
index 3ca0e68..490f072 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java
@@ -31,6 +31,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
.queryParam("corpusQuery", corpusQuery)
+ .request()
.get(ClientResponse.class);
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
@@ -51,6 +52,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
.queryParam("cq", "textType=Abhandlung & corpusSigle=GOE")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -70,6 +72,7 @@
.path("statistics")
.queryParam("cq", "textType=Abhandlung & corpusSigle=GOE")
.queryParam("corpusQuery", "textType=Autobiographie & corpusSigle=GOE")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -90,6 +93,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
.queryParam("corpusQuery", corpusQuery)
+ .request()
.get(ClientResponse.class);
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
@@ -112,6 +116,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
.queryParam("corpusQuery", "creationDate since 1810")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(ent);
@@ -129,6 +134,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
.queryParam("corpusQuery", "creationDate geq 1810")
+ .request()
.get(ClientResponse.class);
assert ClientResponse.Status.BAD_REQUEST.getStatusCode() == response
@@ -149,6 +155,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
.queryParam("corpusQuery", "creationDate >= 1810")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -168,6 +175,7 @@
throws IOException, KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -186,6 +194,7 @@
throws IOException, KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
+ .request()
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.post(ClientResponse.class,"{ \"collection\" : {\"@type\": "
+ "\"koral:doc\", \"key\": \"availability\", \"match\": "
@@ -213,6 +222,7 @@
throws IOException, KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
+ .request()
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.post(ClientResponse.class,"{}");
@@ -231,6 +241,7 @@
throws IOException, KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
+ .request()
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.post(ClientResponse.class,"{ \"collection\" : }");
@@ -248,7 +259,9 @@
public void testGetStatisticsWithoutKoralQuery ()
throws IOException, KustvaktException {
ClientResponse response = resource().path(API_VERSION)
- .path("statistics").post(ClientResponse.class);
+ .path("statistics")
+ .request()
+ .post(ClientResponse.class);
String ent = response.getEntity(String.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/TokenExpiryTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/TokenExpiryTest.java
index b51d912..099027a 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/TokenExpiryTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/TokenExpiryTest.java
@@ -42,6 +42,7 @@
form.add("password", "password");
ClientResponse response = resource().path(API_VERSION).path("oauth2").path("token")
+ .request()
.header(HttpHeaders.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED)
.entity(form).post(ClientResponse.class);
@@ -66,6 +67,7 @@
throws KustvaktException, IOException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "Wasser").queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer " + token)
.get(ClientResponse.class);
@@ -93,6 +95,7 @@
ClientResponse response =
resource().path(API_VERSION).path("oauth2").path("openid").path("authorize")
+ .request()
.header(Attributes.AUTHORIZATION, "Bearer " + token)
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE,
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
index 5201884..2980ca2 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
@@ -36,6 +36,7 @@
throws UniformInterfaceException, ClientHandlerException,
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -52,6 +53,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("list").path("system-admin")
.queryParam("username", "dory")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -69,6 +71,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("list").path("system-admin")
.queryParam("username", "dory").queryParam("status", "ACTIVE")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -86,6 +89,7 @@
public void testListWithoutUsername () throws UniformInterfaceException,
ClientHandlerException, KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -101,6 +105,7 @@
ClientHandlerException, KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("list").path("system-admin")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -125,6 +130,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("list").path("system-admin")
.queryParam("status", "HIDDEN")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -146,6 +152,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@" + groupName)
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser,
@@ -174,6 +181,7 @@
// accept invitation
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@" + groupName).path("subscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
@@ -198,6 +206,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@" + groupName).path("role").path("add")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser,
@@ -230,6 +239,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@" + groupName).path("role").path("delete")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(Attributes.AUTHORIZATION,
HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser,
@@ -255,6 +265,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@" + groupName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -273,6 +284,7 @@
// delete group
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@" + groupName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -291,6 +303,7 @@
// delete marlin from group
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@" + groupName).path("~marlin")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -316,6 +329,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@" + groupName).path("invite")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(adminUser, "pass"))
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
index 8bc2a5e..c0ffafd 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
@@ -46,6 +46,7 @@
throws UniformInterfaceException, ClientHandlerException,
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -60,6 +61,7 @@
private void deleteGroupByName (String groupName) throws KustvaktException{
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -72,6 +74,7 @@
@Test
public void testListDoryGroups () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -92,6 +95,7 @@
@Test
public void testListNemoGroups () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("nemo", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -112,6 +116,7 @@
@Test
public void testListMarlinGroups () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("marlin", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -125,6 +130,7 @@
@Test
public void testListGroupGuest () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.get(ClientResponse.class);
String entity = response.getEntity(String.class);
@@ -167,6 +173,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName).type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32").entity(form)
@@ -180,6 +187,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName).type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -278,6 +286,7 @@
// delete darla from group
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName).path("~darla")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -285,6 +294,7 @@
// check group member
response = resource().path(API_VERSION).path("group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -301,6 +311,7 @@
// nemo is a group member
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName).path("~darla")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("nemo", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -322,6 +333,7 @@
// dory delete pearl
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("~pearl")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -339,6 +351,7 @@
ClientHandlerException, KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("~pearl")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -361,6 +374,7 @@
// delete group
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -374,6 +388,7 @@
response = resource().path(API_VERSION).path("group").path("list")
.path("system-admin").queryParam("username", username)
.queryParam("status", "DELETED")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -398,6 +413,7 @@
// dory is a group admin in marlin-group
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@marlin-group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -418,6 +434,7 @@
ClientHandlerException, KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@deleted-group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -440,6 +457,7 @@
// dory is a group admin in marlin-group
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@marlin-group").path("~marlin")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -463,6 +481,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName).path("invite")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
@@ -472,6 +491,7 @@
// list group
response = resource().path(API_VERSION).path("group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -497,6 +517,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("invite")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
@@ -523,6 +544,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("invite")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
@@ -550,6 +572,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("invite")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
@@ -578,6 +601,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("invite")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
@@ -607,6 +631,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@deleted-group").path("invite")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
@@ -627,6 +652,7 @@
public void testSubscribePendingMember () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("subscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("marlin", "pass"))
@@ -666,6 +692,7 @@
public void testSubscribeDeletedMember () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("subscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("pearl", "pass"))
@@ -684,6 +711,7 @@
public void testSubscribeMissingGroupName() throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("subscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("bruce", "pass"))
@@ -696,6 +724,7 @@
public void testSubscribeNonExistentMember () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("subscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("bruce", "pass"))
@@ -715,6 +744,7 @@
public void testSubscribeToNonExistentGroup () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@non-existent").path("subscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("pearl", "pass"))
@@ -734,6 +764,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName).path("subscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("nemo", "pass"))
@@ -753,6 +784,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName).path("unsubscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("marlin", "pass"))
@@ -768,6 +800,7 @@
throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -794,6 +827,7 @@
// pearl unsubscribes from dory-group
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("unsubscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("pearl", "pass"))
@@ -820,6 +854,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("unsubscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("marlin", "pass"))
@@ -839,6 +874,7 @@
public void testUnsubscribeMissingGroupName () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("unsubscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("marlin", "pass"))
@@ -851,6 +887,7 @@
public void testUnsubscribeNonExistentMember () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@dory-group").path("unsubscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("bruce", "pass"))
@@ -871,6 +908,7 @@
public void testUnsubscribeToNonExistentGroup () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@tralala-group").path("unsubscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("pearl", "pass"))
@@ -893,6 +931,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName).path("unsubscribe")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("nemo", "pass"))
@@ -917,6 +956,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@marlin-group").path("role").path("add")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("marlin", "pass"))
.entity(form).post(ClientResponse.class);
@@ -938,6 +978,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@marlin-group").path("role").path("delete")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("marlin", "pass"))
.entity(form).post(ClientResponse.class);
@@ -960,6 +1001,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@marlin-group").path("role").path("edit")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("marlin", "pass"))
.post(ClientResponse.class, form);
@@ -984,6 +1026,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@marlin-group").path("role").path("edit")
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("marlin", "pass"))
.entity(form).post(ClientResponse.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserSettingControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserSettingControllerTest.java
index ba26d0c..2272488 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserSettingControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserSettingControllerTest.java
@@ -35,6 +35,7 @@
Map<String, Object> map) throws KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.type(MediaType.APPLICATION_JSON).entity(map)
@@ -51,6 +52,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.type(MediaType.APPLICATION_JSON).entity(json)
@@ -109,6 +111,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username2, "pass"))
.type(MediaType.APPLICATION_JSON).entity(json)
@@ -125,6 +128,7 @@
public void testGetDifferentUsername () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username2, "pass"))
.get(ClientResponse.class);
@@ -141,6 +145,7 @@
String username = "tralala";
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.get(ClientResponse.class);
@@ -163,6 +168,7 @@
String username = "tralala";
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.delete(ClientResponse.class);
@@ -174,6 +180,7 @@
public void testDeleteKeyDifferentUsername () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting").path("pos-foundry")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username2, "pass"))
.delete(ClientResponse.class);
@@ -188,6 +195,7 @@
private void testDeleteSetting (String username) throws KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.delete(ClientResponse.class);
@@ -196,6 +204,7 @@
response = resource().path(API_VERSION).path("~" + username)
.path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -216,6 +225,7 @@
throws KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting").path("lemma-foundry")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.delete(ClientResponse.class);
@@ -228,6 +238,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting").path("pos-foundry")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.delete(ClientResponse.class);
@@ -254,6 +265,7 @@
throws KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("~" + username).path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
index aa69a06..a3ca5cb 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
@@ -86,6 +86,7 @@
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq",
"textSigle=\"GOE/AGF/00000\" | textSigle=\"GOE/AGA/01784\"")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -100,6 +101,7 @@
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq",
"textSigle!=\"GOE/AGI/04846\" & textSigle!=\"GOE/AGA/01784\"")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -113,6 +115,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"system/named-vc1\"")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -124,6 +127,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo named-vc2")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -135,6 +139,7 @@
String corpusQuery = "availability = /CC-BY.*/ & referTo named-vc1";
ClientResponse response = resource().path(API_VERSION)
.path("statistics").queryParam("corpusQuery", corpusQuery)
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -150,6 +155,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"username/vc1\"")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -164,6 +170,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"dory/dory-vc\"")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -178,6 +185,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"marlin/published-vc\"")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -203,6 +211,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"marlin/published-vc\"")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("squirt", "pass"))
.get(ClientResponse.class);
@@ -215,6 +224,7 @@
response = resource().path(API_VERSION).path("group")
.path("list").path("system-admin")
.queryParam("status", "HIDDEN")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("admin", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerAdminTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerAdminTest.java
index d4930c6..4b2afdd 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerAdminTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerAdminTest.java
@@ -34,6 +34,7 @@
ClientHandlerException, KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~dory").path("dory-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -54,6 +55,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~dory").path("group-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -73,6 +75,7 @@
ClientHandlerException, KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.queryParam("username", "dory")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
@@ -90,6 +93,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("list").path("system-admin").queryParam("type", "SYSTEM")
.queryParam("createdBy", "system")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
@@ -109,6 +113,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~system").path("new-system-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -127,6 +132,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~system").path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -148,6 +154,7 @@
String vcName = "new-vc";
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+username).path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -169,6 +176,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("list").path("system-admin")
.queryParam("createdBy", username)
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
@@ -188,6 +196,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+vcCreator).path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -205,6 +214,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+vcCreator).path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -221,6 +231,7 @@
// ClientResponse response = resource().path(API_VERSION).path("vc")
// .path("access")
// .queryParam("groupName", groupName)
+// .request()
// .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
// .createBasicAuthorizationHeaderValue(admin, "pass"))
// .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -245,6 +256,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("access")
.queryParam("groupName", groupName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -279,6 +291,7 @@
response = resource().path(API_VERSION).path("vc").path("~"+vcCreator)
.path(vcName).path("share").path("@"+groupName)
.type(MediaType.APPLICATION_FORM_URLENCODED)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(admin, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -294,6 +307,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("access").path(accessId)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
index fa39d4d..2750fae 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
@@ -59,6 +59,7 @@
throws UniformInterfaceException, ClientHandlerException,
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -75,6 +76,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~" + username)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -90,6 +92,7 @@
throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~" + vcCreator).path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -102,6 +105,7 @@
throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("access").queryParam("groupName", groupName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -129,7 +133,9 @@
ClientHandlerException, KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
- .path("~system").path("system-vc").get(ClientResponse.class);
+ .path("~system").path("system-vc")
+ .request()
+ .get(ClientResponse.class);
JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
assertEquals("system-vc", node.at("/name").asText());
assertEquals(ResourceType.SYSTEM.displayName(),
@@ -157,6 +163,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~dory").path("dory-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -189,6 +196,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~dory").path("group-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("marlin", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -217,6 +225,7 @@
ClientResponse response = resource().path(API_VERSION).path("group")
.path("list").path("system-admin")
.queryParam("status", "HIDDEN")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("admin", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -259,6 +268,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~dory")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("pearl", "pass"))
@@ -279,6 +289,7 @@
public void testListAvailableVCByGuest () throws UniformInterfaceException,
ClientHandlerException, KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
+ .request()
.get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(entity);
@@ -295,6 +306,7 @@
private void testListSystemVC () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~system")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("pearl", "pass"))
.get(ClientResponse.class);
@@ -315,6 +327,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("new_vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -346,6 +359,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -389,6 +403,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("group")
.path("@"+groupName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("admin", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -415,6 +430,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("new_vc")
+ .request()
.header(Attributes.AUTHORIZATION,
AuthenticationScheme.API.displayName() + " "
+ authToken)
@@ -447,6 +463,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("new_vc")
+ .request()
.header(Attributes.AUTHORIZATION,
AuthenticationScheme.API.displayName() + " "
+ authToken)
@@ -474,6 +491,7 @@
String vcName = "new_system_vc";
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~system").path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("admin", "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -493,6 +511,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("new_vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -518,6 +537,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("new $vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -539,6 +559,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("ne")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -560,6 +581,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("new_vc")
+ .request()
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
.entity(json).put(ClientResponse.class);
@@ -583,6 +605,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("new_vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -602,6 +625,7 @@
public void testCreateVCWithoutEntity () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("new_vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -624,6 +648,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("new_vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -647,6 +672,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+testUser).path("new_vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -667,6 +693,7 @@
public void testDeleteVCUnauthorized () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~dory").path("dory-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -693,6 +720,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~dory").path("dory-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -710,6 +738,7 @@
response = resource().path(API_VERSION).path("vc").path("~dory")
.path("dory-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -735,6 +764,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~dory").path("dory-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -753,6 +783,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("koralQuery").path("~" + username).path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -770,6 +801,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~dory").path("dory-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -801,6 +833,7 @@
String json = "{\"type\": \"PUBLISHED\"}";
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~dory").path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -827,6 +860,7 @@
response = resource().path(API_VERSION).path("vc").path("~dory")
.path("group-vc")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -859,7 +893,7 @@
// ClientResponse response =
// resource().path(API_VERSION).path("vc")
// .path("access")
- // .header(Attributes.AUTHORIZATION,
+ // .request().header(Attributes.AUTHORIZATION,
// HttpAuthorizationHandler
// .createBasicAuthorizationHeaderValue(
// testUser, "pass"))
@@ -878,6 +912,7 @@
public void testlistAccessByGroup () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("access").queryParam("groupName", "dory-group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -945,6 +980,7 @@
return resource().path(API_VERSION).path("vc").path("~"+vcCreator)
.path(vcName).path("share").path("@"+groupName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(vcCreator, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -997,6 +1033,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~marlin").path("marlin-vc").path("share")
.path("@marlin group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -1018,6 +1055,7 @@
// nemo is not VCA in marlin group
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~nemo").path("nemo-vc").path("share").path("@marlin-group")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("nemo", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -1037,6 +1075,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("access").path(accessId)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -1050,6 +1089,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("access").path(accessId)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(testUser, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java
index 81f63a3..3761a54 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java
@@ -39,6 +39,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("field").path("~" + username).path(vcName)
.queryParam("fieldName", field)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("admin", "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -56,6 +57,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("field").path("~" + username).path(vcName)
.queryParam("fieldName", field)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("admin", "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
@@ -140,6 +142,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("field").path("~system").path("named-vc3")
.queryParam("fieldName", "textSigle")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusTestBase.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusTestBase.java
index f100941..bcb6b5c 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusTestBase.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusTestBase.java
@@ -25,6 +25,7 @@
KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+vcCreator).path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -43,6 +44,7 @@
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("~"+vcCreator).path(vcName)
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
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
index 95df495..ded6871 100644
--- 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
@@ -27,6 +27,7 @@
@Test
public void testInfo () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("info")
+ .request()
.get(ClientResponse.class);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteMultipleCorpusQueryTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteMultipleCorpusQueryTest.java
index ea7f964..0b253e4 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteMultipleCorpusQueryTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteMultipleCorpusQueryTest.java
@@ -23,6 +23,7 @@
.queryParam("q", "das").queryParam("ql", "poliqarp")
.queryParam("cq", "pubPlace=München")
.queryParam("cq", "textSigle=\"GOE/AGA/01784\"")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -47,6 +48,7 @@
ClientResponse response = resource().path(API_VERSION).path("statistics")
.queryParam("cq", "textType=Abhandlung")
.queryParam("cq", "corpusSigle=GOE")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -67,6 +69,7 @@
ClientResponse response = resource().path(API_VERSION).path("statistics")
.queryParam("corpusQuery", "textType=Autobiographie")
.queryParam("corpusQuery", "corpusSigle=GOE")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
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 ebbdbfe..c1b14a1 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
@@ -47,6 +47,7 @@
ClientResponse response = resource().path(API_VERSION).path("query")
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -66,6 +67,7 @@
ClientResponse response = resource().path(API_VERSION).path("query")
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("cq", "corpusSigle=WPD | corpusSigle=GOE")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -75,6 +77,7 @@
assertNotNull(node);
response = resource().path(API_VERSION).path("search")
+ .request()
.post(ClientResponse.class, query);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -87,6 +90,7 @@
@Test
public void testApiWelcomeMessage () {
ClientResponse response = resource().path(API_VERSION).path("")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -103,6 +107,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -120,7 +125,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=das").queryParam("ql", "poliqarp")
.queryParam("cq", "corpusSigle=WPD | corpusSigle=GOE")
- .queryParam("count", "13").get(ClientResponse.class);
+ .queryParam("count", "13")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
response.getStatus());
String query = response.getEntity(String.class);
@@ -139,6 +146,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -157,6 +165,7 @@
s.setQuery("[orth=das]", "poliqarp");
ClientResponse response = resource().path(API_VERSION).path("search")
+ .request()
.post(ClientResponse.class, s.toJSON());
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -173,6 +182,7 @@
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("fields", "author,docSigle")
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -190,6 +200,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
.queryParam("foundry", "*").queryParam("spans", "false")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -207,6 +218,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
.queryParam("foundry", "xy").queryParam("spans", "false")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -228,6 +240,7 @@
.path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42")
.queryParam("foundry", "-").queryParam("spans", "false")
.queryParam("expand","false")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -248,7 +261,9 @@
ClientResponse response = resource().path(API_VERSION)
.path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
.queryParam("foundry", "xy").queryParam("spans", "false")
- .queryParam("hls", "true").get(ClientResponse.class);
+ .queryParam("hls", "true")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
@@ -275,7 +290,9 @@
ClientResponse response = resource().path(API_VERSION)
.path("corpus/GOE/AGA/01784/p36-46/matchInfo")
- .queryParam("foundry", "*").get(ClientResponse.class);
+ .queryParam("foundry", "*")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
@@ -294,6 +311,7 @@
.queryParam("fields", "author, docSigle")
.queryParam("context", "sentence").queryParam("count", "13")
.queryParam("cq", "textClass=Politik & corpus=WPD")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -310,6 +328,7 @@
.queryParam("fields", "author, docSigle")
.queryParam("context", "sentence").queryParam("count", "13")
.queryParam("cq", "textClass=Politik & corpus=WPD")
+ .request()
.get(ClientResponse.class);
// String version =
// LucenePackage.get().getImplementationVersion();;
@@ -330,6 +349,7 @@
public void testMetaFields () throws KustvaktException {
ClientResponse response =
resource().path(API_VERSION).path("/corpus/GOE/AGA/01784")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -385,6 +405,7 @@
public void testSearchWithoutVersion () throws KustvaktException {
ClientResponse response = resource().path("api").path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
+ .request()
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
URI location = response.getLocation();
@@ -395,7 +416,9 @@
public void testSearchWrongVersion () throws KustvaktException {
ClientResponse response = resource().path("api").path("v0.2")
.path("search").queryParam("q", "[orth=der]")
- .queryParam("ql", "poliqarp").accept(MediaType.APPLICATION_JSON)
+ .queryParam("ql", "poliqarp")
+ .accept(MediaType.APPLICATION_JSON)
+ .request()
.get(ClientResponse.class);
assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
URI location = response.getLocation();
@@ -406,6 +429,7 @@
public void testSearchWithIP () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "Wasser").queryParam("ql", "poliqarp")
+ .request()
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.get(ClientResponse.class);
@@ -420,6 +444,7 @@
public void testSearchWithAuthorizationHeader () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "Wasser").queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("test", "pwd"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -437,6 +462,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("access-rewrite-disabled", "true")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -452,6 +478,7 @@
.queryParam("q", "Sonne").queryParam("ql", "poliqarp")
.queryParam("fields", "author,title")
.queryParam("access-rewrite-disabled", "true")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -472,6 +499,7 @@
.queryParam("q", "Sonne").queryParam("ql", "poliqarp")
.queryParam("fields", "author,title,snippet")
.queryParam("access-rewrite-disabled", "true")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -491,6 +519,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=die]").queryParam("ql", "poliqarp")
.queryParam("page", "0")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
response.getStatus());
@@ -509,7 +538,9 @@
m.add("token", "secret");
ClientResponse response = resource().path(API_VERSION).path("index")
- .path("close").type(MediaType.APPLICATION_FORM_URLENCODED)
+ .path("close")
+ .request()
+ .type(MediaType.APPLICATION_FORM_URLENCODED)
.post(ClientResponse.class, m);
assertEquals(HttpStatus.OK_200, response.getStatus());
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchPipeTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchPipeTest.java
index ac69a61..9922ce0 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchPipeTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchPipeTest.java
@@ -113,7 +113,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", glemmUri).get(ClientResponse.class);
+ .queryParam("pipes", glemmUri)
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -152,7 +154,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", glemmUri).get(ClientResponse.class);
+ .queryParam("pipes", glemmUri)
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(entity);
@@ -177,6 +181,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("pipes", glemmUri + "," + glemmUri2)
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -194,7 +199,9 @@
resource().getURI().toString() + API_VERSION + "/test/tralala";
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", url).get(ClientResponse.class);
+ .queryParam("pipes", url)
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -209,7 +216,9 @@
public void testSearchWithUnknownHost () throws KustvaktException {
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", "http://glemm").get(ClientResponse.class);
+ .queryParam("pipes", "http://glemm")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -231,7 +240,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", pipeUri).get(ClientResponse.class);
+ .queryParam("pipes", pipeUri)
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -250,6 +261,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("pipes", url + "," + "http://glemm")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -284,7 +296,9 @@
String pipeUri = "http://localhost:"+port+"/invalid-response";
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", pipeUri).get(ClientResponse.class);
+ .queryParam("pipes", pipeUri)
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
@@ -308,7 +322,9 @@
String pipeUri = "http://localhost:"+port+"/plain-text";
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("pipes", pipeUri).get(ClientResponse.class);
+ .queryParam("pipes", pipeUri)
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
@@ -337,6 +353,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("pipes", "http://unknown" + "," + glemmUri)
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -350,6 +367,7 @@
response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("pipes", glemmUri + ",http://unknown")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchTokenSnippetTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchTokenSnippetTest.java
index feb6308..a091ecf 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchTokenSnippetTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchTokenSnippetTest.java
@@ -22,6 +22,7 @@
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("show-tokens", "true")
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -42,6 +43,7 @@
.queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
.queryParam("show-tokens", "false")
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -61,6 +63,7 @@
.queryParam("access-rewrite-disabled", "true")
.queryParam("show-tokens", "true")
.queryParam("context", "sentence").queryParam("count", "13")
+ .request()
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java
index 060d441..99a05b4 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java
@@ -26,6 +26,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
.queryParam("cq", "textType=Abhandlung & corpusSigle=GOE")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -51,6 +52,7 @@
.path("statistics")
.queryParam("cq", "textType=Abhandlung & corpusSigle=GOE")
.queryParam("corpusQuery", "textType=Autobiographie & corpusSigle=GOE")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -69,6 +71,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
.queryParam("corpusQuery", "textType=Autobiographie & corpusSigle=GOE")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -90,6 +93,7 @@
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
.queryParam("corpusQuery", "")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -102,6 +106,7 @@
response = resource().path(API_VERSION)
.path("statistics")
+ .request()
.method("GET", ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -118,6 +123,7 @@
throws IOException, KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
+ .request()
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.post(ClientResponse.class,"{ \"collection\" : {\"@type\": "
+ "\"koral:doc\", \"key\": \"availability\", \"match\": "
@@ -145,6 +151,7 @@
throws IOException, KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
+ .request()
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.post(ClientResponse.class,"{}");
@@ -163,6 +170,7 @@
throws IOException, KustvaktException {
ClientResponse response = resource().path(API_VERSION)
.path("statistics")
+ .request()
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.post(ClientResponse.class,"{ \"collection\" : }");
@@ -180,7 +188,9 @@
public void testGetStatisticsWithoutKoralQuery ()
throws IOException, KustvaktException {
ClientResponse response = resource().path(API_VERSION)
- .path("statistics").post(ClientResponse.class);
+ .path("statistics")
+ .request()
+ .post(ClientResponse.class);
String ent = response.getEntity(String.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/SearchNetworkEndpointTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/SearchNetworkEndpointTest.java
index c00084d..a4f9dc6 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/SearchNetworkEndpointTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/SearchNetworkEndpointTest.java
@@ -77,7 +77,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("engine", "network").get(ClientResponse.class);
+ .queryParam("engine", "network")
+ .request()
+ .get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
@@ -95,7 +97,9 @@
config.setNetworkEndpointURL("http://localhost:1040/search");
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("engine", "network").get(ClientResponse.class);
+ .queryParam("engine", "network")
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(entity);
@@ -111,7 +115,9 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("engine", "network").get(ClientResponse.class);
+ .queryParam("engine", "network")
+ .request()
+ .get(ClientResponse.class);
String entity = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(entity);