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 2022/08/04 07:35:50 UTC
[camel] branch main updated: CAMEL-18330: 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
The following commit(s) were added to refs/heads/main by this push:
new a5be5fdce73 CAMEL-18330: Added unit test
a5be5fdce73 is described below
commit a5be5fdce7309391ee9727af91e2ec3f55042790
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 4 09:35:39 2022 +0200
CAMEL-18330: Added unit test
---
.../kamelet/TemplatedRouteKameletTest.java | 60 ++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/TemplatedRouteKameletTest.java b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/TemplatedRouteKameletTest.java
new file mode 100644
index 00000000000..99c3075e1cc
--- /dev/null
+++ b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/TemplatedRouteKameletTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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 org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+public class TemplatedRouteKameletTest extends CamelTestSupport {
+
+ @Test
+ public void testKamelet() throws Exception {
+ getMockEndpoint("mock:out").expectedBodiesReceived("test-Hello");
+
+ template.sendBody("direct:start", "Hello");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("echo")
+ .templateParameter("prefix")
+ .from("kamelet:source")
+ .setBody().simple("{{prefix}}-${body}");
+
+ routeTemplate("myTemplate")
+ .templateParameter("uri")
+ .templateParameter("in")
+ .templateParameter("out")
+ .from("{{in}}")
+ .to("{{uri}}")
+ .to("{{out}}");
+
+ templatedRoute("myTemplate")
+ .parameter("in", "direct:start")
+ .parameter("uri", "kamelet:echo/test?prefix=test")
+ .parameter("out", "mock:out");
+ }
+ };
+ }
+}