Hello,

Ok, I realize than my previous post was very vague, so i'll try to give more
context information:

The test class extends Spring 3's AbstractJUnit4SpringContextTests.
The test method is annotated with @Test, @DirtiesContext and
@Timed(millis=20000). This latter annotation can set the test to failed if
it took too much time.

The @After method is as follow:

        @After
public void stopAllContexts() throws Exception {
Collection<CamelContext> contexts =
applicationContext.getBeansOfType(CamelContext.class).values();
for (CamelContext context : contexts) {
LOGGER.info("About to shutdown Context {} with {} inflight exchanges...",
context.getName(), context
.getInflightRepository().size());
context.stop();
}
}


Initially, I was using this method in conjunction with the @DirtiesContext
annotation to clean/restart the camel contexts (several in my application)
before each test. Currently, I have two test methods, but the second one is
annotated with @Ignore.

The application uses Camel 2.7.1 with Java6. Eclipse Helios (the provided
JUnit test runner) vs Maven 3.0 with surefire (mvn clean test)

The route that causes troubles is the following:

from("{{endpoint.phase1.file.incoming}}").routeId("stock.route.phase1.fileValidation")
.convertBodyTo(SAXSource.class)
.log(LoggingLevel.INFO, "[Phase1] Starting validating file
'${header.CamelFileName}' (phase1)")
.to("{{endpoint.phase1.file.validation}}")
.log(LoggingLevel.INFO, "[Phase1] File '${header.CamelFileName}' validation
done.")
.convertBodyTo(GenericFile.class).to("{{endpoint.phase1.file.splitting}}")
.log(LoggingLevel.INFO, "[Phase1] Done with file '${header.CamelFileName}'
validation and splitting");

with endpoint.phase1.file.incoming=file:D:/tmp/integration
and endpoint.phase1.file.validation=validator:xsd/my.xsd?useDom=false

Basically, the route endpoint takes a file (GenericFile) that is converted
into a SAXSource to be validated against an XSD, then converted back into a
GenericFile to be stream/splitted later on a following route.

Regards,
/Xavier

On Wed, Jun 1, 2011 at 6:37 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:

> On Wed, Jun 1, 2011 at 5:01 PM, Xavier Coulon <xcou...@gmail.com> wrote:
> > Hello,
> >
> > I'm having an issue with the File Component in my test case. Running a
> test
> > from within Eclipse works fine, running the exact same test with Maven
> fails
> > because of a timeout I set on the test method.
> >
>
> What do you mean by timeout I set on the test method?
>
> And what version of Camel are you using?
>
> And how do you run it from Maven? And from Eclipse?
>
> And what does your route do.
>
>
>
> > On the Eclipse side, during the route with a file endpoint is shutdown
> with
> > the following messages:
> > ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy:suspendNow]
> > Suspending: Consumer[file://D:/tmp/integration]
> > [16:12:06,735][TRACE][Camel (context1) thread #18 -
> > ShutdownTask][org.apache.camel.util.ServiceHelper:suspendService]
> Suspending
> > service Consumer[file://D:/tmp/integration]
> > [16:12:06,735][DEBUG][Camel (context1) thread #18 -
> > ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy:suspendNow]
> > Suspend complete for: Consumer[file://D:/tmp/integration]
> > [16:12:06,735][ INFO][Camel (context1) thread #18 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > Route: stock.route.phase1.fileValidation suspended and shutdown deferred,
> > was consuming from: Endpoint[file://D:/tmp/integration]
> > [16:12:06,735][DEBUG][Camel (context1) thread #18 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > Route: stock.route.phase1.xml.aggregation preparing to shutdown.
> > [16:12:06,735][ INFO][Camel (context1) thread #18 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > Route: stock.route.phase1.xml.aggregation preparing to shutdown complete.
> > [16:12:06,735][DEBUG][Camel (context1) thread #18 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > Route: stock.route.phase1.fileSplitting preparing to shutdown.
> > [16:12:07,157][TRACE][Camel (context1) thread #6 -
> >
> file://D:/tmp/integration][org.apache.camel.impl.ScheduledPollConsumer:run]
> > Cannot start to poll: Endpoint[file://D:/tmp/integration] as its
> suspended
> > [16:12:07,251][ INFO][Camel (context1) thread #18 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > Route: stock.route.phase1.fileSplitting preparing to shutdown complete.
> > [16:12:07,251][DEBUG][Camel (context1) thread #18 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > Route: stock.route.phase1.fileValidation preparing to shutdown.
> > [16:12:07,251][ INFO][Camel (context1) thread #18 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > Route: stock.route.phase1.fileValidation preparing to shutdown complete.
> > [16:12:07,251][TRACE][Camel (context1) thread #18
> >
> > With Maven, I have the following messages:
> > [16:16:01,670][TRACE][Camel (context1) thread #19 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > Shutting down route: stock.route.phase1.fileValidation with options
> > [Default,CompleteCurrentTaskOnly]
> > [16:16:01,670][TRACE][Camel (context1) thread #19 -
> > ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy:suspendNow]
> > Suspending: Consumer[file://D:/tmp/integration]
> > [16:16:01,670][TRACE][Camel (context1) thread #19 -
> > ShutdownTask][org.apache.camel.util.ServiceHelper:suspendService]
> Suspending
> > service Consumer[file://D:/tmp/integration]
> > [16:16:01,670][DEBUG][Camel (context1) thread #19 -
> > ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy:suspendNow]
> > Suspend complete for: Consumer[file://D:/tmp/integration]
> > [16:16:01,670][ INFO][Camel (context1) thread #19 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > Route: stock.route.phase1.fileValidation suspended and shutdown deferred,
> > was consuming from: Endpoint[file://D:/tmp/integration]
> > [16:16:01,670][DEBUG][Camel (context1) thread #19 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > 1 inflight and pending exchanges for consumer:
> > Consumer[file://D:/tmp/integration]
> > [16:16:01,670][ INFO][Camel (context1) thread #19 -
> >
> ShutdownTask][org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask:run]
> > Waiting as there are still 1 inflight and pending exchanges to complete,
> > timeout in 300 seconds.
> >
> > and this lasts for 300s, until the shutdown is forced..
> >
> > The weird thing is that there should be only one exchange in this route,
> and
> > it was processed in other routes after this one...
> >
> > I don't know if it's related to the way tests are run with Maven, but is
> > there anything I could add to get rid of the stuck inflight exchange ?
> >
> > Thank you in advance
> > Regards,
> > --
> > Xavier
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Xavier

Reply via email to