Search in sources :

Example 11 with SyncInvoker

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

the class JAXRSClientIT method optionsWithGenericTypeStringTest.

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

Example 12 with SyncInvoker

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

the class JAXRSClientIT method methodWithResponseClassWithEntityTest.

/*
   * @testName: methodWithResponseClassWithEntityTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:569;
   * 
   * @test_Strategy: Invoke an arbitrary method for the current request
   * synchronously.
   */
@Test
public void methodWithResponseClassWithEntityTest() throws Fault {
    String response = null;
    for (String method : ENTITY_METHODS) {
        SyncInvoker sync = createSyncInvokerForMethod(method.toLowerCase());
        Entity<String> entity = createEntity(method.toLowerCase());
        response = sync.method(method, entity, String.class);
        assertResponseString(response, method.toLowerCase());
    }
}
Also used : SyncInvoker(jakarta.ws.rs.client.SyncInvoker) Test(org.junit.jupiter.api.Test)

Example 13 with SyncInvoker

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

the class JAXRSClientIT method getWithResponseClassTest.

/*
   * @testName: getWithResponseClassTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:551;
   * 
   * @test_Strategy: Invoke HTTP GET method for the current request
   * synchronously.
   */
@Test
public void getWithResponseClassTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("get");
    Response response = sync.get(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 14 with SyncInvoker

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

the class JAXRSClientIT method optionsThrowsProcessingExceptionTest.

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

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

Example 15 with SyncInvoker

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

the class JAXRSClientIT method getWithGenericTypeStringThrowsWebApplicationExceptionTest.

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

        @Override
        public void run() {
            SyncInvoker sync = createSyncInvokerForMethod("getnotok");
            GenericType<String> generic = createGeneric(String.class);
            sync.get(generic);
        }
    };
    assertWebApplicationException(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