You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/06/03 22:33:30 UTC
svn commit: r951144 [1/2] - in /cxf/trunk:
systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/
systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/
systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/
systests/jaxws/src/test/ja...
Author: dkulp
Date: Thu Jun 3 20:33:29 2010
New Revision: 951144
URL: http://svn.apache.org/viewvc?rev=951144&view=rev
Log:
Update all of jaxws system tests to use dynamic port numbers
Modified:
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/Server.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationUsingAddNumbersTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerServer.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/Server.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans.xml
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AnyClientServerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/Server.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBase.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBaseNoWsdl.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterNoWsdl.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMixedStyle.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerXMLBinding.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentServer.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderRPCClientServerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/Server.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/XMLServer.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/datasource/DataSourceProviderTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/datasource/Server.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/Server.java
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractTestServerBase.java
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java Thu Jun 3 20:33:29 2010
@@ -35,6 +35,7 @@ import javax.xml.transform.dom.DOMSource
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.BindingProvider;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Endpoint;
import javax.xml.ws.Response;
@@ -57,6 +58,7 @@ import org.apache.cxf.interceptor.Loggin
import org.apache.cxf.jaxws.DispatchImpl;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.apache.hello_world_soap_http.BadRecordLitFault;
@@ -70,15 +72,20 @@ import org.junit.Test;
public class DispatchClientServerTest extends AbstractBusClientServerTestBase {
- private final QName serviceName = new QName("http://apache.org/hello_world_soap_http",
- "SOAPDispatchService");
- private final QName portName = new QName("http://apache.org/hello_world_soap_http", "SoapDispatchPort");
+ private static final QName SERVICE_NAME
+ = new QName("http://apache.org/hello_world_soap_http", "SOAPDispatchService");
+ private static final QName PORT_NAME
+ = new QName("http://apache.org/hello_world_soap_http", "SoapDispatchPort");
+ private static String greeterPort = TestUtil.getPortNumber(DispatchClientServerTest.class);
+
public static class Server extends AbstractBusTestServerBase {
protected void run() {
Object implementor = new GreeterImpl();
- String address = "http://localhost:9006/SOAPDispatchService/SoapDispatchPort";
+ String address = "http://localhost:"
+ + TestUtil.getPortNumber(DispatchClientServerTest.class)
+ + "/SOAPDispatchService/SoapDispatchPort";
Endpoint.publish(address, implementor);
}
@@ -135,6 +142,10 @@ public class DispatchClientServerTest ex
Dispatch<SOAPMessage> disp = service
.createDispatch(otherPortName, SOAPMessage.class, Service.Mode.MESSAGE);
+ disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:"
+ + TestUtil.getPortNumber("fake-port")
+ + "/SOAPDispatchService/SoapDispatchPort");
DispatchImpl dispImpl = (DispatchImpl)disp;
HTTPConduit cond = (HTTPConduit)dispImpl.getClient().getConduit();
@@ -163,12 +174,16 @@ public class DispatchClientServerTest ex
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
- SOAPService service = new SOAPService(wsdl, serviceName);
+ SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
assertNotNull(service);
Dispatch<SOAPMessage> disp = service
- .createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
-
+ .createDispatch(PORT_NAME, SOAPMessage.class, Service.Mode.MESSAGE);
+ disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:"
+ + greeterPort
+ + "/SOAPDispatchService/SoapDispatchPort");
+
// Test request-response
InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is);
@@ -220,12 +235,14 @@ public class DispatchClientServerTest ex
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull(service);*/
- Service service = Service.create(serviceName);
+ Service service = Service.create(SERVICE_NAME);
assertNotNull(service);
- service.addPort(portName, "http://schemas.xmlsoap.org/soap/",
- "http://localhost:9006/SOAPDispatchService/SoapDispatchPort");
+ service.addPort(PORT_NAME, "http://schemas.xmlsoap.org/soap/",
+ "http://localhost:"
+ + greeterPort
+ + "/SOAPDispatchService/SoapDispatchPort");
- Dispatch<DOMSource> disp = service.createDispatch(portName, DOMSource.class, Service.Mode.MESSAGE);
+ Dispatch<DOMSource> disp = service.createDispatch(PORT_NAME, DOMSource.class, Service.Mode.MESSAGE);
InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is);
@@ -283,12 +300,13 @@ public class DispatchClientServerTest ex
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull(service);*/
- Service service = Service.create(serviceName);
+ Service service = Service.create(SERVICE_NAME);
assertNotNull(service);
- service.addPort(portName, "http://schemas.xmlsoap.org/soap/",
- "http://localhost:9006/SOAPDispatchService/SoapDispatchPort");
+ service.addPort(PORT_NAME, "http://schemas.xmlsoap.org/soap/",
+ "http://localhost:"
+ + greeterPort + "/SOAPDispatchService/SoapDispatchPort");
- Dispatch<DOMSource> disp = service.createDispatch(portName, DOMSource.class, Service.Mode.PAYLOAD);
+ Dispatch<DOMSource> disp = service.createDispatch(PORT_NAME, DOMSource.class, Service.Mode.PAYLOAD);
InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is);
@@ -356,11 +374,15 @@ public class DispatchClientServerTest ex
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
- SOAPService service = new SOAPService(wsdl, serviceName);
+ SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
assertNotNull(service);
JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_soap_http.types");
- Dispatch<Object> disp = service.createDispatch(portName, jc, Service.Mode.PAYLOAD);
+ Dispatch<Object> disp = service.createDispatch(PORT_NAME, jc, Service.Mode.PAYLOAD);
+ disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:"
+ + greeterPort
+ + "/SOAPDispatchService/SoapDispatchPort");
String expected = "Hello Jeeves";
GreetMe greetMe = new GreetMe();
@@ -446,12 +468,16 @@ public class DispatchClientServerTest ex
String bindingId = "http://schemas.xmlsoap.org/wsdl/soap/";
String endpointUrl = "http://localhost:9006/SOAPDispatchService/SoapDispatchPort";
- Service service = Service.create(wsdl, serviceName);
- service.addPort(portName, bindingId, endpointUrl);
+ Service service = Service.create(wsdl, SERVICE_NAME);
+ service.addPort(PORT_NAME, bindingId, endpointUrl);
assertNotNull(service);
JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_soap_http.types");
- Dispatch<Object> disp = service.createDispatch(portName, jc, Service.Mode.PAYLOAD);
+ Dispatch<Object> disp = service.createDispatch(PORT_NAME, jc, Service.Mode.PAYLOAD);
+ disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:"
+ + greeterPort
+ + "/SOAPDispatchService/SoapDispatchPort");
String expected = "Hello Jeeves";
GreetMe greetMe = new GreetMe();
@@ -480,7 +506,7 @@ public class DispatchClientServerTest ex
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
- SOAPService service = new SOAPService(wsdl, serviceName);
+ SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
assertNotNull(service);
InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
@@ -488,7 +514,11 @@ public class DispatchClientServerTest ex
SAXSource saxSourceReq = new SAXSource(inputSource);
assertNotNull(saxSourceReq);
- Dispatch<SAXSource> disp = service.createDispatch(portName, SAXSource.class, Service.Mode.MESSAGE);
+ Dispatch<SAXSource> disp = service.createDispatch(PORT_NAME, SAXSource.class, Service.Mode.MESSAGE);
+ disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:"
+ + greeterPort
+ + "/SOAPDispatchService/SoapDispatchPort");
SAXSource saxSourceResp = disp.invoke(saxSourceReq);
assertNotNull(saxSourceResp);
String expected = "Hello TestSOAPInputMessage";
@@ -535,10 +565,14 @@ public class DispatchClientServerTest ex
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
- SOAPService service = new SOAPService(wsdl, serviceName);
+ SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
assertNotNull(service);
- Dispatch<SAXSource> disp = service.createDispatch(portName, SAXSource.class, Service.Mode.PAYLOAD);
+ Dispatch<SAXSource> disp = service.createDispatch(PORT_NAME, SAXSource.class, Service.Mode.PAYLOAD);
+ disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:"
+ + greeterPort
+ + "/SOAPDispatchService/SoapDispatchPort");
// Test request-response
InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq.xml");
@@ -602,10 +636,14 @@ public class DispatchClientServerTest ex
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
- SOAPService service = new SOAPService(wsdl, serviceName);
+ SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
assertNotNull(service);
- Dispatch<StreamSource> disp = service.createDispatch(portName, StreamSource.class,
+ Dispatch<StreamSource> disp = service.createDispatch(PORT_NAME, StreamSource.class,
Service.Mode.MESSAGE);
+ disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:"
+ + greeterPort
+ + "/SOAPDispatchService/SoapDispatchPort");
InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
StreamSource streamSourceReq = new StreamSource(is);
@@ -649,10 +687,14 @@ public class DispatchClientServerTest ex
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
- SOAPService service = new SOAPService(wsdl, serviceName);
+ SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
assertNotNull(service);
- Dispatch<StreamSource> disp = service.createDispatch(portName, StreamSource.class,
+ Dispatch<StreamSource> disp = service.createDispatch(PORT_NAME, StreamSource.class,
Service.Mode.PAYLOAD);
+ disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:"
+ + greeterPort
+ + "/SOAPDispatchService/SoapDispatchPort");
InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq.xml");
StreamSource streamSourceReq = new StreamSource(is);
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java Thu Jun 3 20:33:29 2010
@@ -27,6 +27,7 @@ import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingProvider;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
@@ -36,6 +37,7 @@ import org.w3c.dom.Node;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.TestUtil;
import org.apache.hello_world_xml_http.wrapped.XMLService;
import org.apache.hello_world_xml_http.wrapped.types.GreetMe;
import org.apache.hello_world_xml_http.wrapped.types.GreetMeResponse;
@@ -44,28 +46,32 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class DispatchXMLClientServerTest extends AbstractBusClientServerTestBase {
- private final QName serviceName = new QName("http://apache.org/hello_world_xml_http/wrapped",
- "XMLService");
- private final QName portName = new QName("http://apache.org/hello_world_xml_http/wrapped",
- "XMLDispatchPort");
+ private static final QName SERVICE_NAME
+ = new QName("http://apache.org/hello_world_xml_http/wrapped", "XMLService");
+ private static final QName PORT_NAME
+ = new QName("http://apache.org/hello_world_xml_http/wrapped", "XMLDispatchPort");
+ private static String port = TestUtil.getPortNumber(DispatchXMLClientServerTest.class);
@BeforeClass
public static void startServers() throws Exception {
+
assertTrue("server did not launch correctly", launchServer(Server.class));
}
@Test
public void testJAXBMESSAGE() throws Exception {
- Service service = Service.create(serviceName);
+ Service service = Service.create(SERVICE_NAME);
assertNotNull(service);
- service.addPort(portName, "http://cxf.apache.org/bindings/xformat",
- "http://localhost:9007/XMLService/XMLDispatchPort");
+ service.addPort(PORT_NAME, "http://cxf.apache.org/bindings/xformat",
+ "http://localhost:"
+ + port
+ + "/XMLService/XMLDispatchPort");
GreetMe gm = new GreetMe();
gm.setRequestType("CXF");
JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class);
- Dispatch<Object> disp = service.createDispatch(portName, ctx, Service.Mode.MESSAGE);
+ Dispatch<Object> disp = service.createDispatch(PORT_NAME, ctx, Service.Mode.MESSAGE);
GreetMeResponse resp = (GreetMeResponse)disp.invoke(gm);
assertNotNull(resp);
assertEquals("Hello CXF", resp.getResponseType());
@@ -85,16 +91,18 @@ public class DispatchXMLClientServerTest
XMLService service = new XMLService(wsdl, serviceName);
assertNotNull(service);*/
- Service service = Service.create(serviceName);
+ Service service = Service.create(SERVICE_NAME);
assertNotNull(service);
- service.addPort(portName, "http://cxf.apache.org/bindings/xformat",
- "http://localhost:9007/XMLService/XMLDispatchPort");
+ service.addPort(PORT_NAME, "http://cxf.apache.org/bindings/xformat",
+ "http://localhost:"
+ + port
+ + "/XMLService/XMLDispatchPort");
InputStream is = getClass().getResourceAsStream("/messages/XML_GreetMeDocLiteralReq.xml");
StreamSource reqMsg = new StreamSource(is);
assertNotNull(reqMsg);
- Dispatch<Source> disp = service.createDispatch(portName, Source.class, Service.Mode.MESSAGE);
+ Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
Source source = disp.invoke(reqMsg);
assertNotNull(source);
@@ -109,7 +117,7 @@ public class DispatchXMLClientServerTest
URL wsdl = getClass().getResource("/wsdl/hello_world_xml_wrapped.wsdl");
assertNotNull(wsdl);
- XMLService service = new XMLService(wsdl, serviceName);
+ XMLService service = new XMLService(wsdl, SERVICE_NAME);
assertNotNull(service);
InputStream is = getClass().getResourceAsStream("/messages/XML_GreetMeDocLiteralReq.xml");
@@ -117,7 +125,12 @@ public class DispatchXMLClientServerTest
DOMSource reqMsg = new DOMSource(doc);
assertNotNull(reqMsg);
- Dispatch<DOMSource> disp = service.createDispatch(portName, DOMSource.class, Service.Mode.PAYLOAD);
+ Dispatch<DOMSource> disp = service.createDispatch(PORT_NAME, DOMSource.class,
+ Service.Mode.PAYLOAD);
+ disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:"
+ + port
+ + "/XMLService/XMLDispatchPort");
DOMSource result = disp.invoke(reqMsg);
assertNotNull(result);
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/Server.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/Server.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/Server.java Thu Jun 3 20:33:29 2010
@@ -23,6 +23,7 @@ package org.apache.cxf.systest.dispatch;
import javax.xml.ws.Endpoint;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
import org.apache.hello_world_xml_http.wrapped.GreeterImpl;
@@ -30,7 +31,9 @@ public class Server extends AbstractBusT
protected void run() {
Object implementor = new GreeterImpl();
- String address = "http://localhost:9007/XMLService/XMLDispatchPort";
+ String address = "http://localhost:"
+ + TestUtil.getPortNumber(DispatchXMLClientServerTest.class)
+ + "/XMLService/XMLDispatchPort";
Endpoint.publish(address, implementor);
}
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java Thu Jun 3 20:33:29 2010
@@ -53,6 +53,7 @@ import javax.xml.ws.http.HTTPException;
import javax.xml.ws.soap.SOAPFaultException;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.TestUtil;
import org.apache.handlers.AddNumbersService;
import org.apache.handlers.types.AddNumbersResponse;
import org.apache.handlers.types.ObjectFactory;
@@ -62,12 +63,19 @@ import org.junit.Test;
public class DispatchHandlerInvocationTest extends AbstractBusClientServerTestBase {
+ private static String addNumbersAddress
+ = "http://localhost:" + TestUtil.getPortNumber(HandlerServer.class, 1)
+ + "/handlers/AddNumbersService/AddNumbersPort";
+ private static String greeterAddress = "http://localhost:"
+ + TestUtil.getPortNumber(HandlerServer.class, 2) + "/XMLService/XMLDispatchPort";
private final QName serviceName = new QName("http://apache.org/handlers", "AddNumbersService");
private final QName portName = new QName("http://apache.org/handlers", "AddNumbersPort");
private final QName portNameXML = new QName("http://apache.org/hello_world_xml_http/wrapped",
"XMLDispatchPort");
+
+
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly", launchServer(HandlerServer.class));
@@ -83,7 +91,8 @@ public class DispatchHandlerInvocationTe
JAXBContext jc = JAXBContext.newInstance("org.apache.handlers.types");
Dispatch<Object> disp = service.createDispatch(portName, jc, Service.Mode.PAYLOAD);
-
+ setAddress(disp, addNumbersAddress);
+
TestHandler handler = new TestHandler();
TestSOAPHandler soapHandler = new TestSOAPHandler();
addHandlersProgrammatically(disp, handler, soapHandler);
@@ -109,6 +118,7 @@ public class DispatchHandlerInvocationTe
assertNotNull(service);
Dispatch<DOMSource> disp = service.createDispatch(portName, DOMSource.class, Mode.MESSAGE);
+ setAddress(disp, addNumbersAddress);
TestHandler handler = new TestHandler();
TestSOAPHandler soapHandler = new TestSOAPHandler();
@@ -132,6 +142,7 @@ public class DispatchHandlerInvocationTe
assertNotNull(service);
Dispatch<DOMSource> disp = service.createDispatch(portName, DOMSource.class, Mode.PAYLOAD);
+ setAddress(disp, addNumbersAddress);
TestHandler handler = new TestHandler();
TestSOAPHandler soapHandler = new TestSOAPHandler();
@@ -155,6 +166,7 @@ public class DispatchHandlerInvocationTe
assertNotNull(service);
Dispatch<SOAPMessage> disp = service.createDispatch(portName, SOAPMessage.class, Mode.MESSAGE);
+ setAddress(disp, addNumbersAddress);
TestHandler handler = new TestHandler();
TestSOAPHandler soapHandler = new TestSOAPHandler();
@@ -178,6 +190,7 @@ public class DispatchHandlerInvocationTe
assertNotNull(service);
Dispatch<SOAPMessage> disp = service.createDispatch(portName, SOAPMessage.class, Mode.PAYLOAD);
+ setAddress(disp, addNumbersAddress);
TestHandler handler = new TestHandler();
TestSOAPHandler soapHandler = new TestSOAPHandler();
@@ -205,6 +218,7 @@ public class DispatchHandlerInvocationTe
assertNotNull(service);
Dispatch<DOMSource> disp = service.createDispatch(portNameXML, DOMSource.class, Mode.MESSAGE);
+ setAddress(disp, addNumbersAddress);
TestHandlerXMLBinding handler = new TestHandlerXMLBinding();
addHandlersProgrammatically(disp, handler);
@@ -227,6 +241,7 @@ public class DispatchHandlerInvocationTe
assertNotNull(service);
Dispatch<DOMSource> disp = service.createDispatch(portNameXML, DOMSource.class, Mode.PAYLOAD);
+ setAddress(disp, addNumbersAddress);
TestHandlerXMLBinding handler = new TestHandlerXMLBinding();
addHandlersProgrammatically(disp, handler);
@@ -249,6 +264,7 @@ public class DispatchHandlerInvocationTe
assertNotNull(service);
Dispatch<DataSource> disp = service.createDispatch(portNameXML, DataSource.class, Mode.MESSAGE);
+ setAddress(disp, addNumbersAddress);
TestHandlerXMLBinding handler = new TestHandlerXMLBinding();
addHandlersProgrammatically(disp, handler);
@@ -273,6 +289,7 @@ public class DispatchHandlerInvocationTe
assertNotNull(service);
Dispatch<DataSource> disp = service.createDispatch(portNameXML, DataSource.class, Mode.PAYLOAD);
+ setAddress(disp, addNumbersAddress);
TestHandlerXMLBinding handler = new TestHandlerXMLBinding();
addHandlersProgrammatically(disp, handler);
@@ -299,6 +316,7 @@ public class DispatchHandlerInvocationTe
JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_xml_http.wrapped.types");
Dispatch<Object> disp = service.createDispatch(portNameXML, jc, Mode.MESSAGE);
+ setAddress(disp, greeterAddress);
TestHandlerXMLBinding handler = new TestHandlerXMLBinding();
addHandlersProgrammatically(disp, handler);
@@ -324,6 +342,7 @@ public class DispatchHandlerInvocationTe
JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_xml_http.wrapped.types");
Dispatch<Object> disp = service.createDispatch(portNameXML, jc, Mode.PAYLOAD);
+ setAddress(disp, greeterAddress);
TestHandlerXMLBinding handler = new TestHandlerXMLBinding();
addHandlersProgrammatically(disp, handler);
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java Thu Jun 3 20:33:29 2010
@@ -63,6 +63,7 @@ import org.apache.cxf.common.util.Packag
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.TestUtil;
import org.apache.handler_test.HandlerTest;
import org.apache.handler_test.HandlerTestService;
import org.apache.handler_test.PingException;
@@ -73,6 +74,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class HandlerInvocationTest extends AbstractBusClientServerTestBase {
+ private static String port = TestUtil.getPortNumber(Server.class);
private final QName serviceName = new QName("http://apache.org/handler_test", "HandlerTestService");
private final QName portName = new QName("http://apache.org/handler_test", "SoapPort");
@@ -94,6 +96,7 @@ public class HandlerInvocationTest exten
wsdl = HandlerInvocationTest.class.getResource("/wsdl/handler_test.wsdl");
service = new HandlerTestService(wsdl, serviceName);
handlerTest = service.getPort(portName, HandlerTest.class);
+ setAddress(handlerTest, "http://localhost:" + port + "/HandlerTest/SoapPort");
} catch (Exception ex) {
ex.printStackTrace();
fail(ex.toString());
@@ -110,6 +113,7 @@ public class HandlerInvocationTest exten
service.setHandlerResolver(myHandlerResolver);
HandlerTest handlerTestNew = service.getPort(portName, HandlerTest.class);
+ setAddress(handlerTestNew, "http://localhost:" + port + "/HandlerTest/SoapPort");
handlerTestNew.pingOneWay();
@@ -1141,6 +1145,8 @@ public class HandlerInvocationTest exten
public void testHandlersInvokedForDispatch() throws Exception {
Dispatch<SOAPMessage> disp = service
.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
+ setAddress(disp, "http://localhost:" + port + "/HandlerTest/SoapPort");
+
TestHandler<LogicalMessageContext> handler1 = new TestHandler<LogicalMessageContext>(false);
TestHandler<LogicalMessageContext> handler2 = new TestHandler<LogicalMessageContext>(false);
TestSOAPHandler soapHandler1 = new TestSOAPHandler(false);
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationUsingAddNumbersTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationUsingAddNumbersTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationUsingAddNumbersTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationUsingAddNumbersTest.java Thu Jun 3 20:33:29 2010
@@ -39,6 +39,7 @@ import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.resource.ResourceManager;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.TestUtil;
import org.apache.handlers.AddNumbers;
import org.apache.handlers.AddNumbersService;
import org.apache.handlers.types.AddNumbersResponse;
@@ -51,7 +52,11 @@ public class HandlerInvocationUsingAddNu
static QName serviceName = new QName("http://apache.org/handlers", "AddNumbersService");
static QName portName = new QName("http://apache.org/handlers", "AddNumbersPort");
-
+
+ static String addNumbersAddress
+ = "http://localhost:" + TestUtil.getPortNumber(HandlerServer.class, 1)
+ + "/handlers/AddNumbersService/AddNumbersPort";
+
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly", launchServer(HandlerServer.class));
@@ -63,7 +68,7 @@ public class HandlerInvocationUsingAddNu
AddNumbersService service = new AddNumbersService(wsdl, serviceName);
AddNumbers port = (AddNumbers)service.getPort(portName, AddNumbers.class);
-
+ setAddress(port, addNumbersAddress);
SmallNumberHandler sh = new SmallNumberHandler();
addHandlersProgrammatically((BindingProvider)port, sh);
@@ -79,6 +84,7 @@ public class HandlerInvocationUsingAddNu
AddNumbersServiceWithAnnotation service = new AddNumbersServiceWithAnnotation(wsdl, serviceName);
AddNumbers port = (AddNumbers)service.getPort(portName, AddNumbers.class);
+ setAddress(port, addNumbersAddress);
int result = port.addNumbers(10, 20);
assertEquals(200, result);
@@ -96,7 +102,8 @@ public class HandlerInvocationUsingAddNu
JAXBContext jc = JAXBContext.newInstance("org.apache.handlers.types");
Dispatch<Object> disp = service.createDispatch(portName, jc, Service.Mode.PAYLOAD);
-
+ setAddress(disp, addNumbersAddress);
+
SmallNumberHandler sh = new SmallNumberHandler();
TestSOAPHandler soapHandler = new TestSOAPHandler<SOAPMessageContext>(false) {
public boolean handleMessage(SOAPMessageContext ctx) {
@@ -136,6 +143,7 @@ public class HandlerInvocationUsingAddNu
AddNumbersServiceWithAnnotation service = new AddNumbersServiceWithAnnotation(wsdl, serviceName);
AddNumbers port = (AddNumbers)service.getPort(portName, AddNumbers.class);
+ setAddress(port, addNumbersAddress);
List<Handler> handlerChain = ((BindingProvider)port).getBinding().getHandlerChain();
SmallNumberHandler h = (SmallNumberHandler)handlerChain.get(0);
@@ -156,6 +164,7 @@ public class HandlerInvocationUsingAddNu
AddNumbersServiceWithAnnotation service = new AddNumbersServiceWithAnnotation(wsdl, serviceName);
AddNumbers port = (AddNumbers)service.getPort(portName, AddNumbers.class);
+ setAddress(port, addNumbersAddress);
List<Handler> handlerChain = ((BindingProvider)port).getBinding().getHandlerChain();
SmallNumberHandler h = (SmallNumberHandler)handlerChain.get(0);
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerServer.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerServer.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerServer.java Thu Jun 3 20:33:29 2010
@@ -21,16 +21,22 @@ package org.apache.cxf.systest.handlers;
import javax.xml.ws.Endpoint;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
public class HandlerServer extends AbstractBusTestServerBase {
protected void run() {
+ String addNumbersPort = TestUtil.getPortNumber(HandlerServer.class, 1);
+ String greeterPort = TestUtil.getPortNumber(HandlerServer.class, 2);
+
Object implementor = new AddNumbersImpl();
- String address = "http://localhost:9025/handlers/AddNumbersService/AddNumbersPort";
+ String address = "http://localhost:"
+ + addNumbersPort + "/handlers/AddNumbersService/AddNumbersPort";
Endpoint.publish(address, implementor);
Object implementor1 = new org.apache.hello_world_xml_http.wrapped.GreeterImpl();
- String address1 = "http://localhost:9007/XMLService/XMLDispatchPort";
+ String address1 = "http://localhost:"
+ + greeterPort + "/XMLService/XMLDispatchPort";
Endpoint.publish(address1, implementor1);
}
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/Server.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/Server.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/Server.java Thu Jun 3 20:33:29 2010
@@ -25,12 +25,15 @@ import javax.xml.ws.Endpoint;
// import javax.xml.ws.handler.Handler;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
public class Server extends AbstractBusTestServerBase {
protected void run() {
+ String port = TestUtil.getPortNumber(Server.class);
+
Object implementor = new HandlerTestImpl();
- String address = "http://localhost:9005/HandlerTest/SoapPort";
+ String address = "http://localhost:" + port + "/HandlerTest/SoapPort";
Endpoint.publish(address, implementor);
}
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java Thu Jun 3 20:33:29 2010
@@ -20,6 +20,7 @@
package org.apache.cxf.systest.handlers;
import org.apache.cxf.test.AbstractCXFSpringTest;
+import org.apache.cxf.testutil.common.TestUtil;
import org.apache.handlers.AddNumbers;
import org.junit.Test;
@@ -27,7 +28,8 @@ import org.junit.Test;
*
*/
public class SpringConfiguredHandlerTest extends AbstractCXFSpringTest {
-
+ static String port = TestUtil.getPortNumber("springport");
+
@Override
protected String[] getConfigLocations() {
return new String[] {"classpath:/org/apache/cxf/systest/handlers/beans.xml" };
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java Thu Jun 3 20:33:29 2010
@@ -28,6 +28,8 @@ import org.apache.cxf.greeter_control.Gr
import org.apache.cxf.greeter_control.GreeterService;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
+import org.apache.cxf.testutil.common.TestUtil;
+
import org.junit.BeforeClass;
import org.junit.Test;
@@ -36,12 +38,14 @@ import org.junit.Test;
* returns true instead.
*/
public class TrivialSOAPHandlerTest extends AbstractClientServerTestBase {
-
+ static String address = "http://localhost:"
+ + TestUtil.getPortNumber(Server.class)
+ + "/SoapContext/GreeterPort";
+
public static class Server extends AbstractBusTestServerBase {
protected void run() {
Object implementor = new TrivialSOAPHandlerAnnotatedGreeterImpl();
- String address = "http://localhost:9020/SoapContext/GreeterPort";
Endpoint.publish(address, implementor);
}
@@ -74,6 +78,7 @@ public class TrivialSOAPHandlerTest exte
try {
Greeter greeter = service.getGreeterPort();
+ setAddress(greeter, address);
String greeting = greeter.greetMe("Bonjour");
assertNotNull("no response received from service", greeting);
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans.xml?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans.xml (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans.xml Thu Jun 3 20:33:29 2010
@@ -29,18 +29,20 @@ http://cxf.apache.org/jaxws http://cxf.a
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
-<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
-
+<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
<jaxws:endpoint id="cxfHandlerTestEndpoint"
implementor="org.apache.cxf.systest.handlers.AddNumbersNoHandlers"
- address="http://localhost:9025/SpringEndpoint">
+ address="http://localhost:${testutil.ports.springport}/SpringEndpoint">
<jaxws:handlers>
<bean class="org.apache.cxf.systest.handlers.ModifyNumberHandler"/>
</jaxws:handlers>
</jaxws:endpoint>
<jaxws:server id="cxfHandlerTestServer"
serviceClass="org.apache.handlers.AddNumbers"
- address="http://localhost:9025/SpringServer">
+ address="http://localhost:${testutil.ports.springport}/SpringServer">
<jaxws:serviceBean>
<bean class="org.apache.cxf.systest.handlers.AddNumbersNoHandlers" />
</jaxws:serviceBean>
@@ -52,18 +54,18 @@ http://cxf.apache.org/jaxws http://cxf.a
<jaxws:client id="cxfHandlerTestClientEndpoint"
serviceClass="org.apache.handlers.AddNumbers"
- address="http://localhost:9025/SpringEndpoint">
+ address="http://localhost:${testutil.ports.springport}/SpringEndpoint">
<jaxws:handlers>
<bean class="org.apache.cxf.systest.handlers.ModifyNumberHandler"/>
</jaxws:handlers>
</jaxws:client>
<jaxws:client id="cxfHandlerTestClientEndpointNoHandler"
serviceClass="org.apache.handlers.AddNumbers"
- address="http://localhost:9025/SpringEndpoint">
+ address="http://localhost:${testutil.ports.springport}/SpringEndpoint">
</jaxws:client>
<jaxws:client id="cxfHandlerTestClientServer"
serviceClass="org.apache.handlers.AddNumbers"
- address="http://localhost:9025/SpringServer">
+ address="http://localhost:${testutil.ports.springport}/SpringServer">
<jaxws:handlers>
<bean class="org.apache.cxf.systest.handlers.ModifyNumberHandler"/>
</jaxws:handlers>
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AnyClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AnyClientServerTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AnyClientServerTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AnyClientServerTest.java Thu Jun 3 20:33:29 2010
@@ -43,7 +43,8 @@ import org.junit.BeforeClass;
import org.junit.Test;
public final class AnyClientServerTest extends AbstractBusClientServerTestBase {
-
+ static final String PORT = allocatePort(MyServer.class);
+
static final Logger LOG = LogUtils.getLogger(AnyClientServerTest.class);
private final QName serviceName = new QName("http://apache.org/hello_world_soap_http/any",
"SOAPService");
@@ -52,7 +53,7 @@ public final class AnyClientServerTest e
protected void run() {
Object implementor = new GreeterImpl();
- String address = "http://localhost:9000/SoapContext/SoapPort";
+ String address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
Endpoint.publish(address, implementor);
}
@@ -82,7 +83,8 @@ public final class AnyClientServerTest e
SOAPService ss = new SOAPService(wsdl, serviceName);
Greeter port = ss.getSoapPort();
-
+ updateAddressPort(port, PORT);
+
List<Port> any = new ArrayList<Port>();
Port anyPort = new Port();
Port anyPort1 = new Port();
@@ -109,6 +111,8 @@ public final class AnyClientServerTest e
SOAPService ss = new SOAPService(wsdl, serviceName);
Greeter port = ss.getSoapPort();
+ updateAddressPort(port, PORT);
+
List<org.apache.hello_world_soap_http.any_types.SayHi1.Port> list =
new ArrayList<org.apache.hello_world_soap_http.any_types.SayHi1.Port>();
org.apache.hello_world_soap_http.any_types.SayHi1.Port port1 =
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java Thu Jun 3 20:33:29 2010
@@ -29,6 +29,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ClientServerGreeterBaseNoWsdlTest extends AbstractBusClientServerTestBase {
+ static final String PORT = allocatePort(ServerGreeterBaseNoWsdl.class);
@BeforeClass
public static void startServers() throws Exception {
@@ -44,7 +45,7 @@ public class ClientServerGreeterBaseNoWs
try {
Greeter greeter = service.getGreeterPort();
-
+ updateAddressPort(greeter, PORT);
String greeting = greeter.greetMe("Bonjour");
assertNotNull("no response received from service", greeting);
assertEquals("Hello Bonjour", greeting);
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseTest.java Thu Jun 3 20:33:29 2010
@@ -29,6 +29,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ClientServerGreeterBaseTest extends AbstractBusClientServerTestBase {
+ static final String PORT = allocatePort(ServerGreeterBase.class);
@BeforeClass
public static void startServers() throws Exception {
@@ -44,6 +45,7 @@ public class ClientServerGreeterBaseTest
try {
Greeter greeter = service.getGreeterPort();
+ updateAddressPort(greeter, PORT);
String greeting = greeter.greetMe("Bonjour");
assertNotNull("no response received from service", greeting);
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java Thu Jun 3 20:33:29 2010
@@ -41,6 +41,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ClientServerGreeterNoWsdlTest extends AbstractBusClientServerTestBase {
+ static final String PORT = allocatePort(ServerGreeterNoWsdl.class);
@BeforeClass
public static void startServers() throws Exception {
@@ -56,6 +57,7 @@ public class ClientServerGreeterNoWsdlTe
try {
Greeter greeter = service.getGreeterPort();
+ updateAddressPort(greeter, PORT);
String greeting = greeter.greetMe("Bonjour");
assertNotNull("no response received from service", greeting);
@@ -71,7 +73,8 @@ public class ClientServerGreeterNoWsdlTe
@Test
public void testGetGreetMe() throws Exception {
HttpURLConnection httpConnection =
- getHttpConnection("http://localhost:9020/SoapContext/GreeterPort/greetMe/requestType/cxf");
+ getHttpConnection("http://localhost:"
+ + PORT + "/SoapContext/GreeterPort/greetMe/requestType/cxf");
httpConnection.connect();
assertEquals(200, httpConnection.getResponseCode());
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java Thu Jun 3 20:33:29 2010
@@ -76,6 +76,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ClientServerMiscTest extends AbstractBusClientServerTestBase {
+ static final String PORT = allocatePort(ServerMisc.class);
@BeforeClass
@@ -223,7 +224,7 @@ public class ClientServerMiscTest extend
QName portName = new QName("http://cxf.apache.org/anonymous_complex_type/",
"anonymous_complex_typeSOAP");
AnonymousComplexType act = actService.getPort(portName, AnonymousComplexType.class);
-
+ updateAddressPort(act, PORT);
try {
Names reply = act.splitName("Tom Li");
assertNotNull("no response received from service", reply);
@@ -242,6 +243,7 @@ public class ClientServerMiscTest extend
QName portName = new QName("http://cxf.apache.org/anonymous_complex_type/",
"anonymous_complex_typeSOAP");
AnonymousComplexType act = actService.getPort(portName, AnonymousComplexType.class);
+ updateAddressPort(act, PORT);
try {
SplitName name = new SplitName();
@@ -263,6 +265,7 @@ public class ClientServerMiscTest extend
JaxbElementTest_Service service = new JaxbElementTest_Service();
assertNotNull(service);
JaxbElementTest port = service.getPort(JaxbElementTest.class);
+ updateAddressPort(port, PORT);
try {
@@ -283,6 +286,7 @@ public class ClientServerMiscTest extend
public void testOrderedParamHolder() throws Exception {
OrderedParamHolder_Service service = new OrderedParamHolder_Service();
OrderedParamHolder port = service.getOrderedParamHolderSOAP();
+ updateAddressPort(port, PORT);
try {
Holder<ComplexStruct> part3 = new Holder<ComplexStruct>();
@@ -729,6 +733,7 @@ public class ClientServerMiscTest extend
public void testInheritedTypesInOtherPackage() throws Exception {
InheritService serv = new InheritService();
Inherit port = serv.getInheritPort();
+ updateAddressPort(port, PORT);
ObjectInfo obj = port.getObject(0);
assertNotNull(obj);
assertNotNull(obj.getBaseObject());
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java Thu Jun 3 20:33:29 2010
@@ -37,6 +37,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ClientServerMixedStyleTest extends AbstractClientServerTestBase {
+ static final String PORT = allocatePort(ServerMixedStyle.class);
private final QName portName = new QName("http://apache.org/hello_world_mixedstyle", "SoapPort");
@@ -54,6 +55,7 @@ public class ClientServerMixedStyleTest
try {
Greeter greeter = service.getPort(portName, Greeter.class);
+ updateAddressPort(greeter, PORT);
GreetMe1 request = new GreetMe1();
request.setRequestType("Bonjour");
@@ -80,7 +82,7 @@ public class ClientServerMixedStyleTest
Service serv = Service.create(new QName("http://example.com", "MixedTest"));
MixedTest test = serv.getPort(MixedTest.class);
((BindingProvider)test).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- "http://localhost:9027/cxf885");
+ "http://localhost:" + PORT + "/cxf885");
String ret = test.hello("A", "B");
assertEquals("Hello A and B", ret);
@@ -93,7 +95,7 @@ public class ClientServerMixedStyleTest
String ret4 = test.simple2(24);
assertEquals("Int: 24", ret4);
- serv = Service.create(new URL("http://localhost:9027/cxf885?wsdl"),
+ serv = Service.create(new URL("http://localhost:" + PORT + "/cxf885?wsdl"),
new QName("http://example.com", "MixedTestImplService"));
test = serv.getPort(new QName("http://example.com", "MixedTestImplPort"),
MixedTest.class);
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java Thu Jun 3 20:33:29 2010
@@ -28,12 +28,13 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ClientServerRPCLitDefatulAnnoTest extends AbstractClientServerTestBase {
+ static final String PORT = allocatePort(Server.class);
public static class Server extends AbstractBusTestServerBase {
protected void run() {
Object implementor = new HelloImpl();
- String address = "http://localhost:9091/hello";
+ String address = "http://localhost:" + PORT + "/hello";
Endpoint.publish(address, implementor);
}
@@ -62,6 +63,7 @@ public class ClientServerRPCLitDefatulAn
serviceName);
assertNotNull(service);
Hello hello = service.getHelloPort();
+ updateAddressPort(hello, PORT);
assertEquals("getSayHi", hello.sayHi("SayHi"));
}
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java Thu Jun 3 20:33:29 2010
@@ -66,6 +66,7 @@ import org.junit.Test;
public class ClientServerRPCLitTest extends AbstractBusClientServerTestBase {
+ static final String PORT = allocatePort(Server.class);
private final QName portName = new QName("http://apache.org/hello_world_rpclit", "SoapPortRPCLit");
@@ -74,9 +75,9 @@ public class ClientServerRPCLitTest exte
protected void run() {
String address;
Object implementor = new RPCLitGreeterImpl();
- address = "http://localhost:9002/SOAPServiceRPCLit/SoapPort";
+ address = "http://localhost:" + PORT + "/SOAPServiceRPCLit/SoapPort";
Endpoint.publish(address, implementor);
- address = "http://localhost:9002/TestRPCWsdl";
+ address = "http://localhost:" + PORT + "/TestRPCWsdl";
Endpoint.publish(address, new MyService());
}
@@ -108,6 +109,7 @@ public class ClientServerRPCLitTest exte
String response2 = new String("Bonjour");
try {
GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
+ updateAddressPort(greeter, PORT);
for (int idx = 0; idx < 1; idx++) {
String greeting = greeter.greetMe("Milestone-" + idx);
assertNotNull("no response received from service", greeting);
@@ -128,7 +130,8 @@ public class ClientServerRPCLitTest exte
SOAPServiceRPCLit service = new SOAPServiceRPCLit();
Dispatch<Source> disp = service.createDispatch(portName, Source.class,
javax.xml.ws.Service.Mode.PAYLOAD);
-
+ updateAddressPort(disp, PORT);
+
String req = "<ns1:sendReceiveData xmlns:ns1=\"http://apache.org/hello_world_rpclit\">"
+ "<in xmlns:ns2=\"http://apache.org/hello_world_rpclit/types\">"
+ "<ns2:elem1>elem1</ns2:elem1><ns2:elem2>elem2</ns2:elem2><ns2:elem3>45</ns2:elem3>"
@@ -150,6 +153,7 @@ public class ClientServerRPCLitTest exte
assertNotNull(service);
GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
+ updateAddressPort(greeter, PORT);
MyComplexStruct in = new MyComplexStruct();
in.setElem1("elem1");
@@ -181,7 +185,7 @@ public class ClientServerRPCLitTest exte
@Test
public void testNoElementParts() throws Exception {
HttpURLConnection httpConnection =
- getHttpConnection("http://localhost:9002/TestRPCWsdl?wsdl");
+ getHttpConnection("http://localhost:" + PORT + "/TestRPCWsdl?wsdl");
httpConnection.connect();
assertEquals(200, httpConnection.getResponseCode());
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Thu Jun 3 20:33:29 2010
@@ -25,7 +25,6 @@ import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.HttpURLConnection;
-import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
@@ -79,7 +78,15 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ClientServerTest extends AbstractBusClientServerTestBase {
-
+ static final String PORT = allocatePort(Server.class);
+ static final String BARE_PORT = allocatePort(Server.class, 1);
+ static final String BOGUS_REAL_PORT = allocatePort(Server.class, 2);
+
+ static final String BOGUS_PORT = allocatePort(Server.class, 3);
+ static final String PUB_PORT = allocatePort(Server.class, 4);
+
+
+
static final Logger LOG = LogUtils.getLogger(ClientServerTest.class);
private final QName serviceName = new QName("http://apache.org/hello_world_soap_http",
"SOAPService");
@@ -104,14 +111,16 @@ public class ClientServerTest extends Ab
assertTrue("server did not launch correctly", launchServer(Server.class));
}
@Test
- public void testCXF2419() {
+ public void testCXF2419() throws Exception {
org.apache.cxf.hello_world.elrefs.SOAPService serv
= new org.apache.cxf.hello_world.elrefs.SOAPService();
- assertEquals("Hello CXF", serv.getSoapPort().greetMe("CXF"));
+ org.apache.cxf.hello_world.elrefs.Greeter g = serv.getSoapPort();
+ updateAddressPort(g, PORT);
+ assertEquals("Hello CXF", g.greetMe("CXF"));
}
@Test
- public void testBase64() throws URISyntaxException {
+ public void testBase64() throws Exception {
URL wsdl = getClass().getResource("/wsdl/others/dynamic_client_base64.wsdl");
assertNotNull(wsdl);
String wsdlUrl = null;
@@ -144,7 +153,7 @@ public class ClientServerTest extends Ab
assertNotNull(service);
Greeter greeter = service.getPort(portName, Greeter.class);
-
+ updateAddressPort(greeter, PORT);
try {
greeter.greetMe("test");
@@ -166,6 +175,7 @@ public class ClientServerTest extends Ab
assertNotNull(service);
Greeter greeter = service.getPort(portName, Greeter.class);
+ updateAddressPort(greeter, PORT);
try {
String reply = greeter.testNillable("test", 100);
@@ -182,7 +192,7 @@ public class ClientServerTest extends Ab
public void testAddPortWithSpecifiedSoap12Binding() throws Exception {
Service service = Service.create(serviceName);
service.addPort(fakePortName, javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING,
- "http://localhost:9009/SoapContext/SoapPort");
+ "http://localhost:" + PORT + "/SoapContext/SoapPort");
Greeter greeter = service.getPort(fakePortName, Greeter.class);
String response = new String("Bonjour");
@@ -202,7 +212,7 @@ public class ClientServerTest extends Ab
public void testAddPortWithSpecifiedSoap11Binding() throws Exception {
Service service = Service.create(serviceName);
service.addPort(fakePortName, javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
- "http://localhost:9000/SoapContext/SoapPort");
+ "http://localhost:" + PORT + "/SoapContext/SoapPort");
Greeter greeter = service.getPort(fakePortName, Greeter.class);
String response = new String("Bonjour");
@@ -225,7 +235,7 @@ public class ClientServerTest extends Ab
public void testAddPort() throws Exception {
Service service = Service.create(serviceName);
service.addPort(fakePortName, "http://schemas.xmlsoap.org/soap/",
- "http://localhost:9000/SoapContext/SoapPort");
+ "http://localhost:" + PORT + "/SoapContext/SoapPort");
Greeter greeter = service.getPort(fakePortName, Greeter.class);
String response = new String("Bonjour");
@@ -251,7 +261,7 @@ public class ClientServerTest extends Ab
try {
((BindingProvider)greeter).getRequestContext()
.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- "http://localhost:9000/SoapContext/SoapPort");
+ "http://localhost:" + PORT + "/SoapContext/SoapPort");
greeter.greetMe("test");
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
@@ -268,6 +278,7 @@ public class ClientServerTest extends Ab
assertNotNull(service);
DocLitBare greeter = service.getPort(portName1, DocLitBare.class);
+ updateAddressPort(greeter, BARE_PORT);
try {
BareDocumentResponse bareres = greeter.testDocLitBare("MySimpleDocument");
@@ -288,6 +299,7 @@ public class ClientServerTest extends Ab
assertNotNull(service);
Greeter greeter = service.getPort(portName, Greeter.class);
+ updateAddressPort(greeter, PORT);
String response1 = new String("Hello Milestone-");
String response2 = new String("Bonjour");
@@ -325,7 +337,7 @@ public class ClientServerTest extends Ab
Greeter greeter = service.getPort(Greeter.class);
((BindingProvider)greeter).getRequestContext()
.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- "http://localhost:9000/SoapContext/SoapPort");
+ "http://localhost:" + PORT + "/SoapContext/SoapPort");
String response1 = new String("Hello Milestone-");
String response2 = new String("Bonjour");
@@ -362,7 +374,8 @@ public class ClientServerTest extends Ab
Greeter greeter = service.getPort(portName, Greeter.class);
assertNotNull(service);
-
+ updateAddressPort(greeter, PORT);
+
long before = System.currentTimeMillis();
long delay = 3000;
@@ -435,6 +448,7 @@ public class ClientServerTest extends Ab
}
Greeter greeter = (Greeter)service.getPort(portName, Greeter.class);
+ updateAddressPort(greeter, PORT);
long before = System.currentTimeMillis();
@@ -512,7 +526,8 @@ public class ClientServerTest extends Ab
assertEquals(((TestExecutor)executor).getCount(), 0);
- Greeter greeter = (Greeter)service.getPort(portName, Greeter.class);
+ Greeter greeter = service.getPort(portName, Greeter.class);
+ updateAddressPort(greeter, PORT);
List<Response<GreetMeResponse>> responses = new ArrayList<Response<GreetMeResponse>>();
for (int i = 0; i < 5; i++) {
responses.add(greeter.greetMeAsync("asyn call" + i));
@@ -540,6 +555,7 @@ public class ClientServerTest extends Ab
String expectedString = new String("Hello, finally!");
try {
Greeter greeter = (Greeter)service.getPort(portName, Greeter.class);
+ updateAddressPort(greeter, PORT);
long before = System.currentTimeMillis();
long delay = 3000;
Future<?> f = greeter.greetMeLaterAsync(delay, h);
@@ -606,7 +622,9 @@ public class ClientServerTest extends Ab
}
}
- Greeter greeter = (Greeter)service.getPort(portName, Greeter.class);
+ Greeter greeter = service.getPort(portName, Greeter.class);
+ updateAddressPort(greeter, PORT);
+
long before = System.currentTimeMillis();
long delay = 3000;
Future<?> f = greeter.greetMeLaterAsync(delay, h);
@@ -645,6 +663,7 @@ public class ClientServerTest extends Ab
String badRecordFault = "BadRecordLitFault";
Greeter greeter = service.getPort(portName, Greeter.class);
+ updateAddressPort(greeter, PORT);
for (int idx = 0; idx < 2; idx++) {
try {
greeter.testDocLitFault(noSuchCodeFault);
@@ -683,6 +702,7 @@ public class ClientServerTest extends Ab
service.setExecutor(ex);
assertNotNull(service);
Greeter greeter = service.getPort(portName, Greeter.class);
+ updateAddressPort(greeter, PORT);
try {
// trigger runtime exception throw of implementor method
greeter.testDocLitFault("");
@@ -696,7 +716,7 @@ public class ClientServerTest extends Ab
@Test
public void testGetSayHi() throws Exception {
HttpURLConnection httpConnection =
- getHttpConnection("http://localhost:9000/SoapContext/SoapPort/sayHi");
+ getHttpConnection("http://localhost:" + PORT + "/SoapContext/SoapPort/sayHi");
httpConnection.connect();
httpConnection.connect();
@@ -727,7 +747,8 @@ public class ClientServerTest extends Ab
@Test
public void testGetGreetMe() throws Exception {
HttpURLConnection httpConnection =
- getHttpConnection("http://localhost:9000/SoapContext/SoapPort/greetMe/requestType/cxf");
+ getHttpConnection("http://localhost:" + PORT
+ + "/SoapContext/SoapPort/greetMe/requestType/cxf");
httpConnection.connect();
assertEquals(200, httpConnection.getResponseCode());
@@ -755,7 +776,7 @@ public class ClientServerTest extends Ab
@Test
public void testGetWSDL() throws Exception {
- String url = "http://localhost:9000/SoapContext/SoapPort?wsdl";
+ String url = "http://localhost:" + PORT + "/SoapContext/SoapPort?wsdl";
HttpURLConnection httpConnection = getHttpConnection(url);
httpConnection.connect();
@@ -775,7 +796,7 @@ public class ClientServerTest extends Ab
@Test
public void testGetGreetMeFromQuery() throws Exception {
- String url = "http://localhost:9000/SoapContext/SoapPort/greetMe?requestType="
+ String url = "http://localhost:" + PORT + "/SoapContext/SoapPort/greetMe?requestType="
+ URLEncoder.encode("cxf (was CeltixFire)", "UTF-8");
HttpURLConnection httpConnection = getHttpConnection(url);
@@ -808,7 +829,7 @@ public class ClientServerTest extends Ab
public void testBasicAuth() throws Exception {
Service service = Service.create(serviceName);
service.addPort(fakePortName, "http://schemas.xmlsoap.org/soap/",
- "http://localhost:9000/SoapContext/SoapPort");
+ "http://localhost:" + PORT + "/SoapContext/SoapPort");
Greeter greeter = service.getPort(fakePortName, Greeter.class);
try {
@@ -839,7 +860,7 @@ public class ClientServerTest extends Ab
@Test
public void testBogusAddress() throws Exception {
- String realAddress = "http://localhost:9015/SoapContext/SoapPort";
+ String realAddress = "http://localhost:" + BOGUS_REAL_PORT + "/SoapContext/SoapPort";
SOAPServiceBogusAddressTest service = new SOAPServiceBogusAddressTest();
Greeter greeter = service.getSoapPort();
try {
@@ -903,6 +924,7 @@ public class ClientServerTest extends Ab
//TODO test fault exceptions
DynamicClientFactory dcf = DynamicClientFactory.newInstance();
Client client = dcf.createClient(wsdlUrl, serviceName, portName);
+ updateAddressPort(client, PORT);
client.invoke("greetMe", "test");
Object[] result = client.invoke("sayHi");
assertNotNull("no response received from service", result);
@@ -914,6 +936,7 @@ public class ClientServerTest extends Ab
jaxbContextProperties.put("com.sun.xml.bind.defaultNamespaceRemap", "uri:ultima:thule");
dcf.setJaxbContextProperties(jaxbContextProperties);
client = dcf.createClient(wsdlUrl, serviceName, portName);
+ updateAddressPort(client, PORT);
client.invoke("greetMe", "test");
result = client.invoke("sayHi");
assertNotNull("no response received from service", result);
@@ -927,13 +950,15 @@ public class ClientServerTest extends Ab
QName sname = new QName("http://apache.org/hello_world_soap_http",
"SOAPServiceMultiPortTypeTest");
SOAPServiceMultiPortTypeTest service = new SOAPServiceMultiPortTypeTest(wsdl, sname);
-
- BareDocumentResponse resp = service.getDocLitBarePort().testDocLitBare("CXF");
+ DocLitBare b = service.getDocLitBarePort();
+ updateAddressPort(b, PORT);
+ BareDocumentResponse resp = b.testDocLitBare("CXF");
assertNotNull(resp);
assertEquals("CXF", resp.getCompany());
-
- String result = service.getGreeterPort().greetMe("CXF");
+ Greeter g = service.getGreeterPort();
+ updateAddressPort(g, PORT);
+ String result = g.greetMe("CXF");
assertEquals("Hello CXF", result);
}
@@ -950,8 +975,8 @@ public class ClientServerTest extends Ab
Object implementor4 = Proxy.newProxyInstance(this.getClass().getClassLoader(),
new Class<?>[] {DocLitWrappedCodeFirstService.class},
handler);
- Endpoint.publish("http://localhost:9023/DocLitWrappedCodeFirstService/", implementor4);
- URL url = new URL("http://localhost:9023/DocLitWrappedCodeFirstService/?wsdl");
+ Endpoint.publish("http://localhost:" + PUB_PORT + "/DocLitWrappedCodeFirstService/", implementor4);
+ URL url = new URL("http://localhost:" + PUB_PORT + "/DocLitWrappedCodeFirstService/?wsdl");
InputStream ins = url.openStream();
ins.close();
}
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java Thu Jun 3 20:33:29 2010
@@ -59,6 +59,9 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ClientServerXMLTest extends AbstractBusClientServerTestBase {
+ static final String REG_PORT = allocatePort(ServerXMLBinding.class);
+ static final String WRAP_PORT = allocatePort(ServerXMLBinding.class, 1);
+ static final String MIX_PORT = allocatePort(ServerXMLBinding.class, 2);
private final QName barePortName = new QName("http://apache.org/hello_world_xml_http/bare", "XMLPort");
@@ -90,6 +93,7 @@ public class ClientServerXMLTest extends
String response2 = "Bonjour";
try {
Greeter greeter = service.getPort(barePortName, Greeter.class);
+ updateAddressPort(greeter, REG_PORT);
String username = System.getProperty("user.name");
String reply = greeter.greetMe(username);
@@ -123,7 +127,8 @@ public class ClientServerXMLTest extends
@Test
public void testBareGetGreetMe() throws Exception {
HttpURLConnection httpConnection =
- getHttpConnection("http://localhost:9031/XMLService/XMLPort/greetMe/requestType/cxf");
+ getHttpConnection("http://localhost:" + REG_PORT
+ + "/XMLService/XMLPort/greetMe/requestType/cxf");
httpConnection.connect();
assertEquals(200, httpConnection.getResponseCode());
@@ -157,6 +162,8 @@ public class ClientServerXMLTest extends
try {
org.apache.hello_world_xml_http.wrapped.Greeter greeter = service.getPort(wrapPortName,
org.apache.hello_world_xml_http.wrapped.Greeter.class);
+ updateAddressPort(greeter, WRAP_PORT);
+
String username = System.getProperty("user.name");
String reply = greeter.greetMe(username);
@@ -187,6 +194,7 @@ public class ClientServerXMLTest extends
try {
org.apache.hello_world_xml_http.mixed.Greeter greeter = service.getPort(mixedPortName,
org.apache.hello_world_xml_http.mixed.Greeter.class);
+ updateAddressPort(greeter, MIX_PORT);
String username = System.getProperty("user.name");
String reply = greeter.greetMe(username);
@@ -214,13 +222,14 @@ public class ClientServerXMLTest extends
assertNotNull(service);
service.addPort(wrapFakePortName, "http://cxf.apache.org/bindings/xformat",
- "http://localhost:9032/XMLService/XMLPort");
+ "http://localhost:" + WRAP_PORT + "/XMLService/XMLPort");
String response1 = new String("Hello ");
String response2 = new String("Bonjour");
org.apache.hello_world_xml_http.wrapped.Greeter greeter = service.getPort(wrapPortName,
org.apache.hello_world_xml_http.wrapped.Greeter.class);
+ updateAddressPort(greeter, WRAP_PORT);
try {
String username = System.getProperty("user.name");
@@ -254,6 +263,7 @@ public class ClientServerXMLTest extends
assertNotNull(service);
org.apache.hello_world_xml_http.wrapped.Greeter greeter = service.getPort(wrapPortName,
org.apache.hello_world_xml_http.wrapped.Greeter.class);
+ updateAddressPort(greeter, WRAP_PORT);
try {
greeter.pingMe();
fail("did not catch expected PingMeFault exception");
@@ -270,6 +280,7 @@ public class ClientServerXMLTest extends
}
org.apache.hello_world_xml_http.wrapped.Greeter greeterFault = service.getXMLFaultPort();
+ updateAddressPort(greeterFault, REG_PORT);
try {
greeterFault.pingMe();
fail("did not catch expected runtime exception");
@@ -283,6 +294,7 @@ public class ClientServerXMLTest extends
public void testXMLBindingOfSoapHeaderWSDL() throws Exception {
XMLHeaderService service = new XMLHeaderService();
HeaderTester port = service.getXMLPort9000();
+ updateAddressPort(port, REG_PORT);
try {
verifyInHeader(port);
verifyInOutHeader(port);
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/Server.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/Server.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/Server.java Thu Jun 3 20:33:29 2010
@@ -31,6 +31,9 @@ import org.apache.hello_world_soap_http.
import org.apache.hello_world_soap_http.GreeterImpl;
public class Server extends AbstractBusTestServerBase {
+ static final String PORT = allocatePort(Server.class);
+ static final String BARE_PORT = allocatePort(Server.class, 1);
+ static final String BOGUS_REAL_PORT = allocatePort(Server.class, 2);
protected void run() {
URL url = getClass().getResource("fault-stack-trace.xml");
@@ -40,23 +43,23 @@ public class Server extends AbstractBusT
Object implementor;
String address;
implementor = new GreeterImplMultiPort();
- address = "http://localhost:9020/MultiPort/GreeterPort";
+ address = "http://localhost:" + PORT + "/MultiPort/GreeterPort";
Endpoint.publish(address, implementor);
implementor = new DocLitBareGreeterMultiPort();
- address = "http://localhost:9021/MultiPort/DocBarePort";
+ address = "http://localhost:" + PORT + "/MultiPort/DocBarePort";
Endpoint.publish(address, implementor);
implementor = new GreeterImpl();
- address = "http://localhost:9000/SoapContext/SoapPort";
+ address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
Endpoint.publish(address, implementor);
implementor = new RefGreeterImpl();
- address = "http://localhost:9000/SoapContext/SoapPort2";
+ address = "http://localhost:" + PORT + "/SoapContext/SoapPort2";
Endpoint.publish(address, implementor);
//publish port with soap12 binding
- address = "http://localhost:9009/SoapContext/SoapPort";
+ address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
EndpointImpl e = (EndpointImpl) Endpoint.create(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING,
@@ -64,12 +67,12 @@ public class Server extends AbstractBusT
e.publish(address);
implementor = new DocLitBareGreeterImpl();
- address = "http://localhost:7600/SoapContext/SoapPort";
+ address = "http://localhost:" + BARE_PORT + "/SoapContext/SoapPort";
Endpoint.publish(address, implementor);
implementor = new GreeterImplBogus();
- address = "http://localhost:9015/SoapContext/SoapPort";
+ address = "http://localhost:" + BOGUS_REAL_PORT + "/SoapContext/SoapPort";
Endpoint.publish(address, implementor);
}
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBase.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBase.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBase.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBase.java Thu Jun 3 20:33:29 2010
@@ -25,10 +25,12 @@ import org.apache.cxf.greeter_control.Gr
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
public class ServerGreeterBase extends AbstractBusTestServerBase {
+ static final String PORT = allocatePort(ServerGreeterBase.class);
protected void run() {
Object implementor = new GreeterImplBase();
- String address = "http://localhost:9020/SoapContext/GreeterPort";
+ String address = "http://localhost:"
+ + PORT + "/SoapContext/GreeterPort";
Endpoint.publish(address, implementor);
}
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBaseNoWsdl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBaseNoWsdl.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBaseNoWsdl.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBaseNoWsdl.java Thu Jun 3 20:33:29 2010
@@ -23,12 +23,16 @@ import javax.xml.ws.Endpoint;
import org.apache.cxf.greeter_control.GreeterImplBaseNoWsdl;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
public class ServerGreeterBaseNoWsdl extends AbstractBusTestServerBase {
protected void run() {
+
Object implementor = new GreeterImplBaseNoWsdl();
- String address = "http://localhost:9020/SoapContext/GreeterPort";
+ String address = "http://localhost:"
+ + TestUtil.getPortNumber(ServerGreeterBaseNoWsdl.class)
+ + "/SoapContext/GreeterPort";
Endpoint.publish(address, implementor);
}
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterNoWsdl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterNoWsdl.java?rev=951144&r1=951143&r2=951144&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterNoWsdl.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterNoWsdl.java Thu Jun 3 20:33:29 2010
@@ -25,10 +25,11 @@ import org.apache.cxf.greeter_control.Gr
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
public class ServerGreeterNoWsdl extends AbstractBusTestServerBase {
+ static final String PORT = allocatePort(ServerGreeterNoWsdl.class);
protected void run() {
Object implementor = new GreeterImplNoWsdl();
- String address = "http://localhost:9020/SoapContext/GreeterPort";
+ String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
Endpoint.publish(address, implementor);
}