You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/07/26 14:26:15 UTC

[camel-k] branch main updated: [test] Remove 3rd party dependencies

This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 1a9d945  [test] Remove 3rd party dependencies
1a9d945 is described below

commit 1a9d945e7d88d2c7c3d7645b75c506950f2f98b7
Author: Jan <jb...@redhat.com>
AuthorDate: Mon Jul 26 15:09:52 2021 +0200

    [test] Remove 3rd party dependencies
---
 ...isKamelet.java => TimerKameletIntegration.java} |  5 +-
 e2e/common/files/timer-source.kamelet.yaml         | 69 ++++++++++++++++++++++
 e2e/common/kamelet_test.go                         | 15 +++--
 3 files changed, 78 insertions(+), 11 deletions(-)

diff --git a/e2e/common/files/ChuckNorrisKamelet.java b/e2e/common/files/TimerKameletIntegration.java
similarity index 86%
rename from e2e/common/files/ChuckNorrisKamelet.java
rename to e2e/common/files/TimerKameletIntegration.java
index 3410307..c3412a9 100644
--- a/e2e/common/files/ChuckNorrisKamelet.java
+++ b/e2e/common/files/TimerKameletIntegration.java
@@ -19,11 +19,10 @@ import java.lang.Exception;
 import java.lang.Override;
 import org.apache.camel.builder.RouteBuilder;
 
-public class ChuckNorrisKamelet extends RouteBuilder {
+public class TimerKameletIntegration extends RouteBuilder {
     @Override
     public void configure() throws Exception {
-        from("kamelet:chuck-norris-source")
-            .setBody(simple("Received another joke: ${body}"))
+        from("kamelet:timer-source?message=important%20message")
             .to("log:info");
     }
 }
diff --git a/e2e/common/files/timer-source.kamelet.yaml b/e2e/common/files/timer-source.kamelet.yaml
new file mode 100644
index 0000000..3c09572
--- /dev/null
+++ b/e2e/common/files/timer-source.kamelet.yaml
@@ -0,0 +1,69 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: timer-source
+  annotations:
+    camel.apache.org/kamelet.support.level: "Preview"
+    camel.apache.org/catalog.version: "0.3.0"
+    camel.apache.org/kamelet.icon: data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gU3ZnIFZlY3RvciBJY29ucyA6IGh0dHA6Ly93d3cub25saW5ld2ViZm9udHMuY29tL2ljb24gLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm9 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "Timer"
+  labels:
+    camel.apache.org/kamelet.type: source
+    camel.apache.org/kamelet.verified: "true"
+spec:
+  definition:
+    title: Timer Source
+    description: Produces periodic events with a custom payload.
+    required:
+      - message
+    type: object
+    properties:
+      period:
+        title: Period
+        description: The interval between two events in milliseconds
+        type: integer
+        default: 1000
+      message:
+        title: Message
+        description: The message to generate
+        type: string
+        example: hello world
+      contentType:
+        title: Content Type
+        description: The content type of the message being generated
+        type: string
+        default: text/plain
+  dependencies:
+    - "camel:core"
+    - "camel:timer"
+    - "camel:kamelet"
+  flow:
+    from:
+      uri: timer:tick
+      parameters:
+        period: "{{period}}"
+      steps:
+        - set-body:
+            constant: "{{message}}"
+        - set-header:
+            name: "Content-Type"
+            constant: "{{contentType}}"
+        - to: kamelet:sink
diff --git a/e2e/common/kamelet_test.go b/e2e/common/kamelet_test.go
index 13dd19f..4db8a31 100644
--- a/e2e/common/kamelet_test.go
+++ b/e2e/common/kamelet_test.go
@@ -34,21 +34,20 @@ func TestKameletClasspathLoading(t *testing.T) {
 	WithNewTestNamespace(t, func(ns string) {
 		Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
 
-		kameletName := "chuck-norris-source"
+		kameletName := "timer-source"
 		removeKamelet(kameletName , ns)
 
 		Eventually(Kamelet(kameletName, ns)).Should(BeNil())
 
-		Expect(Kamel("run", "files/ChuckNorrisKamelet.java", "-n", ns, "-t", "kamelets.enabled=false",
-			"-d", "github:apache.camel-kamelets:camel-kamelets-catalog:main-SNAPSHOT",
+		Expect(Kamel("run", "files/TimerKameletIntegration.java", "-n", ns, "-t", "kamelets.enabled=false",
+			"--resource", "file:files/timer-source.kamelet.yaml@/kamelets/timer-source.kamelet.yaml",
+			"-p camel.component.kamelet.location=file:/kamelets",
 			"-d", "camel:yaml-dsl",
 			// kamelet dependencies
-			"-d", "camel:timer",
-			"-d", "camel:jsonpath",
-			"-d", "camel:http").Execute()).To(Succeed())
-		Eventually(IntegrationPodPhase(ns, "chuck-norris-kamelet"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
+			"-d", "camel:timer").Execute()).To(Succeed())
+		Eventually(IntegrationPodPhase(ns, "timer-kamelet-integration"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
 
-		Eventually(IntegrationLogs(ns, "chuck-norris-kamelet")).Should(ContainSubstring("Received another joke:"))
+		Eventually(IntegrationLogs(ns, "timer-kamelet-integration")).Should(ContainSubstring("important message"))
 
 		// Cleanup
 		Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())