You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2022/06/02 08:04:06 UTC

[camel-k] branch main updated (8a267fc3e -> 44ce4b900)

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

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


    from 8a267fc3e chore(gc): Fix lint errors
     new 3986fd186 Detect wire tap EIP endpoints
     new 6f6432c13 YAML DSL support for wireTap
     new 3ea86a7c2 Kotlin DSL support for wireTap
     new d6f4959e0 XML DSL support for wireTap
     new eb08051c3 Removed duplicate test case I've added.
     new 4f9ac070a Adding another tag for the YAML DSL.
     new 99e8ba701 Adding test case.
     new 44ce4b900 Adding example.

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/wiretap/README.md                        |  3 ++
 examples/{basic/Env.java => wiretap/WireTap.java} | 13 +++++---
 pkg/util/source/inspector.go                      |  2 ++
 pkg/util/source/inspector_groovy.go               |  2 ++
 pkg/util/source/inspector_groovy_test.go          |  9 ++++++
 pkg/util/source/inspector_java_script.go          |  2 ++
 pkg/util/source/inspector_java_script_test.go     |  9 ++++++
 pkg/util/source/inspector_java_source.go          |  1 +
 pkg/util/source/inspector_java_source_test.go     |  9 ++++++
 pkg/util/source/inspector_kotlin.go               |  1 +
 pkg/util/source/inspector_kotlin_test.go          |  9 ++++++
 pkg/util/source/inspector_xml.go                  |  2 +-
 pkg/util/source/inspector_xml_test.go             | 13 ++++++++
 pkg/util/source/inspector_yaml.go                 |  2 +-
 pkg/util/source/inspector_yaml_test.go            | 36 +++++++++++++++++++++++
 15 files changed, 107 insertions(+), 6 deletions(-)
 create mode 100644 examples/wiretap/README.md
 copy examples/{basic/Env.java => wiretap/WireTap.java} (82%)


[camel-k] 04/08: XML DSL support for wireTap

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d6f4959e0f78aa2f457a359e88ba3e2ef5e0d52f
Author: Adriano Machado <unknown>
AuthorDate: Mon May 30 12:10:22 2022 -0400

    XML DSL support for wireTap
---
 pkg/util/source/inspector_xml.go      |  2 +-
 pkg/util/source/inspector_xml_test.go | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/pkg/util/source/inspector_xml.go b/pkg/util/source/inspector_xml.go
index 18c48277c..51baaee24 100644
--- a/pkg/util/source/inspector_xml.go
+++ b/pkg/util/source/inspector_xml.go
@@ -62,7 +62,7 @@ func (i XMLInspector) Extract(source v1.SourceSpec, meta *Metadata) error {
 						meta.FromURIs = append(meta.FromURIs, a.Value)
 					}
 				}
