Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2170: uniform camel: and camel-quarkus: dependencies #2208

Merged
merged 2 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pkg/apis/camel/v1/camelcatalog_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ func NewCamelCatalogList() CamelCatalogList {
// GetDependencyID returns a Camel K recognizable maven dependency for the artifact
func (in *CamelArtifact) GetDependencyID() string {
switch {
case in.GroupID == "org.apache.camel" && strings.HasPrefix(in.ArtifactID, "camel-"):
return "camel:" + in.ArtifactID[6:]
case in.GroupID == "org.apache.camel.quarkus" && strings.HasPrefix(in.ArtifactID, "camel-quarkus-"):
return "camel-quarkus:" + in.ArtifactID[14:]
return "camel:" + in.ArtifactID[14:]
case in.Version == "":
return "mvn:" + in.GroupID + ":" + in.ArtifactID
default:
Expand Down
6 changes: 4 additions & 2 deletions pkg/apis/camel/v1/integration_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ func (in *IntegrationSpec) AddDependency(dependency string) {
in.Dependencies = make([]string, 0)
}
newDep := dependency
if strings.HasPrefix(newDep, "camel-quarkus") {
newDep = "camel-quarkus:" + strings.TrimPrefix(dependency, "camel-quarkus-")
if strings.HasPrefix(newDep, "camel-quarkus-") {
newDep = "camel:" + strings.TrimPrefix(dependency, "camel-quarkus-")
} else if strings.HasPrefix(newDep, "camel-quarkus:") {
newDep = "camel:" + strings.TrimPrefix(dependency, "camel-quarkus:")
} else if strings.HasPrefix(newDep, "camel-") {
newDep = "camel:" + strings.TrimPrefix(dependency, "camel-")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/kit_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (command *kitCreateCommandOptions) run(_ *cobra.Command, args []string) err
case strings.HasPrefix(item, "file:"):
kit.Spec.Dependencies = append(kit.Spec.Dependencies, item)
case strings.HasPrefix(item, "camel-quarkus-"):
kit.Spec.Dependencies = append(kit.Spec.Dependencies, "camel-quarkus:"+strings.TrimPrefix(item, "camel-quarkus-"))
kit.Spec.Dependencies = append(kit.Spec.Dependencies, "camel:"+strings.TrimPrefix(item, "camel-quarkus-"))
case strings.HasPrefix(item, "camel-"):
kit.Spec.Dependencies = append(kit.Spec.Dependencies, "camel:"+strings.TrimPrefix(item, "camel-"))
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/metadata/metadata_capabilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func TestPlatformHttpCapabilities(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:platform-http",
"camel-quarkus:log",
"camel:platform-http",
"camel:log",
},
meta.Dependencies.List())

Expand Down
168 changes: 84 additions & 84 deletions pkg/metadata/metadata_dependencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ func TestDependenciesJavaSource(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:activemq",
"camel-quarkus:amqp",
"camel-quarkus:log",
"camel-quarkus:telegram",
"camel-quarkus:timer",
"camel-quarkus:twitter",
"camel:activemq",
"camel:amqp",
"camel:log",
"camel:telegram",
"camel:timer",
"camel:twitter",
},
meta.Dependencies.List())
}
Expand Down Expand Up @@ -85,11 +85,11 @@ func TestDependenciesJavaScript(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:activemq",
"camel-quarkus:amqp",
"camel-quarkus:log",
"camel-quarkus:telegram",
"camel-quarkus:timer",
"camel:activemq",
"camel:amqp",
"camel:log",
"camel:telegram",
"camel:timer",
},
meta.Dependencies.List())
}
Expand Down Expand Up @@ -120,12 +120,12 @@ func TestDependenciesGroovy(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:activemq",
"camel-quarkus:amqp",
"camel-quarkus:log",
"camel-quarkus:telegram",
"camel-quarkus:timer",
"camel-quarkus:twitter",
"camel:activemq",
"camel:amqp",
"camel:log",
"camel:telegram",
"camel:timer",
"camel:twitter",
},
meta.Dependencies.List())
}
Expand All @@ -150,10 +150,10 @@ func TestDependencies(t *testing.T) {

assert.ElementsMatch(t,
[]string{
"camel-quarkus:http",
"camel-quarkus:log",
"camel-quarkus:mock",
"camel-quarkus:twitter",
"camel:http",
"camel:log",
"camel:mock",
"camel:twitter",
},
meta.Dependencies.List())
}
Expand Down Expand Up @@ -183,12 +183,12 @@ func TestDependenciesQuarkus(t *testing.T) {

assert.ElementsMatch(t,
[]string{
"camel-quarkus:http",
"camel-quarkus:log",
"camel-quarkus:mock",
"camel-quarkus:timer",
"camel-quarkus:twitter",
"camel-quarkus:direct",
"camel:http",
"camel:log",
"camel:mock",
"camel:timer",
"camel:twitter",
"camel:direct",
},
meta.Dependencies.List())

Expand All @@ -214,9 +214,9 @@ func TestJacksonDependency(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:http",
"camel-quarkus:jackson",
"camel-quarkus:log",
"camel:http",
"camel:jackson",
"camel:log",
},
meta.Dependencies.List())
}
Expand All @@ -242,9 +242,9 @@ func TestJacksonImplicitDependency(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:http",
"camel-quarkus:jackson",
"camel-quarkus:log",
"camel:http",
"camel:jackson",
"camel:log",
},
meta.Dependencies.List())
}
Expand Down Expand Up @@ -275,14 +275,14 @@ func TestLanguageDependencies(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:direct",
"camel-quarkus:mvel",
"camel-quarkus:ognl",
"camel-quarkus:xpath",
"camel-quarkus:jsonpath",
"camel-quarkus:groovy",
"camel-quarkus:saxon",
"camel-quarkus:xml-jaxp",
"camel:direct",
"camel:mvel",
"camel:ognl",
"camel:xpath",
"camel:jsonpath",
"camel:groovy",
"camel:saxon",
"camel:xml-jaxp",
},
meta.Dependencies.List())
}
Expand All @@ -309,10 +309,10 @@ func TestLanguageDependenciesTransformExpression(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:direct",
"camel-quarkus:ognl",
"camel-quarkus:xpath",
"camel-quarkus:jsonpath",
"camel:direct",
"camel:ognl",
"camel:xpath",
"camel:jsonpath",
},
meta.Dependencies.List())
}
Expand All @@ -339,8 +339,8 @@ func TestCircuitBreakerDependency(t *testing.T) {

assert.ElementsMatch(t,
[]string{
"camel-quarkus:http",
"camel-quarkus:log",
"camel:http",
"camel:log",
},
meta.Dependencies.List())

Expand Down Expand Up @@ -370,9 +370,9 @@ func TestRestDependency(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:http",
"camel-quarkus:direct",
"camel-quarkus:log",
"camel:http",
"camel:direct",
"camel:log",
"mvn:org.apache.camel.quarkus:camel-quarkus-rest",
"mvn:org.apache.camel.quarkus:camel-quarkus-platform-http",
},
Expand Down Expand Up @@ -401,9 +401,9 @@ func TestRestWithPathDependency(t *testing.T) {

assert.ElementsMatch(
t, []string{
"camel-quarkus:http",
"camel-quarkus:direct",
"camel-quarkus:log",
"camel:http",
"camel:direct",
"camel:log",
"mvn:org.apache.camel.quarkus:camel-quarkus-rest",
"mvn:org.apache.camel.quarkus:camel-quarkus-platform-http",
},
Expand Down Expand Up @@ -431,8 +431,8 @@ func TestRestConfigurationDependency(t *testing.T) {

assert.ElementsMatch(
t, []string{
"camel-quarkus:http",
"camel-quarkus:log",
"camel:http",
"camel:log",
"mvn:org.apache.camel.quarkus:camel-quarkus-rest",
"mvn:org.apache.camel.quarkus:camel-quarkus-platform-http",
},
Expand Down Expand Up @@ -461,8 +461,8 @@ func TestRestClosureDependencyGroovy(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:http",
"camel-quarkus:log",
"camel:http",
"camel:log",
"mvn:org.apache.camel.quarkus:camel-quarkus-rest",
"mvn:org.apache.camel.quarkus:camel-quarkus-platform-http",
},
Expand Down Expand Up @@ -491,8 +491,8 @@ func TestRestClosureDependencyKotlin(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:http",
"camel-quarkus:log",
"camel:http",
"camel:log",
"mvn:org.apache.camel.quarkus:camel-quarkus-rest",
"mvn:org.apache.camel.quarkus:camel-quarkus-platform-http",
},
Expand Down Expand Up @@ -525,9 +525,9 @@ func TestXMLCircuitBreakerDependency(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:direct",
"camel-quarkus:kafka",
"camel-quarkus:log",
"camel:direct",
"camel:kafka",
"camel:log",
},
meta.Dependencies.List())

Expand Down Expand Up @@ -564,8 +564,8 @@ func TestXMLRestDependency(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:direct",
"camel-quarkus:mock",
"camel:direct",
"camel:mock",
},
meta.Dependencies.List())

Expand Down Expand Up @@ -620,15 +620,15 @@ func TestXMLLanguageDependencies(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:core",
"camel-quarkus:direct",
"camel-quarkus:mvel",
"camel-quarkus:ognl",
"camel-quarkus:xpath",
"camel-quarkus:xml-jaxp",
"camel-quarkus:jsonpath",
"camel-quarkus:saxon",
"camel-quarkus:groovy",
"camel:core",
"camel:direct",
"camel:mvel",
"camel:ognl",
"camel:xpath",
"camel:xml-jaxp",
"camel:jsonpath",
"camel:saxon",
"camel:groovy",
},
meta.Dependencies.List())
}
Expand Down Expand Up @@ -690,8 +690,8 @@ func TestYAMLRestDependency(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:direct",
"camel-quarkus:log",
"camel:direct",
"camel:log",
},
meta.Dependencies.List())

