On Fri, Sep 11, 2009 at 1:27 PM, Charles Moulliard <[email protected]> wrote:
> Hi,
>
> I'm a little confused. The following unit test was working and since I run
> it now, Camel (under Windows) generates the following error :
>
> Caused by: java.lang.IllegalArgumentException: Only directory is supported.
> Endpoint must be configured with a valid starting directory:
> src\test\data\oinp\OINP_Example.csv
Read the exception message. The file endpoint must be configured with
a starting *directory* and not as you have done with a *file*.
So use: src\test\data\oinp\
Instead as its a directory.
> at
> org.apache.camel.component.file.FileEndpoint.createConsumer(FileEndpoint.java:53)
>
> package com.xpectis.x3s.intoout;
>
> ...
>
> @ContextConfiguration(locations =
> "com.xpectis.x3s.intoout.OinpExampleTest$ContextConfig", loader =
> JavaConfigContextLoader.class)
> public class OinpExampleTest extends AbstractJUnit4SpringContextTests {
>
> private static final transient Log LOG =
> LogFactory.getLog(OinpExampleTest.class);
>
> private List<Map<String, Object>> models = new ArrayList<Map<String,
> Object>>();
> private Map<String, Object> model;
>
> private static final String uriDirect = "direct:start-oinp-example";
> private static final String uriFile =
> "file://src/test/data/oinp/OINP_Example.csv";
> private static final String uriMockResult = "mock:result";
>
>
> �...@endpointinject(uri = uriMockResult)
> private MockEndpoint result;
>
> // Test OINP-Example.csv file
> �...@test
> �...@dirtiescontext
> public void testParseFile_OINP_Example() throws Exception {
> result.expectedMessageCount(1);
> result.assertIsSatisfied();
> }
>
> �...@configuration
> public static class ContextConfig extends SingleRouteCamelConfiguration
> {
> BindyCsvDataFormat oinpDataFormat = new BindyCsvDataFormat("
> com.xpectis.x3s.model.backoffice.emx.oinp.in");
>
> �...@override
> �...@bean
> public RouteBuilder route() {
> return new RouteBuilder() {
>
> �...@override
> public void configure() {
>
>
> // Route to test OINP_Example.csv file
>
> from(uriFile).unmarshal(oinpDataFormat).to(uriMockResult);
>
> }
> };
> }
> }
>
> }
>
> Here is the line of the FileEndpoint.class where the error is generated :
>
> // we assume its a file if the name has a dot in it (eg foo.txt)
> if (file.getName().contains(".")) {
> throw new IllegalArgumentException("Only directory is supported.
> Endpoint must be configured with a valid starting directory: " + file);
> }
>
> What is wrong ?
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus