Search in sources :

Example 51 with SyncInvoker

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

the class JAXRSClientIT method methodWithResponseClassTest.

/*
   * @testName: methodWithResponseClassTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:561;
   * 
   * @test_Strategy: Invoke an arbitrary method for the current request
   * synchronously.
   */
@Test
public void methodWithResponseClassTest() throws Fault {
    Response response = null;
    for (String method : METHODS) {
        SyncInvoker sync = createSyncInvokerForMethod(method.toLowerCase());
        response = sync.method(method, 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 52 with SyncInvoker

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

the class JAXRSClientIT method traceWithStringClassTest.

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

Example 53 with SyncInvoker

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

the class JAXRSClientIT method optionsWithGenericTypeResponseTest.

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

Example 54 with SyncInvoker

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

the class JAXRSClientIT method putWithStringClassThrowsProcessingExceptionTest.

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

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

Example 55 with SyncInvoker

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

the class JAXRSClientIT method getThrowsProcessingExceptionTest.

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

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