org.apache.camel.model.dataformat.YAMLLibrary Java Examples
The following examples show how to use
org.apache.camel.model.dataformat.YAMLLibrary.
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: DataformatRoute.java From camel-quarkus with Apache License 2.0 | 6 votes |
@Override public void configure() throws Exception { from("direct:snakeyaml-dataformat-component-marshal") .to("dataformat:yaml-snakeyaml:marshal"); from("direct:snakeyaml-dataformat-component-unmarshal") .to("dataformat:yaml-snakeyaml:unmarshal?unmarshalType=org.apache.camel.quarkus.component.dataformat.it.model.TestPojo"); from("direct:snakeyaml-dsl-marshal") .marshal().yaml(YAMLLibrary.SnakeYAML); from("direct:snakeyaml-dsl-unmarshal") .unmarshal().yaml(YAMLLibrary.SnakeYAML, TestPojo.class); from("direct:ical-marshal") .marshal() .ical(true); from("direct:ical-unmarshal") .unmarshal() .ical(true); }
Example #2
Source File: YamlDataFormatIntegrationTest.java From wildfly-camel with Apache License 2.0 | 6 votes |
@Test public void testMarshalYaml() throws Exception { CamelContext camelctx = new DefaultCamelContext(); camelctx.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .marshal().yaml(YAMLLibrary.SnakeYAML); } }); ClassLoader loader = SnakeYAMLDataFormat.class.getClassLoader(); loader = loader.loadClass("org.yaml.snakeyaml.Yaml").getClassLoader(); System.out.println(loader); camelctx.start(); try { ProducerTemplate template = camelctx.createProducerTemplate(); String result = template.requestBody("direct:start", new Customer("John", "Doe"), String.class); Assert.assertEquals(CUSTOMER_YAML, result.trim()); } finally { camelctx.close(); } }
Example #3
Source File: YamlUnmarshalAction.java From syndesis-extensions with Apache License 2.0 | 5 votes |
@Override public Optional<ProcessorDefinition<?>> configure(CamelContext context, ProcessorDefinition<?> route, Map<String, Object> parameters) { ObjectHelper.notNull(route, "route"); ObjectHelper.notNull(kind, "kind"); return Optional.of(route.unmarshal().yaml(YAMLLibrary.valueOf(kind.toString()))); }
Example #4
Source File: YamlMarshalAction.java From syndesis-extensions with Apache License 2.0 | 5 votes |
@Override public Optional<ProcessorDefinition<?>> configure(CamelContext context, ProcessorDefinition<?> route, Map<String, Object> parameters) { ObjectHelper.notNull(route, "route"); ObjectHelper.notNull(kind, "kind"); return Optional.of(route.marshal().yaml(YAMLLibrary.valueOf(kind.toString()))); }