Guillaume Nodet created CAMEL-23306:
---------------------------------------
Summary:
SpringSamplingThrottlerTest.testSamplingWithPropertyPlaceholder always fails -
missing route in Spring XML config
Key: CAMEL-23306
URL: https://issues.apache.org/jira/browse/CAMEL-23306
Project: Camel
Issue Type: Bug
Components: camel-spring-xml
Reporter: Guillaume Nodet
The test {{SpringSamplingThrottlerTest.testSamplingWithPropertyPlaceholder}}
always fails with a 30-second timeout.
h3. Root cause
The parent test {{SamplingThrottlerTest}} (in {{core/camel-core}}) defines a
route:
{code:java}
from("direct:sample-placeholder").sample("{{sample.period}}").to("mock:result");
{code}
The Spring test {{SpringSamplingThrottlerTest}} (in
{{components/camel-spring-parent/camel-spring-xml}}) extends the parent and
inherits the {{testSamplingWithPropertyPlaceholder()}} method. However, the
Spring XML config file {{samplingThrottler.xml}} only defines 3 routes:
* {{direct:sample}}
* {{direct:sample-messageFrequency}}
* {{direct:sample-messageFrequency-via-dsl}}
The {{direct:sample-placeholder}} route is *missing* from the XML config. When
the inherited test method sends a message to {{direct:sample-placeholder}}, the
message has nowhere to go and the mock endpoint never receives it, causing a
30-second timeout.
h3. Fix
Add the missing route to {{samplingThrottler.xml}}:
{code:xml}
<route>
<from uri="direct:sample-placeholder"/>
<sample samplePeriod="{{sample.period}}"/>
<to uri="mock:result"/>
</route>
{code}
Alternatively, override {{testSamplingWithPropertyPlaceholder()}} in the Spring
test to skip it if the route is intentionally excluded.
h3. Affected files
*
{{components/camel-spring-parent/camel-spring-xml/src/test/resources/org/apache/camel/spring/processor/samplingThrottler.xml}}
*
{{components/camel-spring-parent/camel-spring-xml/src/test/java/org/apache/camel/spring/processor/SpringSamplingThrottlerTest.java}}
*
{{core/camel-core/src/test/java/org/apache/camel/processor/SamplingThrottlerTest.java}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)