use of org.apache.cxf.jaxrs.JAXBContextProvider2 in project cxf by apache.
the class ProviderFactoryTest method testRegisterCustomResolver2.
@Test
public void testRegisterCustomResolver2() throws Exception {
ProviderFactory pf = ServerProviderFactory.getInstance();
pf.registerUserProvider(new JAXBContextProvider());
pf.registerUserProvider(new JAXBContextProvider2());
Message message = prepareMessage("text/xml+b", null);
ContextResolver<JAXBContext> cr = pf.createContextResolver(JAXBContext.class, message);
assertFalse(cr instanceof ProviderFactory.ContextResolverProxy);
assertTrue("JAXBContext ContextProvider can not be found", cr instanceof JAXBContextProvider2);
}
use of org.apache.cxf.jaxrs.JAXBContextProvider2 in project cxf by apache.
the class ProviderFactoryTest method testNoCustomResolver.
@Test
public void testNoCustomResolver() throws Exception {
ProviderFactory pf = ServerProviderFactory.getInstance();
pf.registerUserProvider(new JAXBContextProvider());
pf.registerUserProvider(new JAXBContextProvider2());
Message message = prepareMessage("text/xml+c", null);
ContextResolver<JAXBContext> cr = pf.createContextResolver(JAXBContext.class, message);
assertNull(cr);
}
use of org.apache.cxf.jaxrs.JAXBContextProvider2 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);
}
Aggregations