You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2018/12/20 11:28:07 UTC

[camel-k] branch master updated: catalog : include camel-k components #301

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

nferraro 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 82c1f82  catalog : include camel-k components #301
82c1f82 is described below

commit 82c1f82a41e625b5aa30cc4e48dc28c5f55337a1
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Tue Dec 18 10:14:38 2018 +0100

    catalog : include camel-k components #301
---
 deploy/camel-catalog.yaml                          |  9 ++++++
 deploy/resources.go                                |  9 ++++++
 pkg/util/camel/catalog.go                          |  4 ---
 pkg/util/camel/catalog_test.go                     | 13 ++++++++
 pkg/util/camel/embedded.go                         | 37 ----------------------
 runtime/catalog-builder/pom.xml                    |  4 +++
 .../src/main/resources/catalogbuilder.groovy       | 20 ++++++++++++
 7 files changed, 55 insertions(+), 41 deletions(-)

diff --git a/deploy/camel-catalog.yaml b/deploy/camel-catalog.yaml
index f616af1..c666a1f 100644
--- a/deploy/camel-catalog.yaml
+++ b/deploy/camel-catalog.yaml
@@ -1831,6 +1831,15 @@ artifacts:
     - id: zookeeper-master
     languages: []
     dataformats: []
+  camel-knative:
+    groupId: org.apache.camel.k
+    artifactId: camel-knative
+    version: 0.1.1-SNAPSHOT
+    schemes:
+    - id: knative
+      http: true
+    languages: []
+    dataformats: []
   camel-juel:
     groupId: org.apache.camel
     artifactId: camel-juel
diff --git a/deploy/resources.go b/deploy/resources.go
index 9f5ff45..5ebc74b 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -1875,6 +1875,15 @@ artifacts:
     - id: zookeeper-master
     languages: []
     dataformats: []
+  camel-knative:
+    groupId: org.apache.camel.k
+    artifactId: camel-knative
+    version: 0.1.1-SNAPSHOT
+    schemes:
+    - id: knative
+      http: true
+    languages: []
+    dataformats: []
   camel-juel:
     groupId: org.apache.camel
     artifactId: camel-juel
diff --git a/pkg/util/camel/catalog.go b/pkg/util/camel/catalog.go
index 579b036..c1ad146 100644
--- a/pkg/util/camel/catalog.go
+++ b/pkg/util/camel/catalog.go
@@ -52,10 +52,6 @@ func init() {
 	if err := yaml.Unmarshal([]byte(data), &Runtime); err != nil {
 		panic(err)
 	}
-	// Adding embedded artifacts
-	for k, v := range EmbeddedArtifacts() {
-		Runtime.Artifacts[k] = v
-	}
 
 	Runtime.artifactByScheme = make(map[string]string)
 	Runtime.schemesByID = make(map[string]Scheme)
diff --git a/pkg/util/camel/catalog_test.go b/pkg/util/camel/catalog_test.go
index d7fb0d5..a4c47a0 100644
--- a/pkg/util/camel/catalog_test.go
+++ b/pkg/util/camel/catalog_test.go
@@ -20,6 +20,7 @@ package camel
 import (
 	"testing"
 
+	"github.com/apache/camel-k/version"
 	"github.com/stretchr/testify/assert"
 )
 
@@ -27,3 +28,15 @@ func TestCatalog(t *testing.T) {
 	assert.NotNil(t, Runtime)
 	assert.NotEmpty(t, Runtime.Artifacts)
 }
+
+func TestRuntimeContainsEmbeddedArtifacts(t *testing.T) {
+	artifact := Runtime.GetArtifactByScheme("knative")
+	assert.Equal(t, 1, len(artifact.Schemes))
+	assert.Equal(t, "org.apache.camel.k", artifact.GroupID)
+	assert.Equal(t, "camel-knative", artifact.ArtifactID)
+	assert.Equal(t, version.Version, artifact.Version)
+
+	scheme, found := Runtime.GetScheme("knative")
+	assert.True(t, found)
+	assert.True(t, scheme.HTTP)
+}
diff --git a/pkg/util/camel/embedded.go b/pkg/util/camel/embedded.go
deleted file mode 100644
index a4011cc..0000000
--- a/pkg/util/camel/embedded.go
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-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 camel
-
-import "github.com/apache/camel-k/version"
-
-// EmbeddedArtifacts returns a list of artifacts that are shipped directly with Camel K
-func EmbeddedArtifacts() map[string]Artifact {
-	return map[string]Artifact{
-		"camel-knative": {
-			GroupID:    "org.apache.camel.k",
-			ArtifactID: "camel-knative",
-			Version:    version.Version,
-			Schemes: []Scheme{
-				{
-					ID:   "knative",
-					HTTP: true,
-				},
-			},
-		},
-	}
-}
diff --git a/runtime/catalog-builder/pom.xml b/runtime/catalog-builder/pom.xml
index 080128c..95ff3ce 100644
--- a/runtime/catalog-builder/pom.xml
+++ b/runtime/catalog-builder/pom.xml
@@ -47,6 +47,10 @@
         <configuration>
           <properties>
             <property>
+              <name>projectVersion</name>
+              <value>${project.version}</value>
+            </property>
+            <property>
               <name>catalogOutputFile</name>
               <value>${project.basedir}/../../deploy/camel-catalog.yaml</value>
             </property>
diff --git a/runtime/catalog-builder/src/main/resources/catalogbuilder.groovy b/runtime/catalog-builder/src/main/resources/catalogbuilder.groovy
index 7fcdebe..acfe2a6 100644
--- a/runtime/catalog-builder/src/main/resources/catalogbuilder.groovy
+++ b/runtime/catalog-builder/src/main/resources/catalogbuilder.groovy
@@ -108,6 +108,26 @@ catalog.findComponentNames().sort().each { name ->
     }
 }
 
+
+// *******************************
+//
+// Components :: Embedded
+//
+// *******************************
+
+output['artifacts']['camel-knative'] = [:]
+output['artifacts']['camel-knative']['groupId'] = 'org.apache.camel.k'
+output['artifacts']['camel-knative']['artifactId'] = 'camel-knative'
+output['artifacts']['camel-knative']['version'] = projectVersion
+output['artifacts']['camel-knative']['schemes'] = []
+output['artifacts']['camel-knative']['languages'] = []
+output['artifacts']['camel-knative']['dataformats'] = []
+
+output['artifacts']['camel-knative']['schemes'] << [
+    'id': 'knative',
+    'http': true,
+]
+
 // *******************************
 //
 // Languages