This is an automated email from the ASF dual-hosted git repository. jiriondrusek pushed a commit to branch camel-main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/camel-main by this push: new 135c16e282 Removed camel-k modeline related stuff 135c16e282 is described below commit 135c16e28265991d98a1201e7e2102cf1c1131ea Author: Jiri Ondrusek <ondrusek.j...@gmail.com> AuthorDate: Mon May 19 10:55:07 2025 +0200 Removed camel-k modeline related stuff --- docs/modules/ROOT/examples/others/dsl-modeline.yml | 4 +- .../pages/reference/extensions/dsl-modeline.adoc | 6 +- .../modeline/deployment/DslModelineProcessor.java | 13 --- .../modeline/runtime/PropertyTraitRecorder.java | 34 ------ .../dsl/modeline/it/DslModelineResource.java | 10 -- .../component/dsl/modeline/it/DslModelineTest.java | 116 +++++---------------- 6 files changed, 30 insertions(+), 153 deletions(-) diff --git a/docs/modules/ROOT/examples/others/dsl-modeline.yml b/docs/modules/ROOT/examples/others/dsl-modeline.yml index 5c997fed1a..dcc85c7d8d 100644 --- a/docs/modules/ROOT/examples/others/dsl-modeline.yml +++ b/docs/modules/ROOT/examples/others/dsl-modeline.yml @@ -4,10 +4,10 @@ cqArtifactId: camel-quarkus-dsl-modeline cqArtifactIdBase: dsl-modeline cqNativeSupported: false cqStatus: Preview -cqDeprecated: true +cqDeprecated: false cqJvmSince: 2.14.0 cqNativeSince: n/a cqCamelPartName: dsl-modeline cqCamelPartTitle: DSL Modeline -cqCamelPartDescription: Camel DSL Camel K modeline +cqCamelPartDescription: Camel DSL modeline cqExtensionPageTitle: DSL Modeline diff --git a/docs/modules/ROOT/pages/reference/extensions/dsl-modeline.adoc b/docs/modules/ROOT/pages/reference/extensions/dsl-modeline.adoc index 43deebb78b..63d27a6a61 100644 --- a/docs/modules/ROOT/pages/reference/extensions/dsl-modeline.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/dsl-modeline.adoc @@ -6,15 +6,15 @@ :cq-artifact-id: camel-quarkus-dsl-modeline :cq-native-supported: false :cq-status: Preview -:cq-status-deprecation: Preview Deprecated +:cq-status-deprecation: Preview :cq-description: Support for Camel K style modeline -:cq-deprecated: true +:cq-deprecated: false :cq-jvm-since: 2.14.0 :cq-native-since: n/a ifeval::[{doc-show-badges} == true] [.badges] -[.badge-key]##JVM since##[.badge-supported]##2.14.0## [.badge-key]##Native##[.badge-unsupported]##unsupported## [.badge-key]##⚠️##[.badge-unsupported]##Deprecated## +[.badge-key]##JVM since##[.badge-supported]##2.14.0## [.badge-key]##Native##[.badge-unsupported]##unsupported## endif::[] Support for Camel K style modeline diff --git a/extensions-jvm/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java b/extensions-jvm/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java index 10c491d473..3af82612da 100644 --- a/extensions-jvm/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java +++ b/extensions-jvm/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java @@ -17,14 +17,8 @@ package org.apache.camel.quarkus.component.dsl.modeline.deployment; import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.ExecutionTime; -import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild; -import io.quarkus.runtime.RuntimeValue; -import org.apache.camel.CamelContext; -import org.apache.camel.quarkus.component.dsl.modeline.runtime.PropertyTraitRecorder; -import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem; public class DslModelineProcessor { private static final String FEATURE = "camel-dsl-modeline"; @@ -40,11 +34,4 @@ public class DslModelineProcessor { + "as JMX is not supported on GraalVM"); } - @Record(value = ExecutionTime.STATIC_INIT) - @BuildStep - void addPropertyTrait(CamelContextBuildItem camelContextBuildItem, PropertyTraitRecorder propertyTraitRecorder) { - RuntimeValue<CamelContext> context = camelContextBuildItem.getCamelContext(); - propertyTraitRecorder.addPropertyTrait(context); - } - } diff --git a/extensions-jvm/dsl-modeline/runtime/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/runtime/PropertyTraitRecorder.java b/extensions-jvm/dsl-modeline/runtime/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/runtime/PropertyTraitRecorder.java deleted file mode 100644 index 6423851f17..0000000000 --- a/extensions-jvm/dsl-modeline/runtime/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/runtime/PropertyTraitRecorder.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.quarkus.component.dsl.modeline.runtime; - -import io.quarkus.runtime.RuntimeValue; -import io.quarkus.runtime.annotations.Recorder; -import org.apache.camel.CamelContext; -import org.apache.camel.dsl.modeline.PropertyTrait; -import org.apache.camel.spi.PropertiesComponent; - -@Recorder -public class PropertyTraitRecorder { - - public void addPropertyTrait(RuntimeValue<CamelContext> camelContextRuntimeValue) { - CamelContext camelContext = camelContextRuntimeValue.getValue(); - PropertiesComponent pc = camelContext.getPropertiesComponent(); - pc.addPropertiesSource(new PropertyTrait()); - } - -} diff --git a/integration-tests-jvm/dsl-modeline/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineResource.java b/integration-tests-jvm/dsl-modeline/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineResource.java index 0f8f351bae..7c903c460f 100644 --- a/integration-tests-jvm/dsl-modeline/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineResource.java +++ b/integration-tests-jvm/dsl-modeline/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineResource.java @@ -25,7 +25,6 @@ import jakarta.ws.rs.DELETE; import jakarta.ws.rs.GET; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; @@ -68,15 +67,6 @@ public class DslModelineResource { return deps; } - @Path("props/{property}") - @GET - @Consumes(MediaType.TEXT_PLAIN) - @Produces(MediaType.TEXT_PLAIN) - public String getDependencies(@PathParam("property") String property) { - String uri = String.format("{{%s}}", property); - return context.getPropertiesComponent().parseUri(uri); - } - @DELETE public Response clear() { deps.clear(); diff --git a/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java b/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java index 2bd193d3cd..ae8ae9a2ca 100644 --- a/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java +++ b/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java @@ -16,7 +16,11 @@ */ package org.apache.camel.quarkus.component.dsl.modeline.it; +import java.lang.constant.DynamicCallSiteDesc; +import java.rmi.server.UID; import java.util.List; +import java.util.Optional; +import java.util.UUID; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; @@ -25,7 +29,6 @@ import io.restassured.http.ContentType; import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.Test; -import static org.hamcrest.Matchers.equalTo; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -35,7 +38,7 @@ public class DslModelineTest { @Test void testModelineSingleDependency() { - String line = "// camel-k: dependency=mvn:org.my:application:1.0"; + String line = "//DEPS mvn:org.my:application:1.0"; List<Response> response = parseAndGetDependencies(line); assertNotNull(response); assertEquals(1, response.size()); @@ -43,8 +46,8 @@ public class DslModelineTest { } @Test - void testModelineSingleDependencyCommentHash() { - String line = "### camel-k: dependency=mvn:org.my:application:1.0"; + void testModelineSingleDependenncyIgnoresPom() { + String line = "//DEPS mvn:org.my:application:1.0 mvn:foo:foo:1.0@pom"; List<Response> response = parseAndGetDependencies(line); assertNotNull(response); assertEquals(1, response.size()); @@ -52,108 +55,39 @@ public class DslModelineTest { } @Test - void testModelineMultiDependency() { - String line = "// camel-k: dependency=mvn:org.my:application:1.0 dependency=mvn:com.foo:myapp:2.1"; - + void testModelineSingleDependencyCommentHash() { + String line = "### //DEPS mvn:org.my:application:1.0"; List<Response> response = parseAndGetDependencies(line); assertNotNull(response); - assertEquals(2, response.size()); + assertEquals(1, response.size()); assertTrue(response.contains("mvn:org.my:application:1.0")); - assertTrue(response.contains("mvn:com.foo:myapp:2.1")); - - } - - @Test - void testModelineSingleProperty() throws Exception { - String line = "// camel-k: property=hi=Hello"; - clear(); - parseModeline(line); - - RestAssured - .get("/dsl-modeline/props/" + "hi") - .then() - .body(equalTo("Hello")); - } - - @Test - void testModelineMultiProperty() throws Exception { - String line = "// camel-k: property=hi=Hello property=bye=Farvel"; - parseModeline(line); - - RestAssured - .get("/dsl-modeline/props/" + "hi") - .then() - .body(equalTo("Hello")); - - RestAssured - .get("/dsl-modeline/props/" + "bye") - .then() - .body(equalTo("Farvel")); - - } - - @Test - void testModelineQuoteProperty() throws Exception { - String line = "// camel-k: property=hi='Hello World' property=bye='Farvel Verden'"; - parseModeline(line); - - RestAssured - .get("/dsl-modeline/props/" + "hi") - .then() - .body(equalTo("Hello World")); - - RestAssured - .get("/dsl-modeline/props/" + "bye") - .then() - .body(equalTo("Farvel Verden")); } @Test - void testModelineMixed() throws Exception { - String line = "// camel-k: dependency=mvn:org.my:application:1.0 property=hi=Hello dependency=mvn:com.foo:myapp:2.1"; - List<Response> response = parseAndGetDependencies(line); - assertNotNull(response); - assertEquals(2, response.size()); - assertTrue(response.contains("mvn:org.my:application:1.0")); - assertTrue(response.contains("mvn:com.foo:myapp:2.1")); - - RestAssured - .get("/dsl-modeline/props/" + "hi") - .then() - .body(equalTo("Hello")); - } + void testModelineMultiDependency() { + String line = "//DEPS mvn:org.my:application:1.0 mvn:com.foo:myapp:2.1"; - @Test - void testModelineMixedWithSpaces() throws Exception { - String line = "// camel-k: dependency=mvn:org.my:application:1.0 property=hi=Hello dependency=mvn:com.foo:myapp:2.1"; List<Response> response = parseAndGetDependencies(line); assertNotNull(response); assertEquals(2, response.size()); assertTrue(response.contains("mvn:org.my:application:1.0")); assertTrue(response.contains("mvn:com.foo:myapp:2.1")); - - RestAssured - .get("/dsl-modeline/props/" + "hi") - .then() - .body(equalTo("Hello")); - } @Test - void testModelinePropertiesFile() throws Exception { - String line = "// camel-k: property=classpath:myapp.properties"; - parseModeline(line); - - RestAssured - .get("/dsl-modeline/props/" + "hi") - .then() - .body(equalTo("Hej")); - - RestAssured - .get("/dsl-modeline/props/" + "foo") - .then() - .body(equalTo("bar")); - + void testModelineSingleDependencyIWithSystemProperty() { + String randomKey = UUID.randomUUID().toString() + ".version"; + Optional<String> systemValue = Optional.ofNullable(System.getProperty(randomKey)); + try { + System.setProperty(randomKey, "1.0"); + String line = "//DEPS mvn:org.my:application:${%s}".formatted(randomKey); + List<Response> response = parseAndGetDependencies(line); + assertNotNull(response); + assertEquals(1, response.size()); + assertTrue(response.contains("mvn:org.my:application:1.0")); + } finally { + systemValue.ifPresent(s -> System.setProperty(randomKey, s)); + } } private <T> List<T> parseAndGetDependencies(String line) {