Search in sources :

Example 46 with AsyncInvoker

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

the class JAXRSClientIT method deleteWithStringClassWhileServerWaitTest.

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

Example 47 with AsyncInvoker

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

the class JAXRSClientIT method putTest.

// ------------------------------------------------------------------
// ---------------------------PUT -----------------------------------
// ------------------------------------------------------------------
/*
   * @testName: putTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:401;
   * 
   * @test_Strategy: Invoke HTTP PUT method for the current request
   * asynchronously.
   */
@Test
public void putTest() throws Fault {
    AsyncInvoker async = startAsyncInvokerForMethod("put");
    Entity<String> entity = Entity.entity("put", MediaType.WILDCARD_TYPE);
    Future<Response> future = async.put(entity);
    checkFutureOkResponseNoTime(future);
// return future;
}
Also used : Response(jakarta.ws.rs.core.Response) AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 48 with AsyncInvoker

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

the class JAXRSClientIT method putWithCallbackWhileServerWaitTest.

/*
   * @testName: putWithCallbackWhileServerWaitTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:404;
   * 
   * @test_Strategy: Invoke HTTP put method for the current request
   * asynchronously.
   */
@Test
public void putWithCallbackWhileServerWaitTest() throws Fault {
    Entity<String> entity = Entity.entity("put", MediaType.WILDCARD_TYPE);
    InvocationCallback<Response> callback = createCallback(true);
    AsyncInvoker async = startAsyncInvokerForMethod("putandwait");
    Future<Response> future = async.put(entity, 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 49 with AsyncInvoker

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

the class JAXRSClientIT method headWithCallbackStringThrowsProcessingExceptionTest.

/*
   * @testName: headWithCallbackStringThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:384;
   * 
   * @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 headWithCallbackStringThrowsProcessingExceptionTest() throws Fault {
    _hostname = NONEXISTING_SITE;
    AsyncInvoker async = startAsyncInvokerForMethod("head");
    InvocationCallback<Response> callback = createCallback(false);
    Future<Response> future = async.head(callback);
    assertExceptionWithProcessingExceptionIsThrownAndLog(future);
}
Also used : Response(jakarta.ws.rs.core.Response) AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 50 with AsyncInvoker

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

the class JAXRSClientIT method methodWithResponseClassWithEntityWhileServerWaitTest.

/*
   * @testName: methodWithResponseClassWithEntityWhileServerWaitTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:390;
   * 
   * @test_Strategy: Invoke an arbitrary method for the current request
   * asynchronously.
   */
@Test
public void methodWithResponseClassWithEntityWhileServerWaitTest() throws Fault {
    Future<Response> future = null;
    for (String method : ENTITY_METHODS) {
        AsyncInvoker async = startAsyncInvokerForMethod(method.toLowerCase() + "andwait");
        Entity<String> entity = Entity.entity(method, MediaType.WILDCARD_TYPE);
        future = async.method(method, entity, 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)

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