Search in sources :

Example 81 with WebTarget

use of javax.ws.rs.client.WebTarget in project jersey by jersey.

the class JacksonTest method testEmptyArrayBean.

@Test
public void testEmptyArrayBean() {
    WebTarget target = target();
    EmptyArrayBean responseMsg = target.path("emptyArrayResource").request(MediaType.APPLICATION_JSON).get(EmptyArrayBean.class);
    assertNotNull(responseMsg);
}
Also used : WebTarget(javax.ws.rs.client.WebTarget) Test(org.junit.Test) JerseyTest(org.glassfish.jersey.test.JerseyTest)

Example 82 with WebTarget

use of javax.ws.rs.client.WebTarget in project jersey by jersey.

the class JacksonTest method testApplicationWadl.

/**
     * Test if a WADL document is available at the relative path
     * "application.wadl".
     * <p/>
     */
@Test
public void testApplicationWadl() {
    WebTarget target = target();
    String serviceWadl = target.path("application.wadl").request(MediaTypes.WADL_TYPE).get(String.class);
    assertTrue(serviceWadl.length() > 0);
}
Also used : WebTarget(javax.ws.rs.client.WebTarget) Test(org.junit.Test) JerseyTest(org.glassfish.jersey.test.JerseyTest)

Example 83 with WebTarget

use of javax.ws.rs.client.WebTarget in project jersey by jersey.

the class Jackson1Test method testApplicationWadl.

/**
     * Test if a WADL document is available at the relative path
     * "application.wadl".
     * <p/>
     */
@Test
public void testApplicationWadl() {
    final WebTarget target = target();
    final String serviceWadl = target.path("application.wadl").request(MediaTypes.WADL_TYPE).get(String.class);
    assertTrue(serviceWadl.length() > 0);
}
Also used : WebTarget(javax.ws.rs.client.WebTarget) Test(org.junit.Test) JerseyTest(org.glassfish.jersey.test.JerseyTest)

Example 84 with WebTarget

use of javax.ws.rs.client.WebTarget in project jersey by jersey.

the class JsonResourceTest method roundTripTest.

@Test
public void roundTripTest() {
    final WebTarget target = target("test");
    final TestBean testBean = target.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.entity(new TestBean("a", 1, 1L), MediaType.APPLICATION_JSON_TYPE), TestBean.class);
    assertEquals(testBean, new TestBean("a", 1, 1L));
}
Also used : WebTarget(javax.ws.rs.client.WebTarget) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test)

Example 85 with WebTarget

use of javax.ws.rs.client.WebTarget in project jersey by jersey.

the class RequestScopeAlignmentTest method testUriInfoPropagatesToApp.

@Test
public void testUriInfoPropagatesToApp() {
    for (String d : new String[] { "one", "two", "three" }) {
        final WebTarget fieldTarget = target().path("req/ui/jax-rs-field").path(d);
        final WebTarget appFieldTarget = target().path("req/ui/jax-rs-app-field").path(d);
        String f = fieldTarget.request().get(String.class);
        assertThat(f, containsString(fieldTarget.getUri().toString()));
        String af = appFieldTarget.request().get(String.class);
        assertThat(af, containsString(appFieldTarget.getUri().toString()));
    }
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) WebTarget(javax.ws.rs.client.WebTarget) Test(org.junit.Test) JerseyTest(org.glassfish.jersey.test.JerseyTest)

Aggregations

WebTarget (javax.ws.rs.client.WebTarget)1393 Response (javax.ws.rs.core.Response)712 Test (org.junit.Test)702 Client (javax.ws.rs.client.Client)318 JerseyTest (org.glassfish.jersey.test.JerseyTest)297 Invocation (javax.ws.rs.client.Invocation)106 List (java.util.List)76 ProcessingException (javax.ws.rs.ProcessingException)71 Builder (javax.ws.rs.client.Invocation.Builder)71 ClientBuilder (javax.ws.rs.client.ClientBuilder)69 GenericType (javax.ws.rs.core.GenericType)64 ArrayList (java.util.ArrayList)61 IOException (java.io.IOException)59 Message (com.remswork.project.alice.model.support.Message)58 PulsarAdminException (org.apache.pulsar.client.admin.PulsarAdminException)58 InputStream (java.io.InputStream)52 NamespaceName (org.apache.pulsar.common.naming.NamespaceName)52 ClientConfig (org.glassfish.jersey.client.ClientConfig)52 Form (javax.ws.rs.core.Form)42 MultiPart (org.glassfish.jersey.media.multipart.MultiPart)42