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 2022/09/15 12:39:01 UTC

[GitHub] [camel-quarkus] JiriOndrusek opened a new pull request, #4099: Deprecated parameters in several annotations are ignored - inconsisten

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

   fixes https://github.com/apache/camel-quarkus/issues/4097
   
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] 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.

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

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


[GitHub] [camel-quarkus] llowinge commented on pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

Posted by GitBox <gi...@apache.org>.
llowinge commented on PR #4099:
URL: https://github.com/apache/camel-quarkus/pull/4099#issuecomment-1251000316

   @ppalaga Problem is as follows. Using
   
   ```
   @EndpointInject(id = "mock:result")
       protected MockEndpoint resultEndpoint;
   
       @Produce(id = "direct:start")
       protected ProducerTemplate template;
    ``` fails with `java.lang.IllegalArgumentException: uri must be specified and not empty.`. I'm not sure if it is bug in Camel or CQ. But even using deprecated stuff shouldn't break it IMO. I think if some feature is deprecated + it doesn't work, it should be removed.


-- 
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-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #4099:
URL: https://github.com/apache/camel-quarkus/pull/4099#issuecomment-1257861608

   I agree with that approach and will change the PR accordingly. 
   
   @llowinge 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.

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

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


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #4099:
URL: https://github.com/apache/camel-quarkus/pull/4099#issuecomment-1257920194

   PR is changed to throw an IllegalArgumentException with appropriate message + tests covering these use cases are added as well.


-- 
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-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #4099:
URL: https://github.com/apache/camel-quarkus/pull/4099#issuecomment-1251000555

   From my PoV support of deprecated parameters is not worth of a fix - I agree. But the stat of the code is, that user may use `@Consume` with deprecated parameter, but if `@Produce` or `@EndpountInject` is used with deprecated parameter, execution fails. The doc from the only says, that the same approach as in plain Camel can used -but plain Caml allows deprecated parameters.


-- 
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-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #4099:
URL: https://github.com/apache/camel-quarkus/pull/4099#issuecomment-1269746580

   Hi @ppalaga, @jamesnetherton 
   I think that this PR could be approved/merged. 
   Current change 
   - throws an exception with explanation, that deprecated annotation parameters does not work. 
   - makes he behavior consistent (by throwing exception for `@Consume` annotation)
   - test covering this
   
   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.

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

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


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #4099:
URL: https://github.com/apache/camel-quarkus/pull/4099#issuecomment-1269825455

   @jamesnetherton Would it be possible to merge this fix also to `2.13.x`. To make sure it makes into any patch which may be released?


-- 
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-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] jamesnetherton merged pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

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


-- 
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-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #4099:
URL: https://github.com/apache/camel-quarkus/pull/4099#discussion_r988895549


##########
extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/deployment/main/CamelMainDeprecatedConsumeTest.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.core.deployment.main;
+
+import io.quarkus.test.QuarkusUnitTest;
+import org.apache.camel.Consume;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+public class CamelMainDeprecatedConsumeTest {
+    @RegisterExtension
+    static final QuarkusUnitTest CONFIG = new QuarkusUnitTest().setExpectedException(IllegalArgumentException.class)
+            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));
+
+    @Consume(uri = "direct:consumeAnnotation")
+    public String consumeAnnotation(String name) {
+        return "Consumed " + name;
+    }
+
+    @Test
+    public void camelMainEventBridgeNotConfigured() {

Review Comment:
   fixed.



##########
extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/deployment/main/CamelMainDeprecatedProduceTest.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.core.deployment.main;
+
+import io.quarkus.test.QuarkusUnitTest;
+import org.apache.camel.FluentProducerTemplate;
+import org.apache.camel.Produce;
+import org.apache.camel.builder.RouteBuilder;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+public class CamelMainDeprecatedProduceTest {
+    @RegisterExtension
+    static final QuarkusUnitTest CONFIG = new QuarkusUnitTest().setExpectedException(IllegalArgumentException.class)
+            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));
+
+    @Produce(uri = "direct:start")
+    FluentProducerTemplate produceProducerFluent;
+
+    @Test
+    public void camelMainEventBridgeNotConfigured() {

Review Comment:
   fixed



-- 
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-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #4099:
URL: https://github.com/apache/camel-quarkus/pull/4099#discussion_r988895774


##########
extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/deployment/main/CamelMainDeprecatedEndpointInjectTest.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.core.deployment.main;
+
+import io.quarkus.test.QuarkusUnitTest;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.direct.DirectEndpoint;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+public class CamelMainDeprecatedEndpointInjectTest {
+    @RegisterExtension
+    static final QuarkusUnitTest CONFIG = new QuarkusUnitTest().setExpectedException(IllegalArgumentException.class)
+            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));
+
+    @EndpointInject(uri = "direct:start")
+    DirectEndpoint start;
+
+    @Test
+    public void camelMainEventBridgeNotConfigured() {

Review Comment:
   fixed



-- 
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-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] llowinge commented on pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

