camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Quinn Stevenson <>
Subject Re: DataSet Consumer expected message count - proposed change
Date Fri, 11 Mar 2016 19:54:45 GMT
While working on the PR for this (JIRA CAMEL-9699), I noticed that DataSetEndpoint.performAssertions
does not call super.performAssertions.  As a result, the received exchanges aren’t in the
DataSet/Mock, so I can’t post-process the exchanges for data validation in a test.

Is this the intended/desired behavior?

> On Mar 10, 2016, at 10:03 AM, Claus Ibsen <> wrote:
> Hi
> Yeah it does. And as long you can turn back the old way its fine. And
> such a change in a testing component is much more okay to do than a
> component you use for production.
> I suggest you work on a patch and then lets see this in action.
> On Thu, Mar 10, 2016 at 5:28 PM, Quinn Stevenson
> <> wrote:
>> I could definitely add an option to turn the new behavior on or off, but I’d like
to make the new behavior the default if that’s OK.
>> The reasons for this are:
>> - I think the new behavior is more intuitive (but that’s just my opinion - I’d
like to hear others)
>> - The point of the change was to get rid of a bunch of duplication I have in my tests
that are there to make the tests behave the way I think they should - namely sourceDataSet.expectedMessageCount(0)
that I have everywhere.  It forces me to grab or inject the dataset into the test and change
it.  With the new default, all of that could go away.
>> - The proposed change wouldn’t break existing uses unless they are relying on the
test to fail when it’s a source only and they haven’t overridden the expected message
count.  The endpoints that are targets would still use the size as the default expected message
count, so I don’t think it would break very many tests - and fixing them would be simple.
>> Does all of that make sense?
>>> On Mar 10, 2016, at 2:29 AM, Claus Ibsen <> wrote:
>>> Hi
>>> Yeah sure. Maybe have some option on dataset you can use to turn this
>>> on|off so the old behavior can be the default still.
>>> On Wed, Mar 9, 2016 at 9:50 PM, Quinn Stevenson
>>> <> wrote:
>>>> I would like to propose changing the current behavior of the DataSet component
such that the expected message count defaults to zero for DataSets used as a source (i.e.
>>>> The reasoning behind this is as follows.
>>>> I use the DataSet component for simple load testing.  When I use a DataSet
as a source (i.e. from(“dataset://my-dataset <dataset://my-dataset>”) ), the assertMockEndpointsSatisfied()
always fails because the expectedMessageSize is set to the size of the DataSet.  I either
have to explicitly set the expected message count on the endpoint to zero ( getMockEndpoint(
“dataset://my-dataset <dataset://my-dataset>”).expectedMessageCount( 0 ), or I have
to assert all of the other mock endpoints individually (i.e not use assertMockEndpointsSatisfied()
>>>> I rarely use the same dataset as both a source (i.e. from(“dataset://…”)
) and a target (i.e. to( “dataset://…”) ), so this behavior doesn’t make much sense
to me.  Additionally, I can’t use the same DataSet as the source and target when the source
message count would be different than the target message count - which would be the case for
a route that does some simple filtering, and all I want to assert is the correct number of
messages came through.
>>>> I’ve figured out a way to do this, and I’d like to create a JIRA task
and a pull request for this if it sounds like an acceptable change.
>>> --
>>> Claus Ibsen
>>> -----------------
>>> @davsclaus
>>> Camel in Action 2:
> -- 
> Claus Ibsen
> -----------------
> @davsclaus
> Camel in Action 2:

View raw message