-			case "to", "toD", "toF":
+			case "to", "toD", "toF", "wireTap":
 				for _, a := range se.Attr {
 					if a.Name.Local == "uri" {
 						meta.ToURIs = append(meta.ToURIs, a.Value)
diff --git a/pkg/util/source/inspector_xml_test.go b/pkg/util/source/inspector_xml_test.go
index 52445e820..8552a84b7 100644
--- a/pkg/util/source/inspector_xml_test.go
+++ b/pkg/util/source/inspector_xml_test.go
@@ -46,6 +46,15 @@ const XMLKameletEndpoint = `
 </camelContext>
 `
 
+const XMLWireTapEndpoint = `
+<camelContext xmlns="http://camel.apache.org/schema/spring">
+  <route>
+    <from uri="direct:start"/>
+    <wireTap uri="kamelet:foo/bar?baz=test"/>
+  </route>
+</camelContext>
+`
+
 func TestXMLKamelet(t *testing.T) {
 	tc := []struct {
 		source   string
@@ -59,6 +68,10 @@ func TestXMLKamelet(t *testing.T) {
 			source:   XMLKameletEndpoint,
 			kamelets: []string{"foo/bar"},
 		},
+		{
+			source:   XMLWireTapEndpoint,
+			kamelets: []string{"foo/bar"},
+		},
 	}
 
 	for i := range tc {


[camel-k] 08/08: Adding example.

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 44ce4b900cf4150f0a28043000ce06aa8be51b31
Author: Adriano Machado <unknown>
AuthorDate: Wed Jun 1 10:05:01 2022 -0400

    Adding example.
---
 examples/wiretap/README.md    |  3 +++
 examples/wiretap/WireTap.java | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/examples/wiretap/README.md b/examples/wiretap/README.md
new file mode 100644
index 000000000..daed2a363
--- /dev/null
+++ b/examples/wiretap/README.md
@@ -0,0 +1,3 @@
+# Camel K WireTap example
+
+Find useful examples about how use a "WireTap" EIP in a Camel K integration.
diff --git a/examples/wiretap/WireTap.java b/examples/wiretap/WireTap.java
new file mode 100644
index 000000000..556b524d5
--- /dev/null
+++ b/examples/wiretap/WireTap.java
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+// To run this integrations use:
+//
+// kamel run WireTap.java --dev
+//
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class WireTap extends RouteBuilder {
+
+  @Override
+  public void configure() throws Exception {
+	  from("timer:tick")
+	    .wireTap("direct:tap")
+        .log("Hello from the timer!");
+
+      from("direct:tap")
+        .log("Hello from the tap!");
+  }
+}


[camel-k] 06/08: Adding another tag for the YAML DSL.

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4f9ac070ad31fe3acc7d33b82c13b91846f48ac9
Author: Adriano Machado <unknown>
AuthorDate: Mon May 30 14:04:49 2022 -0400

    Adding another tag for the YAML DSL.
---
 pkg/util/source/inspector_yaml.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg/util/source/inspector_yaml.go b/pkg/util/source/inspector_yaml.go
index e0f618096..99ed8b876 100644
--- a/pkg/util/source/inspector_yaml.go
+++ b/pkg/util/source/inspector_yaml.go
@@ -161,7 +161,7 @@ func (i YAMLInspector) parseStep(key string, content interface{}, meta *Metadata
 		switch key {
 		case "from":
 			meta.FromURIs = append(meta.FromURIs, maybeURI)
-		case "to", "to-d", "toD", "wireTap":
+		case "to", "to-d", "toD", "wire-tap", "wireTap":
 			meta.ToURIs = append(meta.ToURIs, maybeURI)
 		}
 	}


[camel-k] 02/08: YAML DSL support for wireTap

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6f6432c13ce09cd34ff460c6bf02f2a24b903fed
Author: Adriano Machado <unknown>
AuthorDate: Mon May 30 12:04:33 2022 -0400

    YAML DSL support for wireTap
---
 pkg/util/source/inspector_yaml.go      |  2 +-
 pkg/util/source/inspector_yaml_test.go | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/pkg/util/source/inspector_yaml.go b/pkg/util/source/inspector_yaml.go
index 379bd100b..e0f618096 100644
--- a/pkg/util/source/inspector_yaml.go
+++ b/pkg/util/source/inspector_yaml.go
@@ -161,7 +161,7 @@ func (i YAMLInspector) parseStep(key string, content interface{}, meta *Metadata
 		switch key {
 		case "from":
 			meta.FromURIs = append(meta.FromURIs, maybeURI)
-		case "to", "to-d", "toD":
+		case "to", "to-d", "toD", "wireTap":
 			meta.ToURIs = append(meta.ToURIs, maybeURI)
 		}
 	}
diff --git a/pkg/util/source/inspector_yaml_test.go b/pkg/util/source/inspector_yaml_test.go
index 88d77d5ba..3ba4da8a5 100644
--- a/pkg/util/source/inspector_yaml_test.go
+++ b/pkg/util/source/inspector_yaml_test.go
@@ -83,6 +83,16 @@ const YAMLInDepthChannel = `
                 uri: knative:endpoint/service
 `
 
+const YAMLWiretapEIP = `
+- from:
+    uri: knative:channel/mychannel
+    parameters:
+      period: "1000"
+    steps:
+      - wireTap:
+          uri: knative:channel/mychannel
+`
+
 func TestYAMLDependencies(t *testing.T) {
 	tests := []struct {
 		name                string
@@ -125,6 +135,14 @@ func TestYAMLDependencies(t *testing.T) {
 				`mvn:org.apache.camel.k:camel-k-knative-consumer`,
 			},
 		},
+		{
+			name:   "wireTap",
+			source: YAMLWiretapEIP,
+			dependencies: []string{
+				`mvn:org.apache.camel.k:camel-k-knative-producer`,
+				`mvn:org.apache.camel.k:camel-k-knative-consumer`,
+			},
+		},
 	}
 	for i := range tests {
 		test := tests[i]


[camel-k] 07/08: Adding test case.

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 99e8ba7016695e27176da88e88ca58d149ca112a
Author: Adriano Machado <unknown>
AuthorDate: Wed Jun 1 09:57:12 2022 -0400

    Adding test case.
---
 pkg/util/source/inspector_yaml_test.go | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/pkg/util/source/inspector_yaml_test.go b/pkg/util/source/inspector_yaml_test.go
index 3ba4da8a5..1a85b1fd5 100644
--- a/pkg/util/source/inspector_yaml_test.go
+++ b/pkg/util/source/inspector_yaml_test.go
@@ -83,7 +83,7 @@ const YAMLInDepthChannel = `
                 uri: knative:endpoint/service
 `
 
-const YAMLWiretapEIP = `
+const YAMLWireTapKnativeEIP = `
 - from:
     uri: knative:channel/mychannel
     parameters:
@@ -93,6 +93,16 @@ const YAMLWiretapEIP = `
           uri: knative:channel/mychannel
 `
 
+const YAMLWireTapJmsEIP = `
+- from:
+    uri: knative:channel/mychannel
+    parameters:
+      period: "1000"
+    steps:
+      - wireTap:
+          uri: jms:queue:foo
+`
+
 func TestYAMLDependencies(t *testing.T) {
 	tests := []struct {
 		name                string
@@ -136,13 +146,21 @@ func TestYAMLDependencies(t *testing.T) {
 			},
 		},
 		{
-			name:   "wireTap",
-			source: YAMLWiretapEIP,
+			name:   "wire-tap-knative",
+			source: YAMLWireTapKnativeEIP,
 			dependencies: []string{
 				`mvn:org.apache.camel.k:camel-k-knative-producer`,
 				`mvn:org.apache.camel.k:camel-k-knative-consumer`,
 			},
 		},
+		{
+			name:   "wire-tap-jms",
+			source: YAMLWireTapJmsEIP,
+			dependencies: []string{
+				`mvn:org.apache.camel.k:camel-k-knative-consumer`,
+				`camel:jms`,
+			},
+		},
 	}
 	for i := range tests {
 		test := tests[i]


[camel-k] 01/08: Detect wire tap EIP endpoints

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3986fd18660c4a70c2b4dabc7d5d30b9985fbf75
Author: Adriano Machado <unknown>
AuthorDate: Fri May 27 18:20:25 2022 -0400

    Detect wire tap EIP endpoints
---
 pkg/util/source/inspector.go                  |  2 ++
 pkg/util/source/inspector_groovy.go           |  2 ++
 pkg/util/source/inspector_groovy_test.go      |  9 +++++++++
 pkg/util/source/inspector_java_script.go      |  2 ++
 pkg/util/source/inspector_java_script_test.go | 13 +++++++++++++
 pkg/util/source/inspector_java_source.go      |  1 +
 pkg/util/source/inspector_java_source_test.go |  9 +++++++++
 7 files changed, 38 insertions(+)

diff --git a/pkg/util/source/inspector.go b/pkg/util/source/inspector.go
index 651af7344..be2b86ddc 100644
--- a/pkg/util/source/inspector.go
+++ b/pkg/util/source/inspector.go
@@ -40,9 +40,11 @@ var (
 	singleQuotedTo          = regexp.MustCompile(`\.to\s*\(\s*'([a-zA-Z0-9-]+:[^']+)'`)
 	singleQuotedToD         = regexp.MustCompile(`\.toD\s*\(\s*'([a-zA-Z0-9-]+:[^']+)'`)
 	singleQuotedToF         = regexp.MustCompile(`\.toF\s*\(\s*'([a-zA-Z0-9-]+:[^']+)'`)
+	singleQuotedWireTap     = regexp.MustCompile(`\.wireTap\s*\(\s*'([a-zA-Z0-9-]+:[^']+)'`)
 	doubleQuotedTo          = regexp.MustCompile(`\.to\s*\(\s*"([a-zA-Z0-9-]+:[^"]+)"`)
 	doubleQuotedToD         = regexp.MustCompile(`\.toD\s*\(\s*"([a-zA-Z0-9-]+:[^"]+)"`)
 	doubleQuotedToF         = regexp.MustCompile(`\.toF\s*\(\s*"([a-zA-Z0-9-]+:[^"]+)"`)
+	doubleQuotedWireTap     = regexp.MustCompile(`\.wireTap\s*\(\s*"([a-zA-Z0-9-]+:[^"]+)"`)
 	languageRegexp          = regexp.MustCompile(`language\s*\(\s*["|']([a-zA-Z0-9-]+[^"|']+)["|']\s*,.*\)`)
 	camelTypeRegexp         = regexp.MustCompile(`.*(org.apache.camel.*Component|DataFormat|Language)`)
 	jsonLibraryRegexp       = regexp.MustCompile(`.*JsonLibrary\.Jackson.*`)
diff --git a/pkg/util/source/inspector_groovy.go b/pkg/util/source/inspector_groovy.go
index 318107862..686814084 100644
--- a/pkg/util/source/inspector_groovy.go
+++ b/pkg/util/source/inspector_groovy.go
@@ -42,6 +42,8 @@ func (i GroovyInspector) Extract(source v1.SourceSpec, meta *Metadata) error {
 		doubleQuotedToD,
 		singleQuotedToF,
 		doubleQuotedToF,
+		singleQuotedWireTap,
+		doubleQuotedWireTap,
 	)
 
 	meta.FromURIs = append(meta.FromURIs, from...)
diff --git a/pkg/util/source/inspector_groovy_test.go b/pkg/util/source/inspector_groovy_test.go
index 7f091f3b8..d0d2a5e80 100644
--- a/pkg/util/source/inspector_groovy_test.go
+++ b/pkg/util/source/inspector_groovy_test.go
@@ -48,6 +48,11 @@ from("direct:start")
     .to('kamelet:foo/bar?baz=test')
 `
 
+const GroovyWireTapEipSingleQuote = `
+from("direct:start")
+    .wireTap('kamelet:foo/bar?baz=test')
+`
+
 func TestGroovyKamelet(t *testing.T) {
 	tc := []struct {
 		source   string
@@ -69,6 +74,10 @@ func TestGroovyKamelet(t *testing.T) {
 			source:   GroovyKameletEndpointSingleQuote,
 			kamelets: []string{"foo/bar"},
 		},
+		{
+			source:   GroovyWireTapEipSingleQuote,
+			kamelets: []string{"foo/bar"},
+		},
 	}
 
 	for i := range tc {
diff --git a/pkg/util/source/inspector_java_script.go b/pkg/util/source/inspector_java_script.go
index d8679e0c9..ebcbe37bb 100644
--- a/pkg/util/source/inspector_java_script.go
+++ b/pkg/util/source/inspector_java_script.go
@@ -42,6 +42,8 @@ func (i JavaScriptInspector) Extract(source v1.SourceSpec, meta *Metadata) error
 		doubleQuotedToD,
 		singleQuotedToF,
 		doubleQuotedToF,
+		singleQuotedWireTap,
+		doubleQuotedWireTap,
 	)
 
 	meta.FromURIs = append(meta.FromURIs, from...)
diff --git a/pkg/util/source/inspector_java_script_test.go b/pkg/util/source/inspector_java_script_test.go
index f9e1634a6..ff8d82daa 100644
--- a/pkg/util/source/inspector_java_script_test.go
+++ b/pkg/util/source/inspector_java_script_test.go
@@ -37,6 +37,11 @@ from("direct:start")
     .to("kamelet:foo/bar?baz=test")
 `
 
+const JavaScriptWireTapEipSingleQuote = `
+from("direct:start")
+    .wireTap('kamelet:foo/bar?baz=test')
+`
+
 func TestJavaScriptKamelet(t *testing.T) {
 	tc := []struct {
 		source   string
@@ -50,6 +55,14 @@ func TestJavaScriptKamelet(t *testing.T) {
 			source:   JavaScriptKameletEndpoint,
 			kamelets: []string{"foo/bar"},
 		},
+		{
+			source:   JavaScriptKameletEndpoint,
+			kamelets: []string{"foo/bar"},
+		},
+		{
+			source:   JavaScriptWireTapEipSingleQuote,
+			kamelets: []string{"foo/bar"},
+		},
 	}
 
 	for i := range tc {
diff --git a/pkg/util/source/inspector_java_source.go b/pkg/util/source/inspector_java_source.go
index 80981e74b..00a9f391f 100644
--- a/pkg/util/source/inspector_java_source.go
+++ b/pkg/util/source/inspector_java_source.go
@@ -37,6 +37,7 @@ func (i JavaSourceInspector) Extract(source v1.SourceSpec, meta *Metadata) error
 		doubleQuotedTo,
 		doubleQuotedToD,
 		doubleQuotedToF,
+		doubleQuotedWireTap,
 	)
 
 	meta.FromURIs = append(meta.FromURIs, from...)
diff --git a/pkg/util/source/inspector_java_source_test.go b/pkg/util/source/inspector_java_source_test.go
index 353643130..af1a8e3af 100644
--- a/pkg/util/source/inspector_java_source_test.go
+++ b/pkg/util/source/inspector_java_source_test.go
@@ -37,6 +37,11 @@ from("direct:start")
     .to("kamelet:foo/bar?baz=test")
 `
 
+const JavaSourceWireTapEip = `
+from("direct:start")
+    .wireTap("kamelet:foo/bar?baz=test")
+`
+
 func TestJavaSourceKamelet(t *testing.T) {
 	tc := []struct {
 		source   string
@@ -50,6 +55,10 @@ func TestJavaSourceKamelet(t *testing.T) {
 			source:   JavaSourceKameletEndpoint,
 			kamelets: []string{"foo/bar"},
 		},
+		{
+			source:   JavaSourceWireTapEip,
+			kamelets: []string{"foo/bar"},
+		},
 	}
 
 	for i := range tc {


[camel-k] 03/08: Kotlin DSL support for wireTap

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3ea86a7c25a999063aee6866034531133611e78b
Author: Adriano Machado <unknown>
AuthorDate: Mon May 30 12:06:55 2022 -0400

    Kotlin DSL support for wireTap
---
 pkg/util/source/inspector_kotlin.go      | 1 +
 pkg/util/source/inspector_kotlin_test.go | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/pkg/util/source/inspector_kotlin.go b/pkg/util/source/inspector_kotlin.go
index b2485c29b..753d0dbbf 100644
--- a/pkg/util/source/inspector_kotlin.go
+++ b/pkg/util/source/inspector_kotlin.go
@@ -37,6 +37,7 @@ func (i KotlinInspector) Extract(source v1.SourceSpec, meta *Metadata) error {
 		doubleQuotedTo,
 		doubleQuotedToD,
 		doubleQuotedToF,
+		doubleQuotedWireTap,
 	)
 
 	meta.FromURIs = append(meta.FromURIs, from...)
diff --git a/pkg/util/source/inspector_kotlin_test.go b/pkg/util/source/inspector_kotlin_test.go
index d94ee7fd9..1b08fe2b3 100644
--- a/pkg/util/source/inspector_kotlin_test.go
+++ b/pkg/util/source/inspector_kotlin_test.go
@@ -37,6 +37,11 @@ from("direct:start")
     .to("kamelet:foo/bar?baz=test")
 `
 
+const KotlinWireTapEip = `
+from("direct:start")
+    .wireTap("kamelet:foo/bar?baz=test")
+`
+
 func TestKotlinKamelet(t *testing.T) {
 	tc := []struct {
 		source   string
@@ -50,6 +55,10 @@ func TestKotlinKamelet(t *testing.T) {
 			source:   KotlinKameletEndpoint,
 			kamelets: []string{"foo/bar"},
 		},
+		{
+			source:   KotlinWireTapEip,
+			kamelets: []string{"foo/bar"},
+		},
 	}
 
 	for i := range tc {


[camel-k] 05/08: Removed duplicate test case I've added.

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit eb08051c3d5e736a4b27f30a76c85c126e7de4d3
Author: Adriano Machado <unknown>
AuthorDate: Mon May 30 12:14:53 2022 -0400

    Removed duplicate test case I've added.
---
 pkg/util/source/inspector_java_script_test.go | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/pkg/util/source/inspector_java_script_test.go b/pkg/util/source/inspector_java_script_test.go
index ff8d82daa..3ed09d928 100644
--- a/pkg/util/source/inspector_java_script_test.go
+++ b/pkg/util/source/inspector_java_script_test.go
@@ -55,10 +55,6 @@ func TestJavaScriptKamelet(t *testing.T) {
 			source:   JavaScriptKameletEndpoint,
 			kamelets: []string{"foo/bar"},
 		},
-		{
-			source:   JavaScriptKameletEndpoint,
-			kamelets: []string{"foo/bar"},
-		},
 		{
 			source:   JavaScriptWireTapEipSingleQuote,
 			kamelets: []string{"foo/bar"},