Search in sources :

Example 6 with ReactorInvokerProvider

use of org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider in project cxf by apache.

the class FluxReactorTest method testFluxErrorWithExceptionMapperReturnsContentPayload.

@Test
public void testFluxErrorWithExceptionMapperReturnsContentPayload() throws Exception {
    GenericType<List<HelloWorldBean>> helloWorldBeanListType = new GenericType<List<HelloWorldBean>>() {
    };
    String address = "http://localhost:" + PORT + "/reactor2/flux/mixed/error";
    StepVerifier.create(ClientBuilder.newClient().register(new JacksonJsonProvider()).register(new ReactorInvokerProvider()).target(address).request(MediaType.APPLICATION_JSON).rx(ReactorInvoker.class).get()).expectNextMatches(r -> r.getStatus() == 409 && r.readEntity(helloWorldBeanListType).size() == 4).expectComplete().verify();
}
Also used : GenericType(javax.ws.rs.core.GenericType) ReactorInvokerProvider(org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) List(java.util.List) ReactorInvoker(org.apache.cxf.jaxrs.reactor.client.ReactorInvoker) Test(org.junit.Test)

Example 7 with ReactorInvokerProvider

use of org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider in project cxf by apache.

the class MonoReactorTest method testMonoEmpty.

@Test
public void testMonoEmpty() throws Exception {
    String address = "http://localhost:" + PORT + "/reactor/mono/empty";
    StepVerifier.create(ClientBuilder.newClient().register(new JacksonJsonProvider()).register(new ReactorInvokerProvider()).target(address).request(MediaType.APPLICATION_JSON).rx(ReactorInvoker.class).get(HelloWorldBean.class)).expectComplete().verify();
}
Also used : ReactorInvokerProvider(org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) Test(org.junit.Test)

Example 8 with ReactorInvokerProvider

use of org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider in project cxf by apache.

the class MonoReactorTest method testGetError.

@Test
public void testGetError() throws Exception {
    String address = "http://localhost:" + PORT + "/reactor/mono/error";
    StepVerifier.create(ClientBuilder.newClient().register(new JacksonJsonProvider()).register(new ReactorInvokerProvider()).target(address).request(MediaType.APPLICATION_JSON).rx(ReactorInvoker.class).get(HelloWorldBean.class)).expectErrorMatches(ex -> ex.getCause() instanceof InternalServerErrorException).verify();
}
Also used : ClientBuilder(javax.ws.rs.client.ClientBuilder) AbstractResourceInfo(org.apache.cxf.jaxrs.model.AbstractResourceInfo) MediaType(javax.ws.rs.core.MediaType) StepVerifier(reactor.test.StepVerifier) ReactorInvokerProvider(org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider) BeforeClass(org.junit.BeforeClass) ReactorInvoker(org.apache.cxf.jaxrs.reactor.client.ReactorInvoker) AbstractBusClientServerTestBase(org.apache.cxf.testutil.common.AbstractBusClientServerTestBase) Assert.assertTrue(org.junit.Assert.assertTrue) InternalServerErrorException(javax.ws.rs.InternalServerErrorException) Test(org.junit.Test) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) ReactorInvokerProvider(org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) InternalServerErrorException(javax.ws.rs.InternalServerErrorException) Test(org.junit.Test)

Example 9 with ReactorInvokerProvider

use of org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider in project cxf by apache.

the class MonoReactorTest method testTextJsonImplicitListAsyncStream.

@Test
public void testTextJsonImplicitListAsyncStream() throws Exception {
    String address = "http://localhost:" + PORT + "/reactor/mono/textJsonImplicitListAsyncStream";
    StepVerifier.create(ClientBuilder.newClient().register(new JacksonJsonProvider()).register(new ReactorInvokerProvider()).target(address).request(MediaType.APPLICATION_JSON).rx(ReactorInvoker.class).get(HelloWorldBean.class)).expectNextMatches(r -> "Hello".equals(r.getGreeting()) && "World".equals(r.getAudience())).expectComplete().verify();
}
Also used : ReactorInvokerProvider(org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) ReactorInvoker(org.apache.cxf.jaxrs.reactor.client.ReactorInvoker) Test(org.junit.Test)

Example 10 with ReactorInvokerProvider

use of org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider in project cxf by apache.

the class MonoReactorTest method testGetString.

@Test
public void testGetString() throws Exception {
    String address = "http://localhost:" + PORT + "/reactor/mono/textAsync";
    StepVerifier.create(ClientBuilder.newClient().register(new ReactorInvokerProvider()).target(address).request(MediaType.TEXT_PLAIN).rx(ReactorInvoker.class).get(String.class)).expectNextMatches(r -> "Hello, world!".equals(r)).expectComplete().verify();
}
Also used : ReactorInvokerProvider(org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider) ReactorInvoker(org.apache.cxf.jaxrs.reactor.client.ReactorInvoker) Test(org.junit.Test)

Aggregations

ReactorInvokerProvider (org.apache.cxf.jaxrs.reactor.client.ReactorInvokerProvider)19 JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)18 Test (org.junit.Test)18 ReactorInvoker (org.apache.cxf.jaxrs.reactor.client.ReactorInvoker)15 List (java.util.List)2 ClientBuilder (javax.ws.rs.client.ClientBuilder)2 GenericType (javax.ws.rs.core.GenericType)2 MediaType (javax.ws.rs.core.MediaType)2 AbstractResourceInfo (org.apache.cxf.jaxrs.model.AbstractResourceInfo)2 AbstractBusClientServerTestBase (org.apache.cxf.testutil.common.AbstractBusClientServerTestBase)2 Assert.assertTrue (org.junit.Assert.assertTrue)2 BeforeClass (org.junit.BeforeClass)2 StepVerifier (reactor.test.StepVerifier)2 ArrayList (java.util.ArrayList)1 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)1