Search in sources :

Example 31 with CompletionStageRxInvoker

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

the class JAXRSClientIT method putWithGenericTypeThrowsProcessingExceptionTest.

/*
   * @testName: putWithGenericTypeThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1155; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1185;
   * 
   * @test_Strategy: ResponseProcessingException - in case processing of a
   * received HTTP response fails (e.g. in a filter or during conversion of the
   * response entity data to an instance of a particular Java type).
   */
@Test
public void putWithGenericTypeThrowsProcessingExceptionTest() throws Fault {
    _hostname = NONEXISTING_SITE;
    GenericType<String> generic = createGeneric(String.class);
    Entity<String> entity = Entity.entity("put", MediaType.WILDCARD_TYPE);
    CompletionStageRxInvoker rx = startRxInvokerForMethod("put");
    Future<String> future = rx.put(entity, generic).toCompletableFuture();
    assertExceptionWithProcessingExceptionIsThrownAndLog(future);
}
Also used : CompletionStageRxInvoker(jakarta.ws.rs.client.CompletionStageRxInvoker) Test(org.junit.jupiter.api.Test)

Example 32 with CompletionStageRxInvoker

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

the class JAXRSClientIT method putWithClassThrowsNoWebApplicationExceptionForResponseTest.

/*
   * @testName: putWithClassThrowsNoWebApplicationExceptionForResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1154; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1184;
   * 
   * @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 putWithClassThrowsNoWebApplicationExceptionForResponseTest() throws Fault {
    Entity<String> entity = Entity.entity("put", MediaType.WILDCARD_TYPE);
    CompletionStageRxInvoker rx = startRxInvokerForMethod("putnotok");
    Future<Response> future = rx.put(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 33 with CompletionStageRxInvoker

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

the class JAXRSClientIT method methodThrowsProcessingExceptionTest.

/*
   * @testName: methodThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1141; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1171;
   * 
   * @test_Strategy: ResponseProcessingException - in case processing of a
   * received HTTP response fails (e.g. in a filter or during conversion of the
   * response entity data to an instance of a particular Java type).
   */
@Test
public void methodThrowsProcessingExceptionTest() throws Fault {
    _hostname = NONEXISTING_SITE;
    Future<Response> future = null;
    for (String method : METHODS) {
        CompletionStageRxInvoker rx = startRxInvokerForMethod(method.toLowerCase());
        future = rx.method(method).toCompletableFuture();
        assertExceptionWithProcessingExceptionIsThrownAndLog(future);
    }
}
Also used : Response(jakarta.ws.rs.core.Response) CompletionStageRxInvoker(jakarta.ws.rs.client.CompletionStageRxInvoker) Test(org.junit.jupiter.api.Test)

Example 34 with CompletionStageRxInvoker

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

the class JAXRSClientIT method putWithStringClassTest.

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

Example 35 with CompletionStageRxInvoker

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

the class JAXRSClientIT method methodWithClassThrowsNoWebApplicationExceptionForResponseTest.

/*
   * @testName: methodWithClassThrowsNoWebApplicationExceptionForResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1142; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1172;
   * 
   * @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 methodWithClassThrowsNoWebApplicationExceptionForResponseTest() throws Fault {
    Future<Response> future = null;
    for (String method : METHODS) {
        CompletionStageRxInvoker rx = startRxInvokerForMethod(method.toLowerCase() + "notok");
        future = rx.method(method, 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)

Aggregations

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