Search in sources :

Example 36 with SyncInvoker

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

the class JAXRSClientIT method putWithGenericTypeResponseThrowsNoWebApplicationExceptionTest.

/*
   * @testName: putWithGenericTypeResponseThrowsNoWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:596;
   * 
   * @test_Strategy: 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 putWithGenericTypeResponseThrowsNoWebApplicationExceptionTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("putnotok");
    Entity<String> entity = createEntity("put");
    GenericType<Response> generic = createGeneric(Response.class);
    Response response = sync.put(entity, 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 37 with SyncInvoker

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

the class JAXRSClientIT method putWithGenericTypeStringTest.

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

Example 38 with SyncInvoker

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

the class JAXRSClientIT method traceThrowsProcessingExceptionTest.

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

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

Example 39 with SyncInvoker

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

the class JAXRSClientIT method deleteWithStringClassTest.

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

Example 40 with SyncInvoker

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

the class JAXRSClientIT method deleteWithGenericTypeResponseTest.

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