You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/12/14 17:50:44 UTC

[camel] branch main updated (b7f45b1fd60 -> c7902015232)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from b7f45b1fd60 Regen for commit b759c75b8cb4edbb289bf3ef9d70fe2fc6fd8e53
     new 913c1cd5898 CAMEL-18739: camel-core - AggregationStrategy onCompletion to have access to input exchange.
     new 25c6941b8f1 CAMEL-18812 Fix REST DSL configuration placeholder for id
     new c7902015232 CAMEL-18739: camel-core - AggregationStrategy onCompletion to have access to input exchange.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/java/org/apache/camel/AggregationStrategy.java | 13 +++++++++++++
 .../java/org/apache/camel/processor/MulticastProcessor.java |  2 +-
 .../aggregate/ShareUnitOfWorkAggregationStrategy.java       |  5 +++++
 .../camel/component/rest/FromRestExplicitComponentTest.java |  6 +++++-
 .../org/apache/camel/component/rest/FromRestGetTest.java    |  7 +++++--
 .../camel/component/rest/FromRestIdAndDescriptionTest.java  |  5 ++++-
 .../apache/camel/component/rest/FromRestRouteIdTest.java    |  3 ++-
 7 files changed, 35 insertions(+), 6 deletions(-)


[camel] 03/03: CAMEL-18739: camel-core - AggregationStrategy onCompletion to have access to input exchange.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c7902015232e2af9a5f7e3d432944c6556179626
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 14 18:44:03 2022 +0100

    CAMEL-18739: camel-core - AggregationStrategy onCompletion to have access to input exchange.
---
 .../src/main/java/org/apache/camel/AggregationStrategy.java         | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/AggregationStrategy.java b/core/camel-api/src/main/java/org/apache/camel/AggregationStrategy.java
