Skip to content

Commit

Permalink
Switch to Quarkus as runtime #359 (fix catalog generation)
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Nov 5, 2020
1 parent f647c01 commit c38b9b6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ new File(basedir, "catalog.yaml").withReader {
assert catalog.spec.runtime.metadata['camel-quarkus.version'] == camelQuarkusVersion


assert catalog.spec.runtime.dependencies.any {
it.groupId == 'org.apache.camel.k' && it.artifactId == 'camel-k-runtime'
}

assert catalog.spec.runtime.capabilities['cron'].dependencies[0].groupId == 'org.apache.camel.k'
assert catalog.spec.runtime.capabilities['cron'].dependencies[0].artifactId == 'camel-k-quarkus-cron'
assert catalog.spec.runtime.capabilities['cron'].dependencies[0].artifactId == 'camel-k-cron'
assert catalog.spec.runtime.capabilities['health'].dependencies[0].groupId == 'org.apache.camel.quarkus'
assert catalog.spec.runtime.capabilities['health'].dependencies[0].artifactId == 'camel-quarkus-microprofile-health'
assert catalog.spec.runtime.capabilities['rest'].dependencies.any { it.groupId == 'org.apache.camel.quarkus' && it.artifactId == 'camel-quarkus-rest' }
Expand All @@ -38,25 +42,25 @@ new File(basedir, "catalog.yaml").withReader {
assert catalog.spec.runtime.capabilities['tracing'].dependencies[0].groupId == 'org.apache.camel.quarkus'
assert catalog.spec.runtime.capabilities['tracing'].dependencies[0].artifactId == 'camel-quarkus-opentracing'
assert catalog.spec.runtime.capabilities['master'].dependencies[0].groupId == 'org.apache.camel.k'
assert catalog.spec.runtime.capabilities['master'].dependencies[0].artifactId == 'camel-k-quarkus-master'
assert catalog.spec.runtime.capabilities['master'].dependencies[0].artifactId == 'camel-k-master'

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

catalog.spec.artifacts['camel-k-quarkus-knative'].with {
catalog.spec.artifacts['camel-k-knative'].with {
assert dependencies == null
assert schemes.size() == 1
assert schemes[0].id == 'knative'
}

catalog.spec.artifacts['camel-k-quarkus-kamelet'].with {
catalog.spec.artifacts['camel-k-kamelet'].with {
assert dependencies == null
assert schemes.size() == 1
assert schemes[0].id == 'kamelet'
assert schemes[0].passive == true
assert schemes[0].http == false
}

catalog.spec.artifacts['camel-k-quarkus-wrap'].with {
catalog.spec.artifacts['camel-k-wrap'].with {
assert dependencies == null
assert schemes.size() == 1
assert schemes[0].id == 'wrap'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ public void execute() throws MojoExecutionException, MojoFailureException {
version -> runtimeSpec.putMetadata("camel-quarkus.version", version));

runtimeSpec.applicationClass("io.quarkus.runner.GeneratedMain");
runtimeSpec.addDependency("org.apache.camel.k", "camel-k-runtime-quarkus");
runtimeSpec.addDependency("org.apache.camel.k", "camel-k-runtime");
runtimeSpec.putCapability(
"cron",
CamelCapability.forArtifact(
"org.apache.camel.k", "camel-k-quarkus-cron"));
"org.apache.camel.k", "camel-k-cron"));
runtimeSpec.putCapability(
"health",
CamelCapability.forArtifact(
Expand All @@ -142,7 +142,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
runtimeSpec.putCapability(
"master",
CamelCapability.forArtifact(
"org.apache.camel.k", "camel-k-quarkus-master"));
"org.apache.camel.k", "camel-k-master"));

CamelCatalogSpec.Builder catalogSpec = new CamelCatalogSpec.Builder()
.runtime(runtimeSpec.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec
specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-quarkus-cron")
.artifactId("camel-k-cron")
.addScheme(new CamelScheme.Builder()
.id("cron")
.http(true)
Expand All @@ -122,7 +122,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec
specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-quarkus-kamelet")
.artifactId("camel-k-kamelet")
.addScheme(new CamelScheme.Builder()
.id("kamelet")
.http(false)
Expand All @@ -133,7 +133,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec
specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-quarkus-knative")
.artifactId("camel-k-knative")
.addScheme(new CamelScheme.Builder()
.id("knative")
.http(true)
Expand All @@ -143,7 +143,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec
specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-quarkus-webhook")
.artifactId("camel-k-webhook")
.addScheme(new CamelScheme.Builder()
.id("wrap")
.build())
Expand All @@ -152,7 +152,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec
specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-quarkus-master")
.artifactId("camel-k-master")
.addScheme(new CamelScheme.Builder()
.id("master")
.build())
Expand All @@ -161,7 +161,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec
specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-quarkus-webhook")
.artifactId("camel-k-webhook")
.addScheme(new CamelScheme.Builder()
.id("webhook")
.http(true)
Expand All @@ -172,76 +172,53 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec
specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-quarkus-wrap")
.artifactId("camel-k-wrap")
.addScheme(new CamelScheme.Builder()
.id("wrap")
.build())
.build()
);

specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-runtime-knative")
.addDependencies(
MavenArtifact.from("org.apache.camel.k", "camel-k-quarkus-knative"))
.build()
);

specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-runtime-quarkus")
.build()
);

specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-quarkus-core")
.build()
);
}

private static void processLoaders(CamelCatalogSpec.Builder specBuilder) {
specBuilder.putLoader(
"yaml",
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-yaml")
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-yaml")
.addLanguage("yaml")
.putMetadata("native", "true")
.build()
);
specBuilder.putLoader(
"groovy",
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-groovy")
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-groovy")
.addLanguage("groovy")
.putMetadata("native", "false")
.build()
);
specBuilder.putLoader(
"kts",
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-kotlin")
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-kotlin")
.addLanguage("kts")
.putMetadata("native", "false")
.build()
);
specBuilder.putLoader(
"js",
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-js")
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-js")
.addLanguage("js")
.putMetadata("native", "true")
.build()
);
specBuilder.putLoader(
"xml",
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-xml")
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-xml")
.addLanguage("xml")
.putMetadata("native", "true")
.build()
);
specBuilder.putLoader(
"java",
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-java")
CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-java")
.addLanguage("java")
.putMetadata("native", "false")
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void testArtifactsEnrichment() {
CamelCatalogSpec spec = builder.build();
Map<String, CamelArtifact> artifactMap = spec.getArtifacts();

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

0 comments on commit c38b9b6

Please sign in to comment.