Claus Ibsen created CAMEL-27872:
-----------------------------------
Summary: camel-mock: reset() drops the options of the endpoint
URI, browseLimit has no effect, failFast with resultMinimumWaitTime hides the
failure
Key: CAMEL-27872
URL: https://issues.apache.org/jira/browse/CAMEL-27872
Project: Camel
Issue Type: Bug
Components: camel-mock
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-mock for CAMEL-23832
(pull request https://github.com/apache/camel/pull/31149).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. reset() drops the options set in the endpoint URI
{{MockEndpoint.reset}} puts expectedCount, assertPeriod, resultWaitTime,
resultMinimumWaitTime, sleepForEmptyTest, retainFirst and retainLast back to
their defaults. MockEndpoint.resetMocks(context) calls it, and camel-test calls
that between test methods when the context is per class, so from the second
test method on the values from the URI are lost.
Proposed change: remember the values from the URI and restore them in reset(),
at least retainFirst/retainLast, which are settings rather than expectations.
h4. 2. browseLimit has no effect
{{MockEndpoint}} only has a getter and setter for BrowsableEndpoint; nothing
limits the stored exchanges.
Proposed change: apply it, or stop exposing it as an option.
h4. 3. reportGroup only works on mock
Only {{MockComponent.createEndpoint}} creates the ThroughputLogger;
DataSetComponent, DataSetTestComponent and CitrusComponent only set the field,
so the option does nothing there. On mock, a value of 0 or less fails in
ThroughputLogger.setGroupSize at endpoint creation.
Proposed change: create the reporter in MockEndpoint (for example in doStart),
and validate the value.
h4. 4. failFast with resultMinimumWaitTime hides the failure
In {{MockEndpoint.doAssertIsSatisfied}}, when failFast releases the latch early
and resultMinimumWaitTime > 0, waitForCompleteLatch() fails with "Expected
minimum ... millis" before the fail-fast assertion error is thrown.
Proposed change: check the fail-fast error before the minimum wait.
h4. 5. dataset ignores retainFirst/retainLast and overwrites expectedCount
{{DataSetEndpoint.performAssertions}} never calls addReceivedExchange, so
retainFirst/retainLast have no effect; createProducer overwrites expectedCount
with the size of the DataSet. The dataset JSON shows copyOnExchange default
true, but the DataSetEndpoint constructor sets false.
Proposed change: document or align them.
h4. 6. citrus ignores the component log option
{{CitrusComponent.createEndpoint}} never calls endpoint.setLog(isLog()) (see
also CAMEL-27869).
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)