jamesnetherton commented on code in PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#discussion_r913455540


##########
extensions/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.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.NativeBuild;
+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";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep(onlyIf = NativeBuild.class)
+    void nativeUnsupported() {
+        throw new RuntimeException("The " + FEATURE + " extension is not 
supported in native mode "
+                + "as loading DSL modeline code at runtime is not supported on 
GraalVM");
+    }
+
+    @Record(value = ExecutionTime.RUNTIME_INIT)
+    @BuildStep
+    void addPropertyTrait(CamelContextBuildItem camelContextBuildItem, 
PropertyTraitRecorder propertyTraitRecorder) {
+        RuntimeValue<CamelContext> context = 
camelContextBuildItem.getCamelContext();
+        propertyTraitRecorder.addPropertyTrait(context);

Review Comment:
   We don't have to do this now, but we can probably optimize this to be 
`STATIC_INIT`. E.g create the `PropertiesComponent` at build time, configure 
any additional stuff like traits and then pass it to the `CamelContext` we 
create.



##########
integration-tests/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.it;
+
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+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;
+
+@QuarkusTest
+public class DslModelineTest {
+
+    @Test
+    void testModelineSingleDependency() {
+        String line = "// camel-k: dependency=mvn:org.my:application:1.0";

Review Comment:
   We test that the parsing of the modeline bits work correctly, which is great.
   
   But, does stuff like declaring additional dependencies actually work in a 
real Camel Quarkus app?



##########
extensions/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.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.NativeBuild;
+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";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep(onlyIf = NativeBuild.class)
+    void nativeUnsupported() {

Review Comment:
   PR comment states that native support was added but this suggests that there 
is no native support?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to