Search in sources :

Example 21 with Response

use of jakarta.ws.rs.core.Response in project OpenGrok by OpenGrok.

the class SuggesterControllerTest method zTestRebuildProject.

@Test
void zTestRebuildProject() throws InterruptedException {
    Response res = target(SuggesterController.PATH).path("rebuild").path("c").request().put(Entity.text(""));
    assertEquals(Response.Status.NO_CONTENT.getStatusCode(), res.getStatus());
    SuggesterServiceImpl.getInstance().waitForRebuild(15, TimeUnit.SECONDS);
}
Also used : Response(jakarta.ws.rs.core.Response) Test(org.junit.jupiter.api.Test)

Example 22 with Response

use of jakarta.ws.rs.core.Response in project OpenGrok by OpenGrok.

the class SuggesterControllerTest method testDisabledSuggestions.

@Test
void testDisabledSuggestions() {
    env.getSuggesterConfig().setEnabled(false);
    Response r = target(SuggesterController.PATH).queryParam(AuthorizationFilter.PROJECTS_PARAM, "java").queryParam("field", QueryBuilder.FULL).queryParam(QueryBuilder.FULL, "inner").request().get();
    assertEquals(Response.Status.NOT_FOUND.getStatusCode(), r.getStatus());
}
Also used : Response(jakarta.ws.rs.core.Response) Test(org.junit.jupiter.api.Test)

Example 23 with Response

use of jakarta.ws.rs.core.Response in project OpenGrok by OpenGrok.

the class SuggesterControllerTest method testGetSuggesterConfigCors.

@Test
void testGetSuggesterConfigCors() {
    Response response = target(SuggesterController.PATH).path("config").request().header(CORS_REQUEST_HEADER, "http://example.com").get();
    assertEquals("*", response.getHeaderString(ALLOW_CORS_HEADER));
}
Also used : Response(jakarta.ws.rs.core.Response) Test(org.junit.jupiter.api.Test)

Example 24 with Response

use of jakarta.ws.rs.core.Response in project OpenGrok by OpenGrok.

the class SuggesterControllerTest method testMaxProjects.

@Test
void testMaxProjects() {
    env.getSuggesterConfig().setMaxProjects(1);
    Response r = target(SuggesterController.PATH).queryParam(AuthorizationFilter.PROJECTS_PARAM, "java", "kotlin").queryParam("field", QueryBuilder.FULL).queryParam(QueryBuilder.FULL, "me").request().get();
    assertEquals(Response.Status.NOT_FOUND.getStatusCode(), r.getStatus());
}
Also used : Response(jakarta.ws.rs.core.Response) Test(org.junit.jupiter.api.Test)

Example 25 with Response

use of jakarta.ws.rs.core.Response in project OpenGrok by OpenGrok.

the class SuggesterControllerTest method testMinChars.

@Test
void testMinChars() {
    env.getSuggesterConfig().setMinChars(2);
    Response r = target(SuggesterController.PATH).queryParam(AuthorizationFilter.PROJECTS_PARAM, "java").queryParam("field", QueryBuilder.FULL).queryParam(QueryBuilder.FULL, "i").request().get();
    assertEquals(Response.Status.NOT_FOUND.getStatusCode(), r.getStatus());
}
Also used : Response(jakarta.ws.rs.core.Response) Test(org.junit.jupiter.api.Test)

Aggregations

Response (jakarta.ws.rs.core.Response)665 Test (org.junit.jupiter.api.Test)551 AsyncInvoker (jakarta.ws.rs.client.AsyncInvoker)78 ClientRequestContext (jakarta.ws.rs.client.ClientRequestContext)71 ResponseBuilder (jakarta.ws.rs.core.Response.ResponseBuilder)67 Invocation (jakarta.ws.rs.client.Invocation)65 CompletionStageRxInvoker (jakarta.ws.rs.client.CompletionStageRxInvoker)51 Path (jakarta.ws.rs.Path)44 IOException (java.io.IOException)43 SyncInvoker (jakarta.ws.rs.client.SyncInvoker)41 ClientResponseContext (jakarta.ws.rs.client.ClientResponseContext)33 POST (jakarta.ws.rs.POST)27 Client (jakarta.ws.rs.client.Client)25 WebTarget (jakarta.ws.rs.client.WebTarget)24 Link (jakarta.ws.rs.core.Link)23 Status (jakarta.ws.rs.core.Response.Status)23 MediaType (jakarta.ws.rs.core.MediaType)22 Annotation (java.lang.annotation.Annotation)22 Date (java.util.Date)21 GET (jakarta.ws.rs.GET)18