use of org.apache.cxf.jaxrs.rx3.client.FlowableRxInvokerProvider in project cxf by apache.
the class JAXRSRxJava3FlowableTest method testGetHelloWorldEmpty2.
@Test
public void testGetHelloWorldEmpty2() throws Exception {
String address = "http://localhost:" + PORT + "/rx33/flowable/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 -> "[]".equals(r.readEntity(String.class))).assertComplete();
}
use of org.apache.cxf.jaxrs.rx3.client.FlowableRxInvokerProvider in project cxf by apache.
the class JAXRSRxJava3FlowableTest method testFlowableErrorsResponseWithMapper.
@Test
public void testFlowableErrorsResponseWithMapper() throws Exception {
String address = "http://localhost:" + PORT + "/rx33/flowable/mapper/errors";
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.getStatus() == 400).assertComplete();
}
use of org.apache.cxf.jaxrs.rx3.client.FlowableRxInvokerProvider in project cxf by apache.
the class JAXRSRxJava3FlowableTest method testFlowableImmediateErrorsWithExceptionMapper.
@Test
public void testFlowableImmediateErrorsWithExceptionMapper() throws Exception {
String address = "http://localhost:" + PORT + "/rx33/flowable/immediate/mapper/errors";
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.getStatus() == 409 && r.readEntity(String.class).contains("stackTrace")).assertComplete();
}
use of org.apache.cxf.jaxrs.rx3.client.FlowableRxInvokerProvider in project cxf by apache.
the class JAXRSRxJava2MaybeTest method testGetError.
@Test
public void testGetError() throws Exception {
String address = "http://localhost:" + PORT + "/rx2/maybe/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.rx3.client.FlowableRxInvokerProvider in project cxf by apache.
the class JAXRSRxJava2SingleTest method testGetHelloWorldJson.
@Test
public void testGetHelloWorldJson() throws Exception {
String address = "http://localhost:" + PORT + "/rx2/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();
}
Aggregations