Skip to content

Commit

Permalink
Knative extension not listed among knative dependencies in quarkus ca…
Browse files Browse the repository at this point in the history
…talog apache#260
  • Loading branch information
lburgazzoli committed Mar 12, 2020
1 parent efb7df4 commit bc3fad3
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 10 deletions.
10 changes: 9 additions & 1 deletion camel-k-quarkus/camel-k-quarkus-knative/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-knative</artifactId>
<artifactId>camel-knative-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-knative</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-knative-http</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ assert catalog.spec.runtime.capabilities['rest'].dependencies[1].groupId == 'org
assert catalog.spec.runtime.capabilities['rest'].dependencies[1].artifactId == 'camel-undertow'

assert catalog.metadata.labels['camel.apache.org/runtime.version'] == runtimeVersion

assert catalog.spec.artifacts['camel-knative'].dependencies.size == 3
assert catalog.spec.artifacts['camel-knative'].dependencies.find { it.groupId == 'org.apache.camel.k' && it.artifactId == 'camel-knative-api'}
assert catalog.spec.artifacts['camel-knative'].dependencies.find { it.groupId == 'org.apache.camel.k' && it.artifactId == 'camel-knative'}
assert catalog.spec.artifacts['camel-knative'].dependencies.find { it.groupId == 'org.apache.camel.k' && it.artifactId == 'camel-knative-http'}

assert catalog.spec.artifacts['camel-knative'].schemes.size == 1
assert catalog.spec.artifacts['camel-knative'].schemes[0].id == 'knative'
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ assert catalog.spec.runtime.capabilities['rest'].dependencies[1].groupId == 'org
assert catalog.spec.runtime.capabilities['rest'].dependencies[1].artifactId == 'camel-quarkus-platform-http'

assert catalog.metadata.labels['camel.apache.org/runtime.version'] == runtimeVersion

assert catalog.spec.artifacts['camel-knative'].dependencies.size == 1
assert catalog.spec.artifacts['camel-knative'].dependencies[0].groupId == 'org.apache.camel.k'
assert catalog.spec.artifacts['camel-knative'].dependencies[0].artifactId == 'camel-quarkus-knative'
assert catalog.spec.artifacts['camel-knative'].schemes.size == 1
assert catalog.spec.artifacts['camel-knative'].schemes[0].id == 'knative'
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.util.Collections;
import java.util.Set;
import java.util.function.BooleanSupplier;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -65,5 +66,11 @@ default Set<String> getJavaTypes() {
}

class Builder extends ImmutableCamelArtifact.Builder {
public Builder addDependencies(BooleanSupplier condition, Artifact... artifacts) {
if (condition.getAsBoolean()) {
addDependencies(artifacts);
}
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import com.vdurmont.semver4j.Semver;
import org.apache.camel.catalog.CamelCatalog;
import org.apache.camel.catalog.DefaultRuntimeProvider;
import org.apache.camel.catalog.quarkus.QuarkusRuntimeProvider;
import org.apache.camel.k.tooling.maven.model.CamelArtifact;
import org.apache.camel.k.tooling.maven.model.CamelLoader;
Expand Down Expand Up @@ -151,10 +152,16 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-runtime-knative")
.addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-k-loader-yaml"))
.addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-api"))
.addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative"))
.addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-http"))
.addDependencies(
() -> catalog.getRuntimeProvider() instanceof DefaultRuntimeProvider,
MavenArtifact.from("org.apache.camel.k", "camel-k-loader-yaml"),
MavenArtifact.from("org.apache.camel.k", "camel-knative-api"),
MavenArtifact.from("org.apache.camel.k", "camel-knative"),
MavenArtifact.from("org.apache.camel.k", "camel-knative-http"))
.addDependencies(
() -> catalog.getRuntimeProvider() instanceof QuarkusRuntimeProvider,
MavenArtifact.from("org.apache.camel.k", "camel-quarkus-knative"),
MavenArtifact.from("org.apache.camel.k", "camel-quarkus-loader-yaml"))
.build()
);

Expand All @@ -166,8 +173,14 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec
.id("knative")
.http(true)
.build())
.addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-api"))
.addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-http"))
.addDependencies(
() -> catalog.getRuntimeProvider() instanceof DefaultRuntimeProvider,
MavenArtifact.from("org.apache.camel.k", "camel-knative-api"),
MavenArtifact.from("org.apache.camel.k", "camel-knative"),
MavenArtifact.from("org.apache.camel.k", "camel-knative-http"))
.addDependencies(
() -> catalog.getRuntimeProvider() instanceof QuarkusRuntimeProvider,
MavenArtifact.from("org.apache.camel.k", "camel-quarkus-knative"))
.build()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public void testAcceptLessThanLower() {

@Test
public void testAcceptEqualToHigher() {
CatalogProcessor3x cp3 = new CatalogProcessor3x();

CamelCatalog catalog = versionCamelCatalog("4.0.0");

assertThat(new CatalogProcessor3x().accepts(catalog)).isFalse();
Expand Down Expand Up @@ -87,7 +85,7 @@ public void testArtifactsEnrichment() {

assertThat(artifactMap.get("camel-k-runtime-knative")).satisfies(a -> {
assertThat(a.getDependencies()).anyMatch(
d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-knative")
d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-knative-api")
);
assertThat(a.getDependencies()).anyMatch(
d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-knative")
Expand Down

0 comments on commit bc3fad3

Please sign in to comment.