Hi,
I believe OS need some time to reclaim the port, that's why your test
failure if you run a bunch of tests together using same port.
In CXF we use dynamic ports for system tests, you may need take a look.
Freeman
On 2011-5-26, at 下午1:06, ext2 wrote:
Hi:
I wrote several test cases in my project. If I run them one by one,
they are
all ok; But if I using "mvn test" to run all test cases at once,
there are
some test case failure occasionally.
Each test case will start a jaxw-ws service configured by spring and
destroy
it after test case end;
I have tried to avoid such problem. it seems I must using different
http
server port for different test case. But it is exhaust to assign
different
port for different test case.
Does anyone know how to resolve such problem?
By the way , I have try to find the answer by checking source code
of CXF.
And add some log in JettyHttpEngine.shutdown(). I am sure the created
JettyHttpEngine have been shutdown correctly;
The structure of my test cases are both like as following:
1) using a spring xml to configure a jaxws service: etc
<jaxws:endpoint id="mtomBean" implementor=".... "
address="http://localhost:9000/service/mtomRequest64Response64" ...>
2) start the spring configured service at TestCase's setup()
procedure:
@Before
void setup(){
ClassPathXmlApplicationContext context = new
ClassPathXmlApplicationContext(
"mtom/mtom-server-bean.xml");
context.start();
}
3) stop the spring configured service at TestCase's cleanup()
procedure:
{
context.destroy(); //I also tried context.stop();
}
4) do the client's invoke and assertions in TestCase's testXXX case;
---------------------------------------------
Freeman Fang
FuseSource
Email:[email protected]
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference