Search in sources :

Example 1 with JdkLoggingFilter

use of ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method invocationFromLinkWithMediaType.

// /////////////////////////////////////////////////////////////////////////
protected Response invocationFromLinkWithMediaType(String mediaType) throws Fault {
    String url = "mediatype";
    Client client = ClientBuilder.newClient();
    client.register(new JdkLoggingFilter(false));
    URI uri = UriBuilder.fromPath(getUrl(url)).build();
    Link link = Link.fromUri(uri).type(mediaType).build();
    Invocation i = client.invocation(link).buildGet();
    Response response = i.invoke();
    return response;
}
Also used : Response(jakarta.ws.rs.core.Response) JdkLoggingFilter(ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter) Invocation(jakarta.ws.rs.client.Invocation) Client(jakarta.ws.rs.client.Client) JaxrsCommonClient(ee.jakarta.tck.ws.rs.common.client.JaxrsCommonClient) URI(java.net.URI) Link(jakarta.ws.rs.core.Link)

Example 2 with JdkLoggingFilter

use of ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method startBuilderForMethod.

protected Invocation.Builder startBuilderForMethod(String methodName) {
    Client client = ClientBuilder.newClient();
    client.register(new JdkLoggingFilter(false));
    WebTarget target = client.target(getAbsoluteUrl(methodName));
    Invocation.Builder ib = target.request();
    return ib;
}
Also used : JdkLoggingFilter(ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter) Invocation(jakarta.ws.rs.client.Invocation) WebTarget(jakarta.ws.rs.client.WebTarget) JAXRSCommonClient(ee.jakarta.tck.ws.rs.common.JAXRSCommonClient) Client(jakarta.ws.rs.client.Client)

Example 3 with JdkLoggingFilter

use of ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method startAsyncInvokerForMethod.

/**
 * Create AsyncInvoker for given resource method and start time
 */
protected AsyncInvoker startAsyncInvokerForMethod(String methodName) {
    Client client = ClientBuilder.newClient();
    client.register(new JdkLoggingFilter(false));
    WebTarget target = client.target(getUrl(methodName));
    AsyncInvoker async = target.request().async();
    setStartTime();
    return async;
}
Also used : JdkLoggingFilter(ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter) AsyncInvoker(jakarta.ws.rs.client.AsyncInvoker) WebTarget(jakarta.ws.rs.client.WebTarget) JaxrsCommonClient(ee.jakarta.tck.ws.rs.common.client.JaxrsCommonClient) Client(jakarta.ws.rs.client.Client)

Example 4 with JdkLoggingFilter

use of ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method createSyncInvokerForMethod.

/**
 * Create SyncInvoker for given resource method and start time
 */
protected SyncInvoker createSyncInvokerForMethod(String methodName) {
    Client client = ClientBuilder.newClient();
    client.register(new JdkLoggingFilter(false));
    WebTarget target = client.target(getUrl(methodName));
    SyncInvoker sync = target.request();
    return sync;
}
Also used : JdkLoggingFilter(ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter) SyncInvoker(jakarta.ws.rs.client.SyncInvoker) WebTarget(jakarta.ws.rs.client.WebTarget) JaxrsCommonClient(ee.jakarta.tck.ws.rs.common.client.JaxrsCommonClient) Client(jakarta.ws.rs.client.Client)

Example 5 with JdkLoggingFilter

use of ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method completionStageReturnedTest.

/* Run test */
/*
   * @testName: completionStageReturnedTest
   * 
   * @assertion_ids: JAXRS:SPEC:128;
   * 
   * @test_Strategy:
   */
@Test
public void completionStageReturnedTest() throws Fault {
    Future<Response> f = ClientBuilder.newClient().register(new JdkLoggingFilter(false)).target(getAbsoluteUrl("async")).request().async().get();
    assertFalse(f.isDone());
    try (Response r = f.get()) {
        String msg = r.readEntity(String.class);
        assertEquals(CompletionStageResource.MESSAGE, msg);
    } catch (Exception e) {
        fault(e);
    }
}
Also used : Response(jakarta.ws.rs.core.Response) JdkLoggingFilter(ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter) IOException(java.io.IOException) Test(org.junit.jupiter.api.Test)

Aggregations

JdkLoggingFilter (ee.jakarta.tck.ws.rs.common.client.JdkLoggingFilter)8 Client (jakarta.ws.rs.client.Client)7 WebTarget (jakarta.ws.rs.client.WebTarget)6 JaxrsCommonClient (ee.jakarta.tck.ws.rs.common.client.JaxrsCommonClient)4 Invocation (jakarta.ws.rs.client.Invocation)4 AsyncInvoker (jakarta.ws.rs.client.AsyncInvoker)2 Response (jakarta.ws.rs.core.Response)2 JAXRSCommonClient (ee.jakarta.tck.ws.rs.common.JAXRSCommonClient)1 SyncInvoker (jakarta.ws.rs.client.SyncInvoker)1 Link (jakarta.ws.rs.core.Link)1 IOException (java.io.IOException)1 URI (java.net.URI)1 Test (org.junit.jupiter.api.Test)1