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 2021/10/08 07:54:08 UTC
[camel] branch main updated (0927382 -> 7768300)
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 0927382 Sync deps
new 0437d82 Polished
new 7768300 CAMEL-17048: Fixed transacted/sage EIP would add EIPs last that came before them. Though as Camel end user transacted should always be first so its uncommon to have this problem.
The 2 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:
.../apache/camel/model/ProcessorDefinition.java | 2 +-
.../apache/camel/model/RouteDefinitionHelper.java | 6 +-
...Test.java => TransactedSetHeaderIssueTest.java} | 70 ++++++++++++++--------
3 files changed, 49 insertions(+), 29 deletions(-)
copy core/camel-core/src/test/java/org/apache/camel/issues/{AdviceWithPolicyTest.java => TransactedSetHeaderIssueTest.java} (55%)
[camel] 02/02: CAMEL-17048: Fixed transacted/sage EIP would add
EIPs last that came before them. Though as Camel end user transacted should
always be first so its uncommon to have this problem.
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 776830004b517395488491157a7123aaae3302df
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Oct 8 09:53:34 2021 +0200
CAMEL-17048: Fixed transacted/sage EIP would add EIPs last that came before them. Though as Camel end user transacted should always be first so its uncommon to have this problem.
---
.../apache/camel/model/RouteDefinitionHelper.java | 6 +-
.../camel/issues/TransactedSetHeaderIssueTest.java | 95 ++++++++++++++++++++++
2 files changed, 98 insertions(+), 3 deletions(-)
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
index f765b68..fd73a1f 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
@@ -677,7 +677,7 @@ public final class RouteDefinitionHelper {
if (saga != null) {
// the outputs should be moved to the transacted policy
- saga.getOutputs().addAll(lower);
+ saga.getOutputs().addAll(0, lower);
// and add it as the single output
lower.clear();
lower.add(saga);
@@ -699,8 +699,8 @@ public final class RouteDefinitionHelper {
}
if (transacted != null) {
- // the outputs should be moved to the transacted policy
- transacted.getOutputs().addAll(lower);
+ // the outputs should be moved to the start of the transacted policy
+ transacted.getOutputs().addAll(0, lower);
// and add it as the single output
lower.clear();
lower.add(transacted);
diff --git a/core/camel-core/src/test/java/org/apache/camel/issues/TransactedSetHeaderIssueTest.java b/core/camel-core/src/test/java/org/apache/camel/issues/TransactedSetHeaderIssueTest.java
new file mode 100644
index 0000000..bbf473a
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/issues/TransactedSetHeaderIssueTest.java
@@ -0,0 +1,95 @@
+/*
+ * 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.issues;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.NamedNode;
+import org.apache.camel.Processor;
+import org.apache.camel.Route;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.Policy;
+import org.junit.jupiter.api.Test;
+
+public class TransactedSetHeaderIssueTest extends ContextTestSupport {
+
+ private Policy policy = new Policy() {
+ @Override
+ public void beforeWrap(Route route, NamedNode definition) {
+ // noop
+ }
+
+ @Override
+ public Processor wrap(Route route, Processor processor) {
+ return processor;
+ }
+ };
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testSetHeaderOk() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ context.getRegistry().bind("myPolicy", policy);
+
+ from("direct:start")
+ .transacted("myPolicy")
+ .setHeader("foo", constant(123))
+ .to("log:foo")
+ .to("mock:result");
+ }
+ });
+ context.start();
+
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+ getMockEndpoint("mock:result").expectedHeaderReceived("foo", 123);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Test
+ public void testSetHeaderIssue() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ context.getRegistry().bind("myPolicy", policy);
+
+ from("direct:start")
+ .setHeader("foo", constant(123))
+ // transacted should be first but camel will automatic "correct" this
+ .transacted("myPolicy")
+ .to("log:foo")
+ .to("mock:result");
+ }
+ });
+ context.start();
+
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+ getMockEndpoint("mock:result").expectedHeaderReceived("foo", 123);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
[camel] 01/02: Polished
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 0437d8266f0b32d1d71910f3ee57c4c1998952d0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Oct 8 07:42:34 2021 +0200
Polished
---
.../src/main/java/org/apache/camel/model/ProcessorDefinition.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index 8efa326..5dde972 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -2240,7 +2240,7 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
}
/**
- * Marks this route as participating to a saga.
+ * Marks this route as participating in a saga.
*
* @return the saga definition
*/