Search in sources :

Example 16 with AsyncInvoker

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

the class JAXRSClientIT method traceWithCallbackThrowsProcessingExceptionTest.

/*
   * @testName: traceWithCallbackThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:408;
   * 
   * @test_Strategy: Note that calling the Future.get() method on the returned
   * Future instance may throw an ExecutionException that wraps an
   * jakarta.ws.rs.ProcessingException thrown in case of an invocation processing
   * failure.
   */
@Test
public void traceWithCallbackThrowsProcessingExceptionTest() throws Fault {
    _hostname = NONEXISTING_SITE;
    InvocationCallback<String> callback = createStringCallback(false);
    AsyncInvoker async = startAsyncInvokerForMethod("trace");
    Future<String> future = async.trace(callback);
    assertExceptionWithProcessingExceptionIsThrownAndLog(future);
}
Also used : AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 17 with AsyncInvoker

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

the class JAXRSClientIT method postWithGenericTypeThrowsNoWebApplicationExceptionForResponseTest.

/*
   * @testName:
   * postWithGenericTypeThrowsNoWebApplicationExceptionForResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:399;
   * 
   * @test_Strategy: Note that calling the Future.get() method on the returned
   * Future instance may throw an ExecutionException that wraps a
   * WebApplicationException or one of its subclasses thrown in case the
   * received response status code is not successful and the specified response
   * type is not Response.
   */
@Test
public void postWithGenericTypeThrowsNoWebApplicationExceptionForResponseTest() throws Fault {
    AsyncInvoker async = startAsyncInvokerForMethod("postnotok");
    GenericType<Response> generic = createGeneric(Response.class);
    Entity<String> entity = Entity.entity("post", MediaType.WILDCARD_TYPE);
    Future<Response> future = async.post(entity, generic);
    checkFutureStatusResponseNoTime(future, Status.NOT_ACCEPTABLE);
}
Also used : Response(jakarta.ws.rs.core.Response) AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 18 with AsyncInvoker

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

the class JAXRSClientIT method methodWithClassThrowsNoWebApplicationExceptionForResponseTest.

/*
   * @testName: methodWithClassThrowsNoWebApplicationExceptionForResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:386;
   * 
   * @test_Strategy: Note that calling the Future.get() method on the returned
   * Future instance may throw an ExecutionException that wraps a
   * WebApplicationException or one of its subclasses thrown in case the
   * received response status code 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) {
        AsyncInvoker async = startAsyncInvokerForMethod(method.toLowerCase() + "notok");
        future = async.method(method, Response.class);
        checkFutureStatusResponseNoTime(future, Status.NOT_ACCEPTABLE);
    }
}
Also used : Response(jakarta.ws.rs.core.Response) AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 19 with AsyncInvoker

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

the class JAXRSClientIT method getWithGenericTypeThrowsWebApplicationExceptionTest.

/*
   * @testName: getWithGenericTypeThrowsWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:381;
   * 
   * @test_Strategy: Note that calling the Future.get() method on the returned
   * Future instance may throw an ExecutionException that wraps a
   * WebApplicationException or one of its subclasses thrown in case the
   * received response status code is not successful and the specified response
   * type is not Response.
   */
@Test
public void getWithGenericTypeThrowsWebApplicationExceptionTest() throws Fault {
    AsyncInvoker async = startAsyncInvokerForMethod("getnotok");
    GenericType<String> generic = createGeneric(String.class);
    Future<String> future = async.get(generic);
    assertExceptionWithWebApplicationExceptionIsThrownAndLog(future);
}
Also used : AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 20 with AsyncInvoker

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

the class JAXRSClientIT method traceWithStringClassWhileServerWaitTest.

/*
   * @testName: traceWithStringClassWhileServerWaitTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:406;
   * 
   * @test_Strategy: Invoke HTTP trace method for the current request
   * asynchronously.
   */
@Test
public void traceWithStringClassWhileServerWaitTest() throws Fault {
    AsyncInvoker async = startAsyncInvokerForMethod("traceandwait");
    Future<String> future = async.trace(String.class);
    checkFutureString(future, "trace");
// return future;
}
Also used : AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Aggregations

AsyncInvoker (jakarta.ws.rs.client.AsyncInvoker)151 Test (org.junit.jupiter.api.Test)148 Response (jakarta.ws.rs.core.Response)78 Client (jakarta.ws.rs.client.Client)3 WebTarget (jakarta.ws.rs.client.WebTarget)3 JdkLoggingFilter (ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter)2 Invocation (jakarta.ws.rs.client.Invocation)2 JaxrsCommonClient (ee.jakarta.tck.ws.rs.common.client.JaxrsCommonClient)1 SyncInvoker (jakarta.ws.rs.client.SyncInvoker)1 ThrottledClient (jaxrs.examples.client.custom.ThrottledClient)1