use of jakarta.ws.rs.client.ClientRequestFilter in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method invokeWithClientRequestFilters.
// ////////////////////////////////////////////////////////////////////
protected Response invokeWithClientRequestFilters(ClientRequestFilter... filters) {
Client client = ClientBuilder.newClient();
for (ClientRequestFilter filter : filters) client.register(filter);
WebTarget target = client.target("http://nourl/");
Response response = target.request().buildGet().invoke();
return response;
}
use of jakarta.ws.rs.client.ClientRequestFilter in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method invokeWithResponseAndAssertStatus.
protected static void invokeWithResponseAndAssertStatus(Response response, Status status, ContextProvider provider) throws Fault {
ClientRequestFilter filter = createRequestFilter(response);
Invocation i = buildInvocation(filter, provider);
Response r = invoke(i);
assertStatus(r, status);
}
use of jakarta.ws.rs.client.ClientRequestFilter in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getStatusInfoTest.
/*
* @testName: getStatusInfoTest
*
* @assertion_ids: JAXRS:JAVADOC:473; JAXRS:JAVADOC:479; JAXRS:JAVADOC:480;
*
* @test_Strategy: Get the status code associated with the response.
*
* ClientResponseFilter.filter
*/
@Test
public void getStatusInfoTest() throws Fault {
ContextProvider provider = new ContextProvider() {
@Override
protected void checkFilterContext(ClientRequestContext requestContext, ClientResponseContext responseContext) throws Fault {
assertTrue(responseContext.getStatusInfo().getStatusCode() == 222, "unexpected status " + responseContext.getStatusInfo().getStatusCode());
TestUtil.logMsg("Found expected response status 222");
}
};
Response response = Response.status(222).build();
ClientRequestFilter filter = createRequestFilter(response);
Invocation i = buildInvocation(filter, provider);
Response r = invoke(i);
assertTrue(r.getStatus() == 222, "unexpected status " + r.getStatus());
}
Aggregations