Search in sources :

Example 41 with AsyncInvoker

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

the class JAXRSClientIT method methodWithStringClassWhileServerWaitTest.

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

Example 42 with AsyncInvoker

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

the class JAXRSClientIT method methodWithCallbackThrowsProcessingExceptionTest.

/*
   * @testName: methodWithCallbackThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:388;
   * 
   * @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 methodWithCallbackThrowsProcessingExceptionTest() throws Fault {
    _hostname = NONEXISTING_SITE;
    Future<String> future = null;
    InvocationCallback<String> callback = createStringCallback(false);
    for (String method : METHODS) {
        AsyncInvoker async = startAsyncInvokerForMethod(method.toLowerCase());
        future = async.method(method, callback);
        assertExceptionWithProcessingExceptionIsThrownAndLog(future);
    }
}
Also used : AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 43 with AsyncInvoker

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

the class JAXRSClientIT method putWithStringCallbackWhileServerWaitTest.

/*
   * @testName: putWithStringCallbackWhileServerWaitTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:404;
   * 
   * @test_Strategy: Invoke HTTP put method for the current request
   * asynchronously.
   */
@Test
public void putWithStringCallbackWhileServerWaitTest() throws Fault {
    Entity<String> entity = Entity.entity("put", MediaType.WILDCARD_TYPE);
    InvocationCallback<String> callback = createStringCallback(true);
    AsyncInvoker async = startAsyncInvokerForMethod("putandwait");
    Future<String> future = async.put(entity, callback);
    checkFutureString(future, "put");
    assertCallbackCall();
// return future;
}
Also used : AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) Test(org.junit.jupiter.api.Test)

Example 44 with AsyncInvoker

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

the class JAXRSClientIT method postWhileServerWaitTest.

/*
   * @testName: postWhileServerWaitTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:397;
   * 
   * @test_Strategy: Invoke HTTP post method for the current request
   * asynchronously.
   */
@Test
public void postWhileServerWaitTest() throws Fault {
    AsyncInvoker async = startAsyncInvokerForMethod("postandwait");
    Entity<String> entity = Entity.entity("post", MediaType.WILDCARD_TYPE);
    Future<Response> future = async.post(entity);
    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 45 with AsyncInvoker

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

the class JAXRSClientIT method traceThrowsProcessingExceptionTest.

/*
   * @testName: traceThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:405;
   * 
   * @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 traceThrowsProcessingExceptionTest() throws Fault {
    _hostname = NONEXISTING_SITE;
    AsyncInvoker async = startAsyncInvokerForMethod("trace");
    Future<Response> future = async.trace();
    assertExceptionWithProcessingExceptionIsThrownAndLog(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