Hi,

I have a Spring config which defines my jaws:server to be listening on a local 
transport. I load this config in my JUnit as follows:

@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:conf/spring/AppContext.xml" })
@ActiveProfiles(profiles = { "integration-tests" })


 Within the JUnit I have a test which creates a JaxWsProxyBean and sends a 
request in..

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(Test.class);
factory.setAddress("local://test");
…..

All works fine if this is the only JUnit in my Maven project but as soon as I 
have another JUnit which also loads the Spring config using the above 
annotations, I get an error stating:

"Local destination does not have a MessageObserver on address local://test"..

It seems the 2 tests are interfering with each other.

I have added a teardown method to try & shutdown all the cxf stuff but this 
doesn't seem to help. 

        @After
        public void teardown() throws Exception {
                EndpointImpl endpoint = (EndpointImpl) applicationContext
                                .getBean("myEndPoint");
                endpoint.getServer().destroy();
                LocalTransportFactory localFactory = 
applicationContext.getBean(LocalTransportFactory.class);
                localFactory.getBus().shutdown(true);
                localFactory.unregister();

        }

Any help would be very much appreciated!

Thanks
Mandy


Reply via email to