Re: Camel Test Endpoint Error

2016-03-10 Thread Claus Ibsen
Hi

Yeah got the any order fixed
https://issues.apache.org/jira/browse/CAMEL-9697

And will work on the expression

On Thu, Mar 10, 2016 at 5:29 PM, Quinn Stevenson
 wrote:
> I would defiantly like to add an expression to split the messages - that 
> would be very very useful.
>
>> On Mar 10, 2016, at 9:27 AM, Claus Ibsen  wrote:
>>
>> On Thu, Mar 10, 2016 at 5:18 PM, Quinn Stevenson
>> > wrote:
>>> Thank you for the quick fix - I’m building 2.17-SNAPSHOT now so I can work 
>>> with this some more.
>>>
>>> I agree completely on the first case.  I actually assumed that’s what would 
>>> happen for some reason.  Is the component currently limited to one message 
>>> per file?
>>
>> Yes, it may work for a bunch of xml files etc where you want to match
>> against them.
>>
>> But we could allow to configure a expression for splitting, then you
>> can specify \n for new lines, or refer to an xml tokenizer, that can
>> split xml files, etc
>>
>>
>>>
>>> I hadn’t thought about the second - my routes are almost always 
>>> order-dependent (i.e. FIFO), so I normally wouldn’t use that one.
>>>
>>
>> Yeah its in the order it consumes / aka for file the reading order. So
>> you would may need to specify a sort option to sort by name etc.
>>
>>
>>
>>>
 On Mar 10, 2016, at 9:13 AM, Claus Ibsen  wrote:

 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  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
>  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 
>>>  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 ")
>>>   .to( "test:file://data?noop=true" );
>>>   }
>>>   };
>>>   }
>>>
>>>   @Test
>>>   public void testRoute() throws Exception {
>>>   template.sendBody( "direct://source ", "My 
>>> Value");
>>>
>>>   assertMockEndpointsSatisfied();
>>>   }
>>>
>>> }
 On Mar 10, 2016, at 8:11 AM, Quinn Stevenson 
 > 
 wrote:

 Forgot to mention I’m using v2.16.2.

 Also, here’s the full blueprint and test class

 
 http://www.osgi.org/xmlns/blueprint/v1.0.0 
 "
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
 "
  xmlns:camel="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/blueprint.xsd 
 
http://camel.apache.org/schema/blueprint 
  
 http://camel.apache.org/schema/blueprint/camel-blueprint.xsd 

Re: Camel Test Endpoint Error

2016-03-10 Thread Quinn Stevenson
I would defiantly like to add an expression to split the messages - that would 
be very very useful.

> On Mar 10, 2016, at 9:27 AM, Claus Ibsen  wrote:
> 
> On Thu, Mar 10, 2016 at 5:18 PM, Quinn Stevenson
> > wrote:
>> Thank you for the quick fix - I’m building 2.17-SNAPSHOT now so I can work 
>> with this some more.
>> 
>> I agree completely on the first case.  I actually assumed that’s what would 
>> happen for some reason.  Is the component currently limited to one message 
>> per file?
> 
> Yes, it may work for a bunch of xml files etc where you want to match
> against them.
> 
> But we could allow to configure a expression for splitting, then you
> can specify \n for new lines, or refer to an xml tokenizer, that can
> split xml files, etc
> 
> 
>> 
>> I hadn’t thought about the second - my routes are almost always 
>> order-dependent (i.e. FIFO), so I normally wouldn’t use that one.
>> 
> 
> Yeah its in the order it consumes / aka for file the reading order. So
> you would may need to specify a sort option to sort by name etc.
> 
> 
> 
>> 
>>> On Mar 10, 2016, at 9:13 AM, Claus Ibsen  wrote:
>>> 
>>> 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  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
  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 
>>  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 ")
>>   .to( "test:file://data?noop=true" );
>>   }
>>   };
>>   }
>> 
>>   @Test
>>   public void testRoute() throws Exception {
>>   template.sendBody( "direct://source ", "My 
>> Value");
>> 
>>   assertMockEndpointsSatisfied();
>>   }
>> 
>> }
>>> On Mar 10, 2016, at 8:11 AM, Quinn Stevenson 
>>> > 
>>> wrote:
>>> 
>>> Forgot to mention I’m using v2.16.2.
>>> 
>>> Also, here’s the full blueprint and test class
>>> 
>>> 
>>> http://www.osgi.org/xmlns/blueprint/v1.0.0 
>>> "
>>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
>>> "
>>>  xmlns:camel="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/blueprint.xsd 
>>> 
>>>http://camel.apache.org/schema/blueprint 
>>>  
>>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd 
>>> ">
>>> 
>>>   >> xmlns="http://camel.apache.org/schema/blueprint 
>>> ">
>>>   
>>>   
>>>   
>>>   
>>>   
>>> 
>>>   

