camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject File cannot be processed immediately in a camel junit test. Why ?
Date Wed, 15 Jul 2009 10:19:30 GMT
Hi,

When I launch the following unit test of bindy,

@ContextConfiguration(locations =
"org.apache.camel.dataformat.bindy.csv.BindySimpleCsvUnmarshallTest$ContextConfig",
loader = JavaConfigContextLoader.class)
public class BindySimpleCsvUnmarshallTest extends
AbstractJUnit4SpringContextTests {

    @EndpointInject(uri = "mock:result")
    private MockEndpoint resultEndpoint;

    @Test
    public void testUnMarshallMessage() throws Exception {

        List<Exchange> exchanges = resultEndpoint.getExchanges();

        for(Exchange exchange : exchanges) {
            Object body = exchange.getOut().getBody();
            System.out.println("Body received : " + body.toString());
        }

        resultEndpoint.expectedMessageCount(1);
        resultEndpoint.assertIsSatisfied();
    }

    @Configuration
    public static class ContextConfig extends SingleRouteCamelConfiguration
{
        BindyCsvDataFormat camelDataFormat = new
BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");

        @Override
        @Bean
        public RouteBuilder route() {
            return new RouteBuilder() {
                @Override
                public void configure() {

from("file://src/test/data").unmarshal(camelDataFormat).to("mock:result");
                }
            };
        }
    }
}


I see in the log that the message cannot processed immediately (but after 25
seconds):

2009-07-15 12:14:55,453 INFO  MockEndpoint - Asserting:
Endpoint[mock://result] is satisfied
2009-07-15 12:14:55,453 DEBUG MockEndpoint - Waiting on the latch for: 20000
millis
2009-07-15 12:14:56,265 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:14:56,281 DEBUG DefaultListableBeanFactory - Creating instance
of bean 'org.apache.camel.language.simple.FileLanguage'
2009-07-15 12:14:56,281 DEBUG DefaultListableBeanFactory - Finished creating
instance of bean 'org.apache.camel.language.simple.FileLanguage'
2009-07-15 12:14:56,281 DEBUG FileLanguage - Expression is evaluated as
simple (strict) expression: ${file:parent}/.camel/${file:onlyname}
2009-07-15 12:14:56,296 DEBUG FileEndpoint - Using Generic file process
strategy:
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@1cffeb4
2009-07-15 12:14:56,296 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:14:56,750 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:14:56,750 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:14:57,421 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:14:57,421 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:14:58,125 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:14:58,125 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:14:58,640 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:14:58,640 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:14:59,359 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:14:59,359 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:14:59,937 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:14:59,937 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:00,437 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:00,437 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:01,203 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:01,203 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:01,718 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:01,718 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:02,437 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:02,437 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:03,140 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:03,140 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:03,640 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:03,640 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:04,468 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:04,468 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:04,953 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:04,953 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:05,765 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:05,765 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:06,453 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:06,453 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:07,171 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:07,187 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:07,671 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:07,671 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:08,390 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:08,390 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:08,968 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:08,968 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:09,468 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:09,468 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:10,234 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:10,234 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:10,734 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:10,734 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:11,437 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:11,437 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:12,140 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:12,140 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:12,656 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:12,656 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:13,218 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:13,218 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:13,812 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:13,812 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:14,468 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:14,468 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:15,171 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:15,171 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:15,671 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:15,671 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:16,390 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:16,390 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:17,062 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:17,062 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:17,609 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:17,609 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:18,328 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:18,328 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:18,921 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:18,921 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:19,531 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:19,531 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:20,046 DEBUG FileConsumer - Total 1 files to consume
2009-07-15 12:15:20,046 DEBUG FileConsumer - Endpoint[file://src/test/data]
cannot begin processing file: GenericFile[csv.txt]
2009-07-15 12:15:20,406 DEBUG MockEndpoint - Took 24953 millis to complete
latch
2009-07-15 12:15:20,406 DEBUG SpringMethodRoadie - Test method [public void
org.apache.camel.dataformat.bindy.csv.BindySimpleCsvUnmarshallTest.testUnMarshallMessage()
throws java.lang.Exception] threw exception: java.lang.AssertionError:
mock://result Received message count. Expected: <1> but was: <0>
2009-07-15 12:15:20,421 DEBUG DirtiesContextTestExecutionListener - After
test method: context [[TestContext@19ee1ac testClass =
BindySimpleCsvUnmarshallTest, locations =
array<String>['org.apache.camel.dataformat.bindy.csv.BindySimpleCsvUnmarshallTest$ContextConfig'],
testInstance =
org.apache.camel.dataformat.bindy.csv.BindySimpleCsvUnmarshallTest@1f1fba0,
testMethod = testUnMarshallMessage@BindySimpleCsvUnmarshallTest,
testException = java.lang.AssertionError: mock://result Received message
count. Expected: <1> but was: <0>]], dirtiesContext [false].
2009-07-15 12:15:20,437 INFO  GenericApplicationContext - Closing
org.springframework.context.support.GenericApplicationContext@17f409c:
display name
[org.springframework.context.support.GenericApplicationContext@17f409c];
startup date [Wed Jul 15 12:14:55 CEST 2009]; parent:
org.springframework.config.java.context.JavaConfigApplicationContext@167d940
2009-07-15 12:15:20,437 DEBUG SpringCamelContext - onApplicationEvent:
org.springframework.context.event.ContextClosedEvent[source=org.springframework.context.support.GenericApplicationContext@17f409c:
display name
[org.springframework.context.support.GenericApplicationContext@17f409c];
startup date [Wed Jul 15 12:14:55 CEST 2009]; parent:
org.springframework.config.java.context.JavaConfigApplicationContext@167d940]

2009-07-15 12:15:20,437 INFO  DefaultListableBeanFactory - Destroying
singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@296f76:
defining beans
[org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,camelBeanPostProcessor];
parent:
org.springframework.beans.factory.support.DefaultListableBeanFactory@176c74b

Is the reason related to an exception occuring during the processing ?

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message