Search in sources :

Example 76 with SyncInvoker

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

the class JAXRSClientIT method putWithResponseClassThrowsNoWebApplicationExceptionTest.

/*
   * @testName: putWithResponseClassThrowsNoWebApplicationExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:593;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.put( 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 putWithResponseClassThrowsNoWebApplicationExceptionTest() throws Fault {
    SyncInvoker sync = createSyncInvokerForMethod("putnotok");
    Entity<String> entity = createEntity("put");
    Response response = sync.put(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 77 with SyncInvoker

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

the class JAXRSClientIT method optionsWithGenericTypeStringThrowsProcessingExceptionTest.

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

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

Example 78 with SyncInvoker

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

the class JAXRSClientIT method putTest.

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

Example 79 with SyncInvoker

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

the class JAXRSClientIT method optionsWithResponseClassTest.

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

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

the class JAXRSClientIT method methodWithStringClassThrowsProcessingExceptionTest.

/*
   * @testName: methodWithStringClassThrowsProcessingExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:561;
   * 
   * @test_Strategy: jakarta.ws.rs.client.SyncInvoker.method(String) 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 methodWithStringClassThrowsProcessingExceptionTest() throws Fault {
    for (final String method : METHODS) {
        Runnable run = new Runnable() {

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