use of org.apache.cxf.jaxrs.rx2.client.FlowableRxInvokerProvider in project cxf by apache.
the class JAXRSRxJava2MaybeTest method testGetHelloWorldEmpty.
@Test
public void testGetHelloWorldEmpty() throws Exception {
String address = "http://localhost:" + PORT + "/rx2/maybe/empty";
final Flowable<Response> obs = ClientBuilder.newClient().register(new JacksonJsonProvider()).register(new FlowableRxInvokerProvider()).target(address).request(MediaType.APPLICATION_JSON).rx(FlowableRxInvoker.class).get();
final TestSubscriber<Response> subscriber = new TestSubscriber<>();
obs.subscribe(subscriber);
subscriber.await(3, TimeUnit.SECONDS);
subscriber.assertValue(r -> !r.hasEntity()).assertComplete();
}
use of org.apache.cxf.jaxrs.rx2.client.FlowableRxInvokerProvider in project cxf by apache.
the class JAXRSRxJava2MaybeTest method testGetHelloWorldJson.
@Test
public void testGetHelloWorldJson() throws Exception {
String address = "http://localhost:" + PORT + "/rx2/maybe/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 org.apache.cxf.jaxrs.rx2.client.FlowableRxInvokerProvider in project cxf by apache.
the class JAXRSRxJava2SingleTest method testGetString.
@Test
public void testGetString() throws Exception {
String address = "http://localhost:" + PORT + "/rx2/single/textAsync";
final Flowable<String> obs = ClientBuilder.newClient().register(new FlowableRxInvokerProvider()).target(address).request(MediaType.TEXT_PLAIN).rx(FlowableRxInvoker.class).get(String.class);
final TestSubscriber<String> subscriber = new TestSubscriber<>();
obs.subscribe(subscriber);
subscriber.await(3, TimeUnit.SECONDS);
subscriber.assertValue(r -> "Hello, world!".equals(r)).assertComplete();
}
use of org.apache.cxf.jaxrs.rx2.client.FlowableRxInvokerProvider in project cxf by apache.
the class JAXRSRxJava2SingleTest method testGetError.
@Test
public void testGetError() throws Exception {
String address = "http://localhost:" + PORT + "/rx2/single/error";
final Flowable<String> obs = ClientBuilder.newClient().register(new FlowableRxInvokerProvider()).target(address).request(MediaType.APPLICATION_JSON).rx(FlowableRxInvoker.class).get(String.class);
final TestSubscriber<String> subscriber = new TestSubscriber<>();
obs.subscribe(subscriber);
subscriber.await(3, TimeUnit.SECONDS);
subscriber.assertError(InternalServerErrorException.class);
}
use of org.apache.cxf.jaxrs.rx2.client.FlowableRxInvokerProvider in project cxf by apache.
the class JAXRSRxJava3MaybeTest method testGetHelloWorldEmpty.
@Test
public void testGetHelloWorldEmpty() throws Exception {
String address = "http://localhost:" + PORT + "/rx3/maybe/empty";
final Flowable<Response> obs = ClientBuilder.newClient().register(new JacksonJsonProvider()).register(new FlowableRxInvokerProvider()).target(address).request(MediaType.APPLICATION_JSON).rx(FlowableRxInvoker.class).get();
final TestSubscriber<Response> subscriber = new TestSubscriber<>();
obs.subscribe(subscriber);
subscriber.await(3, TimeUnit.SECONDS);
subscriber.assertValue(r -> !r.hasEntity()).assertComplete();
}
Aggregations