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 2021/08/30 03:05:42 UTC

[GitHub] [camel-quarkus] VratislavHais opened a new pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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


   <!-- 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
   -->
   Resolves https://github.com/apache/camel-quarkus/issues/3028


-- 
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] aldettinger commented on a change in pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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



##########
File path: integration-tests/rest/src/test/java/org/apache/camel/quarkus/component/rest/it/RestTest.java
##########
@@ -25,9 +25,11 @@
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.matchesPattern;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 @QuarkusTest
 class RestTest {
+    private static final Person person = new Person("John", "Doe", 64);

Review comment:
       Is it a requirement to use the same object for json/xml consumer/producer binding ? Otherwise, I would use distinct objects, and maybe with different value.




-- 
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] VratislavHais commented on a change in pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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



##########
File path: integration-tests/rest/src/test/java/org/apache/camel/quarkus/component/rest/it/RestTest.java
##########
@@ -25,9 +25,11 @@
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.matchesPattern;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 @QuarkusTest
 class RestTest {
+    private static final Person person = new Person("John", "Doe", 64);

Review comment:
       it's definitely not a requirement. I just thought it would be a little better to create the object only once. I'll change it as you suggest. 




-- 
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 merged pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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


   


-- 
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 a change in pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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



##########
File path: integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestResource.java
##########
@@ -68,4 +68,26 @@ public String restProducer(@QueryParam("port") int port) {
         return producerTemplate.requestBodyAndHeaders(
                 "rest:get:/rest/template/{messageStart}/{messageEnd}?host=localhost:" + port, null, headers, String.class);
     }
+
+    @Path("/producer/binding/mode/json")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Person restProducerBindingModeJson(@QueryParam("port") int port) {
+        String query = "rest:get:/rest/binding/json/producer" +
+                "?bindingMode=json" +
+                "&outType=org.apache.camel.quarkus.component.rest.it.Person" +
+                "&host=localhost:" + port;

Review comment:
       Looking at this, I am am why we need a JAX-RS endpoint to test the rest component? This is perhaps a way to pass `bindingMode=json`, but it it can also be passed via REST DSL, which we already did before this PR, see https://github.com/apache/camel-quarkus/pull/3052/files#diff-58cbc36531a538cc13ef975a1889ac4ec3b28c54786b5896118916846558a592R64-R71 for JSON and https://github.com/apache/camel-quarkus/pull/3052/files#diff-58cbc36531a538cc13ef975a1889ac4ec3b28c54786b5896118916846558a592R78-R85 for XML. 
   Is this PR adding anything new the above two exist?




-- 
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] vkasala commented on pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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


   @ppalaga @jamesnetherton Can someone of you take a look?
   


-- 
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] VratislavHais commented on a change in pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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



