You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/07/28 05:17:59 UTC
[camel] 01/03: CAMEL-16818: Added unit test
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1c2db0f282ec078c93bef7a65d680be3d2624da0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Jul 28 07:04:21 2021 +0200
CAMEL-16818: Added unit test
---
components/camel-kamelet/pom.xml | 5 ++
.../component/kamelet/KameletRouteDumpTest.java | 67 ++++++++++++++++++++++
2 files changed, 72 insertions(+)
diff --git a/components/camel-kamelet/pom.xml b/components/camel-kamelet/pom.xml
index 01abf1b..a921909 100644
--- a/components/camel-kamelet/pom.xml
+++ b/components/camel-kamelet/pom.xml
@@ -46,6 +46,11 @@
<!-- TESTS -->
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-xml-jaxb</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-groovy</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletRouteDumpTest.java b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletRouteDumpTest.java
new file mode 100644
index 0000000..f2fe6f4
--- /dev/null
+++ b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletRouteDumpTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.component.kamelet;
+
+import java.util.UUID;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class KameletRouteDumpTest extends CamelTestSupport {
+
+ @Override
+ protected void postProcessTest() throws Exception {
+ context().setDumpRoutes(true);
+ super.postProcessTest();
+ }
+
+ @Test
+ public void canProduceToKamelet() {
+ String body = UUID.randomUUID().toString();
+
+ assertThat(
+ fluentTemplate.toF("direct:templateEmbedded", body).request(String.class)).isEqualTo("test");
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Override
+ protected RoutesBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ routeTemplate("setBody")
+ .templateParameter("bodyValue")
+ .from("kamelet:source")
+ .setBody().constant("{{bodyValue}}")
+ .to("kamelet:sink");
+
+ from("direct:templateEmbedded").id("test")
+ .kamelet("setBody?bodyValue=test")
+ .to("log:TEST?showAll=true&multiline=true");
+ }
+ };
+ }
+}