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

Knative extension not listed among knative dependencies in quarkus catalog #261

Merged
merged 1 commit into from
Mar 12, 2020
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
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-k-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-k-quarkus-knative"),
MavenArtifact.from("org.apache.camel.k", "camel-k-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-k-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