On Mon, Feb 8, 2010 at 9:37 AM, Kevin Jackson <[email protected]> wrote:
> Hi,
>
> Thanks for the responses.
>
>> [1] http://camel.apache.org/spring-testing.html
>
> I have read this and it doesn't really answer my question.
>
> I already do integration testing using fluent dsl for :
> direct-> processor/bean -> mock
>
> I have integration tests in Camel using Camel test framework for these
> simple integrations.  The problem is that I want to test the spring
> config and also test the memory consumption of a single route before
> integrating the route into my main context (which is also Spring).
>

Monitoring memory usage is not a Camel specific thing. Use google to
find solutions for that.


> So for each part of the route I have classic JUnit tests and also
> Camel Tests, now I want an end-to-end test :
>
> from fileconsumer via processing pojos to persistence
>
>>> Then the next thing is to feed the data into the route.
>>> If you want to keep your file endpoint you could copy files into the
>>> directory it listens to.
>
> This needs to be repeatable, so manually copying a file into a directory is 
> out.
>

You can use Camel to create or move files for your testing as well.

>>> I normally use a producer (see
>>> http://camel.apache.org/pojo-producing.html). For this aproach you need to
>>> start the route with a direct endpoint.
>
> This is the part I don't get - I have already configured the from
> endpoint in Spring, I need to kickstart the route from within the
> context of JUnit's TestRunner.  This works fine with direct:start
>
> So I can get this route to work :
> <camel:route id="mock-integration-test">
>  <camel:from uri="direct:start"/>
>  <camel:bean ref="Unmarshaller" method="unmarshall"/>
>  <camel:bean ref="Transformer" method="transform"/>
>  <camel:to uri="mock:result"/>
> </camel:route>
>
> by using:
> @Produce(uri = "direct:start")
> private ProducerTemplate template;
>
> @Test
> @DirtiesContext
> public void testIntegrated() throws Exception {
>  resultEndpoint.expectedBodiesReceived(result);
>  template.sendBody(test);
>  resultEndpoint.assertIsSatisfied();
> }
>
> but this only has a subset of test data (hardcoded in the Test class),
>
> So I need to be able to consume a representative sample of test data:
> <camel:route id="integration-test">
>  <camel:from uri="direct:file"/>
>  <camel:to ref="file-consumer"/>
>  <camel:split streaming="true">
>    <camel:tokenize token="\n"/>
>    <camel:bean ref="Unmarshaller" method="unmarshall"/>
>    <camel:bean ref="Transformer" method="transform"/>
>    <camel:to uri="mock:result"/>
>  </camel:split>
> </camel:route>
>
> How can I trigger this?
>
> Thanks,
> Kev
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to