Re: Camel Test Endpoint Error

2016-03-10 Thread Claus Ibsen
On Thu, Mar 10, 2016 at 5:18 PM, Quinn Stevenson
 wrote:
> Thank you for the quick fix - I’m building 2.17-SNAPSHOT now so I can work 
> with this some more.
>
> I agree completely on the first case.  I actually assumed that’s what would 
> happen for some reason.  Is the component currently limited to one message 
> per file?

Yes, it may work for a bunch of xml files etc where you want to match
against them.

But we could allow to configure a expression for splitting, then you
can specify \n for new lines, or refer to an xml tokenizer, that can
split xml files, etc


>
> I hadn’t thought about the second - my routes are almost always 
> order-dependent (i.e. FIFO), so I normally wouldn’t use that one.
>

Yeah its in the order it consumes / aka for file the reading order. So
you would may need to specify a sort option to sort by name etc.



>
>> On Mar 10, 2016, at 9:13 AM, Claus Ibsen  wrote:
>>
>> 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  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
>>>  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 
>  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 ")
>.to( "test:file://data?noop=true" );
>}
>};
>}
>
>@Test
>public void testRoute() throws Exception {
>template.sendBody( "direct://source ", "My 
> Value");
>
>assertMockEndpointsSatisfied();
>}
>
> }
>> On Mar 10, 2016, at 8:11 AM, Quinn Stevenson 
>> > wrote:
>>
>> Forgot to mention I’m using v2.16.2.
>>
>> Also, here’s the full blueprint and test class
>>
>> 
>> http://www.osgi.org/xmlns/blueprint/v1.0.0 
>> "
>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
>> "
>>   xmlns:camel="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/blueprint.xsd 
>> 
>> http://camel.apache.org/schema/blueprint 
>>  
>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd 
>> ">
>>
>>> xmlns="http://camel.apache.org/schema/blueprint 
>> ">
>>
>>
>>
>>
>>
>>
>>> xmlns="http://camel.apache.org/schema/blueprint 
>> ">
>>
>>
>>
>> 
>>
>>
>> package com.pronoia.camel;
>>
>> import org.apache.camel.EndpointInject;
>> import org.apache.camel.component.mock.MockEndpoint;
>> import 

Re: Camel Test Endpoint Error

2016-03-10 Thread Quinn Stevenson
Thank you for the quick fix - I’m building 2.17-SNAPSHOT now so I can work with 
this some more.

I agree completely on the first case.  I actually assumed that’s what would 
happen for some reason.  Is the component currently limited to one message per 
file?

I hadn’t thought about the second - my routes are almost always order-dependent 
(i.e. FIFO), so I normally wouldn’t use that one.


> On Mar 10, 2016, at 9:13 AM, Claus Ibsen  wrote:
> 
> 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  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
>>  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  
 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 ")
.to( "test:file://data?noop=true" );
}
};
}
 
@Test
public void testRoute() throws Exception {
template.sendBody( "direct://source ", "My Value");
 
assertMockEndpointsSatisfied();
}
 
 }
> On Mar 10, 2016, at 8:11 AM, Quinn Stevenson  > wrote:
> 
> Forgot to mention I’m using v2.16.2.
> 
> Also, here’s the full blueprint and test class
> 
> 
> http://www.osgi.org/xmlns/blueprint/v1.0.0 
> "
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
> "
>   xmlns:camel="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/blueprint.xsd 
> 
> http://camel.apache.org/schema/blueprint 
>  
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd 
> ">
> 
> xmlns="http://camel.apache.org/schema/blueprint 
> ">
>
>
>
>
>
> 
> xmlns="http://camel.apache.org/schema/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( 

Re: Camel Test Endpoint Error

