You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by lm...@apache.org on 2010/07/27 22:47:12 UTC
svn commit: r979862 [12/19] - in /cxf/sandbox/oauth_1.0a: ./ api/
api/src/main/java/org/apache/cxf/ api/src/main/java/org/apache/cxf/endpoint/
api/src/main/java/org/apache/cxf/phase/
api/src/main/java/org/apache/cxf/ws/addressing/ api/src/main/java/org...
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml Tue Jul 27 20:46:55 2010
@@ -28,9 +28,10 @@ under the License.
http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
">
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<httpj:engine-factory id="port-9095-tls-config">
- <httpj:engine port="9095">
+ <httpj:engine port="${testutil.ports.jaxrs-https}">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="password">
<sec:keyStore type="JKS" password="password"
@@ -47,7 +48,7 @@ under the License.
<!-- -->
<!-- HTTP/S configuration for proxy & web clients -->
<!-- -->
- <http:conduit name="https://localhost:9095/bookstore/securebooks.*">
+ <http:conduit name="https://localhost:.*/bookstore/securebooks.*">
<http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
<http:tlsClientParameters disableCNCheck="true">
<sec:keyManagers keyPassword="password">
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml Tue Jul 27 20:46:55 2010
@@ -29,8 +29,11 @@ under the License.
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
">
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+
<httpj:engine-factory id="port-9095-tls-config">
- <httpj:engine port="9095">
+ <httpj:engine port="${testutil.ports.jaxrs-https}">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="password">
<sec:keyStore type="JKS" password="password"
@@ -64,7 +67,7 @@ under the License.
<!-- -->
<!-- HTTP/S configuration for web clients -->
<!-- -->
- <http:conduit name="{https://localhost:9095}WebClient.http-conduit">
+ <http:conduit name="\{https://localhost\:.*\}WebClient\.http-conduit">
<http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
<http:tlsClientParameters disableCNCheck="true">
<sec:keyManagers keyPassword="password">
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_logging_atompush/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_logging_atompush/WEB-INF/beans.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_logging_atompush/WEB-INF/beans.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_logging_atompush/WEB-INF/beans.xml Tue Jul 27 20:46:55 2010
@@ -38,6 +38,9 @@ http://www.springframework.org/schema/ut
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+
<bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
init-method="init">
<property name="multiplicity" value="one"/>
@@ -56,7 +59,7 @@ http://www.springframework.org/schema/ut
<bean id="webClient" class="org.apache.cxf.jaxrs.client.WebClient"
factory-method="create">
- <constructor-arg type="java.lang.String" value="http://localhost:9080/root/feeds" />
+ <constructor-arg type="java.lang.String" value="http://localhost:${testutil.ports.AbstractSpringServer}/root/feeds" />
<constructor-arg ref="feedProvider" />
</bean>
@@ -67,7 +70,7 @@ factory-method="create">
value="
org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushSpringTest$Resource2:ALL,
namedLogger:WARN" />
- <property name="url" value="http://localhost:9080/batch/feeds"/>
+ <property name="url" value="http://localhost:${testutil.ports.AbstractSpringServer}/batch/feeds"/>
</bean>
<bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
@@ -88,7 +91,7 @@ factory-method="create">
<bean id="webClient3" class="org.apache.cxf.jaxrs.client.WebClient"
factory-method="create">
- <constructor-arg type="java.lang.String" value="http://localhost:9080/entries/entries" />
+ <constructor-arg type="java.lang.String" value="http://localhost:${testutil.ports.AbstractSpringServer}/entries/entries" />
<constructor-arg ref="entryProvider" />
</bean>
@@ -101,7 +104,7 @@ factory-method="create">
value="
org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushSpringTest$Resource4:ALL,
namedLogger:WARN" />
- <property name="url" value="http://localhost:9080/entriesMany/entries"/>
+ <property name="url" value="http://localhost:${testutil.ports.AbstractSpringServer}/entriesMany/entries"/>
</bean>
<bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
@@ -112,7 +115,7 @@ factory-method="create">
value="
org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushSpringTest$Resource5:ALL,
namedLogger:WARN" />
- <property name="url" value="http://localhost:9080/extensions/feeds"/>
+ <property name="url" value="http://localhost:${testutil.ports.AbstractSpringServer}/extensions/feeds"/>
</bean>
<util:list id="feedProvider">
@@ -150,7 +153,7 @@ factory-method="create">
<bean class="org.apache.cxf.management.web.logging.atom.AtomPushBean"
init-method="init">
- <property name="url" value="http://localhost:9080/feed" />
+ <property name="url" value="http://localhost:${testutil.ports.AbstractSpringServer}/feed" />
<property name="level" value="ALL" />
</bean>
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml Tue Jul 27 20:46:55 2010
@@ -49,6 +49,14 @@
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.apache.cxf.systest.jaxrs.BookApplication</param-value>
</init-param>
+ <init-param>
+ <param-name>jaxrs.outInterceptors</param-name>
+ <param-value>org.apache.cxf.interceptor.LoggingOutInterceptor</param-value>
+ </init-param>
+ <init-param>
+ <param-name>jaxrs.inInterceptors</param-name>
+ <param-value>org.apache.cxf.interceptor.LoggingInInterceptor</param-value>
+ </init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml Tue Jul 27 20:46:55 2010
@@ -38,13 +38,15 @@ http://cxf.apache.org/schemas/jaxrs.xsd"
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
<bean id="org.apache.cxf.ws.policy.PolicyEngine" class="org.apache.cxf.ws.policy.PolicyEngineImpl">
<property name="bus" ref="cxf"/>
<property name="enabled" value="true"/>
</bean>
<jaxrs:client id="restClient"
- address="http://localhost:9092/test/services/rest"
+ address="http://localhost:${testutil.ports.BookServerRestSoap}/test/services/rest"
serviceClass="org.apache.cxf.systest.jaxrs.BookStoreJaxrsJaxws"
inheritHeaders="true">
<jaxrs:headers>
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/pom.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/pom.xml Tue Jul 27 20:46:55 2010
@@ -84,8 +84,8 @@
</profiles>
<dependencies>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <groupId>${servlet-api.group}</groupId>
+ <artifactId>${servlet-api.artifact}</artifactId>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java Tue Jul 27 20:46:55 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();
@@ -151,8 +162,9 @@ public class DispatchClientServerTest ex
fail("should not be a SOAPFaultException");
} catch (WebServiceException ex) {
//expected
- assertTrue(ex.getCause().getClass().getName(),
- ex.getCause() instanceof java.net.ConnectException);
+ assertTrue(ex.getCause().getClass().getName(),
+ ex.getCause() instanceof java.net.ConnectException
+ || ex.getCause() instanceof java.net.SocketTimeoutException);
}
}
@@ -163,12 +175,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 +236,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 +301,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 +375,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 +469,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 +507,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 +515,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 +566,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 +637,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 +688,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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/Server.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/Server.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/Server.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/Server.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationUsingAddNumbersTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationUsingAddNumbersTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationUsingAddNumbersTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationUsingAddNumbersTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerServer.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerServer.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerServer.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerServer.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/Server.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/Server.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/Server.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/Server.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SpringConfiguredHandlerTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans.xml Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AnyClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AnyClientServerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AnyClientServerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/AnyClientServerTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java Tue Jul 27 20:46:55 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,12 +73,13 @@ 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());
- assertEquals("text/xml; charset=utf-8", httpConnection.getContentType());
+ assertEquals("text/xml;charset=utf-8", httpConnection.getContentType().toLowerCase());
assertEquals("OK", httpConnection.getResponseMessage());
InputStream in = httpConnection.getInputStream();
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitDefatulAnnoTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Tue Jul 27 20:46:55 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);
@@ -661,7 +680,7 @@ public class ClientServerTest extends Ab
BindingProvider bp = (BindingProvider)greeter;
Map<String, Object> responseContext = bp.getResponseContext();
String contentType = (String) responseContext.get(Message.CONTENT_TYPE);
- assertEquals("text/xml; charset=utf-8", contentType);
+ assertEquals("text/xml;charset=utf-8", contentType.toLowerCase());
Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);
assertEquals(500, responseCode.intValue());
assertNotNull(brlf.getFaultInfo());
@@ -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,14 +716,14 @@ 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();
assertEquals(200, httpConnection.getResponseCode());
- assertEquals("text/xml; charset=utf-8", httpConnection.getContentType());
+ assertEquals("text/xml;charset=utf-8", httpConnection.getContentType().toLowerCase());
assertEquals("OK", httpConnection.getResponseMessage());
InputStream in = httpConnection.getInputStream();
@@ -727,12 +747,13 @@ 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());
- assertEquals("text/xml; charset=utf-8", httpConnection.getContentType());
+ assertEquals("text/xml;charset=utf-8", httpConnection.getContentType().toLowerCase());
assertEquals("OK", httpConnection.getResponseMessage());
InputStream in = httpConnection.getInputStream();
@@ -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);
@@ -783,7 +804,7 @@ public class ClientServerTest extends Ab
assertEquals(200, httpConnection.getResponseCode());
- assertEquals("text/xml; charset=utf-8", httpConnection.getContentType());
+ assertEquals("text/xml;charset=utf-8", httpConnection.getContentType().toLowerCase());
assertEquals("OK", httpConnection.getResponseMessage());
InputStream in = httpConnection.getInputStream();
@@ -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();
}