This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/master by this push: new fb419a4 Failed to resolve endpoint: twitter-search #370 fb419a4 is described below commit fb419a46e78257e4c80213495dcf6d01143c57ab Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Thu Jan 24 18:03:08 2019 +0100 Failed to resolve endpoint: twitter-search #370 --- pkg/metadata/metadata_dependencies_test.go | 27 +++++++-------------------- pkg/util/source/inspector.go | 16 ++++++++-------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/pkg/metadata/metadata_dependencies_test.go b/pkg/metadata/metadata_dependencies_test.go index 9f952f5..3b2b44b 100644 --- a/pkg/metadata/metadata_dependencies_test.go +++ b/pkg/metadata/metadata_dependencies_test.go @@ -32,6 +32,8 @@ func TestDependenciesJavaSource(t *testing.T) { from("telegram:bots/cippa").to("log:stash"); from("timer:tick").to("amqp:queue"); from("ine:xistent").to("amqp:queue"); + from("twitter-search:{{twitterKeywords}}" + + "?delay={{twitterDelayMs}}"); `, }, Language: v1alpha1.LanguageJavaSource, @@ -39,24 +41,7 @@ func TestDependenciesJavaSource(t *testing.T) { meta := Extract(code) // assert all dependencies are found and sorted (removing duplicates) - assert.Equal(t, []string{"camel:amqp", "camel:core", "camel:telegram"}, meta.Dependencies) -} - -func TestDependenciesJavaClass(t *testing.T) { - code := v1alpha1.SourceSpec{ - DataSpec: v1alpha1.DataSpec{ - Name: "Request.class", - Content: ` - from("telegram:bots/cippa").to("log:stash"); - from("timer:tick").to("amqp:queue"); - from("ine:xistent").to("amqp:queue"); - `, - }, - Language: v1alpha1.LanguageJavaClass, - } - - meta := Extract(code) - assert.Empty(t, meta.Dependencies) + assert.Equal(t, []string{"camel:amqp", "camel:core", "camel:telegram", "camel:twitter"}, meta.Dependencies) } func TestDependenciesJavaScript(t *testing.T) { @@ -85,7 +70,9 @@ func TestDependenciesGroovy(t *testing.T) { from('telegram:bots/cippa').to("log:stash"); from('timer:tick').to("amqp:queue"); from("ine:xistent").to("amqp:queue"); - '"' + from('twitter-search:{{twitterKeywords}}' + + '?delay={{twitterDelayMs}}'); + '" `, }, Language: v1alpha1.LanguageGroovy, @@ -93,7 +80,7 @@ func TestDependenciesGroovy(t *testing.T) { meta := Extract(code) // assert all dependencies are found and sorted (removing duplicates) - assert.Equal(t, []string{"camel:amqp", "camel:core", "camel:telegram"}, meta.Dependencies) + assert.Equal(t, []string{"camel:amqp", "camel:core", "camel:telegram", "camel:twitter"}, meta.Dependencies) } func TestDependencies(t *testing.T) { diff --git a/pkg/util/source/inspector.go b/pkg/util/source/inspector.go index 550f064..d6d3e3b 100644 --- a/pkg/util/source/inspector.go +++ b/pkg/util/source/inspector.go @@ -29,14 +29,14 @@ import ( ) var ( - singleQuotedFrom = regexp.MustCompile(`from\s*\(\s*'([a-z0-9-]+:[^']+)'\s*\)`) - doubleQuotedFrom = regexp.MustCompile(`from\s*\(\s*"([a-z0-9-]+:[^"]+)"\s*\)`) - singleQuotedTo = regexp.MustCompile(`\.to\s*\(\s*'([a-z0-9-]+:[^']+)'\s*\)`) - singleQuotedToD = regexp.MustCompile(`\.toD\s*\(\s*'([a-z0-9-]+:[^']+)'\s*\)`) - singleQuotedToF = regexp.MustCompile(`\.toF\s*\(\s*'([a-z0-9-]+:[^']+)'[^)]*\)`) - doubleQuotedTo = regexp.MustCompile(`\.to\s*\(\s*"([a-z0-9-]+:[^"]+)"\s*\)`) - doubleQuotedToD = regexp.MustCompile(`\.toD\s*\(\s*"([a-z0-9-]+:[^"]+)"\s*\)`) - doubleQuotedToF = regexp.MustCompile(`\.toF\s*\(\s*"([a-z0-9-]+:[^"]+)"[^)]*\)`) + singleQuotedFrom = regexp.MustCompile(`from\s*\(\s*'([a-z0-9-]+:[^']+)'`) + doubleQuotedFrom = regexp.MustCompile(`from\s*\(\s*"([a-z0-9-]+:[^"]+)"`) + singleQuotedTo = regexp.MustCompile(`\.to\s*\(\s*'([a-z0-9-]+:[^']+)'`) + singleQuotedToD = regexp.MustCompile(`\.toD\s*\(\s*'([a-z0-9-]+:[^']+)'`) + singleQuotedToF = regexp.MustCompile(`\.toF\s*\(\s*'([a-z0-9-]+:[^']+)'`) + doubleQuotedTo = regexp.MustCompile(`\.to\s*\(\s*"([a-z0-9-]+:[^"]+)"`) + doubleQuotedToD = regexp.MustCompile(`\.toD\s*\(\s*"([a-z0-9-]+:[^"]+)"`) + doubleQuotedToF = regexp.MustCompile(`\.toF\s*\(\s*"([a-z0-9-]+:[^"]+)"`) additionalDependencies = map[string]string{ ".*JsonLibrary\\.Jackson.*": "camel:jackson",