use of com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider in project cxf by apache.
the class JAXRSRxJava3SingleTest method testGetHelloWorldJson.
@Test
public void testGetHelloWorldJson() throws Exception {
String address = "http://localhost:" + PORT + "/rx3/single/textJson";
final Flowable<HelloWorldBean> obs = ClientBuilder.newClient().register(new JacksonJsonProvider()).register(new FlowableRxInvokerProvider()).target(address).request(MediaType.APPLICATION_JSON).rx(FlowableRxInvoker.class).get(HelloWorldBean.class);
final TestSubscriber<HelloWorldBean> subscriber = new TestSubscriber<>();
obs.subscribe(subscriber);
subscriber.await(3, TimeUnit.SECONDS);
subscriber.assertValue(r -> "Hello".equals(r.getGreeting()) && "World".equals(r.getAudience())).assertComplete();
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider 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());
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider in project cxf by apache.
the class RxJava2MaybeServer method createServer.
@Override
protected Server createServer(Bus bus) throws Exception {
// Make sure default JSONProvider is not loaded
bus.setProperty("skip.default.json.provider.registration", true);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setProvider(new JacksonJsonProvider());
new ReactiveIOCustomizer().customize(sf);
sf.getOutInterceptors().add(new LoggingOutInterceptor());
sf.setResourceClasses(RxJava2MaybeService.class);
sf.setResourceProvider(RxJava2MaybeService.class, new SingletonResourceProvider(new RxJava2MaybeService(), true));
sf.setAddress("http://localhost:" + PORT + "/");
return sf.create();
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider in project cxf by apache.
the class RxJava2ObservableServer method createServer.
@Override
protected Server createServer(Bus bus) throws Exception {
bus.setProperty("skip.default.json.provider.registration", true);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setProvider(new JacksonJsonProvider());
sf.setProvider(new IllegalStateExceptionMapper());
new ReactiveIOCustomizer().customize(sf);
sf.getOutInterceptors().add(new LoggingOutInterceptor());
sf.setResourceClasses(RxJava2ObservableService.class);
sf.setResourceProvider(RxJava2ObservableService.class, new SingletonResourceProvider(new RxJava2ObservableService(), true));
sf.setAddress("http://localhost:" + PORT + "/");
return sf.create();
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider in project cxf by apache.
the class RxJava2SingleServer method createServer.
@Override
protected Server createServer(Bus bus) throws Exception {
// Make sure default JSONProvider is not loaded
bus.setProperty("skip.default.json.provider.registration", true);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setProvider(new JacksonJsonProvider());
new ReactiveIOCustomizer().customize(sf);
sf.getOutInterceptors().add(new LoggingOutInterceptor());
sf.setResourceClasses(RxJava2SingleService.class);
sf.setResourceProvider(RxJava2SingleService.class, new SingletonResourceProvider(new RxJava2SingleService(), true));
sf.setAddress("http://localhost:" + PORT + "/");
return sf.create();
}
Aggregations