Search in sources :

Example 16 with SyncInvoker

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

the class JAXRSClientIT method deleteWithGenericTypeStringThrowsProcessingExceptionTest.

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

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

Example 17 with SyncInvoker

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

the class JAXRSClientIT method traceWithStringClassThrowsWebApplicationExceptionTest.

/*
   * @testName: traceWithStringClassThrowsWebApplicationExceptionTest
   * 
   * @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 traceWithStringClassThrowsWebApplicationExceptionTest() throws Fault {
    Runnable run = new Runnable() {

        @Override
        public void run() {
            SyncInvoker sync = createSyncInvokerForMethod("tracenotok");
            sync.trace(String.class);
        }
    };
    assertWebApplicationException(run);
}
Also used : SyncInvoker(jakarta.ws.rs.client.SyncInvoker) Test(org.junit.jupiter.api.Test)

Example 18 with SyncInvoker

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

the class JAXRSClientIT method postWithResponseClassThrowsNoWebApplicationExceptionTest.

/*
   * @testName: postWithResponseClassThrowsNoWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:585;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.post( 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 postWithResponseClassThrowsNoWebApplicationExceptionTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("postnotok");
    Entity<String> entity = createEntity("post");
    Response response = sync.post(entity, 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 19 with SyncInvoker

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

the class JAXRSClientIT method methodWithGenericTypeStringWithEntityThrowsProcessingExceptionTest.

/*
   * @testName:
   * methodWithGenericTypeStringWithEntityThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:572;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.method(String, Entity,
   * GenericType) throws ProcessingException in case the invocation failed.
   */
@Test
public void methodWithGenericTypeStringWithEntityThrowsProcessingExceptionTest() throws Fault {
    for (final String method : ENTITY_METHODS) {
        Runnable run = new Runnable() {

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

Example 20 with SyncInvoker

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

the class JAXRSClientIT method putWithStringClassTest.

/*
   * @testName: putWithStringClassTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:593;
   * 
   * @test_Strategy: Invoke HTTP put method for the current request
   * synchronously.
   */
@Test
public void putWithStringClassTest() throws Fault {
    Entity<String> entity = createEntity("put");
    SyncInvoker sync = createSyncInvokerForMethod("put");
    String response = sync.put(entity, String.class);
    assertResponseString(response, "put");
}
Also used : 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