use of org.apache.camel.spring.SpringModelJAXBContextFactory in project camel by apache.
the class CamelContextModelErrorHandlerIssueTest method testCamelContextModel.
@Test
public void testCamelContextModel() throws Exception {
JAXBContext jaxbContext = new SpringModelJAXBContextFactory().newJAXBContext();
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
Object obj = unmarshaller.unmarshal(new File("src/test/resources/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.xml"));
assertNotNull(obj);
CamelContextFactoryBean context = (CamelContextFactoryBean) obj;
assertEquals("myCamel", context.getId());
assertEquals("dlc", context.getErrorHandlerRef());
assertEquals(1, context.getRoutes().size());
Marshaller marshaller = jaxbContext.createMarshaller();
StringWriter writer = new StringWriter();
marshaller.marshal(context, writer);
String s = writer.getBuffer().toString();
LOG.info(s);
assertTrue("Should have error handler", s.contains("<errorHandler"));
assertTrue("Should have redelivery policy", s.contains("<redeliveryPolicy"));
}
Aggregations