Search in sources :

Example 36 with CompletionStageRxInvoker

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

the class JAXRSClientIT method putWithResponseClassTest.

/*
   * @testName: putWithResponseClassTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1154; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1184;
   * 
   * @test_Strategy: Invoke HTTP put method for the current request
   */
@Test
public void putWithResponseClassTest() throws Fault {
    Entity<String> entity = Entity.entity("put", MediaType.WILDCARD_TYPE);
    CompletionStageRxInvoker rx = startRxInvokerForMethod("put");
    Future<Response> future = rx.put(entity, 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)

Example 37 with CompletionStageRxInvoker

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

the class JAXRSClientIT method traceWithStringClassTest.

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

Example 38 with CompletionStageRxInvoker

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

the class JAXRSClientIT method methodWithClassThrowsProcessingExceptionTest.

/*
   * @testName: methodWithClassThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1142; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1172;
   * 
   * @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 methodWithClassThrowsProcessingExceptionTest() throws Fault {
    _hostname = NONEXISTING_SITE;
    Future<String> future = null;
    for (String method : METHODS) {
        CompletionStageRxInvoker rx = startRxInvokerForMethod(method.toLowerCase());
        future = rx.method(method, String.class).toCompletableFuture();
        assertExceptionWithProcessingExceptionIsThrownAndLog(future);
    }
}
Also used : CompletionStageRxInvoker(jakarta.ws.rs.client.CompletionStageRxInvoker) Test(org.junit.jupiter.api.Test)

Example 39 with CompletionStageRxInvoker

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

the class JAXRSClientIT method traceWithClassThrowsWebApplicationExceptionTest.

/*
   * @testName: traceWithClassThrowsWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1157; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1187;
   * 
   * @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 traceWithClassThrowsWebApplicationExceptionTest() throws Fault {
    CompletionStageRxInvoker rx = startRxInvokerForMethod("tracenotok");
    Future<String> future = rx.trace(String.class).toCompletableFuture();
    assertExceptionWithWebApplicationExceptionIsThrownAndLog(future);
}
Also used : CompletionStageRxInvoker(jakarta.ws.rs.client.CompletionStageRxInvoker) Test(org.junit.jupiter.api.Test)

Example 40 with CompletionStageRxInvoker

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

the class JAXRSClientIT method postWithStringClassTest.

/*
   * @testName: postWithStringClassTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1151; JAXRS:JAVADOC:1162; JAXRS:JAVADOC:1181;
   * 
   * @test_Strategy: Invoke HTTP post method for the current request
   */
@Test
public void postWithStringClassTest() throws Fault {
    Entity<String> entity = Entity.entity("post", MediaType.WILDCARD_TYPE);
    CompletionStageRxInvoker rx = startRxInvokerForMethod("post");
    Future<String> future = rx.post(entity, String.class).toCompletableFuture();
    checkFutureString(future, "post");
}
Also used : 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