Search in sources :

Example 31 with SyncInvoker

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

the class JAXRSClientIT method putWithStringClassThrowsWebApplicationExceptionTest.

/*
   * @testName: putWithStringClassThrowsWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:593;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.put( Entity, 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 putWithStringClassThrowsWebApplicationExceptionTest() throws Fault {
    Runnable run = new Runnable() {

        @Override
        public void run() {
            SyncInvoker sync = createSyncInvokerForMethod("putnotok");
            Entity<String> entity = createEntity("put");
            sync.put(entity, String.class);
        }
    };
    assertWebApplicationException(run);
}
Also used : SyncInvoker(jakarta.ws.rs.client.SyncInvoker) Test(org.junit.jupiter.api.Test)

Example 32 with SyncInvoker

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

the class JAXRSClientIT method traceWithResponseClassThrowsNoWebApplicationExceptionTest.

/*
   * @testName: traceWithResponseClassThrowsNoWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:601;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.trace( Entity, 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 traceWithResponseClassThrowsNoWebApplicationExceptionTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("tracenotok");
    Response response = sync.trace(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 33 with SyncInvoker

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

the class JAXRSClientIT method optionsWithStringThrowsProcessingExceptionTest.

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

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

Example 34 with SyncInvoker

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

the class JAXRSClientIT method optionsWithGenericTypeResponseThrowsNoWebApplicationExceptionTest.

/*
   * @testName:
   * optionsWithGenericTypeResponseThrowsNoWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:580;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.options( GenericType )
   * 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 optionsWithGenericTypeResponseThrowsNoWebApplicationExceptionTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("optionsnotok");
    GenericType<Response> generic = createGeneric(Response.class);
    Response response = sync.options(generic);
    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 35 with SyncInvoker

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

the class JAXRSClientIT method getWithGenericTypeResponseThrowsNoWebApplicationExceptionTest.

/*
   * @testName: getWithGenericTypeResponseThrowsNoWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:554;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.get( GenericType ) 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 getWithGenericTypeResponseThrowsNoWebApplicationExceptionTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("getnotok");
    GenericType<Response> generic = createGeneric(Response.class);
    Response response = sync.get(generic);
    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)

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