Search in sources :

Example 41 with SyncInvoker

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

the class JAXRSClientIT method putWithGenericTypeStringThrowsWebApplicationExceptionTest.

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

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

Example 42 with SyncInvoker

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

the class JAXRSClientIT method deleteWithResponseClassTest.

/*
   * @testName: deleteWithResponseClassTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:543;
   * 
   * @test_Strategy: Invoke HTTP DELETE method for the current request
   * synchronously.
   */
@Test
public void deleteWithResponseClassTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("delete");
    Response response = sync.delete(Response.class);
    assertResponseOk(response);
}
Also used : Response(jakarta.ws.rs.core.Response) SyncInvoker(jakarta.ws.rs.client.SyncInvoker) Test(org.junit.jupiter.api.Test)

Example 43 with SyncInvoker

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

the class JAXRSClientIT method deleteWithStringClassThrowsProcessingExceptionTest.

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

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

Example 44 with SyncInvoker

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

the class JAXRSClientIT method methodWithGenericTypeStringWithEntityThrowsWebApplicationExceptionTest.

/*
   * @testName:
   * methodWithGenericTypeStringWithEntityThrowsWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:572;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.method(String, Entity,
   * 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 methodWithGenericTypeStringWithEntityThrowsWebApplicationExceptionTest() throws Fault {
    for (final String method : ENTITY_METHODS) {
        Runnable run = new Runnable() {

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

Example 45 with SyncInvoker

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

the class JAXRSClientIT method methodWithEntityThrowsProcessingExceptionTest.

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

            @Override
            public void run() {
                SyncInvoker sync = createSyncInvokerWrongUrl();
                sync.method(method, entity);
            }
        };
        assertProcessingException(run);
    }
}
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