2016-03-10 Thread Claus Ibsen
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  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
>  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  
>>> 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 ")
>>> .to( "test:file://data?noop=true" );
>>> }
>>> };
>>> }
>>>
>>> @Test
>>> public void testRoute() throws Exception {
>>> template.sendBody( "direct://source ", "My Value");
>>>
>>> assertMockEndpointsSatisfied();
>>> }
>>>
>>> }
 On Mar 10, 2016, at 8:11 AM, Quinn Stevenson > wrote:

 Forgot to mention I’m using v2.16.2.

 Also, here’s the full blueprint and test class

 
 http://www.osgi.org/xmlns/blueprint/v1.0.0 
 "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
 "
xmlns:camel="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/blueprint.xsd 
 
  http://camel.apache.org/schema/blueprint 
  
 http://camel.apache.org/schema/blueprint/camel-blueprint.xsd 
 ">

 >>> xmlns="http://camel.apache.org/schema/blueprint 
 ">
 
 
 
 
 

 >>> xmlns="http://camel.apache.org/schema/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 
 ");
 }

 @Test
 public void testRoute() throws Exception {
 template.sendBody( "direct://source ", "My 
 Value");

 assertMockEndpointsSatisfied();
 }

 }



> On Mar 10, 2016, at 8:07 AM, Quinn Stevenson  > 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 

Re: Camel Test Endpoint Error

2016-03-10 Thread Claus Ibsen
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
 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  
>> 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 ")
>> .to( "test:file://data?noop=true" );
>> }
>> };
>> }
>>
>> @Test
>> public void testRoute() throws Exception {
>> template.sendBody( "direct://source ", "My Value");
>>
>> assertMockEndpointsSatisfied();
>> }
>>
>> }
>>> On Mar 10, 2016, at 8:11 AM, Quinn Stevenson >> > wrote:
>>>
>>> Forgot to mention I’m using v2.16.2.
>>>
>>> Also, here’s the full blueprint and test class
>>>
>>> 
>>> http://www.osgi.org/xmlns/blueprint/v1.0.0 
>>> "
>>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
>>> "
>>>xmlns:camel="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/blueprint.xsd 
>>> 
>>>  http://camel.apache.org/schema/blueprint 
>>>  
>>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd 
>>> ">
>>>
>>> >> xmlns="http://camel.apache.org/schema/blueprint 
>>> ">
>>> 
>>> 
>>> 
>>> 
>>> 
>>>
>>> >> xmlns="http://camel.apache.org/schema/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 
>>> ");
>>> }
>>>
>>> @Test
>>> public void testRoute() throws Exception {
>>> template.sendBody( "direct://source ", "My Value");
>>>
>>> assertMockEndpointsSatisfied();
>>> }
>>>
>>> }
>>>
>>>
>>>
 On Mar 10, 2016, at 8:07 AM, Quinn Stevenson > 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  > 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 

Re: Camel Test Endpoint Error

2016-03-10 Thread Quinn Stevenson
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  
> 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 ")
> .to( "test:file://data?noop=true" );
> }
> };
> }
> 
> @Test
> public void testRoute() throws Exception {
> template.sendBody( "direct://source ", "My Value");
> 
> assertMockEndpointsSatisfied();
> }
> 
> }
>> On Mar 10, 2016, at 8:11 AM, Quinn Stevenson > > wrote:
>> 
>> Forgot to mention I’m using v2.16.2.
>> 
>> Also, here’s the full blueprint and test class
>> 
>> 
>> http://www.osgi.org/xmlns/blueprint/v1.0.0 
>> "
>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
>> "
>>xmlns:camel="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/blueprint.xsd 
>> 
>>  http://camel.apache.org/schema/blueprint 
>>  
>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd 
>> ">
>> 
>> > xmlns="http://camel.apache.org/schema/blueprint 
>> ">
>> 
>> 
>> 
>> 
>> 
>> 
>> > xmlns="http://camel.apache.org/schema/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 ");
>> }
>> 
>> @Test
>> public void testRoute() throws Exception {
>> template.sendBody( "direct://source ", "My Value");
>> 
>> assertMockEndpointsSatisfied();
>> }
>> 
>> }
>> 
>> 
>> 
>>> On Mar 10, 2016, at 8:07 AM, Quinn Stevenson >> > 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 > 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
 > wrote:
> I’m trying to get the sample from the documentation for the Test 
> Component working ( http://camel.apache.org/test.html 
>   > ), but I keep getting a type 
> conversion error.
> 
> Here’s 

