Search in sources :

Example 66 with Response

use of jakarta.ws.rs.core.Response 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 67 with Response

use of jakarta.ws.rs.core.Response 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)

Example 68 with Response

use of jakarta.ws.rs.core.Response 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 69 with Response

use of jakarta.ws.rs.core.Response 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 70 with Response

use of jakarta.ws.rs.core.Response 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)

Aggregations

Response (jakarta.ws.rs.core.Response)665 Test (org.junit.jupiter.api.Test)551 AsyncInvoker (jakarta.ws.rs.client.AsyncInvoker)78 ClientRequestContext (jakarta.ws.rs.client.ClientRequestContext)71 ResponseBuilder (jakarta.ws.rs.core.Response.ResponseBuilder)67 Invocation (jakarta.ws.rs.client.Invocation)65 CompletionStageRxInvoker (jakarta.ws.rs.client.CompletionStageRxInvoker)51 Path (jakarta.ws.rs.Path)44 IOException (java.io.IOException)43 SyncInvoker (jakarta.ws.rs.client.SyncInvoker)41 ClientResponseContext (jakarta.ws.rs.client.ClientResponseContext)33 POST (jakarta.ws.rs.POST)27 Client (jakarta.ws.rs.client.Client)25 WebTarget (jakarta.ws.rs.client.WebTarget)24 Link (jakarta.ws.rs.core.Link)23 Status (jakarta.ws.rs.core.Response.Status)23 MediaType (jakarta.ws.rs.core.MediaType)22 Annotation (java.lang.annotation.Annotation)22 Date (java.util.Date)21 GET (jakarta.ws.rs.GET)18