Search in sources :

Example 56 with SyncInvoker

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

the class JAXRSClientIT method traceWithGenericTypeStringTest.

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

Example 57 with SyncInvoker

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

the class JAXRSClientIT method optionsWithStringClassTest.

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

Example 58 with SyncInvoker

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

the class JAXRSClientIT method postWithGenericTypeStringThrowsProcessingExceptionTest.

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

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

Example 59 with SyncInvoker

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

the class JAXRSClientIT method getWithStringClassThrowsWebApplicationExceptionTest.

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

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

Example 60 with SyncInvoker

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

the class JAXRSClientIT method putThrowsProcessingExceptionTest.

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

        @Override
        public void run() {
            SyncInvoker sync = createSyncInvokerWrongUrl();
            Entity<String> entity = createEntity("put");
            sync.put(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