Re: Camel Test Endpoint Error

2016-03-10 Thread Quinn Stevenson
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")
.to( "test:file://data?noop=true" );
}
};
}

@Test
public void testRoute() throws Exception {
template.sendBody( "direct://source", "My Value");

assertMockEndpointsSatisfied();
}

}
> On Mar 10, 2016, at 8:11 AM, Quinn Stevenson  
> wrote:
> 
> Forgot to mention I’m using v2.16.2.
> 
> Also, here’s the full blueprint and test class
> 
> 
> http://www.osgi.org/xmlns/blueprint/v1.0.0 
> "
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
> "
>xmlns:camel="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/blueprint.xsd 
> 
>  http://camel.apache.org/schema/blueprint 
>  
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd 
> ">
> 
>  xmlns="http://camel.apache.org/schema/blueprint 
> ">
> 
> 
> 
> 
> 
> 
>  xmlns="http://camel.apache.org/schema/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 ");
> }
> 
> @Test
> public void testRoute() throws Exception {
> template.sendBody( "direct://source ", "My Value");
> 
> assertMockEndpointsSatisfied();
> }
> 
> }
> 
> 
> 
>> On Mar 10, 2016, at 8:07 AM, Quinn Stevenson > > 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 >> > 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
>>> > wrote:
 I’m trying to get the sample from the documentation for the Test Component 
 working ( http://camel.apache.org/test.html 
  > ), but I keep getting a type 
 conversion error.
 
 Here’s the route definition:
 
   
   
 
 
 Here’s the test method:
 @Test
 public void testRoute() throws Exception {
   template.sendBody( "direct://source ", "My Value");
 
   assertMockEndpointsSatisfied();
 }
 
 Here’s the error:
 java.lang.AssertionError: 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  @davsclaus
>>> Camel 

Re: Camel Test Endpoint Error

2016-03-10 Thread Quinn Stevenson
Forgot to mention I’m using v2.16.2.

Also, here’s the full blueprint and test class


http://www.osgi.org/xmlns/blueprint/v1.0.0;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
   xmlns:camel="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/blueprint.xsd
 http://camel.apache.org/schema/blueprint 
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd;>

http://camel.apache.org/schema/blueprint;>






http://camel.apache.org/schema/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");
}

@Test
public void testRoute() throws Exception {
template.sendBody( "direct://source", "My Value");

assertMockEndpointsSatisfied();
}

}



> On Mar 10, 2016, at 8:07 AM, Quinn Stevenson  
> 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  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
>>  wrote:
>>> I’m trying to get the sample from the documentation for the Test Component 
>>> working ( http://camel.apache.org/test.html 
>>>  ), but I keep getting a type conversion 
>>> error.
>>> 
>>> Here’s the route definition:
>>> 
>>>   
>>>   
>>> 
>>> 
>>> Here’s the test method:
>>> @Test
>>> public void testRoute() throws Exception {
>>>   template.sendBody( "direct://source", "My Value");
>>> 
>>>   assertMockEndpointsSatisfied();
>>> }
>>> 
>>> Here’s the error:
>>> java.lang.AssertionError: 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 @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
> 



Re: Camel Test Endpoint Error

2016-03-10 Thread Quinn Stevenson
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  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
>  wrote:
>> I’m trying to get the sample from the documentation for the Test Component 
>> working ( http://camel.apache.org/test.html 
>>  ), but I keep getting a type conversion 
>> error.
>> 
>> Here’s the route definition:
>> 
>>
>>
>> 
>> 
>> Here’s the test method:
>> @Test
>> public void testRoute() throws Exception {
>>template.sendBody( "direct://source", "My Value");
>> 
>>assertMockEndpointsSatisfied();
>> }
>> 
>> Here’s the error:
>> java.lang.AssertionError: 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 @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



Re: Camel Test Endpoint Error

2016-03-10 Thread Claus Ibsen
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
 wrote:
> I’m trying to get the sample from the documentation for the Test Component 
> working ( http://camel.apache.org/test.html 
>  ), but I keep getting a type conversion 
> error.
>
> Here’s the route definition:
> 
> 
> 
> 
>
> Here’s the test method:
> @Test
> public void testRoute() throws Exception {
> template.sendBody( "direct://source", "My Value");
>
> assertMockEndpointsSatisfied();
> }
>
> Here’s the error:
> java.lang.AssertionError: 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 @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2