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/10/19 15:24:30 UTC

[GitHub] [camel-quarkus] jamesnetherton opened a new pull request #1932: Increase test coverage for Spring dependent extensions

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


   Prelude to fixing https://github.com/apache/camel-quarkus/issues/1759.


----------------------------------------------------------------
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 #1932: Increase test coverage for Spring dependent extensions

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



##########
File path: integration-tests/jpa/src/main/java/org/apache/camel/quarkus/component/jpa/it/JpaResource.java
##########
@@ -49,6 +56,51 @@
         return consumerTemplate.receiveBodyNoWait("jpa:" + Fruit.class.getName(), List.class);
     }
 
+    @Path("/get/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Fruit getFruit(@PathParam("id") int id) {
+        return producerTemplate.requestBody("jpa:" + Fruit.class.getName() + "?findEntity=true", id, Fruit.class);
+    }
+
+    @Path("/get/query/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @SuppressWarnings("unchecked")
+    public List<Fruit> getFruitByQuery(@PathParam("id") int id) {
+        return producerTemplate.requestBody("jpa:" + Fruit.class.getName() + "?query="
+                + "select f from " + Fruit.class.getName() + " f where f.id = " + id,
+                null, List.class);
+    }
+
+    @Path("/get/query/named/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @SuppressWarnings("unchecked")
+    public List<Fruit> getFruitByNamedQuery(@PathParam("id") int id) {
+        Map<String, Object> queryParams = new HashMap<>();
+        queryParams.put("fruitId", id);
+        context.getRegistry().bind("parameters", queryParams);

Review comment:
       Shouldn't we add a comment here that this is not a good pattern to copy in a real application?




----------------------------------------------------------------
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 #1932: Increase test coverage for Spring dependent extensions

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


   


----------------------------------------------------------------
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 #1932: Increase test coverage for Spring dependent extensions

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



##########
File path: integration-tests/jpa/src/main/java/org/apache/camel/quarkus/component/jpa/it/JpaResource.java
##########
@@ -49,6 +56,51 @@
         return consumerTemplate.receiveBodyNoWait("jpa:" + Fruit.class.getName(), List.class);
     }
 
+    @Path("/get/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Fruit getFruit(@PathParam("id") int id) {
+        return producerTemplate.requestBody("jpa:" + Fruit.class.getName() + "?findEntity=true", id, Fruit.class);
+    }
+
+    @Path("/get/query/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @SuppressWarnings("unchecked")
+    public List<Fruit> getFruitByQuery(@PathParam("id") int id) {
+        return producerTemplate.requestBody("jpa:" + Fruit.class.getName() + "?query="
+                + "select f from " + Fruit.class.getName() + " f where f.id = " + id,
+                null, List.class);
+    }
+
+    @Path("/get/query/named/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @SuppressWarnings("unchecked")
+    public List<Fruit> getFruitByNamedQuery(@PathParam("id") int id) {
+        Map<String, Object> queryParams = new HashMap<>();
+        queryParams.put("fruitId", id);
+        context.getRegistry().bind("parameters", queryParams);

Review comment:
       I can rework it so that it gets bound to the registry via a producer method, which is a bit more 'real world'.




----------------------------------------------------------------
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 #1932: Increase test coverage for Spring dependent extensions

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



##########
File path: integration-tests/jpa/src/main/java/org/apache/camel/quarkus/component/jpa/it/JpaResource.java
##########
@@ -49,6 +56,51 @@
         return consumerTemplate.receiveBodyNoWait("jpa:" + Fruit.class.getName(), List.class);
     }
 
+    @Path("/get/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Fruit getFruit(@PathParam("id") int id) {
+        return producerTemplate.requestBody("jpa:" + Fruit.class.getName() + "?findEntity=true", id, Fruit.class);
+    }
+
+    @Path("/get/query/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @SuppressWarnings("unchecked")
+    public List<Fruit> getFruitByQuery(@PathParam("id") int id) {
+        return producerTemplate.requestBody("jpa:" + Fruit.class.getName() + "?query="
+                + "select f from " + Fruit.class.getName() + " f where f.id = " + id,
+                null, List.class);
+    }
+
+    @Path("/get/query/named/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @SuppressWarnings("unchecked")
+    public List<Fruit> getFruitByNamedQuery(@PathParam("id") int id) {
+        Map<String, Object> queryParams = new HashMap<>();
+        queryParams.put("fruitId", id);
+        context.getRegistry().bind("parameters", queryParams);

Review comment:
       I can rework it so that it gets bound to the registry via a producer method, which is a bit more 'real world'.
   
   I can do that when I follow up later with a fix for #1759.




----------------------------------------------------------------
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 #1932: Increase test coverage for Spring dependent extensions

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



##########
File path: integration-tests/jpa/src/main/java/org/apache/camel/quarkus/component/jpa/it/JpaResource.java
##########
@@ -49,6 +56,51 @@
         return consumerTemplate.receiveBodyNoWait("jpa:" + Fruit.class.getName(), List.class);
     }
 
+    @Path("/get/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Fruit getFruit(@PathParam("id") int id) {
+        return producerTemplate.requestBody("jpa:" + Fruit.class.getName() + "?findEntity=true", id, Fruit.class);
+    }
+
+    @Path("/get/query/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @SuppressWarnings("unchecked")
+    public List<Fruit> getFruitByQuery(@PathParam("id") int id) {
+        return producerTemplate.requestBody("jpa:" + Fruit.class.getName() + "?query="
+                + "select f from " + Fruit.class.getName() + " f where f.id = " + id,
+                null, List.class);
+    }
+
+    @Path("/get/query/named/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @SuppressWarnings("unchecked")
+    public List<Fruit> getFruitByNamedQuery(@PathParam("id") int id) {
+        Map<String, Object> queryParams = new HashMap<>();
+        queryParams.put("fruitId", id);
+        context.getRegistry().bind("parameters", queryParams);

Review comment:
       No, this OK for a test, esp. if we do it only once. I just wanted that ppl. see that this not good for areal app.




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