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 2020/01/24 17:09:02 UTC

[camel-k] 01/07: chore(trait): Rename Classpath trait to JVM trait

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

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

commit e93f01c6ae712a83ab76ccd94a8d47214ff28d8a
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Jan 23 09:12:08 2020 +0100

    chore(trait): Rename Classpath trait to JVM trait
---
 docs/modules/ROOT/nav.adoc                         |  2 +-
 .../ROOT/pages/traits/{classpath.adoc => jvm.adoc} | 10 +++---
 docs/modules/ROOT/pages/traits/traits.adoc         |  2 +-
 pkg/trait/{classpath.go => jvm.go}                 | 18 +++++-----
 pkg/trait/{classpath_test.go => jvm_test.go}       | 39 +++++++++++-----------
 pkg/trait/trait_catalog.go                         | 12 +++----
 pkg/trait/trait_test.go                            |  2 +-
 7 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index fb4ee9d..1251e0a 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -19,7 +19,6 @@
 ** xref:traits/affinity.adoc[Affinity]
 ** xref:traits/builder.adoc[Builder]
 ** xref:traits/camel.adoc[Camel]
-** xref:traits/classpath.adoc[Classpath]
 ** xref:traits/container.adoc[Container]
 ** xref:traits/cron.adoc[Cron]
 ** xref:traits/debug.adoc[Debug]
@@ -31,6 +30,7 @@
 ** xref:traits/ingress.adoc[Ingress]
 ** xref:traits/istio.adoc[Istio]
 ** xref:traits/jolokia.adoc[Jolokia]
+** xref:traits/jvm.adoc[Jvm]
 ** xref:traits/knative-service.adoc[Knative Service]
 ** xref:traits/knative.adoc[Knative]
 ** xref:traits/owner.adoc[Owner]
diff --git a/docs/modules/ROOT/pages/traits/classpath.adoc b/docs/modules/ROOT/pages/traits/jvm.adoc
similarity index 68%
rename from docs/modules/ROOT/pages/traits/classpath.adoc
rename to docs/modules/ROOT/pages/traits/jvm.adoc
index 9b5f516..2ae6152 100755
--- a/docs/modules/ROOT/pages/traits/classpath.adoc
+++ b/docs/modules/ROOT/pages/traits/jvm.adoc
@@ -1,12 +1,12 @@
-= Classpath Trait
+= Jvm Trait
 
 // Start of autogenerated code - DO NOT EDIT! (description)
-The Classpath trait is used internally to configure the classpath of the final integration.
+The JVM trait is used to configure the JVM that runs the integration.
 
 
 This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**.
 
-WARNING: The classpath trait is a *platform trait*: disabling it may compromise the platform functionality.
+WARNING: The jvm trait is a *platform trait*: disabling it may compromise the platform functionality.
 
 // End of autogenerated code - DO NOT EDIT! (description)
 // Start of autogenerated code - DO NOT EDIT! (configuration)
@@ -14,7 +14,7 @@ WARNING: The classpath trait is a *platform trait*: disabling it may compromise
 
 Trait properties can be specified when running any integration with the CLI:
 ```
-kamel run --trait classpath.[key]=[value] integration.groovy
+kamel run --trait jvm.[key]=[value] integration.groovy
 ```
 The following configuration options are available:
 
@@ -22,7 +22,7 @@ The following configuration options are available:
 |===
 |Property | Type | Description
 
-| classpath.enabled
+| jvm.enabled
 | bool
 | Can be used to enable or disable a trait. All traits share this common property.
 
diff --git a/docs/modules/ROOT/pages/traits/traits.adoc b/docs/modules/ROOT/pages/traits/traits.adoc
index 44bc59e..efb3465 100644
--- a/docs/modules/ROOT/pages/traits/traits.adoc
+++ b/docs/modules/ROOT/pages/traits/traits.adoc
@@ -37,7 +37,6 @@ See the trait description pages for more information on a specific trait:
 * xref:traits/affinity.adoc[Affinity Trait]
 * xref:traits/builder.adoc[Builder Trait]
 * xref:traits/camel.adoc[Camel Trait]
-* xref:traits/classpath.adoc[Classpath Trait]
 * xref:traits/container.adoc[Container Trait]
 * xref:traits/cron.adoc[Cron Trait]
 * xref:traits/debug.adoc[Debug Trait]
@@ -49,6 +48,7 @@ See the trait description pages for more information on a specific trait:
 * xref:traits/ingress.adoc[Ingress Trait]
 * xref:traits/istio.adoc[Istio Trait]
 * xref:traits/jolokia.adoc[Jolokia Trait]
+* xref:traits/jvm.adoc[Jvm Trait]
 * xref:traits/knative-service.adoc[Knative Service Trait]
 * xref:traits/knative.adoc[Knative Trait]
 * xref:traits/owner.adoc[Owner Trait]
diff --git a/pkg/trait/classpath.go b/pkg/trait/jvm.go
similarity index 88%
rename from pkg/trait/classpath.go
rename to pkg/trait/jvm.go
index 71b7cc4..b143683 100644
--- a/pkg/trait/classpath.go
+++ b/pkg/trait/jvm.go
@@ -35,20 +35,20 @@ const (
 	defaultMainClass = "org.apache.camel.k.main.Application"
 )
 
