Search in sources :

Example 6 with JAXBContextProvider

use of org.apache.cxf.jaxrs.JAXBContextProvider in project cxf by apache.

the class ProviderFactoryTest method testCustomResolverProxy.

@Test
public void testCustomResolverProxy() throws Exception {
    ProviderFactory pf = ServerProviderFactory.getInstance();
    pf.registerUserProvider(new JAXBContextProvider());
    pf.registerUserProvider(new JAXBContextProvider2());
    Message message = prepareMessage("text/xml+*", null);
    ContextResolver<JAXBContext> cr = pf.createContextResolver(JAXBContext.class, message);
    assertTrue(cr instanceof ProviderFactory.ContextResolverProxy);
    assertTrue(((ProviderFactory.ContextResolverProxy<?>) cr).getResolvers().get(0) instanceof JAXBContextProvider);
    assertTrue(((ProviderFactory.ContextResolverProxy<?>) cr).getResolvers().get(1) instanceof JAXBContextProvider2);
}
Also used : JAXBContextProvider2(org.apache.cxf.jaxrs.JAXBContextProvider2) Message(org.apache.cxf.message.Message) JAXBContextProvider(org.apache.cxf.jaxrs.JAXBContextProvider) JAXBContext(javax.xml.bind.JAXBContext) Test(org.junit.Test)

Aggregations

JAXBContext (javax.xml.bind.JAXBContext)6 JAXBContextProvider (org.apache.cxf.jaxrs.JAXBContextProvider)6 Message (org.apache.cxf.message.Message)6 Test (org.junit.Test)6 JAXBContextProvider2 (org.apache.cxf.jaxrs.JAXBContextProvider2)3 Customer (org.apache.cxf.jaxrs.Customer)2 ClassResourceInfo (org.apache.cxf.jaxrs.model.ClassResourceInfo)2 OperationResourceInfo (org.apache.cxf.jaxrs.model.OperationResourceInfo)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 ContextResolver (javax.ws.rs.ext.ContextResolver)1 PerRequestResourceProvider (org.apache.cxf.jaxrs.lifecycle.PerRequestResourceProvider)1