Search in sources :

Example 1 with JSONProvider

use of org.apache.cxf.jaxrs.provider.json.JSONProvider in project camel by apache.

the class CxfRsEndpointTest method testCxfRsEndpointSetProvider.

@Test
public void testCxfRsEndpointSetProvider() throws Exception {
    String endpointUri = "cxfrs://http://localhost:" + CTX + "" + "?resourceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService";
    CxfRsComponent component = new CxfRsComponent(context);
    CxfRsEndpoint endpoint = (CxfRsEndpoint) component.createEndpoint(endpointUri);
    JSONProvider<?> jsonProvider = new JSONProvider<Object>();
    jsonProvider.setDropRootElement(true);
    jsonProvider.setSupportUnwrapped(true);
    endpoint.setProvider(jsonProvider);
    JAXRSServerFactoryBean sfb = endpoint.createJAXRSServerFactoryBean();
    assertEquals("Get a wrong proider size", 1, sfb.getProviders().size());
    JAXRSClientFactoryBean cfb = endpoint.createJAXRSClientFactoryBean();
    assertEquals("Get a wrong proider size", 1, cfb.getProviders().size());
}
Also used : JAXRSClientFactoryBean(org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean) JSONProvider(org.apache.cxf.jaxrs.provider.json.JSONProvider) JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) Test(org.junit.Test)

Aggregations

JAXRSServerFactoryBean (org.apache.cxf.jaxrs.JAXRSServerFactoryBean)1 JAXRSClientFactoryBean (org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean)1 JSONProvider (org.apache.cxf.jaxrs.provider.json.JSONProvider)1 Test (org.junit.Test)1