Search in sources :

Example 21 with AsyncInvoker

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

the class JAXRSClientIT method getWithResponseClassWhileServerWaitTest.

/*
   * @testName: getWithResponseClassWhileServerWaitTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:380;
   * 
   * @test_Strategy: Invoke HTTP GET method for the current request
   * asynchronously.
   */
@Test
public void getWithResponseClassWhileServerWaitTest() throws Fault {
    AsyncInvoker async = startAsyncInvokerForMethod("getandwait");
    Future<Response> future = async.get(Response.class);
    checkFutureOkResponse(future);
// return future;
}
Also used : Response(jakarta.ws.rs.core.Response) AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 22 with AsyncInvoker

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

the class JAXRSClientIT method traceWithGenericTypeStringWhileServerWaitTest.

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

Example 23 with AsyncInvoker

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

the class JAXRSClientIT method methodWithCallbackWithEntityThrowsNoWebApplicationExceptionForResponseTest.

/*
   * @testName:
   * methodWithCallbackWithEntityThrowsNoWebApplicationExceptionForResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:392;
   * 
   * @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 methodWithCallbackWithEntityThrowsNoWebApplicationExceptionForResponseTest() throws Fault {
    Future<Response> future = null;
    InvocationCallback<Response> callback = createCallback(false);
    for (String method : ENTITY_METHODS) {
        AsyncInvoker async = startAsyncInvokerForMethod(method.toLowerCase() + "notok");
        Entity<String> entity = Entity.entity(method, MediaType.WILDCARD_TYPE);
        future = async.method(method, entity, callback);
        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 24 with AsyncInvoker

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

the class JAXRSClientIT method methodWithCallbackWhileServerWaitTest.

/*
   * @testName: methodWithCallbackWhileServerWaitTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:388;
   * 
   * @test_Strategy: Invoke an arbitrary method for the current request
   * asynchronously.
   */
@Test
public void methodWithCallbackWhileServerWaitTest() throws Fault {
    InvocationCallback<Response> callback = createCallback(true);
    Future<Response> future = null;
    for (String method : METHODS) {
        AsyncInvoker async = startAsyncInvokerForMethod(method.toLowerCase() + "andwait");
        future = async.method(method, callback);
        checkFutureOkResponse(future);
        assertCallbackCall();
    }
// return future;
}
Also used : Response(jakarta.ws.rs.core.Response) AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 25 with AsyncInvoker

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

the class JAXRSClientIT method optionsWhileServerWaitTest.

/*
   * @testName: optionsWhileServerWaitTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:393;
   * 
   * @test_Strategy: Invoke HTTP options method for the current request
   * asynchronously.
   */
@Test
public void optionsWhileServerWaitTest() throws Fault {
    AsyncInvoker async = startAsyncInvokerForMethod("optionsandwait");
    Future<Response> future = async.options();
    checkFutureOkResponse(future);
// return future;
}
Also used : Response(jakarta.ws.rs.core.Response) 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