Posted by GitBox <gi...@apache.org>.
llowinge commented on PR #4099:
URL: https://github.com/apache/camel-quarkus/pull/4099#issuecomment-1257864456

   @JiriOndrusek I agree with @ppalaga.


-- 
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-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] ppalaga commented on pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

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

   I am perhaps missing something, but why should we add support for deprecated stuff?
   The supported cases are documented in https://camel.apache.org/camel-quarkus/2.12.x/user-guide/cdi.html#_endpointinject_and_produce 


-- 
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-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] ppalaga commented on pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

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

   > fails with java.lang.IllegalArgumentException: uri must be specified and not empty.. I'm not sure if it is bug in Camel or CQ. But even using deprecated stuff shouldn't break it IMO. I think if some feature is deprecated + it doesn't work, it should be removed.
   
   The evaluation of the annotation params happens (or is missing in) in Camel Quarkus. I'd vote for throwing a better error message (something like `@org.apache.camel.EndpointInject(uri = "my-component:...") is not supported on Camel Quarkus. Please replace it with just @org.apache.camel.EndpointInject("my-component:...")`. We could output a similar warning for `@Consume`. 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.

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

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


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #4099: Deprecated parameters in several annotations are ignored - inconsisten

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on code in PR #4099:
URL: https://github.com/apache/camel-quarkus/pull/4099#discussion_r988875250


##########
extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/deployment/main/CamelMainDeprecatedEndpointInjectTest.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.core.deployment.main;
+
+import io.quarkus.test.QuarkusUnitTest;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.direct.DirectEndpoint;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+public class CamelMainDeprecatedEndpointInjectTest {
+    @RegisterExtension
+    static final QuarkusUnitTest CONFIG = new QuarkusUnitTest().setExpectedException(IllegalArgumentException.class)
+            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));
+
+    @EndpointInject(uri = "direct:start")
+    DirectEndpoint start;
+
+    @Test
+    public void camelMainEventBridgeNotConfigured() {

Review Comment:
   See my previous comment about the empty test method.



##########
extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/deployment/main/CamelMainDeprecatedProduceTest.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.core.deployment.main;
+
+import io.quarkus.test.QuarkusUnitTest;
+import org.apache.camel.FluentProducerTemplate;
+import org.apache.camel.Produce;
+import org.apache.camel.builder.RouteBuilder;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+public class CamelMainDeprecatedProduceTest {
+    @RegisterExtension
+    static final QuarkusUnitTest CONFIG = new QuarkusUnitTest().setExpectedException(IllegalArgumentException.class)
+            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));
+
+    @Produce(uri = "direct:start")
+    FluentProducerTemplate produceProducerFluent;
+
+    @Test
+    public void camelMainEventBridgeNotConfigured() {

Review Comment:
   See my previous comment about the empty test method.



##########
extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/deployment/main/CamelMainDeprecatedConsumeTest.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.core.deployment.main;
+
+import io.quarkus.test.QuarkusUnitTest;
+import org.apache.camel.Consume;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+public class CamelMainDeprecatedConsumeTest {
+    @RegisterExtension
+    static final QuarkusUnitTest CONFIG = new QuarkusUnitTest().setExpectedException(IllegalArgumentException.class)
+            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));
+
+    @Consume(uri = "direct:consumeAnnotation")
+    public String consumeAnnotation(String name) {
+        return "Consumed " + name;
+    }
+
+    @Test
+    public void camelMainEventBridgeNotConfigured() {

Review Comment:
   If the empty test is required to make the tests run, please can we name it something relevant to the thing under test. E.g:
   
   ```
       @Test
       public void consumeAnnotationWithDeprecatedParamsThrowsIllegalArgumentException() {
           // Noop - we expect IllegalArgumentException to be thrown on application startup
       }
   ```



-- 
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-unsubscribe@camel.apache.org

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