cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r953806 [3/3] - in /cxf/branches/2.2.x-fixes: ./ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/...
Date Fri, 11 Jun 2010 18:28:59 GMT
Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
Fri Jun 11 18:28:57 2010
@@ -59,15 +59,20 @@ import org.junit.Test;
 
 
 public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
-    public static final String POLICY_ADDRESS = "http://localhost:9010/SecPolTest";
-    public static final String POLICY_HTTPS_ADDRESS = "https://localhost:9009/SecPolTest";
-    public static final String POLICY_ENCSIGN_ADDRESS = "http://localhost:9010/SecPolTestEncryptThenSign";
-    public static final String POLICY_SIGNENC_ADDRESS = "http://localhost:9010/SecPolTestSignThenEncrypt";
+    public static final String PORT = allocatePort(SecurityPolicyTest.class);
+    public static final String SSL_PORT = allocatePort(SecurityPolicyTest.class, 1);
+
+    public static final String POLICY_ADDRESS = "http://localhost:" + PORT + "/SecPolTest";
+    public static final String POLICY_HTTPS_ADDRESS = "https://localhost:" + SSL_PORT + "/SecPolTest";
+    public static final String POLICY_ENCSIGN_ADDRESS = "http://localhost:" 
+            + PORT + "/SecPolTestEncryptThenSign";
+    public static final String POLICY_SIGNENC_ADDRESS = "http://localhost:" 
+            + PORT + "/SecPolTestSignThenEncrypt";
     public static final String POLICY_SIGNENC_PROVIDER_ADDRESS 
-        = "http://localhost:9010/SecPolTestSignThenEncryptProvider";
-    public static final String POLICY_SIGN_ADDRESS = "http://localhost:9010/SecPolTestSign";
-    public static final String POLICY_XPATH_ADDRESS = "http://localhost:9010/SecPolTestXPath";
-    public static final String POLICY_SIGNONLY_ADDRESS = "http://localhost:9010/SecPolTestSignedOnly";
+        = "http://localhost:" + PORT + "/SecPolTestSignThenEncryptProvider";
+    public static final String POLICY_SIGN_ADDRESS = "http://localhost:" + PORT + "/SecPolTestSign";
+    public static final String POLICY_XPATH_ADDRESS = "http://localhost:" + PORT + "/SecPolTestXPath";
+    public static final String POLICY_SIGNONLY_ADDRESS = "http://localhost:" + PORT + "/SecPolTestSignedOnly";
 
     
     public static class ServerPasswordCallback implements CallbackHandler {
@@ -162,6 +167,7 @@ public class SecurityPolicyTest extends 
         DoubleItPortType pt;
 
         pt = service.getDoubleItPortXPath();
+        updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER,

                                                       new KeystorePasswordCallback());
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
@@ -172,6 +178,7 @@ public class SecurityPolicyTest extends 
         
         
         pt = service.getDoubleItPortEncryptThenSign();
+        updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER,

                                                       new KeystorePasswordCallback());
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
@@ -181,6 +188,7 @@ public class SecurityPolicyTest extends 
         pt.doubleIt(BigInteger.valueOf(5));
         
         pt = service.getDoubleItPortSign();
+        updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER,

                                                       new KeystorePasswordCallback());
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
@@ -191,6 +199,7 @@ public class SecurityPolicyTest extends 
 
         
         pt = service.getDoubleItPortSignThenEncrypt();
+        updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER,

                                                       new KeystorePasswordCallback());
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
@@ -205,6 +214,7 @@ public class SecurityPolicyTest extends 
         assertEquals(10, x);
         
         pt = service.getDoubleItPortHttps();
