One use case it may be nice would be to allow to use 1 file, but each
row in the file is a expected message.
In case you test with 1000s of messages.

Also maybe being able to specify that the order can be random. I think
today they are in the order the consumer fetches the messages.

On Thu, Mar 10, 2016 at 5:06 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> Hi
>
> I have reproduced your issue and logged a ticket
> https://issues.apache.org/jira/browse/CAMEL-9696
>
> And also work on improving so those options you pass on the file
> endpoint are passed on. Today they are dropped.
>
> On Thu, Mar 10, 2016 at 4:56 PM, Quinn Stevenson
> <qu...@pronoia-solutions.com> wrote:
>> Claus -
>>
>> Sorry - I missed one part of your comment the first time.
>>
>> For this test, yes - I only expect a single value, and it’s out in a file.  
>> What I’d like to be able to do is put a bunch of values in that file and 
>> have the MockEndpoint setup with the correct expected message bodies.
>>
>> I actually expected this test to fail because my test data file has about 50 
>> lines in it, so I expected the Mock to fail because the test only sends one 
>> message.
>>
>> Hopefully that clarifies what I’m after here
>>
>>> On Mar 10, 2016, at 8:50 AM, Quinn Stevenson <qu...@pronoia-solutions.com> 
>>> wrote:
>>>
>>> Here’s a single Camel test that shows the issue.
>>>
>>> package com.pronoia.camel;
>>>
>>> import org.apache.camel.builder.RouteBuilder;
>>> import org.apache.camel.test.junit4.CamelTestSupport;
>>> import org.junit.Test;
>>>
>>> public class JavaTestRouteTest extends CamelTestSupport {
>>>     @Override
>>>     protected RouteBuilder createRouteBuilder() throws Exception {
>>>         return new RouteBuilder() {
>>>             @Override
>>>             public void configure() throws Exception {
>>>                 from( "direct://source <direct://source>")
>>>                     .to( "test:file://data?noop=true" );
>>>             }
>>>         };
>>>     }
>>>
>>>     @Test
>>>     public void testRoute() throws Exception {
>>>         template.sendBody( "direct://source <direct://source>", "My Value");
>>>
>>>         assertMockEndpointsSatisfied();
>>>     }
>>>
>>> }
>>>> On Mar 10, 2016, at 8:11 AM, Quinn Stevenson <qu...@pronoia-solutions.com 
>>>> <mailto:qu...@pronoia-solutions.com>> wrote:
>>>>
>>>> Forgot to mention I’m using v2.16.2.
>>>>
>>>> Also, here’s the full blueprint and test class
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0 
>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0>"
>>>>            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
>>>> <http://www.w3.org/2001/XMLSchema-instance>"
>>>>            xmlns:camel="http://camel.apache.org/schema/blueprint 
>>>> <http://camel.apache.org/schema/blueprint>"
>>>>            xsi:schemaLocation="
>>>>          http://www.osgi.org/xmlns/blueprint/v1.0.0 
>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0> 
>>>> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd 
>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd>
>>>>          http://camel.apache.org/schema/blueprint 
>>>> <http://camel.apache.org/schema/blueprint> 
>>>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd 
>>>> <http://camel.apache.org/schema/blueprint/camel-blueprint.xsd>">
>>>>
>>>>     <camel:routeContext id="test-route-context" 
>>>> xmlns="http://camel.apache.org/schema/blueprint 
>>>> <http://camel.apache.org/schema/blueprint>">
>>>>         <route id="direct-to-test">
>>>>             <from uri="direct://source <direct://source>"/>
>>>>             <to uri="test:file://data?noop=true" />
>>>>         </route>
>>>>     </camel:routeContext>
>>>>
>>>>     <camel:camelContext id="blueprint-camel-context" 
>>>> xmlns="http://camel.apache.org/schema/blueprint 
>>>> <http://camel.apache.org/schema/blueprint>">
>>>>         <routeContextRef ref="test-route-context"/>
>>>>     </camel:camelContext>
>>>>
>>>> </blueprint>
>>>>
>>>>
>>>> package com.pronoia.camel;
>>>>
>>>> import org.apache.camel.EndpointInject;
>>>> import org.apache.camel.component.mock.MockEndpoint;
>>>> import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
>>>> import org.junit.Before;
>>>> import org.junit.Test;
>>>>
>>>> public class BlueprintTestRouteTest extends CamelBlueprintTestSupport {
>>>>     @EndpointInject( uri = "test:file://data?noop=true")
>>>>     MockEndpoint targetEndpoint;
>>>>
>>>>     @Override
>>>>     protected String getBlueprintDescriptor() {
>>>>         return "/OSGI-INF/blueprint/blueprint-test.xml";
>>>>     }
>>>>
>>>>     @Override
>>>>     @Before
>>>>     public void setUp() throws Exception {
>>>>         super.setUp();
>>>>         template.setDefaultEndpointUri( "direct://source 
>>>> <direct://source>");
>>>>     }
>>>>
>>>>     @Test
>>>>     public void testRoute() throws Exception {
>>>>         template.sendBody( "direct://source <direct://source>", "My 
>>>> Value");
>>>>
>>>>         assertMockEndpointsSatisfied();
>>>>     }
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>>> On Mar 10, 2016, at 8:07 AM, Quinn Stevenson <qu...@pronoia-solutions.com 
>>>>> <mailto:qu...@pronoia-solutions.com>> wrote:
>>>>>
>>>>> The route is defined in blueprint and I’m running the test using 
>>>>> CamelBlueprintTestSupport - does that make a difference?
>>>>>
>>>>>
>>>>>> On Mar 10, 2016, at 8:04 AM, Claus Ibsen <claus.ib...@gmail.com 
>>>>>> <mailto:claus.ib...@gmail.com>> wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> Ah that test component is never really used. So the idea is that you
>>>>>> have a file in that directory, that has the value "My Value" which the
>>>>>> test component will load and compare agains the incoming message.
>>>>>>
>>>>>> But yeah seems like the file -> string conversion somehow fails. You
>>>>>> just run this from straing junit ? No karaf or blueprint or osgi
>>>>>> container?
>>>>>>
>>>>>> On Thu, Mar 10, 2016 at 4:01 PM, Quinn Stevenson
>>>>>> <qu...@pronoia-solutions.com <mailto:qu...@pronoia-solutions.com>> wrote:
>>>>>>> I’m trying to get the sample from the documentation for the Test 
>>>>>>> Component working ( http://camel.apache.org/test.html 
>>>>>>> <http://camel.apache.org/test.html> <http://camel.apache.org/test.html 
>>>>>>> <http://camel.apache.org/test.html>> ), but I keep getting a type 
>>>>>>> conversion error.
>>>>>>>
>>>>>>> Here’s the route definition:
>>>>>>> <route id="direct-to-test">
>>>>>>>   <from uri="direct://source <direct://source>"/>
>>>>>>>   <to uri="test:file://data?noop=true" />
>>>>>>> </route>
>>>>>>>
>>>>>>> Here’s the test method:
>>>>>>> @Test
>>>>>>> public void testRoute() throws Exception {
>>>>>>>   template.sendBody( "direct://source <direct://source>", "My Value");
>>>>>>>
>>>>>>>   assertMockEndpointsSatisfied();
>>>>>>> }
>>>>>>>
>>>>>>> Here’s the error:
>>>>>>> java.lang.AssertionError: test://file://data?noop=true 
>>>>>>> <test://file//data?noop=true> There is no type conversion possible from 
>>>>>>> java.lang.String to org.apache.camel.component.file.GenericFile
>>>>>>>
>>>>>>> I can see that Camel is finding the file with the test data because I’m 
>>>>>>> getting a .camelLock file, but I can’t seem to figure out what I’m 
>>>>>>> doing wrong
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> -----------------
>>>>>> http://davsclaus.com <http://davsclaus.com/> @davsclaus
>>>>>> Camel in Action 2: https://www.manning.com/ibsen2 
>>>>>> <https://www.manning.com/ibsen2>
>>>>>
>>>>
>>>
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to