You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jp...@apache.org on 2013/07/27 06:17:50 UTC
svn commit: r1507571 -
/cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/WsdlGetUtilsTest.java
Author: jpell
Date: Sat Jul 27 04:17:47 2013
New Revision: 1507571
URL: http://svn.apache.org/r1507571
Log:
CXF-5151 ensure the server is shut down after the test.
Modified:
cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/WsdlGetUtilsTest.java
Modified: cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/WsdlGetUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/WsdlGetUtilsTest.java?rev=1507571&r1=1507570&r2=1507571&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/WsdlGetUtilsTest.java (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/WsdlGetUtilsTest.java Sat Jul 27 04:17:47 2013
@@ -43,7 +43,6 @@ import org.junit.Test;
public class WsdlGetUtilsTest extends AbstractBusClientServerTestBase {
static final String PORT = allocatePort(Server.class);
- static Server server;
@WebService(targetNamespace = "org.apache.cxf.ws.WsdlTest")
public static class StuffImpl {
@@ -53,34 +52,38 @@ public class WsdlGetUtilsTest extends Ab
}
@BeforeClass
- public static void setUpBeforeClass() throws Exception {
+ public static void beforeClass() throws Exception {
createStaticBus();
-
- JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
- factory.setServiceBean(new StuffImpl());
- factory.setAddress("http://localhost:" + PORT + "/Stuff");
- server = factory.create();
}
-
+
@Test
public void testNewDocumentIsCreatedForEachWsdlRequest() {
- // FIXME - surely there is a better way to create a stubbed message and exchange
- Message message = new MessageImpl();
- Exchange exchange = new ExchangeImpl();
- exchange.put(Bus.class, getBus());
- exchange.put(Service.class, server.getEndpoint().getService());
- exchange.put(Endpoint.class, server.getEndpoint());
- message.setExchange(exchange);
-
- Map<String, String> map = UrlUtils.parseQueryString("wsdl");
- String baseUri = "http://localhost:" + PORT + "/Stuff";
- String ctx = "/Stuff";
-
- WSDLGetUtils utils = new WSDLGetUtils();
- Document doc = utils.getDocument(message, baseUri, map, ctx, server.getEndpoint().getEndpointInfo());
-
- Document doc2 = utils.getDocument(message, baseUri, map, ctx, server.getEndpoint().getEndpointInfo());
-
- assertFalse(doc == doc2);
+ JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+ factory.setServiceBean(new StuffImpl());
+ factory.setAddress("http://localhost:" + PORT + "/Stuff");
+ Server server = factory.create();
+
+ try {
+ // FIXME - surely there is a better way to create a stubbed message and exchange
+ Message message = new MessageImpl();
+ Exchange exchange = new ExchangeImpl();
+ exchange.put(Bus.class, getBus());
+ exchange.put(Service.class, server.getEndpoint().getService());
+ exchange.put(Endpoint.class, server.getEndpoint());
+ message.setExchange(exchange);
+
+ Map<String, String> map = UrlUtils.parseQueryString("wsdl");
+ String baseUri = "http://localhost:" + PORT + "/Stuff";
+ String ctx = "/Stuff";
+
+ WSDLGetUtils utils = new WSDLGetUtils();
+ Document doc = utils.getDocument(message, baseUri, map, ctx, server.getEndpoint().getEndpointInfo());
+
+ Document doc2 = utils.getDocument(message, baseUri, map, ctx, server.getEndpoint().getEndpointInfo());
+
+ assertFalse(doc == doc2);
+ } finally {
+ server.stop();
+ }
}
}