Option 3) works fine. On Wed, Aug 29, 2012 at 10:01 PM, Daniel Kulp <dk...@apache.org> wrote:
> > It's a semi-Jetty issue. If you use Keep-Alive connections (the > default), Jetty has issues shutting down the port for some reason. It > holds the port in some sort of strange semi-open state that accepts > connections but doesn't properly process things. Never really had time to > investigate any potential workarounds or fixes. > > Couple of solutions: > 1) Turn off the keep-alives in the connections > > 2) Put a "Thread.sleep(60000)" between the tests. (might just be 10000) > to wait for the keep-alive to timeout. Yea, not recommended, but thought > I'd mention it. :-) > > 3) Set the System property: > "org.apache.cxf.transports.http_jetty.DontClosePort." + port > (port is the port number you are using) to true. > > which tells CXF to just keep the port open and not make any attempt to > close it. Thus, when the second server starts up, it just registers on > the already running instance. This is what we do for all the Camel and > CXF unit/system tests. > > > Dan > > > > > On Aug 29, 2012, at 12:25 PM, Charles Moulliard <ch0...@gmail.com> wrote: > > > Hi, > > > > I have a unit test issue with camel (2.7.1) and cxf. One camel test class > > (extending CamelSpringTestSupport) contain 2 unit tests where we call a > web > > service exposed by a camel route using a CamelProducerTemplate. Tests > > executed individually pass well but If I would like to execute both > tests, > > I get an exception that the jetty server of CXF cannot respond on the > > socket. I have tried to add @DirtiesContext for each individual unit test > > (to force Spring to create a new CamelContext) but that does not help. It > > seems that when the second test is executed by Junit/Spring, it tries to > > call the Jetty server created during execution of the first test. > > > > Any idea is welcome ? > > > > Regards, > > -- > > Charles Moulliard > > Apache Committer / Sr. Pr. Consultant at FuseSource.com > > Twitter : @cmoulliard > > Blog : http://cmoulliard.blogspot.com > > -- > Daniel Kulp > dk...@apache.org - http://dankulp.com/blog > Talend Community Coder - http://coders.talend.com > > -- Charles Moulliard Apache Committer / Sr. Pr. Consultant at FuseSource.com Twitter : @cmoulliard Blog : http://cmoulliard.blogspot.com