OK. So I will add my file using the parameter ?fileName== Charles Moulliard Senior Enterprise Architect Apache Camel Committer
***************************** blog : http://cmoulliard.blogspot.com On Fri, Sep 11, 2009 at 1:33 PM, Claus Ibsen <[email protected]> wrote: > 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 >
