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 [13/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/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java Tue Jul 27 20:46:55 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,12 +127,13 @@ 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());
- 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();
@@ -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");
@@ -264,12 +274,13 @@ public class ClientServerXMLTest extends
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());
}
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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java Tue Jul 27 20:46:55 2010
@@ -31,10 +31,13 @@ import org.apache.cxf.jaxws.endpoint.dyn
import org.apache.cxf.no_body_parts.types.Operation1;
import org.apache.cxf.no_body_parts.types.Operation1Response;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.TestUtil;
+
import org.junit.BeforeClass;
import org.junit.Test;
public class JaxWsDynamicClientTest extends AbstractBusClientServerTestBase {
+ static final String PORT = TestUtil.getPortNumber(ServerNoBodyParts.class);
private String md5(byte[] bytes) {
MessageDigest algorithm;
@@ -64,7 +67,7 @@ public class JaxWsDynamicClientTest exte
public void testInvocation() throws Exception {
JaxWsDynamicClientFactory dcf =
JaxWsDynamicClientFactory.newInstance();
- URL wsdlURL = new URL("http://localhost:9020/NoBodyParts/NoBodyPartsService?wsdl");
+ URL wsdlURL = new URL("http://localhost:" + PORT + "/NoBodyParts/NoBodyPartsService?wsdl");
Client client = dcf.createClient(wsdlURL);
byte[] bucketOfBytes =
IOUtils.readBytesFromStream(getClass().getResourceAsStream("/wsdl/no_body_parts.wsdl"));
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsExecutorTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsExecutorTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsExecutorTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsExecutorTest.java Tue Jul 27 20:46:55 2010
@@ -37,12 +37,13 @@ import org.junit.Test;
*
*/
public class JaxwsExecutorTest extends AbstractBusClientServerTestBase {
-
+ static final String PORT = allocatePort(ServerNoBodyParts.class);
+
public static class Server extends AbstractBusTestServerBase {
protected void run() {
GreeterImpl implementor = new GreeterImpl();
- String address = "http://localhost:9020/SoapContext/GreeterPort";
+ String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
javax.xml.ws.Endpoint.publish(address, implementor);
}
@@ -97,6 +98,7 @@ public class JaxwsExecutorTest extends
assertSame(executor, service.getExecutor());
Greeter proxy = service.getGreeterPort();
+ updateAddressPort(proxy, PORT);
assertEquals(0, executor.getCount());
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorClientServerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorClientServerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorClientServerTest.java Tue Jul 27 20:46:55 2010
@@ -39,6 +39,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class LocatorClientServerTest extends AbstractBusClientServerTestBase {
+ static final String PORT = allocatePort(MyServer.class);
static final Logger LOG = LogUtils.getLogger(LocatorClientServerTest.class);
private final QName serviceName = new QName("http://apache.org/locator", "LocatorService");
@@ -47,7 +48,7 @@ public class LocatorClientServerTest ext
protected void run() {
Object implementor = new LocatorServiceImpl();
- String address = "http://localhost:6006/services/LocatorService";
+ String address = "http://localhost:" + PORT + "/services/LocatorService";
Endpoint.publish(address, implementor);
}
@@ -78,7 +79,7 @@ public class LocatorClientServerTest ext
LocatorService_Service ss = new LocatorService_Service(wsdl, serviceName);
LocatorService port = ss.getLocatorServicePort();
-
+ updateAddressPort(port, PORT);
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
W3CEndpointReference w3cEpr = builder.build();
port.registerPeerManager(w3cEpr,
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java Tue Jul 27 20:46:55 2010
@@ -35,6 +35,7 @@ import org.apache.cxf.BusFactory;
import org.apache.cxf.catalog.CatalogWSDLLocator;
import org.apache.cxf.catalog.OASISCatalogManager;
import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.testutil.common.TestUtil;
import org.apache.cxf.wsdl.WSDLManager;
import org.apache.cxf.wsdl11.WSDLManagerImpl;
@@ -46,7 +47,8 @@ import org.junit.Assert;
import org.junit.Test;
public class OASISCatalogTest extends Assert {
-
+ static final String PORT = TestUtil.getPortNumber(OASISCatalogTest.class);
+
private final QName serviceName =
new QName("http://apache.org/hello_world/services",
"SOAPService");
@@ -57,21 +59,22 @@ public class OASISCatalogTest extends As
@Test
public void testWSDLPublishWithCatalogs() throws Exception {
- Endpoint ep = Endpoint.publish(null, new GreeterImpl());
+ Endpoint ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort",
+ new GreeterImpl());
try {
- URL url = new URL("http://localhost:9000/SoapContext/SoapPort?"
+ URL url = new URL("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+ "xsd=hello_world_schema2.xsd");
assertNotNull(url.getContent());
String result = IOUtils.toString((InputStream)url.getContent());
assertTrue(result, result.contains("xsd=hello_world_schema.xsd"));
- url = new URL("http://localhost:9000/SoapContext/SoapPort"
+ url = new URL("http://localhost:" + PORT + "/SoapContext/SoapPort"
+ "?xsd=hello_world_schema.xsd");
result = IOUtils.toString((InputStream)url.getContent());
assertTrue(result, result.contains("xsd=hello_world_schema2.xsd"));
- url = new URL("http://localhost:9000/SoapContext/SoapPort"
+ url = new URL("http://localhost:" + PORT + "/SoapContext/SoapPort"
+ "?wsdl=testutils/others/hello_world_messages_catalog.wsdl");
result = IOUtils.toString((InputStream)url.getContent());
assertTrue(result, result.contains("xsd=hello_world_schema.xsd"));
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/Server.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/Server.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/Server.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/Server.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBase.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBase.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBase.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBase.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBaseNoWsdl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBaseNoWsdl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBaseNoWsdl.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterBaseNoWsdl.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterNoWsdl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterNoWsdl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterNoWsdl.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerGreeterNoWsdl.java Tue Jul 27 20:46:55 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);
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java Tue Jul 27 20:46:55 2010
@@ -35,16 +35,19 @@ import org.apache.cxf.testutil.common.Ab
public class ServerMisc extends AbstractBusTestServerBase {
+ public static final String PORT = allocatePort(ServerMisc.class);
+
+
public static final String DOCLIT_CODEFIRST_URL =
- "http://localhost:9003/DocLitWrappedCodeFirstService/";
+ "http://localhost:" + PORT + "/DocLitWrappedCodeFirstService/";
public static final String RPCLIT_CODEFIRST_URL =
- "http://localhost:9003/RpcLitCodeFirstService/";
+ "http://localhost:" + PORT + "/RpcLitCodeFirstService/";
public static final String DOCLIT_CODEFIRST_BASE_URL =
- "http://localhost:9003/DocLitWrappedCodeFirstServiceBaseService/";
+ "http://localhost:" + PORT + "/DocLitWrappedCodeFirstServiceBaseService/";
public static final String DOCLITBARE_CODEFIRST_URL =
- "http://localhost:9003/DocLitBareCodeFirstService/";
+ "http://localhost:" + PORT + "/DocLitBareCodeFirstService/";
public static final String DOCLIT_CODEFIRST_SETTINGS_URL =
- "http://localhost:9003/DocLitWrappedCodeFirstServiceSettings/";
+ "http://localhost:" + PORT + "/DocLitWrappedCodeFirstServiceSettings/";
protected void run() {
@@ -85,15 +88,15 @@ public class ServerMisc extends Abstract
Endpoint.publish(DOCLIT_CODEFIRST_BASE_URL, implementor6);
Object implementor1 = new AnonymousComplexTypeImpl();
- String address = "http://localhost:9000/anonymous_complex_typeSOAP";
+ String address = "http://localhost:" + PORT + "/anonymous_complex_typeSOAP";
Endpoint.publish(address, implementor1);
Object implementor2 = new JaxbElementTestImpl();
- address = "http://localhost:9001/jaxb_element_test";
+ address = "http://localhost:" + PORT + "/jaxb_element_test";
Endpoint.publish(address, implementor2);
Object implementor3 = new OrderedParamHolderImpl();
- address = "http://localhost:9002/ordered_param_holder/";
+ address = "http://localhost:" + PORT + "/ordered_param_holder/";
Endpoint.publish(address, implementor3);
//Object implementor4 = new DocLitWrappedCodeFirstServiceImpl();
@@ -102,7 +105,7 @@ public class ServerMisc extends Abstract
Object implementor5 = new RpcLitCodeFirstServiceImpl();
Endpoint.publish(RPCLIT_CODEFIRST_URL, implementor5);
- Endpoint.publish("http://localhost:9000/InheritContext/InheritPort",
+ Endpoint.publish("http://localhost:" + PORT + "/InheritContext/InheritPort",
new InheritImpl());
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMixedStyle.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMixedStyle.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMixedStyle.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMixedStyle.java Tue Jul 27 20:46:55 2010
@@ -31,13 +31,14 @@ import org.apache.hello_world_mixedstyle
public class ServerMixedStyle extends AbstractBusTestServerBase {
+ static final String PORT = allocatePort(ServerMixedStyle.class);
protected void run() {
Object implementor = new GreeterImplMixedStyle();
- String address = "http://localhost:9027/SoapContext/SoapPort";
+ String address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
Endpoint.publish(address, implementor);
- Endpoint.publish("http://localhost:9027/cxf885", new MixedTestImpl());
+ Endpoint.publish("http://localhost:" + PORT + "/cxf885", new MixedTestImpl());
}
public static void main(String[] args) {
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerNoBodyParts.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerNoBodyParts.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerNoBodyParts.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerNoBodyParts.java Tue Jul 27 20:46:55 2010
@@ -25,10 +25,11 @@ import org.apache.cxf.no_body_parts.NoBo
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
public class ServerNoBodyParts extends AbstractBusTestServerBase {
+ static final String PORT = allocatePort(ServerNoBodyParts.class);
protected void run() {
Object implementor = new NoBodyPartsImpl();
- String address = "http://localhost:9020/NoBodyParts/NoBodyPartsService";
+ String address = "http://localhost:" + PORT + "/NoBodyParts/NoBodyPartsService";
Endpoint.publish(address, implementor);
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerXMLBinding.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerXMLBinding.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerXMLBinding.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerXMLBinding.java Tue Jul 27 20:46:55 2010
@@ -28,26 +28,29 @@ import org.apache.hello_world_xml_http.w
public class ServerXMLBinding extends AbstractBusTestServerBase {
+ 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);
protected void run() {
Object implementor = new GreeterImpl();
- String address = "http://localhost:9031/XMLService/XMLPort";
+ String address = "http://localhost:" + REG_PORT + "/XMLService/XMLPort";
Endpoint.publish(address, implementor);
Object implementor1 = new org.apache.hello_world_xml_http.wrapped.GreeterImpl();
- address = "http://localhost:9032/XMLService/XMLPort";
+ address = "http://localhost:" + WRAP_PORT + "/XMLService/XMLPort";
Endpoint.publish(address, implementor1);
Object faultImplementor = new GreeterFaultImpl();
- String faultAddress = "http://localhost:9033/XMLService/XMLFaultPort";
+ String faultAddress = "http://localhost:" + REG_PORT + "/XMLService/XMLFaultPort";
Endpoint.publish(faultAddress, faultImplementor);
Object implementor2 = new HeaderTesterImpl();
- address = "http://localhost:9034/XMLContext/XMLPort";
+ address = "http://localhost:" + REG_PORT + "/XMLContext/XMLPort";
Endpoint.publish(address, implementor2);
Object implementor3 = new org.apache.hello_world_xml_http.mixed.GreeterImpl();
- address = "http://localhost:9028/XMLService/XMLPort";
+ address = "http://localhost:" + MIX_PORT + "/XMLService/XMLPort";
Endpoint.publish(address, implementor3);
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java Tue Jul 27 20:46:55 2010
@@ -36,7 +36,8 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class AttachmentProviderXMLClientServerTest extends AbstractBusClientServerTestBase {
-
+ private static final String ADDRESS = AttachmentServer.ADDRESS;
+
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
@@ -47,7 +48,7 @@ public class AttachmentProviderXMLClient
public void testRequestWithAttachment() throws Exception {
HttpURLConnection connection =
- (HttpURLConnection)new URL("http://localhost:9033/XMLServiceAttachment").openConnection();
+ (HttpURLConnection)new URL(ADDRESS).openConnection();
connection.setRequestMethod("POST");
String ct = "multipart/related; type=\"text/xml\"; " + "start=\"rootPart\"; "
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentServer.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentServer.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentServer.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentServer.java Tue Jul 27 20:46:55 2010
@@ -22,13 +22,15 @@ package org.apache.cxf.systest.provider;
import javax.xml.ws.Endpoint;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
public class AttachmentServer extends AbstractBusTestServerBase {
-
+ public static final String ADDRESS
+ = "http://localhost:" + TestUtil.getPortNumber(AttachmentServer.class)
+ + "/XMLServiceAttachment";
protected void run() {
Object implementor = new AttachmentStreamSourceXMLProvider();
- String address = "http://localhost:9033/XMLServiceAttachment";
- Endpoint.publish(address, implementor);
+ Endpoint.publish(ADDRESS, implementor);
}
public static void main(String[] args) {
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSourcePayloadProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSourcePayloadProvider.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSourcePayloadProvider.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSourcePayloadProvider.java Tue Jul 27 20:46:55 2010
@@ -18,120 +18,12 @@
*/
package org.apache.cxf.systest.provider;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.io.Writer;
-import javax.annotation.Resource;
-import javax.jws.HandlerChain;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.ws.Provider;
-import javax.xml.ws.ServiceMode;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.WebServiceProvider;
-import javax.xml.ws.handler.MessageContext;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-import org.apache.cxf.helpers.XMLUtils;
-import org.apache.cxf.staxutils.StaxSource;
-import org.apache.cxf.staxutils.StaxUtils;
-
-//The following wsdl file is used.
-//wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl"
-@WebServiceProvider(portName = "SoapPortProviderRPCLit3", serviceName = "SOAPServiceProviderRPCLit",
- targetNamespace = "http://apache.org/hello_world_rpclit",
- wsdlLocation = "/wsdl/hello_world_rpc_lit.wsdl")
-@ServiceMode (value = javax.xml.ws.Service.Mode.PAYLOAD)
-@HandlerChain(file = "./handlers_invocation.xml", name = "TestHandlerChain")
-public class HWSourcePayloadProvider implements Provider<Source> {
- boolean doneStax;
- @Resource
- WebServiceContext ctx;
-
- public HWSourcePayloadProvider() {
-
+public class HWSourcePayloadProvider extends AbstractSourcePayloadProvider
+ implements Comparable<HWSourcePayloadProvider> {
+
+ public int compareTo(HWSourcePayloadProvider p) {
+ return p == this ? 0 : -1;
}
- public Source invoke(Source request) {
- QName qn = (QName)ctx.getMessageContext().get(MessageContext.WSDL_OPERATION);
- if (qn == null) {
- throw new RuntimeException("No Operation Name");
- }
-
- try {
- System.out.println(request.getClass().getName());
- String input = getSourceAsString(request);
- System.out.println(input);
-
- if (input.indexOf("ServerLogicalHandler") >= 0) {
- return map(request.getClass());
- }
-
- } catch (Exception e) {
- System.out.println("Received an exception while parsing the source");
- e.printStackTrace();
- }
- return null;
- }
-
- private Source map(Class<? extends Source> class1)
- throws Exception {
-
- InputStream greetMeInputStream = getClass()
- .getResourceAsStream("resources/GreetMeRpcLiteralRespBody.xml");
- if (DOMSource.class.equals(class1)) {
- return new DOMSource(XMLUtils.parse(greetMeInputStream));
- } else if (StaxSource.class.equals(class1)) {
- if (doneStax) {
- XMLReader reader = XMLReaderFactory.createXMLReader();
- return new SAXSource(reader, new InputSource(greetMeInputStream));
- } else {
- doneStax = true;
- return new StaxSource(StaxUtils.createXMLStreamReader(greetMeInputStream));
- }
- } else if (StreamSource.class.equals(class1)) {
- StreamSource source = new StreamSource();
- source.setInputStream(greetMeInputStream);
- return source;
- }
- //java 6 javax.xml.transform.stax.StAXSource
- XMLStreamReader reader = StaxUtils.createXMLStreamReader(greetMeInputStream);
- return class1.getConstructor(XMLStreamReader.class).newInstance(reader);
- }
-
- public static String getSourceAsString(Source s) throws Exception {
- try {
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- Writer out = new StringWriter();
- StreamResult streamResult = new StreamResult();
- streamResult.setWriter(out);
- transformer.transform(s, streamResult);
- return streamResult.getWriter().toString();
-
- } catch (TransformerException te) {
- if ("javax.xml.transform.stax.StAXSource".equals(s.getClass().getName())) {
- //on java6, we will get this class if "stax" is configured
- //for the preferred type. However, older xalans don't know about it
- //we'll manually do it
- XMLStreamReader r = (XMLStreamReader)s.getClass().getMethod("getXMLStreamReader").invoke(s);
- return XMLUtils.toString(StaxUtils.read(r).getDocumentElement());
- }
- throw te;
- }
- }
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java Tue Jul 27 20:46:55 2010
@@ -27,18 +27,22 @@ import javax.xml.ws.Endpoint;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
import org.apache.hello_world_soap_http.Greeter;
import org.apache.hello_world_soap_http.SOAPService;
import org.junit.BeforeClass;
import org.junit.Test;
public class ProviderClientServerTest extends AbstractBusClientServerTestBase {
+ public static final String ADDRESS
+ = "http://localhost:" + TestUtil.getPortNumber(Server.class)
+ + "/SoapContext/SoapProviderPort";
+
public static class Server extends AbstractBusTestServerBase {
protected void run() {
Object implementor = new HWSoapMessageDocProvider();
- String address = "http://localhost:9003/SoapContext/SoapProviderPort";
- Endpoint.publish(address, implementor);
+ Endpoint.publish(ADDRESS, implementor);
}
public static void main(String[] args) {
@@ -77,6 +81,7 @@ public class ProviderClientServerTest ex
String response2 = new String("Bonjour");
try {
Greeter greeter = service.getPort(portName, Greeter.class);
+ setAddress(greeter, ADDRESS);
try {
greeter.greetMe("Return sayHi");
fail("Should have thrown an exception");
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderRPCClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderRPCClientServerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderRPCClientServerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderRPCClientServerTest.java Tue Jul 27 20:46:55 2010
@@ -39,7 +39,8 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ProviderRPCClientServerTest extends AbstractBusClientServerTestBase {
-
+ private static final String PORT = Server.PORT;
+
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly", launchServer(Server.class));
@@ -63,7 +64,8 @@ public class ProviderRPCClientServerTest
msg.saveChanges();
SOAPConnection con = conFac.createConnection();
- URL endpoint = new URL("http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit1");
+ URL endpoint = new URL("http://localhost:" + PORT
+ + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit1");
SOAPMessage response = con.call(msg, endpoint);
QName sayHiResp = new QName("http://apache.org/hello_world_rpclit", "sayHiResponse");
assertNotNull(response.getSOAPBody().getChildElements(sayHiResp));
@@ -74,21 +76,11 @@ public class ProviderRPCClientServerTest
QName portName,
int count,
boolean doFault) throws Exception {
- doGreeterRPCLit(service, portName, count, doFault, null);
- }
- private void doGreeterRPCLit(SOAPServiceRPCLit service,
- QName portName,
- int count,
- boolean doFault,
- String address) throws Exception {
String response1 = new String("TestGreetMeResponse");
String response2 = new String("TestSayHiResponse");
try {
GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
- if (address != null) {
- ((BindingProvider)greeter).getRequestContext()
- .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);
- }
+ updateAddressPort(greeter, PORT);
for (int idx = 0; idx < count; idx++) {
String greeting = greeter.greetMe("Milestone-" + idx);
assertNotNull("no response received from service", greeting);
@@ -128,6 +120,8 @@ public class ProviderRPCClientServerTest
String response1 = new String("TestGreetMeResponseServerLogicalHandlerServerSOAPHandler");
String response2 = new String("TestSayHiResponse");
GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
+ updateAddressPort(greeter, PORT);
+
String greeting = greeter.greetMe("Milestone-0");
assertNotNull("no response received from service", greeting);
assertEquals(response1, greeting);
@@ -177,12 +171,18 @@ public class ProviderRPCClientServerTest
assertNotNull(service);
String addresses[] = {
- "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8",
- "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-dom",
- "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-sax",
- "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-cxfstax",
- "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-stax",
- "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-stream"
+ "http://localhost:" + PORT
+ + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8",
+ "http://localhost:" + PORT
+ + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-dom",
+ "http://localhost:" + PORT
+ + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-sax",
+ "http://localhost:" + PORT
+ + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-cxfstax",
+ "http://localhost:" + PORT
+ + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-stax",
+ "http://localhost:" + PORT
+ + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-stream"
};
String response1 = new String("TestGreetMeResponseServerLogicalHandlerServerSOAPHandler");
GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java Tue Jul 27 20:46:55 2010
@@ -38,6 +38,8 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ProviderXMLClientServerTest extends AbstractBusClientServerTestBase {
+ public static final String ADDRESS = XMLServer.ADDRESS;
+
private final QName serviceName = new QName(
"http://apache.org/hello_world_xml_http/wrapped", "XMLService");
@@ -52,7 +54,7 @@ public class ProviderXMLClientServerTest
@Test
public void testEmptyPost() throws Exception {
- URL url = new URL("http://localhost:9022/XMLService/XMLProviderPort");
+ URL url = new URL(ADDRESS);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setDoInput(true);
@@ -76,6 +78,7 @@ public class ProviderXMLClientServerTest
Dispatch<DOMSource> disp = service.createDispatch(portName,
DOMSource.class, Service.Mode.PAYLOAD);
+ setAddress(disp, ADDRESS);
DOMSource result = disp.invoke(reqMsg);
assertNotNull(result);
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/Server.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/Server.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/Server.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/Server.java Tue Jul 27 20:46:55 2010
@@ -26,73 +26,75 @@ import javax.xml.ws.Endpoint;
import org.apache.cxf.databinding.source.SourceDataBinding;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
public class Server extends AbstractBusTestServerBase {
+ public static final String PORT = TestUtil.getPortNumber(Server.class);
protected void run() {
Object implementor = new HWSourcePayloadProvider();
- String address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8";
+ String address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8";
Endpoint ep = Endpoint.create(implementor);
ep.publish(address);
Map<String, Object> map = new HashMap<String, Object>();
map.put(SourceDataBinding.PREFERRED_FORMAT, "dom");
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-dom";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-dom";
ep = Endpoint.create(implementor);
ep.setProperties(map);
ep.publish(address);
map.put(SourceDataBinding.PREFERRED_FORMAT, "sax");
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-sax";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-sax";
ep = Endpoint.create(implementor);
ep.setProperties(map);
ep.publish(address);
map.put(SourceDataBinding.PREFERRED_FORMAT, "stax");
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-stax";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-stax";
ep = Endpoint.create(implementor);
ep.setProperties(map);
ep.publish(address);
map.put(SourceDataBinding.PREFERRED_FORMAT, "cxf.stax");
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-cxfstax";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-cxfstax";
ep = Endpoint.create(implementor);
ep.setProperties(map);
ep.publish(address);
map.put(SourceDataBinding.PREFERRED_FORMAT, "stream");
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-stream";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit8-stream";
ep = Endpoint.create(implementor);
ep.setProperties(map);
ep.publish(address);
implementor = new HWSoapMessageProvider();
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit1";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit1";
Endpoint.publish(address, implementor);
implementor = new HWDOMSourceMessageProvider();
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit2";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit2";
Endpoint.publish(address, implementor);
implementor = new HWDOMSourcePayloadProvider();
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit3";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit3";
Endpoint.publish(address, implementor);
implementor = new HWSAXSourceMessageProvider();
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit4";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit4";
Endpoint.publish(address, implementor);
implementor = new HWStreamSourceMessageProvider();
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit5";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit5";
Endpoint.publish(address, implementor);
implementor = new HWSAXSourcePayloadProvider();
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit6";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit6";
Endpoint.publish(address, implementor);
implementor = new HWStreamSourcePayloadProvider();
- address = "http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit7";
+ address = "http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit7";
Endpoint.publish(address, implementor);
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/XMLServer.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/XMLServer.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/XMLServer.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/XMLServer.java Tue Jul 27 20:46:55 2010
@@ -25,17 +25,20 @@ import java.util.Map;
import javax.xml.ws.Endpoint;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
public class XMLServer extends AbstractBusTestServerBase {
-
+ public static final String ADDRESS
+ = "http://localhost:" + TestUtil.getPortNumber(XMLServer.class)
+ + "/XMLService/XMLProviderPort";
+
protected void run() {
Object implementor = new HWDOMSourcePayloadXMLBindingProvider();
- String address = "http://localhost:9022/XMLService/XMLProviderPort";
Endpoint ep = Endpoint.create(implementor);
Map<String, Object> map = new HashMap<String, Object>();
map.put("schema-validation-enabled", Boolean.TRUE);
ep.setProperties(map);
- ep.publish(address);
+ ep.publish(ADDRESS);
}
public static void main(String[] args) {
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/datasource/DataSourceProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/datasource/DataSourceProviderTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/datasource/DataSourceProviderTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/datasource/DataSourceProviderTest.java Tue Jul 27 20:46:55 2010
@@ -42,11 +42,14 @@ import javax.xml.transform.stream.Stream
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.TestUtil;
+
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class DataSourceProviderTest extends AbstractBusClientServerTestBase {
+ static String serverPort = TestUtil.getPortNumber(Server.class);
static final Logger LOG = LogUtils.getLogger(DataSourceProviderTest.class);
private static final String BOUNDARY = "----=_Part_4_701508.1145579811786";
@@ -61,7 +64,7 @@ public class DataSourceProviderTest exte
@Before
public void createConnection() throws Exception {
- url = new URL("http://localhost:9000/test/foo");
+ url = new URL("http://localhost:" + serverPort + "/test/foo");
conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
}
@@ -69,7 +72,7 @@ public class DataSourceProviderTest exte
@Test
public void invokeOnServer() throws Exception {
- url = new URL("http://localhost:9000/test/foo");
+ url = new URL("http://localhost:" + serverPort + "/test/foo");
conn = (HttpURLConnection) url.openConnection();
printSource(new StreamSource(conn.getInputStream()));
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/datasource/Server.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/datasource/Server.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/datasource/Server.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/datasource/Server.java Tue Jul 27 20:46:55 2010
@@ -20,13 +20,15 @@
package org.apache.cxf.systest.provider.datasource;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
public class Server extends AbstractBusTestServerBase {
- protected void run() {
+ protected void run() {
+ String port = TestUtil.getPortNumber(Server.class);
TestProvider servant = new TestProvider();
- servant.publish("http://localhost:9000/test/foo");
+ servant.publish("http://localhost:" + port + "/test/foo");
}
public static void main(String[] args) throws Exception {
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java Tue Jul 27 20:46:55 2010
@@ -47,11 +47,14 @@ import org.apache.cxf.swa.types.DataStru
import org.apache.cxf.swa.types.OutputResponseAll;
import org.apache.cxf.swa.types.VoidRequest;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.TestUtil;
+
import org.junit.BeforeClass;
import org.junit.Test;
public class ClientServerSwaTest extends AbstractBusClientServerTestBase {
-
+ static String serverPort = TestUtil.getPortNumber(Server.class);
+
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly", launchServer(Server.class, true));
@@ -62,8 +65,7 @@ public class ClientServerSwaTest extends
org.apache.cxf.swa_nomime.SwAService service = new org.apache.cxf.swa_nomime.SwAService();
org.apache.cxf.swa_nomime.SwAServiceInterface port = service.getSwAServiceHttpPort();
-// ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-// "http://localhost:9037/swa");
+ setAddress(port, "http://localhost:" + serverPort + "/swa-nomime");
Holder<String> textHolder = new Holder<String>("Hi");
Holder<byte[]> data = new Holder<byte[]>("foobar".getBytes());
@@ -105,9 +107,8 @@ public class ClientServerSwaTest extends
SwAService service = new SwAService();
SwAServiceInterface port = service.getSwAServiceHttpPort();
-// ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-// "http://localhost:9037/swa");
-
+ setAddress(port, "http://localhost:" + serverPort + "/swa");
+
Holder<String> textHolder = new Holder<String>();
Holder<DataHandler> data = new Holder<DataHandler>();
@@ -133,8 +134,7 @@ public class ClientServerSwaTest extends
SwAService service = new SwAService();
SwAServiceInterface port = service.getSwAServiceHttpPort();
-// ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-// "http://localhost:9037/swa");
+ setAddress(port, "http://localhost:" + serverPort + "/swa");
Holder<String> textHolder = new Holder<String>();
Holder<String> headerHolder = new Holder<String>();
@@ -164,8 +164,7 @@ public class ClientServerSwaTest extends
SwAService service = new SwAService();
SwAServiceInterface port = service.getSwAServiceHttpPort();
-// ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-// "http://localhost:9037/swa");
+ setAddress(port, "http://localhost:" + serverPort + "/swa");
Holder<DataStruct> structHolder = new Holder<DataStruct>();
@@ -197,6 +196,7 @@ public class ClientServerSwaTest extends
SwAService service = new SwAService();
SwAServiceInterface port = service.getSwAServiceHttpPort();
+ setAddress(port, "http://localhost:" + serverPort + "/swa");
URL url1 = this.getClass().getResource("resources/attach.text");
URL url2 = this.getClass().getResource("resources/attach.html");
@@ -262,6 +262,7 @@ public class ClientServerSwaTest extends
.createDispatch(SwAService.SwAServiceHttpPort,
SOAPMessage.class,
Service.Mode.MESSAGE);
+ setAddress(disp, "http://localhost:" + serverPort + "/swa");
SOAPMessage msg = MessageFactory.newInstance().createMessage();
Modified: cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/Server.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/Server.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/Server.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/Server.java Tue Jul 27 20:46:55 2010
@@ -23,12 +23,15 @@ import javax.xml.ws.Endpoint;
import org.apache.cxf.jaxws.EndpointImpl;
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 SwAServiceImpl();
- String address = "http://localhost:9036/swa";
+ String address = "http://localhost:" + port + "/swa";
EndpointImpl ep;
try {
ep = (EndpointImpl) Endpoint.create(new SwANoMimeServiceImpl());
Modified: cxf/sandbox/oauth_1.0a/systests/transports/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/transports/pom.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/transports/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/transports/pom.xml Tue Jul 27 20:46:55 2010
@@ -107,8 +107,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.cxf</groupId>
@@ -167,6 +167,14 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${project.version}</version>
Modified: cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/testcases/AbstractSOAPJMSTestSuite.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/testcases/AbstractSOAPJMSTestSuite.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/testcases/AbstractSOAPJMSTestSuite.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/testcases/AbstractSOAPJMSTestSuite.java Tue Jul 27 20:46:55 2010
@@ -29,10 +29,12 @@ import javax.jms.Session;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
+import org.apache.cxf.BusFactory;
import org.apache.cxf.jms.testsuite.util.JMSTestUtil;
import org.apache.cxf.testsuite.testcase.MessagePropertiesType;
import org.apache.cxf.testsuite.testcase.TestCaseType;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
import org.apache.cxf.transport.jms.JMSConfiguration;
import org.apache.cxf.transport.jms.JMSFactory;
import org.apache.cxf.transport.jms.JMSMessageHeadersType;
@@ -58,7 +60,9 @@ public abstract class AbstractSOAPJMSTes
QName qServiceName = new QName(namespace, serviceName);
QName qPortName = new QName(namespace, portName);
URL wsdl = getClass().getResource("/wsdl/jms_spec_testsuite.wsdl");
-
+ EmbeddedJMSBrokerLauncher.updateWsdlExtensors(getBus(), wsdl.toString());
+ BusFactory.setThreadDefaultBus(getBus());
+ BusFactory.setDefaultBus(getBus());
Class<? extends Service> svcls = serviceClass.asSubclass(Service.class);
Constructor<? extends Service> serviceConstructor = svcls.getConstructor(URL.class,
@@ -156,8 +160,12 @@ public abstract class AbstractSOAPJMSTes
// todo messagetype
// todo messageid
if (messageProperties.isSetDeliveryMode()) {
- assertEquals(header.getJMSDeliveryMode(), messageProperties.getDeliveryMode()
- .intValue());
+ int dm = 0;
+ if (header.isSetJMSDeliveryMode()) {
+ dm = header.getJMSDeliveryMode();
+ }
+ assertEquals(dm,
+ messageProperties.getDeliveryMode().intValue());
}
if (messageProperties.isSetPriority()) {
assertEquals(header.getJMSPriority(), messageProperties.getPriority().intValue());
Modified: cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/testcases/SOAPJMSTestSuiteTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/testcases/SOAPJMSTestSuiteTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/testcases/SOAPJMSTestSuiteTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/testcases/SOAPJMSTestSuiteTest.java Tue Jul 27 20:46:55 2010
@@ -60,7 +60,8 @@ import org.junit.Test;
*
*/
public class SOAPJMSTestSuiteTest extends AbstractSOAPJMSTestSuite {
-
+ static final String JMS_PORT = EmbeddedJMSBrokerLauncher.PORT;
+
@BeforeClass
public static void startServers() throws Exception {
Map<String, String> props = new HashMap<String, String>();
@@ -72,14 +73,16 @@ public class SOAPJMSTestSuiteTest extend
assertTrue("server did not launch correctly", launchServer(EmbeddedJMSBrokerLauncher.class,
props, null));
assertTrue("server did not launch correctly", launchServer(Server.class, false));
+ createStaticBus();
}
-
+
private void oneWayTest(TestCaseType testcase, JMSSimplePortType port) throws Exception {
InvocationHandler handler = Proxy.getInvocationHandler(port);
BindingProvider bp = (BindingProvider)handler;
Map<String, Object> requestContext = bp.getRequestContext();
JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
+
requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
Exception e = null;
try {
Modified: cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/util/JMSTestUtil.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/util/JMSTestUtil.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/util/JMSTestUtil.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/jms/testsuite/util/JMSTestUtil.java Tue Jul 27 20:46:55 2010
@@ -37,6 +37,7 @@ import javax.xml.bind.Unmarshaller;
import org.apache.cxf.testsuite.testcase.MessagePropertiesType;
import org.apache.cxf.testsuite.testcase.TestCaseType;
import org.apache.cxf.testsuite.testcase.TestCasesType;
+import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
import org.apache.cxf.transport.jms.JMSConfiguration;
import org.apache.cxf.transport.jms.JMSFactory;
import org.apache.cxf.transport.jms.JMSOldConfigHolder;
@@ -91,6 +92,19 @@ public final class JMSTestUtil {
JAXBElement e = (JAXBElement)unmarshaller.unmarshal(new JMSTestUtil().getClass()
.getResource("/org/apache/cxf/jms/testsuite/util/testcases.xml"));
testcases = (TestCasesType)e.getValue();
+ for (TestCaseType tct : testcases.getTestCase()) {
+ if (tct.isSetAddress()) {
+ String add = tct.getAddress();
+ int idx = add.indexOf("jndiURL=");
+ if (idx != -1) {
+ int idx2 = add.indexOf("&", idx);
+ add = add.substring(0, idx)
+ + "jndiURL=tcp://localhost:" + EmbeddedJMSBrokerLauncher.PORT
+ + (idx2 == -1 ? "" : add.substring(idx2));
+ tct.setAddress(add);
+ }
+ }
+ }
}
public static JmsTemplate getJmsTemplate(String address) throws Exception {
Modified: cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/BareServer.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/BareServer.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/BareServer.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/BareServer.java Tue Jul 27 20:46:55 2010
@@ -26,13 +26,13 @@ import org.apache.cxf.bus.spring.SpringB
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
public class BareServer extends AbstractBusTestServerBase {
-
+ public static final String PORT = allocatePort(BareServer.class);
@Override
protected void run() {
Bus bus = new SpringBusFactory().createBus();
SpringBusFactory.setDefaultBus(bus);
Object implementor = new GreeterImpl();
- String address = "http://localhost:9020/SoapContext/GreeterPort";
+ String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
Endpoint.publish(address, implementor);
}
Modified: cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/BusServer.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/BusServer.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/BusServer.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/BusServer.java Tue Jul 27 20:46:55 2010
@@ -28,7 +28,16 @@ import org.apache.cxf.testutil.common.Ab
* Everything else is designed to be spring-loaded.
*/
public class BusServer extends AbstractBusTestServerBase {
-
+ public static final String PORT0 = allocatePort(BusServer.class, 0);
+ public static final String PORT1 = allocatePort(BusServer.class, 1);
+ public static final String PORT2 = allocatePort(BusServer.class, 2);
+ public static final String PORT3 = allocatePort(BusServer.class, 3);
+ public static final String PORT4 = allocatePort(BusServer.class, 4);
+ public static final String PORT5 = allocatePort(BusServer.class, 5);
+ public static final String PORT6 = allocatePort(BusServer.class, 6);
+ public static final String PORT7 = allocatePort(BusServer.class, 7);
+ public static final String PORT8 = allocatePort(BusServer.class, 8);
+
protected void run() {
//
// Just instantiate the Bus; services will be instantiated
Modified: cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/CertConstraintsTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/CertConstraintsTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/CertConstraintsTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/CertConstraintsTest.java Tue Jul 27 20:46:55 2010
@@ -36,7 +36,15 @@ import org.junit.Test;
* constraints logic.
*/
public class CertConstraintsTest extends AbstractBusClientServerTestBase {
-
+ public static final String PORT0 = BusServer.PORT0;
+ public static final String PORT1 = BusServer.PORT1;
+ public static final String PORT2 = BusServer.PORT2;
+ public static final String PORT3 = BusServer.PORT3;
+ public static final String PORT4 = BusServer.PORT4;
+ public static final String PORT5 = BusServer.PORT5;
+ public static final String PORT6 = BusServer.PORT6;
+ public static final String PORT7 = BusServer.PORT7;
+ public static final String PORT8 = BusServer.PORT8;
//
// data
//
@@ -122,35 +130,35 @@ public class CertConstraintsTest extends
//
// Good Subject DN
//
- testSuccessfulCall("https://localhost:9006/SoapContext/HttpsPort");
+ testSuccessfulCall("https://localhost:" + PORT0 + "/SoapContext/HttpsPort");
//
// Bad Subject DN
//
- testFailedCall("https://localhost:9007/SoapContext/HttpsPort");
+ testFailedCall("https://localhost:" + PORT1 + "/SoapContext/HttpsPort");
//
// Mixed Subject DN (ALL)
//
- testFailedCall("https://localhost:9008/SoapContext/HttpsPort");
+ testFailedCall("https://localhost:" + PORT2 + "/SoapContext/HttpsPort");
//
// Mixed Subject DN (ANY)
//
- testSuccessfulCall("https://localhost:9009/SoapContext/HttpsPort");
+ testSuccessfulCall("https://localhost:" + PORT3 + "/SoapContext/HttpsPort");
//
// Mixed Issuer DN (ALL)
//
- testFailedCall("https://localhost:9010/SoapContext/HttpsPort");
+ testFailedCall("https://localhost:" + PORT4 + "/SoapContext/HttpsPort");
//
// Mixed Issuer DN (ANY)
//
- testSuccessfulCall("https://localhost:9011/SoapContext/HttpsPort");
+ testSuccessfulCall("https://localhost:" + PORT5 + "/SoapContext/HttpsPort");
//
// Bad server Subject DN
//
- testFailedCall("https://localhost:9012/SoapContext/HttpsPort");
+ testFailedCall("https://localhost:" + PORT6 + "/SoapContext/HttpsPort");
//
// Bad server Issuer DN
//
- testFailedCall("https://localhost:9013/SoapContext/HttpsPort");
+ testFailedCall("https://localhost:" + PORT7 + "/SoapContext/HttpsPort");
stopServers();
}
Modified: cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java Tue Jul 27 20:46:55 2010
@@ -38,6 +38,7 @@ import org.junit.Ignore;
import org.junit.Test;
public class ClientServerSessionTest extends AbstractBusClientServerTestBase {
+ public static final String PORT = SessionServer.PORT;
@BeforeClass
public static void startServers() throws Exception {
@@ -57,6 +58,7 @@ public class ClientServerSessionTest ext
Greeter greeter = service.getGreeterPort();
BindingProvider bp = (BindingProvider)greeter;
+ updateAddressPort(bp, PORT);
bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
@@ -118,6 +120,7 @@ public class ClientServerSessionTest ext
try {
Greeter greeter = service.getGreeterPort();
+ updateAddressPort(greeter, PORT);
String greeting = greeter.greetMe("Bonjour");
@@ -145,7 +148,7 @@ public class ClientServerSessionTest ext
boolean isWindows = System.getProperty("os.name").startsWith("Windows");
GreeterSessionImpl implementor = new GreeterSessionImpl();
- String address = "http://localhost:9020/SoapContext/GreeterPort";
+ String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
try {
Endpoint.publish(address, implementor);
if (!isWindows) {
Modified: cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java Tue Jul 27 20:46:55 2010
@@ -102,6 +102,15 @@ import org.springframework.context.Appli
* the Hostname Verifier.
*/
public class HTTPConduitTest extends AbstractBusClientServerTestBase {
+ public static final String PORT0 = BusServer.PORT0;
+ public static final String PORT1 = BusServer.PORT1;
+ public static final String PORT2 = BusServer.PORT2;
+ public static final String PORT3 = BusServer.PORT3;
+ public static final String PORT4 = BusServer.PORT4;
+ public static final String PORT5 = BusServer.PORT5;
+ public static final String PORT6 = BusServer.PORT6;
+ public static final String PORT7 = BusServer.PORT7;
+ public static final String PORT8 = BusServer.PORT8;
private static final boolean IN_PROCESS = true;
@@ -110,15 +119,15 @@ public class HTTPConduitTest extends Abs
private static List<String> servers = new ArrayList<String>();
static {
- addrMap.put("Mortimer", "http://localhost:9000/");
- addrMap.put("Tarpin", "https://localhost:9003/");
- addrMap.put("Rethwel", "http://localhost:9004/");
- addrMap.put("Poltim", "https://localhost:9005/");
- addrMap.put("Gordy", "https://localhost:9001/");
- addrMap.put("Bethal", "https://localhost:9002/");
- addrMap.put("Abost", "http://localhost:9007/");
- addrMap.put("Hurlon", "http://localhost:9006/");
- addrMap.put("Morpit", "https://localhost:9008/");
+ addrMap.put("Mortimer", "http://localhost:" + PORT0 + "/");
+ addrMap.put("Tarpin", "https://localhost:" + PORT3 + "/");
+ addrMap.put("Rethwel", "http://localhost:" + PORT4 + "/");
+ addrMap.put("Poltim", "https://localhost:" + PORT5 + "/");
+ addrMap.put("Gordy", "https://localhost:" + PORT1 + "/");
+ addrMap.put("Bethal", "https://localhost:" + PORT2 + "/");
+ addrMap.put("Abost", "http://localhost:" + PORT7 + "/");
+ addrMap.put("Hurlon", "http://localhost:" + PORT6 + "/");
+ addrMap.put("Morpit", "https://localhost:" + PORT8 + "/");
tlsClientParameters.setDisableCNCheck(true);
}
@@ -270,7 +279,8 @@ public class HTTPConduitTest extends Abs
Greeter mortimer = service.getPort(mortimerQ, Greeter.class);
assertNotNull("Port is null", mortimer);
-
+ updateAddressPort(mortimer, PORT0);
+
String answer = mortimer.sayHi();
assertTrue("Unexpected answer: " + answer,
"Bonjour from Mortimer".equals(answer));
@@ -299,7 +309,8 @@ public class HTTPConduitTest extends Abs
Greeter rethwel = service.getPort(rethwelQ, Greeter.class);
assertNotNull("Port is null", rethwel);
-
+ updateAddressPort(rethwel, PORT5);
+
String answer = null;
try {
answer = rethwel.sayHi();
@@ -346,6 +357,7 @@ public class HTTPConduitTest extends Abs
assertNotNull("Service is null", service);
Greeter rethwel = service.getPort(rethwelQ, Greeter.class);
+ updateAddressPort(rethwel, PORT4);
assertNotNull("Port is null", rethwel);
String answer = rethwel.sayHi();
@@ -379,6 +391,7 @@ public class HTTPConduitTest extends Abs
Greeter hurlon = service.getPort(hurlonQ, Greeter.class);
assertNotNull("Port is null", hurlon);
+ updateAddressPort(hurlon, PORT6);
String answer = null;
try {
@@ -413,6 +426,7 @@ public class HTTPConduitTest extends Abs
Greeter bethal = service.getPort(bethalQ, Greeter.class);
assertNotNull("Port is null", bethal);
+ updateAddressPort(bethal, PORT2);
verifyBethalClient(bethal);
}
@@ -428,6 +442,7 @@ public class HTTPConduitTest extends Abs
ApplicationContext context = bus.getExtension(BusApplicationContext.class);
Greeter bethal = (Greeter)context.getBean("Bethal");
+ updateAddressPort(bethal, PORT2);
// verify the client side's setting
verifyBethalClient(bethal);
}
@@ -477,6 +492,7 @@ public class HTTPConduitTest extends Abs
Greeter bethal = service.getPort(bethalQ, Greeter.class);
assertNotNull("Port is null", bethal);
+ updateAddressPort(bethal, PORT2);
// Okay, I'm sick of configuration files.
// This also tests dynamic configuration of the conduit.
@@ -517,7 +533,8 @@ public class HTTPConduitTest extends Abs
Greeter poltim = service.getPort(poltimQ, Greeter.class);
assertNotNull("Port is null", poltim);
-
+ updateAddressPort(poltim, PORT5);
+
// Okay, I'm sick of configuration files.
// This also tests dynamic configuration of the conduit.
Client client = ClientProxy.getClient(poltim);
@@ -601,6 +618,7 @@ public class HTTPConduitTest extends Abs
Greeter bethal = service.getPort(bethalQ, Greeter.class);
assertNotNull("Port is null", bethal);
+ updateAddressPort(bethal, PORT2);
// Okay, I'm sick of configuration files.
// This also tests dynamic configuration of the conduit.
@@ -657,6 +675,7 @@ public class HTTPConduitTest extends Abs
Greeter tarpin = service.getPort(tarpinQ, Greeter.class);
assertNotNull("Port is null", tarpin);
+ updateAddressPort(tarpin, PORT3);
// Okay, I'm sick of configuration files.
// This also tests dynamic configuration of the conduit.
@@ -804,6 +823,7 @@ public class HTTPConduitTest extends Abs
Greeter gordy = service.getPort(gordyQ, Greeter.class);
assertNotNull("Port is null", gordy);
+ updateAddressPort(gordy, PORT1);
// Okay, I'm sick of configuration files.
// This also tests dynamic configuration of the conduit.
Modified: cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java Tue Jul 27 20:46:55 2010
@@ -36,7 +36,12 @@ import org.junit.Test;
* HTTP/S service.
*/
public class HTTPSClientTest extends AbstractBusClientServerTestBase {
-
+ public static final String PORT1 = BusServer.PORT1;
+ public static final String PORT2 = BusServer.PORT2;
+ public static final String PORT3 = BusServer.PORT3;
+ public static final String PORT4 = BusServer.PORT4;
+ public static final String PORT5 = BusServer.PORT5;
+ public static final String PORT6 = BusServer.PORT6;
//
// data
//
@@ -106,34 +111,34 @@ public class HTTPSClientTest extends Abs
@Test
public final void testJaxwsServer() throws Exception {
testSuccessfulCall("resources/jaxws-server.xml",
- "https://localhost:9002/SoapContext/HttpsPort");
+ "https://localhost:" + PORT2 + "/SoapContext/HttpsPort");
}
@Test
public final void testJaxwsServerChangeHttpsToHttp() throws Exception {
testSuccessfulCall("resources/jaxws-server.xml",
- "http://localhost:9003/SoapContext/HttpPort");
+ "http://localhost:" + PORT3 + "/SoapContext/HttpPort");
}
@Test
public final void testJaxwsEndpoint() throws Exception {
testSuccessfulCall("resources/jaxws-publish.xml",
- "https://localhost:9001/SoapContext/HttpsPort");
+ "https://localhost:" + PORT1 + "/SoapContext/HttpsPort");
}
@Test
public final void testPKCS12Endpoint() throws Exception {
testSuccessfulCall("resources/pkcs12.xml",
- "https://localhost:9006/SoapContext/HttpsPort");
+ "https://localhost:" + PORT6 + "/SoapContext/HttpsPort");
}
@Test
public final void testResourceKeySpecEndpoint() throws Exception {
testSuccessfulCall("resources/resource-key-spec.xml",
- "https://localhost:9004/SoapContext/HttpsPort");
+ "https://localhost:" + PORT4 + "/SoapContext/HttpsPort");
}
@Test
public final void testResourceKeySpecEndpointURL() throws Exception {
testSuccessfulCall("resources/resource-key-spec-url.xml",
- "https://localhost:9005/SoapContext/HttpsPort",
- new URL("https://localhost:9005/SoapContext/HttpsPort?wsdl"));
+ "https://localhost:" + PORT5 + "/SoapContext/HttpsPort",
+ new URL("https://localhost:" + PORT5 + "/SoapContext/HttpsPort?wsdl"));
}
}