Search in sources :

Example 51 with GenericType

use of javax.ws.rs.core.GenericType in project cxf by apache.

the class JAXRSClientServerResourceJacksonSpringProviderTest method testGetGenericSuperBookInt1.

@Test
public void testGetGenericSuperBookInt1() throws Exception {
    String endpointAddress = "http://localhost:" + PORT + "/webapp/genericstoreInt1/int/books/superbook";
    WebClient wc = WebClient.create(endpointAddress, Collections.singletonList(new JacksonJsonProvider()));
    WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(1000000000L);
    GenericType<List<SuperBook>> genericResponseType = new GenericType<List<SuperBook>>() {
    };
    List<SuperBook> books = wc.get(genericResponseType);
    assertEquals(1, books.size());
    assertEquals(111L, books.get(0).getId());
}
Also used : GenericType(javax.ws.rs.core.GenericType) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) List(java.util.List) WebClient(org.apache.cxf.jaxrs.client.WebClient) Test(org.junit.Test)

Example 52 with GenericType

use of javax.ws.rs.core.GenericType in project cxf by apache.

the class JAXRSRxJava3FlowableTest method doTestGetHelloWorldJsonList.

private void doTestGetHelloWorldJsonList(String address) throws Exception {
    WebClient wc = WebClient.create(address, Collections.singletonList(new JacksonJsonProvider()));
    WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000);
    GenericType<List<HelloWorldBean>> genericResponseType = new GenericType<List<HelloWorldBean>>() {
    };
    List<HelloWorldBean> beans = wc.accept("application/json").get(genericResponseType);
    assertEquals(2, beans.size());
    assertEquals("Hello", beans.get(0).getGreeting());
    assertEquals("World", beans.get(0).getAudience());
    assertEquals("Ciao", beans.get(1).getGreeting());
    assertEquals("World", beans.get(1).getAudience());
}
Also used : GenericType(javax.ws.rs.core.GenericType) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) List(java.util.List) LinkedList(java.util.LinkedList) WebClient(org.apache.cxf.jaxrs.client.WebClient)

Example 53 with GenericType

use of javax.ws.rs.core.GenericType in project cxf by apache.

the class JAXRSRxJava3ObservableTest method doTestGetHelloWorldJsonList.

private void doTestGetHelloWorldJsonList(String address) throws Exception {
    WebClient wc = WebClient.create(address, Collections.singletonList(new JacksonJsonProvider()));
    WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000);
    GenericType<List<HelloWorldBean>> genericResponseType = new GenericType<List<HelloWorldBean>>() {
    };
    List<HelloWorldBean> beans = wc.accept("application/json").get(genericResponseType);
    assertEquals(2, beans.size());
    assertEquals("Hello", beans.get(0).getGreeting());
    assertEquals("World", beans.get(0).getAudience());
    assertEquals("Ciao", beans.get(1).getGreeting());
    assertEquals("World", beans.get(1).getAudience());
}
Also used : GenericType(javax.ws.rs.core.GenericType) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) List(java.util.List) LinkedList(java.util.LinkedList) WebClient(org.apache.cxf.jaxrs.client.WebClient)

Example 54 with GenericType

use of javax.ws.rs.core.GenericType in project cxf by apache.

the class JAXRSRxJava2FlowableTest method doTestGetHelloWorldJsonList.

private void doTestGetHelloWorldJsonList(String address) throws Exception {
    WebClient wc = WebClient.create(address, Collections.singletonList(new JacksonJsonProvider()));
    WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000);
    GenericType<List<HelloWorldBean>> genericResponseType = new GenericType<List<HelloWorldBean>>() {
    };
    List<HelloWorldBean> beans = wc.accept("application/json").get(genericResponseType);
    assertEquals(2, beans.size());
    assertEquals("Hello", beans.get(0).getGreeting());
    assertEquals("World", beans.get(0).getAudience());
    assertEquals("Ciao", beans.get(1).getGreeting());
    assertEquals("World", beans.get(1).getAudience());
}
Also used : GenericType(javax.ws.rs.core.GenericType) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) List(java.util.List) LinkedList(java.util.LinkedList) WebClient(org.apache.cxf.jaxrs.client.WebClient)

Example 55 with GenericType

use of javax.ws.rs.core.GenericType in project cxf by apache.

the class JAXRSRxJava2ObservableTest method doTestGetHelloWorldJsonList.

private void doTestGetHelloWorldJsonList(String address) throws Exception {
    WebClient wc = WebClient.create(address, Collections.singletonList(new JacksonJsonProvider()));
    WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000);
    GenericType<List<HelloWorldBean>> genericResponseType = new GenericType<List<HelloWorldBean>>() {
    };
    List<HelloWorldBean> beans = wc.accept("application/json").get(genericResponseType);
    assertEquals(2, beans.size());
    assertEquals("Hello", beans.get(0).getGreeting());
    assertEquals("World", beans.get(0).getAudience());
    assertEquals("Ciao", beans.get(1).getGreeting());
    assertEquals("World", beans.get(1).getAudience());
}
Also used : GenericType(javax.ws.rs.core.GenericType) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) List(java.util.List) LinkedList(java.util.LinkedList) WebClient(org.apache.cxf.jaxrs.client.WebClient)

Aggregations

GenericType (javax.ws.rs.core.GenericType)126 List (java.util.List)64 WebTarget (javax.ws.rs.client.WebTarget)64 Response (javax.ws.rs.core.Response)60 Test (org.junit.Test)51 Client (javax.ws.rs.client.Client)24 ArrayList (java.util.ArrayList)17 Message (com.remswork.project.alice.model.support.Message)16 WebClient (org.apache.cxf.jaxrs.client.WebClient)16 GenericEntity (javax.ws.rs.core.GenericEntity)15 MediaType (javax.ws.rs.core.MediaType)15 Collection (java.util.Collection)14 Set (java.util.Set)14 LinkedList (java.util.LinkedList)12 HashSet (java.util.HashSet)11 Test (org.junit.jupiter.api.Test)11 JerseyTest (org.glassfish.jersey.test.JerseyTest)10 JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)9 Collections (java.util.Collections)9 Entity (javax.ws.rs.client.Entity)9