Search in sources :

Example 26 with SyncInvoker

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

the class JAXRSClientIT method getWithGenericTypeStringThrowsProcessingExceptionTest.

/*
   * @testName: getWithGenericTypeStringThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:554;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.get( GenericType ) throws
   * ProcessingException in case the invocation failed.
   */
@Test
public void getWithGenericTypeStringThrowsProcessingExceptionTest() throws Fault {
    Runnable run = new Runnable() {

        @Override
        public void run() {
            SyncInvoker sync = createSyncInvokerWrongUrl();
            GenericType<String> generic = createGeneric(String.class);
            sync.get(generic);
        }
    };
    assertProcessingException(run);
}
Also used : SyncInvoker(jakarta.ws.rs.client.SyncInvoker) Test(org.junit.jupiter.api.Test)

Example 27 with SyncInvoker

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

the class JAXRSClientIT method getWithGenericTypeStringTest.

/*
   * @testName: getWithGenericTypeStringTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:554;
   * 
   * @test_Strategy: Invoke HTTP GET method for the current request
   * synchronously.
   */
@Test
public void getWithGenericTypeStringTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("get");
    GenericType<String> generic = createGeneric(String.class);
    String response = sync.get(generic);
    assertResponseString(response, "get");
}
Also used : SyncInvoker(jakarta.ws.rs.client.SyncInvoker) Test(org.junit.jupiter.api.Test)

Example 28 with SyncInvoker

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

the class JAXRSClientIT method traceWithGenericTypeStringThrowsProcessingExceptionTest.

/*
   * @testName: traceWithGenericTypeStringThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:604;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.trace( Entity, GenericType )
   * throws ProcessingException in case the invocation failed.
   */
@Test
public void traceWithGenericTypeStringThrowsProcessingExceptionTest() throws Fault {
    Runnable run = new Runnable() {

        @Override
        public void run() {
            SyncInvoker sync = createSyncInvokerWrongUrl();
            GenericType<String> generic = createGeneric(String.class);
            sync.trace(generic);
        }
    };
    assertProcessingException(run);
}
Also used : SyncInvoker(jakarta.ws.rs.client.SyncInvoker) Test(org.junit.jupiter.api.Test)

Example 29 with SyncInvoker

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

the class JAXRSClientIT method deleteWithResponseClassThrowsNoWebApplicationExceptionTest.

/*
   * @testName: deleteWithResponseClassThrowsNoWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:543;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.delete( Class ) throws
   * WebApplicationException - in case the response status code of the response
   * returned by the server is not successful and the specified response type is
   * not Response.
   */
@Test
public void deleteWithResponseClassThrowsNoWebApplicationExceptionTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("deletenotok");
    Response response = sync.delete(Response.class);
    assertStatusAndLog(response, Status.NOT_ACCEPTABLE);
}
Also used : Response(jakarta.ws.rs.core.Response) SyncInvoker(jakarta.ws.rs.client.SyncInvoker) Test(org.junit.jupiter.api.Test)

Example 30 with SyncInvoker

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

the class JAXRSClientIT method getWithGenericTypeResponseTest.

/*
   * @testName: getWithGenericTypeResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:554;
   * 
   * @test_Strategy: Invoke HTTP GET method for the current request
   * synchronously.
   */
@Test
public void getWithGenericTypeResponseTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("get");
    GenericType<Response> generic = createGeneric(Response.class);
    Response response = sync.get(generic);
    assertResponseOk(response);
}
Also used : Response(jakarta.ws.rs.core.Response) SyncInvoker(jakarta.ws.rs.client.SyncInvoker) Test(org.junit.jupiter.api.Test)

Aggregations

SyncInvoker (jakarta.ws.rs.client.SyncInvoker)100 Test (org.junit.jupiter.api.Test)98 Response (jakarta.ws.rs.core.Response)41 Client (jakarta.ws.rs.client.Client)2 WebTarget (jakarta.ws.rs.client.WebTarget)2 JaxrsCommonClient (ee.jakarta.tck.ws.rs.common.client.JaxrsCommonClient)1 JdkLoggingFilter (ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter)1 AsyncInvoker (jakarta.ws.rs.client.AsyncInvoker)1 Invocation (jakarta.ws.rs.client.Invocation)1 Status (jakarta.ws.rs.core.Response.Status)1 ThrottledClient (jaxrs.examples.client.custom.ThrottledClient)1