org.apache.camel.spi.ModelToXMLDumper Java Examples

The following examples show how to use org.apache.camel.spi.ModelToXMLDumper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JAXBInitalizationTest.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
@Test
public void testJaxbDumpModelAsXML() throws Exception {

	ModelCamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .routeId("route-1")
            .to("log:test");
        }
    });

    camelctx.start();

    try {
        ModelToXMLDumper dumper = camelctx.adapt(ExtendedCamelContext.class).getModelToXMLDumper();
        String xml = dumper.dumpModelAsXml(camelctx, camelctx.getRouteDefinition("route-1"));
        Assert.assertTrue(xml.contains("log:test"));
    } finally {
        camelctx.close();
    }
}
 
Example #2
Source File: CamelContextRecorder.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
public RuntimeValue<CamelContext> createContext(
        RuntimeValue<Registry> registry,
        RuntimeValue<TypeConverterRegistry> typeConverterRegistry,
        RuntimeValue<ModelJAXBContextFactory> contextFactory,
        RuntimeValue<XMLRoutesDefinitionLoader> xmlLoader,
        RuntimeValue<ModelToXMLDumper> xmlModelDumper,
        RuntimeValue<FactoryFinderResolver> factoryFinderResolver,
        BeanContainer beanContainer,
        String version,
        CamelConfig config) {

    FastCamelContext context = new FastCamelContext(
            factoryFinderResolver.getValue(),
            version,
            xmlLoader.getValue(),
            xmlModelDumper.getValue());

    context.setDefaultExtension(RuntimeCamelCatalog.class, () -> new CamelRuntimeCatalog(config.runtimeCatalog));
    context.setRegistry(registry.getValue());
    context.setTypeConverterRegistry(typeConverterRegistry.getValue());
    context.setLoadTypeConverters(false);
    context.setModelJAXBContextFactory(contextFactory.getValue());
    context.build();
    context.addLifecycleStrategy(new CamelLifecycleEventBridge());
    context.getManagementStrategy().addEventNotifier(new CamelManagementEventBridge());

    // register to the container
    beanContainer.instance(CamelProducers.class).setContext(context);

    return new RuntimeValue<>(context);
}
 
Example #3
Source File: IntegrationTestSupport.java    From syndesis with Apache License 2.0 5 votes vote down vote up
protected void dumpRoutes(CamelContext context, RoutesDefinition definition) {
    if (!LOGGER.isInfoEnabled()) {
        return;
    }

    try {
        ExtendedCamelContext extendedCamelContext = context.adapt(ExtendedCamelContext.class);
        ModelToXMLDumper dumper = extendedCamelContext.getModelToXMLDumper();
        LOGGER.info("Routes: \n{}", dumper.dumpModelAsXml(context, definition));
    } catch (Exception e) {
        LOGGER.warn("Unable to dump routes as XML", e);
    }
}
 
Example #4
Source File: IntegrationTestSupport.java    From syndesis with Apache License 2.0 5 votes vote down vote up
public static void dumpRoutes(CamelContext context, RoutesDefinition definition) {
    if (!LOGGER.isInfoEnabled()) {
        return;
    }

    try {
        ExtendedCamelContext extendedCamelContext = context.adapt(ExtendedCamelContext.class);
        ModelToXMLDumper dumper = extendedCamelContext.getModelToXMLDumper();
        LOGGER.info("Routes: \n{}", dumper.dumpModelAsXml(context, definition));
    } catch (Exception e) {
        LOGGER.warn("Unable to dump route definition as XML");
        LOGGER.debug("Error encountered while dumping route definition as XML", e);
    }
}
 
Example #5
Source File: XmlJaxbRecorder.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
public RuntimeValue<ModelToXMLDumper> newJaxbModelToXMLDumper() {
    return new RuntimeValue<>(new JaxbModelToXMLDumper());
}
 
Example #6
Source File: CamelModelToXMLDumperBuildItem.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
public CamelModelToXMLDumperBuildItem(RuntimeValue<ModelToXMLDumper> value) {
    this.value = value;
}
 
Example #7
Source File: CamelModelToXMLDumperBuildItem.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
public RuntimeValue<ModelToXMLDumper> getValue() {
    return value;
}
 
Example #8
Source File: CamelRecorder.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
public RuntimeValue<ModelToXMLDumper> newDisabledModelToXMLDumper() {
    return new RuntimeValue<>(new DisabledModelToXMLDumper());
}