-// The Classpath trait is used internally to configure the classpath of the final integration.
+// The JVM trait is used to configure the JVM that runs the integration.
 //
-// +camel-k:trait=classpath
-type classpathTrait struct {
+// +camel-k:trait=jvm
+type jvmTrait struct {
 	BaseTrait `property:",squash"`
 }
 
-func newClasspathTrait() *classpathTrait {
-	return &classpathTrait{
-		BaseTrait: newBaseTrait("classpath"),
+func newJvmTrait() *jvmTrait {
+	return &jvmTrait{
+		BaseTrait: newBaseTrait("jvm"),
 	}
 }
 
-func (t *classpathTrait) Configure(e *Environment) (bool, error) {
+func (t *jvmTrait) Configure(e *Environment) (bool, error) {
 	if t.Enabled != nil && !*t.Enabled {
 		return false, nil
 	}
@@ -57,7 +57,7 @@ func (t *classpathTrait) Configure(e *Environment) (bool, error) {
 		e.InPhase(v1.IntegrationKitPhaseReady, v1.IntegrationPhaseRunning), nil
 }
 
-func (t *classpathTrait) Apply(e *Environment) error {
+func (t *jvmTrait) Apply(e *Environment) error {
 	kit := e.IntegrationKit
 
 	if kit == nil && e.Integration.Status.Kit != "" {
@@ -126,6 +126,6 @@ func (t *classpathTrait) Apply(e *Environment) error {
 }
 
 // IsPlatformTrait overrides base class method
-func (t *classpathTrait) IsPlatformTrait() bool {
+func (t *jvmTrait) IsPlatformTrait() bool {
 	return true
 }
diff --git a/pkg/trait/classpath_test.go b/pkg/trait/jvm_test.go
similarity index 79%
rename from pkg/trait/classpath_test.go
rename to pkg/trait/jvm_test.go
index 5b12675..e480f06 100644
--- a/pkg/trait/classpath_test.go
+++ b/pkg/trait/jvm_test.go
@@ -22,29 +22,30 @@ import (
 	"sort"
 	"testing"
 
+	"github.com/scylladb/go-set/strset"
+	"github.com/stretchr/testify/assert"
+
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
 	serving "knative.dev/serving/pkg/apis/serving/v1"
 
 	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/apache/camel-k/pkg/util/test"
-
-	"github.com/scylladb/go-set/strset"
-	"github.com/stretchr/testify/assert"
 )
 
-func TestConfigureClasspathTraitInRightPhasesDoesSucceed(t *testing.T) {
-	trait, environment := createNominalClasspathTest()
+func TestConfigureJvmTraitInRightPhasesDoesSucceed(t *testing.T) {
+	trait, environment := createNominalJvmTest()
 
 	configured, err := trait.Configure(environment)
 	assert.Nil(t, err)
 	assert.True(t, configured)
 }
 
-func TestConfigureClasspathTraitInWrongIntegrationPhaseDoesNotSucceed(t *testing.T) {
-	trait, environment := createNominalClasspathTest()
+func TestConfigureJvmTraitInWrongIntegrationPhaseDoesNotSucceed(t *testing.T) {
+	trait, environment := createNominalJvmTest()
 	environment.Integration.Status.Phase = v1.IntegrationPhaseError
 
 	configured, err := trait.Configure(environment)
@@ -52,8 +53,8 @@ func TestConfigureClasspathTraitInWrongIntegrationPhaseDoesNotSucceed(t *testing
 	assert.False(t, configured)
 }
 
-func TestConfigureClasspathTraitInWrongIntegrationKitPhaseDoesNotSucceed(t *testing.T) {
-	trait, environment := createNominalClasspathTest()
+func TestConfigureJvmTraitInWrongIntegrationKitPhaseDoesNotSucceed(t *testing.T) {
+	trait, environment := createNominalJvmTest()
 	environment.IntegrationKit.Status.Phase = v1.IntegrationKitPhaseWaitingForPlatform
 
 	configured, err := trait.Configure(environment)
@@ -61,8 +62,8 @@ func TestConfigureClasspathTraitInWrongIntegrationKitPhaseDoesNotSucceed(t *test
 	assert.False(t, configured)
 }
 
-func TestConfigureClasspathDisabledTraitDoesNotSucceed(t *testing.T) {
-	trait, environment := createNominalClasspathTest()
+func TestConfigureJvmDisabledTraitDoesNotSucceed(t *testing.T) {
+	trait, environment := createNominalJvmTest()
 	trait.Enabled = new(bool)
 
 	configured, err := trait.Configure(environment)
@@ -70,8 +71,8 @@ func TestConfigureClasspathDisabledTraitDoesNotSucceed(t *testing.T) {
 	assert.False(t, configured)
 }
 
-func TestApplyClasspathTraitWithDeploymentResource(t *testing.T) {
-	trait, environment := createNominalClasspathTest()
+func TestApplyJvmTraitWithDeploymentResource(t *testing.T) {
+	trait, environment := createNominalJvmTest()
 
 	d := appsv1.Deployment{
 		Spec: appsv1.DeploymentSpec{
@@ -108,8 +109,8 @@ func TestApplyClasspathTraitWithDeploymentResource(t *testing.T) {
 	})
 }
 
-func TestApplyClasspathTraitWithKNativeResource(t *testing.T) {
-	trait, environment := createNominalClasspathTest()
+func TestApplyJvmTraitWithKNativeResource(t *testing.T) {
+	trait, environment := createNominalJvmTest()
 
 	s := serving.Service{}
 	s.Spec.ConfigurationSpec.Template = serving.RevisionTemplateSpec{}
@@ -140,11 +141,11 @@ func TestApplyClasspathTraitWithKNativeResource(t *testing.T) {
 	})
 }
 
-func createNominalClasspathTest() (*classpathTrait, *Environment) {
-	return createClasspathTestWithKitType(v1.IntegrationKitTypePlatform)
+func createNominalJvmTest() (*jvmTrait, *Environment) {
+	return createJvmTestWithKitType(v1.IntegrationKitTypePlatform)
 }
 
-func createClasspathTestWithKitType(kitType string) (*classpathTrait, *Environment) {
+func createJvmTestWithKitType(kitType string) (*jvmTrait, *Environment) {
 	client, _ := test.NewFakeClient(
 		&v1.IntegrationKit{
 			TypeMeta: metav1.TypeMeta{
@@ -161,7 +162,7 @@ func createClasspathTestWithKitType(kitType string) (*classpathTrait, *Environme
 		},
 	)
 
-	trait := newClasspathTrait()
+	trait := newJvmTrait()
 	enabled := true
 	trait.Enabled = &enabled
 	trait.ctx = context.TODO()
diff --git a/pkg/trait/trait_catalog.go b/pkg/trait/trait_catalog.go
index a045f30..81a3180 100644
--- a/pkg/trait/trait_catalog.go
+++ b/pkg/trait/trait_catalog.go
@@ -52,7 +52,7 @@ type Catalog struct {
 	tBuilder          Trait
 	tIstio            Trait
 	tEnvironment      Trait
-	tClasspath        Trait
+	tJvm              Trait
 	tRestDsl          Trait
 	tProbes           Trait
 	tQuarkus          Trait
@@ -85,7 +85,7 @@ func NewCatalog(ctx context.Context, c client.Client) *Catalog {
 		tBuilder:          newBuilderTrait(),
 		tIstio:            newIstioTrait(),
 		tEnvironment:      newEnvironmentTrait(),
-		tClasspath:        newClasspathTrait(),
+		tJvm:              newJvmTrait(),
 		tProbes:           newProbesTrait(),
 		tQuarkus:          newQuarkusTrait(),
 		tContainer:        newContainerTrait(),
@@ -126,7 +126,7 @@ func (c *Catalog) allTraits() []Trait {
 		c.tBuilder,
 		c.tIstio,
 		c.tEnvironment,
-		c.tClasspath,
+		c.tJvm,
 		c.tProbes,
 		c.tQuarkus,
 		c.tContainer,
@@ -167,7 +167,7 @@ func (c *Catalog) TraitsForProfile(profile v1.TraitProfile) []Trait {
 			c.tJolokia,
 			c.tPrometheus,
 			c.tDebug,
-			c.tClasspath,
+			c.tJvm,
 			c.tProbes,
 			c.tRoute,
 			c.tIstio,
@@ -193,7 +193,7 @@ func (c *Catalog) TraitsForProfile(profile v1.TraitProfile) []Trait {
 			c.tJolokia,
 			c.tPrometheus,
 			c.tDebug,
-			c.tClasspath,
+			c.tJvm,
 			c.tProbes,
 			c.tIngress,
 			c.tIstio,
@@ -220,7 +220,7 @@ func (c *Catalog) TraitsForProfile(profile v1.TraitProfile) []Trait {
 			c.tJolokia,
 			c.tPrometheus,
 			c.tDebug,
-			c.tClasspath,
+			c.tJvm,
 			c.tProbes,
 			c.tIstio,
 			c.tOwner,
diff --git a/pkg/trait/trait_test.go b/pkg/trait/trait_test.go
index bab4131..72a8da0 100644
--- a/pkg/trait/trait_test.go
+++ b/pkg/trait/trait_test.go
@@ -376,7 +376,7 @@ func TestOnlySomeTraitsInfluenceBuild(t *testing.T) {
 
 func TestOnlySomeTraitsArePlatform(t *testing.T) {
 	c := NewTraitTestCatalog()
-	platformTraits := []string{"builder", "camel", "classpath", "container", "dependencies", "deployer", "deployment", "environment", "rest-dsl", "owner", "platform"}
+	platformTraits := []string{"builder", "camel", "jvm", "container", "dependencies", "deployer", "deployment", "environment", "rest-dsl", "owner", "platform"}
 
 	for _, trait := range c.allTraits() {
 		if trait.IsPlatformTrait() {