Search in sources :

Example 46 with SyncInvoker

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

the class JAXRSClientIT method traceTest.

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

Example 47 with SyncInvoker

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

the class JAXRSClientIT method methodWithStringClassWithEntityThrowsProcessingExceptionTest.

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

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

Example 48 with SyncInvoker

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

the class JAXRSClientIT method postWithGenericTypeResponseTest.

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

Example 49 with SyncInvoker

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

the class JAXRSClientIT method methodWithResponseClassWithEntityThrowsNoWebApplicationExceptionTest.

/*
   * @testName:
   * methodWithResponseClassWithEntityThrowsNoWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:569;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.method(String, 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 methodWithResponseClassWithEntityThrowsNoWebApplicationExceptionTest() throws Fault {
    for (final String method : ENTITY_METHODS) {
        SyncInvoker sync = createSyncInvokerForMethod(method.toLowerCase() + "notok");
        Entity<String> entity = createEntity(method.toLowerCase());
        Response response = sync.method(method, 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 50 with SyncInvoker

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

the class JAXRSClientIT method deleteWithGenericTypeStringTest.

/*
   * @testName: deleteWithGenericTypeStringTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:546;
   * 
   * @test_Strategy: Invoke HTTP DELETE method for the current request
   * synchronously.
   */
@Test
public void deleteWithGenericTypeStringTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("delete");
    GenericType<String> generic = createGeneric(String.class);
    String response = sync.delete(generic);
    assertResponseString(response, "delete");
}
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