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
The following commit(s) were added to refs/heads/main by this push:
new faf28748b33a CAMEL-28100: camel-core -
AdviceWithRouteConfigurationTest expects the intercept on the main route path
(#31353)
faf28748b33a is described below
commit faf28748b33a7e196c3a638da85b0598d305ef9b
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Dec 4 12:39:07 2026 +0100
CAMEL-28100: camel-core - AdviceWithRouteConfigurationTest expects the
intercept on the main route path (#31353)
AdviceWithRouteConfigurationTest (CAMEL-28099, #31336) and the intercept
change of CAMEL-28100 (#31337) were merged one hour apart, and each PR's CI
ran without the other. The test still expected the intercept behaviour from
before CAMEL-28100, so it fails on main:
- the InterceptDefinition now stays in the route outputs when the route is
created, so an advised route of a started context has it once (was 0);
- the intercept runs before each step of the main route path only, not the
steps of interceptFrom, interceptSendToEndpoint, onException and
onCompletion, so mock:intercept gets 7 messages (was 11).
Test-only change; the code behaves as CAMEL-28100 intends.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../interceptor/AdviceWithRouteConfigurationTest.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git
a/core/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithRouteConfigurationTest.java
b/core/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithRouteConfigurationTest.java
index 9eacb5950fa4..19e68fee96e3 100644
---
a/core/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithRouteConfigurationTest.java
+++
b/core/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithRouteConfigurationTest.java
@@ -56,8 +56,8 @@ public class AdviceWithRouteConfigurationTest extends
ContextTestSupport {
RouteDefinition merged = advice();
assertMergedOnce(merged);
- // the intercept is removed from the outputs when the route is created
- assertThat(count(merged, InterceptDefinition.class)).isZero();
+ // the intercept stays in the outputs when the route is created
(CAMEL-28100)
+ assertThat(count(merged, InterceptDefinition.class)).isOne();
assertThat(merged.getContextScopedIntercepts()).hasSize(1);
assertThat(merged.getContextScopedOnCompletions()).hasSize(1);
assertThat(merged.getAppliedRouteConfigurationIds()).containsExactly("myConfig");
@@ -155,9 +155,10 @@ public class AdviceWithRouteConfigurationTest extends
ContextTestSupport {
}
private void assertRunsOnce() throws Exception {
- // the same count as the route written with the mock:advice step,
without adviceWith (the intercept runs before
- // each step, also the steps of the interceptFrom,
interceptSendToEndpoint and onCompletion)
- getMockEndpoint("mock:intercept").expectedMessageCount(11);
+ // the same count as the route written with the mock:advice step,
without adviceWith: the intercept runs before
+ // each step of the main route path, not the steps of the
interceptFrom, interceptSendToEndpoint, onException and
+ // onCompletion (CAMEL-28100): to, filter and the advice step for
Hello World, and also throwException for Kaboom
+ getMockEndpoint("mock:intercept").expectedMessageCount(7);
assertRunsOnceWithoutIntercept();
}