index 22a4cea8479..7d062c1dd20 100644
--- a/core/camel-api/src/main/java/org/apache/camel/AggregationStrategy.java
+++ b/core/camel-api/src/main/java/org/apache/camel/AggregationStrategy.java
@@ -125,9 +125,9 @@ public interface AggregationStrategy {
      *
      * <b>Important: </b> This method must <b>not</b> throw any exceptions.
      *
-     * @param exchange the current aggregated exchange, or the original {@link org.apache.camel.Exchange} if no
-     *                 aggregation has been done before the completion occurred
-     * @param  inputExchange the input exchange (input to the EIP)
+     * @param exchange      the current aggregated exchange, or the original {@link org.apache.camel.Exchange} if no
+     *                      aggregation has been done before the completion occurred
+     * @param inputExchange the input exchange (input to the EIP)
      */
     default void onCompletion(Exchange exchange, Exchange inputExchange) {
         onCompletion(exchange);


[camel] 02/03: CAMEL-18812 Fix REST DSL configuration placeholder for id

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 25c6941b8f133fd3f1dce785f783266406a11bc5
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 14 18:42:28 2022 +0100

    CAMEL-18812 Fix REST DSL configuration placeholder for id
---
 .../apache/camel/component/rest/FromRestExplicitComponentTest.java | 6 +++++-
 .../test/java/org/apache/camel/component/rest/FromRestGetTest.java | 7 +++++--
 .../apache/camel/component/rest/FromRestIdAndDescriptionTest.java  | 5 ++++-
 .../java/org/apache/camel/component/rest/FromRestRouteIdTest.java  | 3 ++-
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
index a19718ad65b..da33b3fb2cc 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
@@ -27,12 +27,16 @@ public class FromRestExplicitComponentTest extends FromRestGetTest {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+                context.getPropertiesComponent().addInitialProperty("mySpecialId", "scott");
+
                 // configure to use dummy-rest
                 restConfiguration().component("dummy-rest").host("localhost");
 
                 rest("/say/hello").get().to("direct:hello");
 
-                rest("dummy-rest").path("/say/bye").get().consumes("application/json").param().type(RestParamType.header)
+                rest("dummy-rest").path("/say/bye")
+                        .get().id("{{mySpecialId}}")
+                        .consumes("application/json").param().type(RestParamType.header)
                         .description("header param description1")
                         .dataType("integer").allowableValues("1", "2", "3", "4").defaultValue("1").name("header_count")
                         .required(true).endParam().param().type(RestParamType.query)
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
index 70b6792c43a..91946aea0bc 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
@@ -108,8 +108,11 @@ public class FromRestGetTest extends ContextTestSupport {
         String out2 = template.requestBody("seda:get-say-bye", "Me", String.class);
         assertEquals("Bye World", out2);
 
-        Route route = context.getRoute("scott");
-        Assertions.assertNotNull(route);
+        // some tests that inherit this class does not use dynamic id
+        if (context.getPropertiesComponent().resolveProperty("mySpecialId").isPresent()) {
+            Route route = context.getRoute("scott");
+            Assertions.assertNotNull(route);
+        }
     }
 
     @Override
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
index 47d9d40edf0..4fc77b4c78f 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
@@ -52,11 +52,14 @@ public class FromRestIdAndDescriptionTest extends FromRestGetTest {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+                context.getPropertiesComponent().addInitialProperty("mySpecialId", "scott");
+
                 restConfiguration().host("localhost");
                 rest("/say/hello").id("hello").description("Hello Service").get().id("get-say").description("Says hello to you")
                         .to("direct:hello");
 
-                rest("/say/bye").description("bye", "Bye Service", "en").get().description("Says bye to you")
+                rest("/say/bye").description("bye", "Bye Service", "en")
+                        .get().id("{{mySpecialId}}").description("Says bye to you")
                         .consumes("application/json").param().type(RestParamType.header)
                         .description("header param description1").dataType("integer").allowableValues("1", "2", "3", "4")
                         .defaultValue("1").name("header_count").required(true)
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestRouteIdTest.java b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestRouteIdTest.java
index dd36316200f..e4753c2869a 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestRouteIdTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestRouteIdTest.java
@@ -42,7 +42,8 @@ public class FromRestRouteIdTest extends FromRestGetTest {
                 restConfiguration().host("localhost");
                 rest("/say/hello").get().to("direct:hello");
 
-                rest("/say/bye").get().consumes("application/json").param().type(RestParamType.header)
+                rest("/say/bye").get().id("{{mySpecialId}}")
+                        .consumes("application/json").param().type(RestParamType.header)
                         .description("header param description1").dataType("integer")
                         .allowableValues("1", "2", "3", "4").defaultValue("1").name("header_count").required(true).endParam()
                         .param().type(RestParamType.query)


[camel] 01/03: CAMEL-18739: camel-core - AggregationStrategy onCompletion to have access to input exchange.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 913c1cd5898d579604cc87c88edd27444178607f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 14 18:35:41 2022 +0100

    CAMEL-18739: camel-core - AggregationStrategy onCompletion to have access to input exchange.
---
 .../src/main/java/org/apache/camel/AggregationStrategy.java | 13 +++++++++++++
 .../java/org/apache/camel/processor/MulticastProcessor.java |  2 +-
 .../aggregate/ShareUnitOfWorkAggregationStrategy.java       |  5 +++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/AggregationStrategy.java b/core/camel-api/src/main/java/org/apache/camel/AggregationStrategy.java
index 79b454f85d8..22a4cea8479 100644
--- a/core/camel-api/src/main/java/org/apache/camel/AggregationStrategy.java
+++ b/core/camel-api/src/main/java/org/apache/camel/AggregationStrategy.java
@@ -120,6 +120,19 @@ public interface AggregationStrategy {
     default void onCompletion(Exchange exchange) {
     }
 
+    /**
+     * The aggregated {@link Exchange} has completed
+     *
+     * <b>Important: </b> This method must <b>not</b> throw any exceptions.
+     *
+     * @param exchange the current aggregated exchange, or the original {@link org.apache.camel.Exchange} if no
+     *                 aggregation has been done before the completion occurred
+     * @param  inputExchange the input exchange (input to the EIP)
+     */
+    default void onCompletion(Exchange exchange, Exchange inputExchange) {
+        onCompletion(exchange);
+    }
+
     /**
      * A timeout occurred.
      * <p/>
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
index 2cc448af400..380829ff369 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
@@ -776,7 +776,7 @@ public class MulticastProcessor extends AsyncProcessorSupport
         AggregationStrategy strategy = getAggregationStrategy(subExchange);
         // invoke the on completion callback
         if (strategy != null) {
-            strategy.onCompletion(subExchange);
+            strategy.onCompletion(subExchange, original);
         }
 
         // cleanup any per exchange aggregation strategy
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/ShareUnitOfWorkAggregationStrategy.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/ShareUnitOfWorkAggregationStrategy.java
index 9cd293059f5..06e97ad4983 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/ShareUnitOfWorkAggregationStrategy.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/ShareUnitOfWorkAggregationStrategy.java
@@ -72,6 +72,11 @@ public final class ShareUnitOfWorkAggregationStrategy extends ServiceSupport imp
         strategy.onCompletion(exchange);
     }
 
+    @Override
+    public void onCompletion(Exchange exchange, Exchange inputExchange) {
+        strategy.onCompletion(exchange, inputExchange);
+    }
+
     @Override
     public void timeout(Exchange exchange, int index, int total, long timeout) {
         strategy.timeout(exchange, index, total, timeout);