Search in sources :

Example 66 with CompletionStageRxInvoker

use of jakarta.ws.rs.client.CompletionStageRxInvoker in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method methodWithClassWithEntityThrowsNoWebApplicationExceptionForResponseTest.

/*
   * @testName:
   * methodWithClassWithEntityThrowsNoWebApplicationExceptionForResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1145; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1175;
   * 
   * @test_Strategy: WebApplicationException - in case the response status code
   * of the response returned by the server is not successful and the specified
   * response type is not Response.
   */
@Test
public void methodWithClassWithEntityThrowsNoWebApplicationExceptionForResponseTest() throws Fault {
    Future<Response> future = null;
    for (String method : ENTITY_METHODS) {
        CompletionStageRxInvoker rx = startRxInvokerForMethod(method.toLowerCase() + "notok");
        Entity<String> entity = Entity.entity(method, MediaType.WILDCARD_TYPE);
        future = rx.method(method, entity, Response.class).toCompletableFuture();
        checkFutureResponseStatus(future, Status.NOT_ACCEPTABLE);
    }
}
Also used : Response(jakarta.ws.rs.core.Response) CompletionStageRxInvoker(jakarta.ws.rs.client.CompletionStageRxInvoker) Test(org.junit.jupiter.api.Test)

Example 67 with CompletionStageRxInvoker

use of jakarta.ws.rs.client.CompletionStageRxInvoker in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method getWithStringClassTest.

/*
   * @testName: getWithStringClassTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1138; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1168;
   * 
   * @test_Strategy: Invoke HTTP GET method for the current request
   */
@Test
public void getWithStringClassTest() throws Fault {
    CompletionStageRxInvoker rx = startRxInvokerForMethod("get");
    Future<String> future = rx.get(String.class).toCompletableFuture();
    checkFutureString(future, "get");
}
Also used : CompletionStageRxInvoker(jakarta.ws.rs.client.CompletionStageRxInvoker) Test(org.junit.jupiter.api.Test)

Example 68 with CompletionStageRxInvoker

use of jakarta.ws.rs.client.CompletionStageRxInvoker in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method postWithGenericTypeThrowsNoWebApplicationExceptionForResponseTest.

/*
   * @testName:
   * postWithGenericTypeThrowsNoWebApplicationExceptionForResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1152; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1182;
   * 
   * @test_Strategy: WebApplicationException - in case the response status code
   * of the response returned by the server is not successful and the specified
   * response type is not Response.
   */
@Test
public void postWithGenericTypeThrowsNoWebApplicationExceptionForResponseTest() throws Fault {
    CompletionStageRxInvoker rx = startRxInvokerForMethod("postnotok");
    GenericType<Response> generic = createGeneric(Response.class);
    Entity<String> entity = Entity.entity("post", MediaType.WILDCARD_TYPE);
    Future<Response> future = rx.post(entity, generic).toCompletableFuture();
    checkFutureResponseStatus(future, Status.NOT_ACCEPTABLE);
}
Also used : Response(jakarta.ws.rs.core.Response) CompletionStageRxInvoker(jakarta.ws.rs.client.CompletionStageRxInvoker) Test(org.junit.jupiter.api.Test)

Example 69 with CompletionStageRxInvoker

use of jakarta.ws.rs.client.CompletionStageRxInvoker in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method putWithGenericTypeResponseTest.

/*
   * @testName: putWithGenericTypeResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1155; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1185;
   * 
   * @test_Strategy: Invoke HTTP put method for the current request
   */
@Test
public void putWithGenericTypeResponseTest() throws Fault {
    GenericType<Response> generic = createGeneric(Response.class);
    Entity<String> entity = Entity.entity("put", MediaType.WILDCARD_TYPE);
    CompletionStageRxInvoker rx = startRxInvokerForMethod("put");
    Future<Response> future = rx.put(entity, generic).toCompletableFuture();
    checkFutureOkResponse(future);
}
Also used : Response(jakarta.ws.rs.core.Response) CompletionStageRxInvoker(jakarta.ws.rs.client.CompletionStageRxInvoker) Test(org.junit.jupiter.api.Test)

Example 70 with CompletionStageRxInvoker

use of jakarta.ws.rs.client.CompletionStageRxInvoker in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method getWithResponseClassTest.

/*
   * @testName: getWithResponseClassTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1138; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1168;
   * 
   * @test_Strategy: Invoke HTTP GET method for the current request
   */
@Test
public void getWithResponseClassTest() throws Fault {
    CompletionStageRxInvoker rx = startRxInvokerForMethod("get");
    Future<Response> future = rx.get(Response.class).toCompletableFuture();
    checkFutureOkResponse(future);
}
Also used : Response(jakarta.ws.rs.core.Response) CompletionStageRxInvoker(jakarta.ws.rs.client.CompletionStageRxInvoker) Test(org.junit.jupiter.api.Test)

Aggregations

CompletionStageRxInvoker (jakarta.ws.rs.client.CompletionStageRxInvoker)98 Test (org.junit.jupiter.api.Test)98 Response (jakarta.ws.rs.core.Response)51