Expand All @@ -716,7 +716,7 @@ func TestYAMLCircuitBreakerDependency(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:direct",
"camel:direct",
},
meta.Dependencies.List())
assert.True(t, meta.RequiredCapabilities.Has(v1.CapabilityCircuitBreaker))
Expand All @@ -739,14 +739,14 @@ func TestYAMLLanguageDependencies(t *testing.T) {
assert.ElementsMatch(
t,
[]string{
"camel-quarkus:core",
"camel-quarkus:direct",
"camel-quarkus:ognl",
"camel-quarkus:xpath",
"camel-quarkus:jsonpath",
"camel-quarkus:groovy",
"camel-quarkus:saxon",
"camel-quarkus:xml-jaxp",
"camel:core",
"camel:direct",
"camel:ognl",
"camel:xpath",
"camel:jsonpath",
"camel:groovy",
"camel:saxon",
"camel:xml-jaxp",
},
meta.Dependencies.List())
}
2 changes: 1 addition & 1 deletion pkg/trait/cron_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func TestCronDepsFallback(t *testing.T) {
assert.NotNil(t, ct)
assert.NotNil(t, ct.Fallback)
assert.True(t, util.StringSliceExists(environment.Integration.Status.Capabilities, v1.CapabilityCron))
assert.Contains(t, environment.Integration.Status.Dependencies, "camel-quarkus:quartz")
assert.Contains(t, environment.Integration.Status.Dependencies, "camel:quartz")
assert.Contains(t, environment.Integration.Status.Dependencies, "mvn:org.apache.camel.k:camel-k-cron")
}

Expand Down
Loading