You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/09/24 12:08:31 UTC

[GitHub] [camel-quarkus] JiriOndrusek opened a new pull request #1828: String template native support #1694

JiriOndrusek opened a new pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828


   Issue: https://github.com/apache/camel-quarkus/issues/1694
   
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494854498



##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       We should agree on whether [this](https://github.com/apache/camel-quarkus/blob/bd845d3959984d575441d3e79cd9a58095b6aa34/extensions/stringtemplate/runtime/src/main/java/org/apache/camel/quarkus/component/stringtemplate/StringtemplateEndpointSubstitute.java) is the right thing to do.
   
   Originally, I saw the 'fix' to #1807 as purely a documentation exercise. Where we just state for each affected extension that `contextMapAll` will not work in native mode.
   
   Potentially forcing `contextMapAll` to `false` is a bit confusing because you would run into problems at runtime. Where as without it, the native build would fail, so it's sort like a 'fail fast'.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494309768



##########
File path: extensions/stringtemplate/deployment/src/main/java/org/apache/camel/quarkus/component/stringtemplate/deployment/StringtemplateProcessor.java
##########
@@ -17,30 +17,23 @@
 package org.apache.camel.quarkus.component.stringtemplate.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 org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.DefaultExchange;
 
 class StringtemplateProcessor {
 
-    private static final Logger LOG = Logger.getLogger(StringtemplateProcessor.class);
     private static final String FEATURE = "camel-stringtemplate";
 
     @BuildStep
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflectionWithMethods() {
+        return new ReflectiveClassBuildItem(true, false,
+                //required for values in properties
+                DefaultExchange.class.getName());

Review comment:
       Fine with me :+1: 




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494268390



##########
File path: extensions/stringtemplate/deployment/src/main/java/org/apache/camel/quarkus/component/stringtemplate/deployment/StringtemplateProcessor.java
##########
@@ -17,30 +17,23 @@
 package org.apache.camel.quarkus.component.stringtemplate.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 org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.DefaultExchange;
 
 class StringtemplateProcessor {
 
-    private static final Logger LOG = Logger.getLogger(StringtemplateProcessor.class);
     private static final String FEATURE = "camel-stringtemplate";
 
     @BuildStep
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflectionWithMethods() {
+        return new ReflectiveClassBuildItem(true, false,
+                //required for values in properties
+                DefaultExchange.class.getName());

Review comment:
       Maybe we should not do this. See my comments in https://github.com/apache/camel-quarkus/issues/1807.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494298738



##########
File path: extensions/stringtemplate/deployment/src/main/java/org/apache/camel/quarkus/component/stringtemplate/deployment/StringtemplateProcessor.java
##########
@@ -17,30 +17,23 @@
 package org.apache.camel.quarkus.component.stringtemplate.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 org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.DefaultExchange;
 
 class StringtemplateProcessor {
 
-    private static final Logger LOG = Logger.getLogger(StringtemplateProcessor.class);
     private static final String FEATURE = "camel-stringtemplate";
 
     @BuildStep
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflectionWithMethods() {
+        return new ReflectiveClassBuildItem(true, false,
+                //required for values in properties
+                DefaultExchange.class.getName());

Review comment:
       If it may be security vulnerability, I'll remove corresponding test, I'll remove this build item and add into limitations, that this feature is not supported in native mode. @jamesnetherton Do you agree?

##########
File path: extensions/stringtemplate/deployment/src/main/java/org/apache/camel/quarkus/component/stringtemplate/deployment/StringtemplateProcessor.java
##########
@@ -17,30 +17,23 @@
 package org.apache.camel.quarkus.component.stringtemplate.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 org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.DefaultExchange;
 
 class StringtemplateProcessor {
 
-    private static final Logger LOG = Logger.getLogger(StringtemplateProcessor.class);
     private static final String FEATURE = "camel-stringtemplate";
 
     @BuildStep
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflectionWithMethods() {
+        return new ReflectiveClassBuildItem(true, false,
+                //required for values in properties
+                DefaultExchange.class.getName());

Review comment:
       I've fixed it as I suggested. (also discovered a bug in camel component - https://issues.apache.org/jira/browse/CAMEL-15577)
   
   

##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       I've added test for native to verify that parameter `allowContextMapAll` is disabled. 
   But because there are usually no special tests for native mode, I'd like to ask. @jamesnetherton , @ppalaga   Should I keep it or remove it?

##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       So, removing substitution (which forcescontextMapAll = true), rewriting limitations (that exchange.properties won't work) and removing test, should be the correct solution, yes?
   

##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       I think about documentation like this one:
   > If property `allowContextMapAll` is set to `true` there is a limitation in native mode. Reflective calls to methods
   of several classes in camel are not allowed (for example `org.apache.camel.support.DefaultExchange`). Therefore 
   some expression won't work (for example `<exchange.properties.*>).
   >
   >You can allow reflective calls to such classes (for example by application.properties), but keep in mind that it brings 
   some security risks.
   
   WDYT? @ppalaga , @jamesnetherton 

##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       done




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#issuecomment-698811631






----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494854498



##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       We should agree on whether [this](https://github.com/apache/camel-quarkus/blob/bd845d3959984d575441d3e79cd9a58095b6aa34/extensions/stringtemplate/runtime/src/main/java/org/apache/camel/quarkus/component/stringtemplate/StringtemplateEndpointSubstitute.java) is the right thing to do.
   
   Originally, I saw the 'fix' to #1807 as purely a documentation exercise. Where we just state for each affected extension that `contextMapAll` = `true` will not work in native mode.
   
   Potentially forcing `contextMapAll` to `false` is a bit confusing because you would run into problems at runtime. Where as without it, the native build would fail, so it's sort like a 'fail fast'.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton merged pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
jamesnetherton merged pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828


   


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#issuecomment-698914600


   Ups, conflicts again. Sorry. Could you please rebase?


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494848565



##########
File path: extensions/stringtemplate/deployment/src/main/java/org/apache/camel/quarkus/component/stringtemplate/deployment/StringtemplateProcessor.java
##########
@@ -17,30 +17,23 @@
 package org.apache.camel.quarkus.component.stringtemplate.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 org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.DefaultExchange;
 
 class StringtemplateProcessor {
 
-    private static final Logger LOG = Logger.getLogger(StringtemplateProcessor.class);
     private static final String FEATURE = "camel-stringtemplate";
 
     @BuildStep
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflectionWithMethods() {
+        return new ReflectiveClassBuildItem(true, false,
+                //required for values in properties
+                DefaultExchange.class.getName());

Review comment:
       > Maybe we should not do this. See my comments in #1807.
   
   I thought the same when I saw it, but I was not able to find the place where Claus mentioned that allowContextMapAll is a security vulnerabilty fix. Thanks for mentioning #1807 @jamesnetherton !




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494298738



##########
File path: extensions/stringtemplate/deployment/src/main/java/org/apache/camel/quarkus/component/stringtemplate/deployment/StringtemplateProcessor.java
##########
@@ -17,30 +17,23 @@
 package org.apache.camel.quarkus.component.stringtemplate.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 org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.DefaultExchange;
 
 class StringtemplateProcessor {
 
-    private static final Logger LOG = Logger.getLogger(StringtemplateProcessor.class);
     private static final String FEATURE = "camel-stringtemplate";
 
     @BuildStep
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflectionWithMethods() {
+        return new ReflectiveClassBuildItem(true, false,
+                //required for values in properties
+                DefaultExchange.class.getName());

Review comment:
       If it may be security vulnerability, I'll remove corresponding test, I'll remove this build item and add into limitations, that this feature is not supported in native mode. @jamesnetherton Do you agree?




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494863900



##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       I think about documentation like this one:
   > If property `allowContextMapAll` is set to `true` there is a limitation in native mode. Reflective calls to methods
   of several classes in camel are not allowed (for example `org.apache.camel.support.DefaultExchange`). Therefore 
   some expression won't work (for example `<exchange.properties.*>).
   >
   >You can allow reflective calls to such classes (for example by application.properties), but keep in mind that it brings 
   some security risks.
   
   WDYT? @ppalaga , @jamesnetherton 




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494893457



##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       done




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494875927



##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       +1 for removing the substitution and letting the native compilation fail




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494860949



##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       IMO, yes. @ppalaga WDYT?




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494847179



##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       No problem with having a special test for native. We definitely had such in the past, not sure we still have them elsewhere.

##########
File path: extensions/stringtemplate/deployment/src/main/java/org/apache/camel/quarkus/component/stringtemplate/deployment/StringtemplateProcessor.java
##########
@@ -17,30 +17,23 @@
 package org.apache.camel.quarkus.component.stringtemplate.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 org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.DefaultExchange;
 
 class StringtemplateProcessor {
 
-    private static final Logger LOG = Logger.getLogger(StringtemplateProcessor.class);
     private static final String FEATURE = "camel-stringtemplate";
 
     @BuildStep
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflectionWithMethods() {
+        return new ReflectiveClassBuildItem(true, false,
+                //required for values in properties
+                DefaultExchange.class.getName());

Review comment:
       > Maybe we should not do this. See my comments in #1807.
   
   I thought the same when I saw it, but I was not able to find the place where Claus mentioned that allowContextMapAll is a security vulnerabilty fix. Thanks for mentioning #1807 @jamesnetherton !

##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       +1 for removing the substitution and letting the native compilation fail




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#issuecomment-698914293


   I have restarted the CI


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#issuecomment-698811631


   There are conflicts. Could you please rebase?


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494268390



##########
File path: extensions/stringtemplate/deployment/src/main/java/org/apache/camel/quarkus/component/stringtemplate/deployment/StringtemplateProcessor.java
##########
@@ -17,30 +17,23 @@
 package org.apache.camel.quarkus.component.stringtemplate.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 org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.DefaultExchange;
 
 class StringtemplateProcessor {
 
-    private static final Logger LOG = Logger.getLogger(StringtemplateProcessor.class);
     private static final String FEATURE = "camel-stringtemplate";
 
     @BuildStep
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflectionWithMethods() {
+        return new ReflectiveClassBuildItem(true, false,
+                //required for values in properties
+                DefaultExchange.class.getName());

Review comment:
       Maybe we should not do this. See my comments in https://github.com/apache/camel-quarkus/issues/1807.

##########
File path: extensions/stringtemplate/deployment/src/main/java/org/apache/camel/quarkus/component/stringtemplate/deployment/StringtemplateProcessor.java
##########
@@ -17,30 +17,23 @@
 package org.apache.camel.quarkus.component.stringtemplate.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 org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.DefaultExchange;
 
 class StringtemplateProcessor {
 
-    private static final Logger LOG = Logger.getLogger(StringtemplateProcessor.class);
     private static final String FEATURE = "camel-stringtemplate";
 
     @BuildStep
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflectionWithMethods() {
+        return new ReflectiveClassBuildItem(true, false,
+                //required for values in properties
+                DefaultExchange.class.getName());

Review comment:
       Fine with me :+1: 

##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       We should agree on whether [this](https://github.com/apache/camel-quarkus/blob/bd845d3959984d575441d3e79cd9a58095b6aa34/extensions/stringtemplate/runtime/src/main/java/org/apache/camel/quarkus/component/stringtemplate/StringtemplateEndpointSubstitute.java) is the right thing to do.
   
   Originally, I saw the 'fix' to #1807 as purely a documentation exercise. Where we just state for each affected extension that `contextMapAll` will not work in native mode.
   
   Potentially forcing `contextMapAll` to `false` is a bit confusing because you would run into problems at runtime. Where as without it, the native build would fail, so it's sort like a 'fail fast'.

##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       We should agree on whether [this](https://github.com/apache/camel-quarkus/blob/bd845d3959984d575441d3e79cd9a58095b6aa34/extensions/stringtemplate/runtime/src/main/java/org/apache/camel/quarkus/component/stringtemplate/StringtemplateEndpointSubstitute.java) is the right thing to do.
   
   Originally, I saw the 'fix' to #1807 as purely a documentation exercise. Where we just state for each affected extension that `contextMapAll` = `true` will not work in native mode.
   
   Potentially forcing `contextMapAll` to `false` is a bit confusing because you would run into problems at runtime. Where as without it, the native build would fail, so it's sort like a 'fail fast'.

##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       IMO, yes. @ppalaga WDYT?

##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       Sounds ok to me. Maybe tweak `some expression` to `some expressions`.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494844421



##########
File path: extensions/stringtemplate/deployment/src/main/java/org/apache/camel/quarkus/component/stringtemplate/deployment/StringtemplateProcessor.java
##########
@@ -17,30 +17,23 @@
 package org.apache.camel.quarkus.component.stringtemplate.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 org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.DefaultExchange;
 
 class StringtemplateProcessor {
 
-    private static final Logger LOG = Logger.getLogger(StringtemplateProcessor.class);
     private static final String FEATURE = "camel-stringtemplate";
 
     @BuildStep
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflectionWithMethods() {
+        return new ReflectiveClassBuildItem(true, false,
+                //required for values in properties
+                DefaultExchange.class.getName());

Review comment:
       I've fixed it as I suggested. (also discovered a bug in camel component - https://issues.apache.org/jira/browse/CAMEL-15577)
   
   




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494847179



##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       No problem with having a special test for native. We definitely had such in the past, not sure we still have them elsewhere.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#issuecomment-699102744


   Something went wrong with the rebase: https://github.com/apache/camel-quarkus/pull/1828/checks?check_run_id=1166121710#step:9:16


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494878130



##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       Sounds ok to me. Maybe tweak `some expression` to `some expressions`.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #1828: String template native support #1694

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on a change in pull request #1828:
URL: https://github.com/apache/camel-quarkus/pull/1828#discussion_r494844792



##########
File path: integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateIT.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.stringtemplate.it;
+
+import java.util.Collections;
+
+import io.quarkus.test.junit.NativeImageTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+
+@NativeImageTest
+class StringtemplateIT extends StringtemplateTest {
+
+    @Test
+    public void testDisabledContextMapAll() {
+        //allowContextMapAll has to be disabled in native mode
+        RestAssured.given()

Review comment:
       I've added test for native to verify that parameter `allowContextMapAll` is disabled. 
   But because there are usually no special tests for native mode, I'd like to ask. @jamesnetherton , @ppalaga   Should I keep it or remove it?




----------------------------------------------------------------
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.

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