+        updateAddressPort(pt, SSL_PORT);
         try {
             pt.doubleIt(BigInteger.valueOf(25));
         } catch (Exception ex) {
@@ -220,6 +230,7 @@ public class SecurityPolicyTest extends 
         
         try {
             pt = service.getDoubleItPortHttp();
+            updateAddressPort(pt, PORT);
             pt.doubleIt(BigInteger.valueOf(25));
             fail("https policy should have triggered");
         } catch (Exception ex) {
@@ -239,6 +250,7 @@ public class SecurityPolicyTest extends 
         DoubleItPortType pt;
 
         pt = service.getDoubleItPortSignedOnly();
+        updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER,

                                                       new KeystorePasswordCallback());
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
@@ -276,6 +288,7 @@ public class SecurityPolicyTest extends 
                                      getClass().getResource("alice.properties"));
         disp.getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, 
                                      getClass().getResource("bob.properties"));
+        updateAddressPort(disp, PORT);
 
         String req = "<ns2:DoubleIt xmlns:ns2=\"http://cxf.apache.org/policytest/DoubleIt\">"
             + "<numberToDouble>25</numberToDouble></ns2:DoubleIt>";

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/Server.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/Server.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/Server.java
Fri Jun 11 18:28:57 2010
@@ -25,6 +25,7 @@ import org.apache.cxf.bus.spring.SpringB
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 
 public class Server extends AbstractBusTestServerBase {
+    public static final String PORT = allocatePort(Server.class);
 
     protected void run()  {
         SpringBusFactory factory = new SpringBusFactory();

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java
Fri Jun 11 18:28:57 2010
@@ -59,6 +59,8 @@ import org.junit.Test;
  *
  */
 public class WSSecurityClientTest extends AbstractBusClientServerTestBase {
+    public static final String PORT = allocatePort(Server.class);
+    public static final String DEC_PORT = allocatePort(WSSecurityClientTest.class);
 
     private static final java.net.URL WSDL_LOC;
     static {
@@ -102,10 +104,11 @@ public class WSSecurityClientTest extend
     }
     
     @Test
-    public void testUsernameToken() {
+    public void testUsernameToken() throws Exception {
         final javax.xml.ws.Service svc 
             = javax.xml.ws.Service.create(WSDL_LOC, GREETER_SERVICE_QNAME);
         final Greeter greeter = svc.getPort(USERNAME_TOKEN_PORT_QNAME, Greeter.class);
+        updateAddressPort(greeter, PORT);
         
         Client client = ClientProxy.getClient(greeter);
         Map<String, Object> props = new HashMap<String, Object>();
@@ -137,7 +140,7 @@ public class WSSecurityClientTest extend
     }
 
     @Test
-    public void testTimestampSignEncrypt() {
+    public void testTimestampSignEncrypt() throws Exception {
         BusFactory.setDefaultBus(
             new SpringBusFactory().createBus(
                 "org/apache/cxf/systest/ws/security/client.xml"
@@ -151,6 +154,7 @@ public class WSSecurityClientTest extend
             TIMESTAMP_SIGN_ENCRYPT_PORT_QNAME,
             Greeter.class
         );
+        updateAddressPort(greeter, PORT);
 
         // Add a No-Op JAX-WS SoapHandler to the dispatch chain to
         // verify that the SoapHandlerInterceptor can peacefully co-exist
@@ -268,7 +272,7 @@ public class WSSecurityClientTest extend
         service.addPort(
             USERNAME_TOKEN_PORT_QNAME,
             decoupled ? SOAPBinding.SOAP11HTTP_BINDING : HTTPBinding.HTTP_BINDING, 
-            "http://localhost:9000/GreeterService/UsernameTokenPort"
+            "http://localhost:" + PORT + "/GreeterService/UsernameTokenPort"
         );
         final Dispatch<Source> dispatcher = service.createDispatch(
             USERNAME_TOKEN_PORT_QNAME,
@@ -284,7 +288,7 @@ public class WSSecurityClientTest extend
         );
         if (decoupled) {
             HTTPConduit cond = (HTTPConduit)((DispatchImpl)dispatcher).getClient().getConduit();
-            cond.getClient().setDecoupledEndpoint("http://localhost:9001/decoupled");
+            cond.getClient().setDecoupledEndpoint("http://localhost:" + DEC_PORT + "/decoupled");
         }
         return dispatcher;
     }

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/https_config.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/https_config.xml?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/https_config.xml
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/https_config.xml
Fri Jun 11 18:28:57 2010
@@ -30,6 +30,7 @@ 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"/>
 
     <!-- -->
     <!-- This Spring config file is designed to represent a minimal -->
@@ -47,7 +48,7 @@ under the License.
     <!-- TLS Port configuration parameters for port 9009 -->
     <!-- -->
     <httpj:engine-factory id="port-9009-tls-config">
-        <httpj:engine port="9009">
+        <httpj:engine port="${testutil.ports.SecurityPolicyTest.1}">
             <httpj:tlsServerParameters>
                <sec:keyManagers keyPassword="password">
                    <sec:keyStore type="JKS" password="password" 

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/server.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/server.xml?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/server.xml
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/security/server.xml
Fri Jun 11 18:28:57 2010
@@ -31,6 +31,8 @@
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://cxf.apache.org/jaxws                                     
         http://cxf.apache.org/schemas/jaxws.xsd">
+  
+   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
     
     <!--    
          Enable logging at all endpoints    
@@ -49,7 +51,7 @@
     <jaxws:endpoint
         id="UsernameTokenEndpoint"
         implementor="org.apache.cxf.systest.ws.security.GreeterImpl"
-        address="http://localhost:9000/GreeterService/UsernameTokenPort"
+        address="http://localhost:${testutil.ports.Server}/GreeterService/UsernameTokenPort"
         serviceName="test:GreeterService"
         endpointName="test:UsernameTokenPort"
         >
@@ -86,7 +88,7 @@
     <jaxws:endpoint 
         id="TimestampSignEncryptEndpoint"
         implementor="org.apache.cxf.systest.ws.security.GreeterImpl"
-        address="http://localhost:9000/GreeterService/TimestampSignEncryptPort"
+        address="http://localhost:${testutil.ports.Server}/GreeterService/TimestampSignEncryptPort"
         serviceName="test:GreeterService"
         endpointName="test:TimestampSignEncryptPort"
         >

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java
Fri Jun 11 18:28:57 2010
@@ -36,6 +36,7 @@ import org.junit.Test;
  *
  */
 public class WSSCTest extends AbstractBusClientServerTestBase {
+    static final String PORT = allocatePort(Server.class);
 
        
     private static final String OUT = "CXF : ping";
@@ -189,7 +190,7 @@ public class WSSCTest extends AbstractBu
                 );
            
             ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-                                                            "http://localhost:9001/" + portPrefix);
+                                                            "http://localhost:" + PORT +
"/" + portPrefix);
             if (portPrefix.charAt(0) == '_') {
                 //MS would like the _ versions to send a cancel
                 ((BindingProvider)port).getRequestContext()

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/Server.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/Server.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/Server.java
Fri Jun 11 18:28:57 2010
@@ -32,7 +32,8 @@ import org.apache.ws.security.WSSConfig;
 
 
 public class Server extends AbstractBusTestServerBase {
-    
+    static final String PORT = allocatePort(Server.class);
+
     public Server() throws Exception {
         
     }
@@ -86,7 +87,7 @@ public class Server extends AbstractBusT
     protected void run()  {
         try {
             WSSConfig.getDefaultWSConfig();
-            new Server("http://localhost:9001/");
+            new Server("http://localhost:" + PORT + "/");
             Bus busLocal = new SpringBusFactory().createBus(
                     "org/apache/cxf/systest/ws/wssc/server/server.xml");
             BusFactory.setDefaultBus(busLocal);

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/server.xml?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/server.xml
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/server.xml
Fri Jun 11 18:28:57 2010
@@ -42,21 +42,5 @@
         </cxf:features>
     </cxf:bus>
     
-    <!-- -->
-    <!-- Any services listening on port 9002 must use the following -->
-    <!-- Transport Layer Security (TLS) settings -->
-    <!-- -->
-    <!-- httpj:engine-factory bus="cxf">
-        <httpj:engine port="9002">
-            <httpj:tlsServerParameters>
-                <sec:keyManagers keyPassword="password">
-                    <sec:keyStore type="pkcs12" password="password" resource="org/apache/cxf/systest/ws/wssc/certs/alice.p12"/>
-                </sec:keyManagers>
-
-            </httpj:tlsServerParameters>
-        </httpj:engine>
-    </httpj:engine-factory-->
-
-
     
 </beans>

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java
Fri Jun 11 18:28:57 2010
@@ -42,7 +42,9 @@ import wssec.wssec10.PingService;
  *
  */
 public class WSSecurity10Test extends AbstractBusClientServerTestBase {
-    
+    static final String PORT = allocatePort(Server.class);
+    static final String SSL_PORT = allocatePort(Server.class, 1);
+
     private static final String INPUT = "foo";
     private static boolean unrestrictedPoliciesInstalled;
     
@@ -102,13 +104,13 @@ public class WSSecurity10Test extends Ab
     private static URL getWsdlLocation(String portPrefix) {
         try {
             if ("UserNameOverTransport".equals(portPrefix)) {
-                return new URL("https://localhost:9001/" + portPrefix + "?wsdl");
+                return new URL("https://localhost:" + SSL_PORT + "/" + portPrefix + "?wsdl");
             } else if ("UserName".equals(portPrefix)) {
-                return new URL("http://localhost:9003/" + portPrefix + "?wsdl");
+                return new URL("http://localhost:" + PORT + "/" + portPrefix + "?wsdl");
             } else if ("MutualCertificate10SignEncrypt".equals(portPrefix)) {
-                return new URL("http://localhost:9002/" + portPrefix + "?wsdl");
+                return new URL("http://localhost:" + PORT + "/" + portPrefix + "?wsdl");
             } else if ("MutualCertificate10SignEncryptRsa15TripleDes".equals(portPrefix))
{
-                return new URL("http://localhost:9000/" + portPrefix + "?wsdl");
+                return new URL("http://localhost:" + PORT + "/" + portPrefix + "?wsdl");
             }
         } catch (MalformedURLException mue) {
             return null;

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java
Fri Jun 11 18:28:57 2010
@@ -25,6 +25,8 @@ import org.apache.cxf.systest.ws.wssec11
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 
 public class Server extends AbstractBusTestServerBase {
+    static final String PORT = allocatePort(Server.class);
+    static final String SSL_PORT = allocatePort(Server.class, 1);
 
     private static boolean unrestrictedPoliciesInstalled;
     private static String configFileName;

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml
Fri Jun 11 18:28:57 2010
@@ -37,6 +37,7 @@
         http://cxf.apache.org/configuration/security                    http://cxf.apache.org/schemas/configuration/security.xsd
         http://schemas.iona.com/soa/security-config                     http://schemas.iona.com/soa/security-config.xsd
     ">
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
     
     <cxf:bus>
         <cxf:features>
@@ -50,7 +51,7 @@
     <!-- Transport Layer Security (TLS) settings -->
     <!-- -->
     <httpj:engine-factory id="tls-settings">
-        <httpj:engine port="9001">
+        <httpj:engine port="${testutil.ports.Server.1}">
             <httpj:tlsServerParameters>
                 <sec:keyManagers keyPassword="password">
                     <sec:keyStore type="jks" password="password" resource="org/apache/cxf/systest/ws/wssec10/certs/bob.jks"/>
@@ -78,7 +79,7 @@
     <!-- -->
     <jaxws:endpoint 
        id="UserNameOverTransport"
-       address="https://localhost:9001/UserNameOverTransport" 
+       address="https://localhost:${testutil.ports.Server.1}/UserNameOverTransport" 
        serviceName="interop:PingService"
        endpointName="interop:UserNameOverTransport_IPingService"
        implementor="org.apache.cxf.systest.ws.wssec10.server.UserNameOverTransport"
@@ -92,7 +93,7 @@
     </jaxws:endpoint> 
     <jaxws:endpoint 
        id="UserName"
-       address="http://localhost:9003/UserName" 
+       address="http://localhost:${testutil.ports.Server}/UserName" 
        serviceName="interop:PingService"
        endpointName="interop:UserName_IPingService"
        implementor="org.apache.cxf.systest.ws.wssec10.server.UserNameOverTransport">
@@ -110,7 +111,7 @@
     <jaxws:endpoint 
        name="{http://WSSec/wssec10}MutualCertificate10SignEncrypt_IPingService"
        id="MutualCertificate10SignEncrypt"
-       address="http://localhost:9002/MutualCertificate10SignEncrypt" 
+       address="http://localhost:${testutil.ports.Server}/MutualCertificate10SignEncrypt"

        serviceName="interop:PingService"
        endpointName="interop:MutualCertificate10SignEncrypt_IPingService"
        implementor="org.apache.cxf.systest.ws.wssec10.server.MutualCertificate10SignEncrypt">
@@ -131,7 +132,7 @@
     <jaxws:endpoint 
        name="{http://WSSec/wssec10}MutualCertificate10SignEncryptRsa15TripleDes_IPingService"
        id="MutualCertificate10SignEncryptRsa15TripleDes"
-       address="http://localhost:9000/MutualCertificate10SignEncryptRsa15TripleDes" 
+       address="http://localhost:${testutil.ports.Server}/MutualCertificate10SignEncryptRsa15TripleDes"

        serviceName="interop:PingService"
        endpointName="interop:MutualCertificate10SignEncryptRsa15TripleDes_IPingService"
        implementor="org.apache.cxf.systest.ws.wssec10.server.MutualCertificate10SignEncryptRsa15TripleDes">

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml
Fri Jun 11 18:28:57 2010
@@ -37,6 +37,7 @@
         http://cxf.apache.org/configuration/security                    http://cxf.apache.org/schemas/configuration/security.xsd
         http://schemas.iona.com/soa/security-config                     http://schemas.iona.com/soa/security-config.xsd
     ">
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
     
     <cxf:bus>
         <cxf:features>
@@ -50,7 +51,7 @@
     <!-- Transport Layer Security (TLS) settings -->
     <!-- -->
     <httpj:engine-factory id="tls-settings">
-        <httpj:engine port="9001">
+        <httpj:engine port="${testutil.ports.Server.1}">
             <httpj:tlsServerParameters>
                 <sec:keyManagers keyPassword="password">
                     <sec:keyStore type="jks" password="password" resource="org/apache/cxf/systest/ws/wssec10/certs/restricted/bob.jks"/>
@@ -78,7 +79,7 @@
     <!-- -->
     <jaxws:endpoint 
        id="UserNameOverTransport"
-       address="https://localhost:9001/UserNameOverTransport" 
+       address="https://localhost:${testutil.ports.Server.1}/UserNameOverTransport" 
        serviceName="interop:PingService"
        endpointName="interop:UserNameOverTransport_IPingService"
        implementor="org.apache.cxf.systest.ws.wssec10.server.UserNameOverTransportRestricted"
@@ -92,7 +93,7 @@
     </jaxws:endpoint> 
     <jaxws:endpoint 
        id="UserName"
-       address="http://localhost:9003/UserName" 
+       address="http://localhost:${testutil.ports.Server}/UserName" 
        serviceName="interop:PingService"
        endpointName="interop:UserName_IPingService"
        implementor="org.apache.cxf.systest.ws.wssec10.server.UserNameOverTransportRestricted"
@@ -112,7 +113,7 @@
     <jaxws:endpoint 
        name="{http://WSSec/wssec10}MutualCertificate10SignEncrypt_IPingService"
        id="MutualCertificate10SignEncrypt"
-       address="http://localhost:9002/MutualCertificate10SignEncrypt" 
+       address="http://localhost:${testutil.ports.Server}/MutualCertificate10SignEncrypt"

        serviceName="interop:PingService"
        endpointName="interop:MutualCertificate10SignEncrypt_IPingService"
        implementor="org.apache.cxf.systest.ws.wssec10.server.MutualCertificate10SignEncryptRestricted">
@@ -133,7 +134,7 @@
     <jaxws:endpoint 
        name="{http://WSSec/wssec10}MutualCertificate10SignEncryptRsa15TripleDes_IPingService"
        id="MutualCertificate10SignEncryptRsa15TripleDes"
-       address="http://localhost:9000/MutualCertificate10SignEncryptRsa15TripleDes" 
+       address="http://localhost:${testutil.ports.Server}/MutualCertificate10SignEncryptRsa15TripleDes"

        serviceName="interop:PingService"
        endpointName="interop:MutualCertificate10SignEncryptRsa15TripleDes_IPingService"
        implementor="org.apache.cxf.systest.ws.wssec10.server.MutualCertificate10SignEncryptRsa15TripleDesRestricted">

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java
Fri Jun 11 18:28:57 2010
@@ -31,8 +31,10 @@ import javax.xml.namespace.QName;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.systest.ws.wssec11.server.Server;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
+
 import wssec.wssec11.IPingService;
 import wssec.wssec11.PingService11;
 
@@ -41,6 +43,7 @@ import wssec.wssec11.PingService11;
  *
  */
 public class WSSecurity11Common extends AbstractBusClientServerTestBase {
+    static final String PORT = allocatePort(Server.class);
 
        
     private static final String INPUT = "foo";
@@ -79,7 +82,7 @@ public class WSSecurity11Common extends 
     
     private static URL getWsdlLocation(String portPrefix) {
         try {
-            return new URL("http://localhost:9001/" + portPrefix + "PingService?wsdl");
+            return new URL("http://localhost:" + PORT + "/" + portPrefix + "PingService?wsdl");
         } catch (MalformedURLException mue) {
             return null;
         }

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java
Fri Jun 11 18:28:57 2010
@@ -28,9 +28,10 @@ import org.apache.cxf.testutil.common.Ab
 import org.apache.cxf.ws.security.SecurityConstants;
 
 public class Server extends AbstractBusTestServerBase {
+    static final String PORT = allocatePort(Server.class);
 
     public Server() throws Exception {
-        this("http://localhost:9001");
+        this("http://localhost:" + PORT);
     }
     
     protected Server(String baseUrl) throws Exception {
@@ -70,7 +71,7 @@ public class Server extends AbstractBusT
         setBus(busLocal);
 
         try {
-            new Server("http://localhost:9001");
+            new Server("http://localhost:" + PORT);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -78,7 +79,7 @@ public class Server extends AbstractBusT
     
     public static void main(String args[]) throws Exception {
         new SpringBusFactory().createBus("org/apache/cxf/systest/ws/wssec11/server/server.xml");
-        new Server("http://localhost:9001");
+        new Server("http://localhost:" + PORT);
         System.out.println("Server ready...");
 
         Thread.sleep(60 * 60 * 10000);

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java
Fri Jun 11 18:28:57 2010
@@ -28,9 +28,10 @@ import org.apache.cxf.testutil.common.Ab
 import org.apache.cxf.ws.security.SecurityConstants;
 
 public class ServerRestricted extends AbstractBusTestServerBase {
+    static final String PORT = allocatePort(Server.class);
 
     public ServerRestricted() throws Exception {
-        this("http://localhost:9001");
+        this("http://localhost:" + PORT);
     }
     
     protected ServerRestricted(String baseUrl) throws Exception {
@@ -70,7 +71,7 @@ public class ServerRestricted extends Ab
         setBus(busLocal);
 
         try {
-            new ServerRestricted("http://localhost:9001");
+            new ServerRestricted("http://localhost:" + PORT);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -78,7 +79,7 @@ public class ServerRestricted extends Ab
     
     public static void main(String args[]) throws Exception {
         new SpringBusFactory().createBus("org/apache/cxf/systest/ws/wssec11/server/server.xml");
-        new ServerRestricted("http://localhost:9001");
+        new ServerRestricted("http://localhost:" + PORT);
         System.out.println("Server ready...");
 
         Thread.sleep(60 * 60 * 10000);

Modified: cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
(original)
+++ cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
Fri Jun 11 18:28:57 2010
@@ -20,6 +20,9 @@
 package org.apache.cxf.testutil.common;
 
 import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -114,11 +117,31 @@ public abstract class AbstractClientServ
             ((BindingProvider)o).getRequestContext()
                 .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                      address);
-        } else if (o instanceof Client) {
-            Client c = (Client)o;
+        }
+        Client c = null;
+        if (o instanceof Client) {
+            c = (Client)o;
+        }
+        if (c == null) {
+            try {
+                InvocationHandler i = Proxy.getInvocationHandler(o);
+                c = (Client)i.getClass().getMethod("getClient").invoke(i);
+            } catch (Throwable t) {
+                //ignore
+            }
+        }
+        if (c == null) {
+            try {
+                Method m = o.getClass().getDeclaredMethod("getClient");
+                m.setAccessible(true);
+                c = (Client)m.invoke(o);
+            } catch (Throwable t) {
+                //ignore
+            }
+        }
+        if (c != null) {
             c.getEndpoint().getEndpointInfo().setAddress(address);
-        } 
-        //maybe simple frontend proxy?
+        }
     }
     protected void updateAddressPort(Object o, String port) 
         throws NumberFormatException, MalformedURLException {
@@ -142,6 +165,9 @@ public abstract class AbstractClientServ
         //maybe simple frontend proxy?
     }
     
+    protected static String allocatePort(String s) {
+        return TestUtil.getPortNumber(s);
+    }
     protected static String allocatePort(Class<?> cls) {
         return TestUtil.getPortNumber(cls);
     }

Modified: cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
(original)
+++ cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
Fri Jun 11 18:28:57 2010
@@ -19,15 +19,76 @@
 package org.apache.cxf.testutil.common;
 
 import java.io.File;
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
 
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.wsdl.WSDLManager;
 
 public class EmbeddedJMSBrokerLauncher extends AbstractBusTestServerBase {
+    public static final String PORT = allocatePort(EmbeddedJMSBrokerLauncher.class);
     
     BrokerService broker;
-    final String brokerUrl1 = "tcp://localhost:61500";            
+    final String brokerUrl1 = "tcp://localhost:" + PORT;            
             
+    
+    public static void updateWsdlExtensors(Bus bus, String wsdlLocation) {
+        try {
+            Definition def = BusFactory.getDefaultBus().getExtension(WSDLManager.class)
+                .getDefinition(wsdlLocation);
+            Map map = def.getAllServices();
+            for (Object o : map.values()) {
+                Service service = (Service)o;
+                Map ports = service.getPorts();
+                for (Object p : ports.values()) {
+                    Port port = (Port)p;
+                    List<?> l = port.getExtensibilityElements();
+                    for (Object e : l) {
+                        if (e instanceof SOAPAddress) {
+                            String add = ((SOAPAddress)e).getLocationURI();
+                            int idx = add.indexOf("jndiURL=");
+                            if (idx != -1) {
+                                int idx2 = add.indexOf("&", idx);
+                                add = add.substring(0, idx)
+                                    + "jndiURL=tcp://localhost:" + PORT
+                                    + (idx2 == -1 ? "" : add.substring(idx2));
+                                ((SOAPAddress)e).setLocationURI(add);
+                            }
+                        } else {
+                            try {
+                                Field f = e.getClass().getDeclaredField("jmsNamingProperty");
+                                f.setAccessible(true);
+                                List<?> props = (List)f.get(e);
+                                for (Object prop : props) {
+                                    f = prop.getClass().getDeclaredField("name");
+                                    f.setAccessible(true);
+                                    if ("java.naming.provider.url".equals(f.get(prop))) {
+                                        f = prop.getClass().getDeclaredField("value");
+                                        f.setAccessible(true);
+                                        f.set(prop, "tcp://localhost:" + PORT);
+                                    }
+                                }
+                            } catch (Exception ex) {
+                                //ignore
+                            }
+                        }
+                    }                    
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
     public void tearDown() throws Exception {
         if (broker != null) {
             broker.stop();

Modified: cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java?rev=953806&r1=953805&r2=953806&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
(original)
+++ cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
Fri Jun 11 18:28:57 2010
@@ -96,7 +96,7 @@ public class ServerLauncher {
                         break;
                     }
                 } catch (InterruptedException ex) {
-                    ex.printStackTrace();
+                    //ex.printStackTrace();
                 }
             }
             if (!inProcess) {



Mime
View raw message