use of jakarta.ws.rs.core.Response in project OpenGrok by OpenGrok.
the class SuggesterControllerTest method testAllowComplexQueries.
@Test
void testAllowComplexQueries() {
env.getSuggesterConfig().setAllowComplexQueries(false);
Response r = target(SuggesterController.PATH).queryParam(AuthorizationFilter.PROJECTS_PARAM, "java", "kotlin").queryParam("field", QueryBuilder.FULL).queryParam(QueryBuilder.FULL, "me").queryParam(QueryBuilder.PATH, "kt").request().get();
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), r.getStatus());
}
use of jakarta.ws.rs.core.Response in project OpenGrok by OpenGrok.
the class SuggesterControllerTest method zTestRebuild.
@Test
void zTestRebuild() throws InterruptedException {
Response res = target(SuggesterController.PATH).path("rebuild").request().put(Entity.text(""));
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), res.getStatus());
SuggesterServiceImpl.getInstance().waitForRebuild(15, TimeUnit.SECONDS);
}
use of jakarta.ws.rs.core.Response in project OpenGrok by OpenGrok.
the class IncomingFilterTest method localhostTestWithForwardedHeader.
@Test
public void localhostTestWithForwardedHeader() throws Exception {
Map<String, String> headers = new TreeMap<>();
headers.put("X-Forwarded-For", "192.0.2.43, 2001:db8:cafe::17");
IncomingFilter filter = mockWithRemoteAddress("127.0.0.1", headers, true);
ContainerRequestContext context = mockContainerRequestContext("test");
ArgumentCaptor<Response> captor = ArgumentCaptor.forClass(Response.class);
filter.filter(context);
verify(context).abortWith(captor.capture());
assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), captor.getValue().getStatus());
}
use of jakarta.ws.rs.core.Response in project OpenGrok by OpenGrok.
the class IncomingFilterTest method assertFilterDoesNotBlockAddress.
private void assertFilterDoesNotBlockAddress(final String remoteAddr) throws Exception {
IncomingFilter filter = mockWithRemoteAddress(remoteAddr);
ContainerRequestContext context = mockContainerRequestContext("test");
ArgumentCaptor<Response> captor = ArgumentCaptor.forClass(Response.class);
filter.filter(context);
verify(context, never()).abortWith(captor.capture());
}
use of jakarta.ws.rs.core.Response in project OpenGrok by OpenGrok.
the class IncomingFilterTest method searchTest.
@Test
public void searchTest() throws Exception {
IncomingFilter filter = mockWithRemoteAddress("10.0.0.1");
ContainerRequestContext context = mockContainerRequestContext("search");
ArgumentCaptor<Response> captor = ArgumentCaptor.forClass(Response.class);
filter.filter(context);
verify(context, never()).abortWith(captor.capture());
}
Aggregations