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
    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

Reply via email to