##########
File path: integration-tests/rest/src/test/java/org/apache/camel/quarkus/component/rest/it/RestTest.java
##########
@@ -25,9 +25,11 @@
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.matchesPattern;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 @QuarkusTest
 class RestTest {
+    private static final Person person = new Person("John", "Doe", 64);

Review comment:
       it's definitely not a requirement. I just thought it would be a little better to create the object only once. I'll change it as you suggest. 

##########
File path: integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestResource.java
##########
@@ -68,4 +68,26 @@ public String restProducer(@QueryParam("port") int port) {
         return producerTemplate.requestBodyAndHeaders(
                 "rest:get:/rest/template/{messageStart}/{messageEnd}?host=localhost:" + port, null, headers, String.class);
     }
+
+    @Path("/producer/binding/mode/json")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Person restProducerBindingModeJson(@QueryParam("port") int port) {
+        String query = "rest:get:/rest/binding/json/producer" +
+                "?bindingMode=json" +
+                "&outType=org.apache.camel.quarkus.component.rest.it.Person" +
+                "&host=localhost:" + port;

Review comment:
       Hello @ppalaga,
   the above two test only Consumer while addition in this PR covers Producer. As you can see within this test coverage result https://fuse-next-jenkins-csb-fuse-qe.apps.ocp4.prod.psi.redhat.com/job/Integration.next/job/camel-quarkus/job/code-coverage/43/Camel_20JaCoCo_20report/org.apache.camel.component.rest/RestProducer.java.html#L272 
   method `createBindingProcessor()` is almost entirely untested. With those changes the coverage increase greatly. 




-- 
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 merged pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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


   


-- 
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 a change in pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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



##########
File path: integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestResource.java
##########
@@ -68,4 +68,26 @@ public String restProducer(@QueryParam("port") int port) {
         return producerTemplate.requestBodyAndHeaders(
                 "rest:get:/rest/template/{messageStart}/{messageEnd}?host=localhost:" + port, null, headers, String.class);
     }
+
+    @Path("/producer/binding/mode/json")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Person restProducerBindingModeJson(@QueryParam("port") int port) {
+        String query = "rest:get:/rest/binding/json/producer" +
+                "?bindingMode=json" +
+                "&outType=org.apache.camel.quarkus.component.rest.it.Person" +
+                "&host=localhost:" + port;

Review comment:
       Thanks for explaining, @vhais!




-- 
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 a change in pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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



##########
File path: integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestResource.java
##########
@@ -68,4 +68,26 @@ public String restProducer(@QueryParam("port") int port) {
         return producerTemplate.requestBodyAndHeaders(
                 "rest:get:/rest/template/{messageStart}/{messageEnd}?host=localhost:" + port, null, headers, String.class);
     }
+
+    @Path("/producer/binding/mode/json")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Person restProducerBindingModeJson(@QueryParam("port") int port) {
+        String query = "rest:get:/rest/binding/json/producer" +
+                "?bindingMode=json" +
+                "&outType=org.apache.camel.quarkus.component.rest.it.Person" +
+                "&host=localhost:" + port;

Review comment:
       Looking at this, I am wondering why we need a JAX-RS endpoint to test the rest component? This is perhaps a way to pass `bindingMode=json`, but it it can also be passed via REST DSL, which we already did before this PR, see https://github.com/apache/camel-quarkus/pull/3052/files#diff-58cbc36531a538cc13ef975a1889ac4ec3b28c54786b5896118916846558a592R64-R71 for JSON and https://github.com/apache/camel-quarkus/pull/3052/files#diff-58cbc36531a538cc13ef975a1889ac4ec3b28c54786b5896118916846558a592R78-R85 for XML. 
   Is this PR adding anything new the above two exist?




-- 
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 a change in pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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



##########
File path: integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestResource.java
##########
@@ -68,4 +68,26 @@ public String restProducer(@QueryParam("port") int port) {
         return producerTemplate.requestBodyAndHeaders(
                 "rest:get:/rest/template/{messageStart}/{messageEnd}?host=localhost:" + port, null, headers, String.class);
     }
+
+    @Path("/producer/binding/mode/json")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Person restProducerBindingModeJson(@QueryParam("port") int port) {
+        String query = "rest:get:/rest/binding/json/producer" +
+                "?bindingMode=json" +
+                "&outType=org.apache.camel.quarkus.component.rest.it.Person" +
+                "&host=localhost:" + port;

Review comment:
       Thanks for explaining, @vhais!




-- 
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 a change in pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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



##########
File path: integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestResource.java
##########
@@ -68,4 +68,26 @@ public String restProducer(@QueryParam("port") int port) {
         return producerTemplate.requestBodyAndHeaders(
                 "rest:get:/rest/template/{messageStart}/{messageEnd}?host=localhost:" + port, null, headers, String.class);
     }
+
+    @Path("/producer/binding/mode/json")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Person restProducerBindingModeJson(@QueryParam("port") int port) {
+        String query = "rest:get:/rest/binding/json/producer" +
+                "?bindingMode=json" +
+                "&outType=org.apache.camel.quarkus.component.rest.it.Person" +
+                "&host=localhost:" + port;

Review comment:
       Looking at this, I am wondering why we need a JAX-RS endpoint to test the rest component? This is perhaps a way to pass `bindingMode=json`, but it it can also be passed via REST DSL, which we already did before this PR, see https://github.com/apache/camel-quarkus/pull/3052/files#diff-58cbc36531a538cc13ef975a1889ac4ec3b28c54786b5896118916846558a592R64-R71 for JSON and https://github.com/apache/camel-quarkus/pull/3052/files#diff-58cbc36531a538cc13ef975a1889ac4ec3b28c54786b5896118916846558a592R78-R85 for XML. 
   Is this PR adding anything new given the above two exist?




-- 
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] VratislavHais commented on a change in pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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



##########
File path: integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestResource.java
##########
@@ -68,4 +68,26 @@ public String restProducer(@QueryParam("port") int port) {
         return producerTemplate.requestBodyAndHeaders(
                 "rest:get:/rest/template/{messageStart}/{messageEnd}?host=localhost:" + port, null, headers, String.class);
     }
+
+    @Path("/producer/binding/mode/json")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Person restProducerBindingModeJson(@QueryParam("port") int port) {
+        String query = "rest:get:/rest/binding/json/producer" +
+                "?bindingMode=json" +
+                "&outType=org.apache.camel.quarkus.component.rest.it.Person" +
+                "&host=localhost:" + port;

Review comment:
       Hello @ppalaga,
   the above two test only Consumer while addition in this PR covers Producer. As you can see within this test coverage result https://fuse-next-jenkins-csb-fuse-qe.apps.ocp4.prod.psi.redhat.com/job/Integration.next/job/camel-quarkus/job/code-coverage/43/Camel_20JaCoCo_20report/org.apache.camel.component.rest/RestProducer.java.html#L272 
   method `createBindingProcessor()` is almost entirely untested. With those changes the coverage increase greatly. 




-- 
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] VratislavHais commented on a change in pull request #3052: [#3028] Increase test coverage of a binding mode of camel-rest component

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



##########
File path: integration-tests/rest/src/test/java/org/apache/camel/quarkus/component/rest/it/RestTest.java
##########
@@ -25,9 +25,11 @@
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.matchesPattern;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 @QuarkusTest
 class RestTest {
+    private static final Person person = new Person("John", "Doe", 64);

Review comment:
       it's definitely not a requirement. I just thought it would be a little better to create the object only once. I'll change it as you suggest. 

##########
File path: integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestResource.java
##########
@@ -68,4 +68,26 @@ public String restProducer(@QueryParam("port") int port) {
         return producerTemplate.requestBodyAndHeaders(
                 "rest:get:/rest/template/{messageStart}/{messageEnd}?host=localhost:" + port, null, headers, String.class);
     }
+
+    @Path("/producer/binding/mode/json")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Person restProducerBindingModeJson(@QueryParam("port") int port) {
+        String query = "rest:get:/rest/binding/json/producer" +
+                "?bindingMode=json" +
+                "&outType=org.apache.camel.quarkus.component.rest.it.Person" +
+                "&host=localhost:" + port;

Review comment:
       Hello @ppalaga,
   the above two test only Consumer while addition in this PR covers Producer. As you can see within this test coverage result https://fuse-next-jenkins-csb-fuse-qe.apps.ocp4.prod.psi.redhat.com/job/Integration.next/job/camel-quarkus/job/code-coverage/43/Camel_20JaCoCo_20report/org.apache.camel.component.rest/RestProducer.java.html#L272 
   method `createBindingProcessor()` is almost entirely untested. With those changes the coverage increase greatly. 




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