Search in sources :

Example 61 with JacksonJsonProvider

use of com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider 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 62 with JacksonJsonProvider

use of com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider 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 63 with JacksonJsonProvider

use of com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider 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 64 with JacksonJsonProvider

use of com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider 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 65 with JacksonJsonProvider

use of com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider in project cxf by apache.

the class JAXRSClientServerTikaTest method createWebClient.

private WebClient createWebClient(final String url) {
    WebClient wc = WebClient.create("http://localhost:" + PORT + url, Arrays.asList(new MultipartProvider(), new JacksonJsonProvider()));
    WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000L);
    return wc;
}
Also used : JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) MultipartProvider(org.apache.cxf.jaxrs.provider.MultipartProvider) WebClient(org.apache.cxf.jaxrs.client.WebClient)

Aggregations

JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)225 WebClient (org.apache.cxf.jaxrs.client.WebClient)152 Response (javax.ws.rs.core.Response)129 ArrayList (java.util.ArrayList)112 HashMap (java.util.HashMap)104 URL (java.net.URL)103 Book (org.apache.cxf.systest.jaxrs.security.Book)76 Test (org.junit.Test)66 JwtAuthenticationClientFilter (org.apache.cxf.rs.security.jose.jaxrs.JwtAuthenticationClientFilter)50 JwtClaims (org.apache.cxf.rs.security.jose.jwt.JwtClaims)50 JwtToken (org.apache.cxf.rs.security.jose.jwt.JwtToken)45 List (java.util.List)31 ClientBuilder (javax.ws.rs.client.ClientBuilder)28 Number (org.apache.coheigea.cxf.jaxrs.json.common.Number)28 LinkedList (java.util.LinkedList)27 GenericType (javax.ws.rs.core.GenericType)27 JwsWriterInterceptor (org.apache.cxf.rs.security.jose.jaxrs.JwsWriterInterceptor)27 MediaType (javax.ws.rs.core.MediaType)26 AbstractResourceInfo (org.apache.cxf.jaxrs.model.AbstractResourceInfo)26 AbstractBusClientServerTestBase (org.apache.cxf.testutil.common.AbstractBusClientServerTestBase)26