This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-3.11.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 56d91353839ae85b819c71023c325be7d937a8a0 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Sep 3 17:40:09 2021 +0200 CAMEL-16920: routes built with endpoint-dsl does not output uri when dumping routes. --- core/camel-endpointdsl/pom.xml | 5 ++ .../camel/builder/endpoint/DumpRoutesTest.java | 58 ++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/core/camel-endpointdsl/pom.xml b/core/camel-endpointdsl/pom.xml index 95f5800..429e50f 100644 --- a/core/camel-endpointdsl/pom.xml +++ b/core/camel-endpointdsl/pom.xml @@ -96,6 +96,11 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-xml-jaxb</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> <scope>test</scope> diff --git a/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/DumpRoutesTest.java b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/DumpRoutesTest.java new file mode 100644 index 0000000..3323b95 --- /dev/null +++ b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/DumpRoutesTest.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.builder.endpoint; + +import java.util.concurrent.TimeUnit; + +import org.apache.camel.ExtendedCamelContext; +import org.apache.camel.builder.RouteBuilder; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class DumpRoutesTest extends BaseEndpointDslTest { + + private static final Logger LOG = LoggerFactory.getLogger(DumpRoutesTest.class); + + @Test + public void testDumpModelAsXml() throws Exception { + ExtendedCamelContext ecc = context.adapt(ExtendedCamelContext.class); + String xml = ecc.getModelToXMLDumper().dumpModelAsXml(context, context.getRouteDefinition("myRoute")); + assertNotNull(xml); + LOG.info(xml); + + assertTrue(xml + .contains("file://target/data/files/?delay=2&delete=true&maxMessagesPerPoll=1&timeUnit=SECONDS")); + assertTrue(xml.contains("mock://result")); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new EndpointRouteBuilder() { + public void configure() throws Exception { + from(file("target/data/files/").delay(2).timeUnit(TimeUnit.SECONDS).delete(true).maxMessagesPerPoll(1)) + .routeId("myRoute") + .convertBodyTo(String.class) + .to(mock("result")); + } + }; + } + +}