Search in sources :

Example 86 with AsyncInvoker

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

the class JAXRSClientIT method putWithGenericTypeResponseWhileServerWaitTest.

/*
   * @testName: putWithGenericTypeResponseWhileServerWaitTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:403;
   * 
   * @test_Strategy: Invoke HTTP put method for the current request
   * asynchronously.
   */
@Test
public void putWithGenericTypeResponseWhileServerWaitTest() throws Fault {
    GenericType<Response> generic = createGeneric(Response.class);
    Entity<String> entity = Entity.entity("put", MediaType.WILDCARD_TYPE);
    AsyncInvoker async = startAsyncInvokerForMethod("putandwait");
    Future<Response> future = async.put(entity, generic);
    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 87 with AsyncInvoker

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

the class JAXRSClientIT method getWithGenericTypeStringWhileServerWaitTest.

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

Example 88 with AsyncInvoker

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

the class JAXRSClientIT method optionsWithCallbackThrowsWebApplicationExceptionTest.

/*
   * @testName: optionsWithCallbackThrowsWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:396;
   * 
   * @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 optionsWithCallbackThrowsWebApplicationExceptionTest() throws Fault {
    AsyncInvoker async = startAsyncInvokerForMethod("optionsnotok");
    InvocationCallback<String> callback = createStringCallback(false);
    Future<String> future = async.options(callback);
    assertExceptionWithWebApplicationExceptionIsThrownAndLog(future);
}
Also used : AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 89 with AsyncInvoker

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

the class JAXRSClientIT method headWithCallbackWhileServerWaitTest.

/*
   * @testName: headWithCallbackWhileServerWaitTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:384;
   * 
   * @test_Strategy: Invoke HTTP HEAD method for the current request
   * asynchronously.
   */
@Test
public void headWithCallbackWhileServerWaitTest() throws Fault {
    AsyncInvoker async = startAsyncInvokerForMethod("headandwait");
    InvocationCallback<Response> callback = createCallback(true);
    Future<Response> future = async.head(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 90 with AsyncInvoker

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

the class JAXRSClientIT method putWithGenericTypeThrowsProcessingExceptionTest.

/*
   * @testName: putWithGenericTypeThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:403;
   * 
   * @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 putWithGenericTypeThrowsProcessingExceptionTest() throws Fault {
    _hostname = NONEXISTING_SITE;
    GenericType<String> generic = createGeneric(String.class);
    Entity<String> entity = Entity.entity("put", MediaType.WILDCARD_TYPE);
    AsyncInvoker async = startAsyncInvokerForMethod("put");
    Future<String> future = async.put(entity, generic);
    assertExceptionWithProcessingExceptionIsThrownAndLog(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