cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r951551 [3/3] - in /cxf/trunk: rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/ systests/transports/src/te...
Date Fri, 04 Jun 2010 20:13:20 GMT
Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java
Fri Jun  4 20:13:17 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/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/Server.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/Server.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/Server.java
Fri Jun  4 20:13:17 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/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/server.xml?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/server.xml
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssc/server/server.xml
Fri Jun  4 20:13:17 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/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java
Fri Jun  4 20:13:17 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/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10UsernameAuthorizationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10UsernameAuthorizationTest.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10UsernameAuthorizationTest.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10UsernameAuthorizationTest.java
Fri Jun  4 20:13:17 2010
@@ -42,7 +42,8 @@ import wssec.wssec10.PingService;
  *
  */
 public class WSSecurity10UsernameAuthorizationTest extends AbstractBusClientServerTestBase
{
-    
+    static final String PORT = allocatePort(AuthorizedServer.class);
+
     private static final String INPUT = "foo";
     
     @BeforeClass
@@ -99,7 +100,7 @@ public class WSSecurity10UsernameAuthori
     
     private static URL getWsdlLocation() {
         try {
-            return new URL("http://localhost:9003/" + "UserName" + "?wsdl");
+            return new URL("http://localhost:" + PORT + "/" + "UserName" + "?wsdl");
         } catch (MalformedURLException mue) {
             return null;
         }

Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/AuthorizedServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/AuthorizedServer.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/AuthorizedServer.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/AuthorizedServer.java
Fri Jun  4 20:13:17 2010
@@ -24,6 +24,7 @@ import org.apache.cxf.bus.spring.SpringB
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 
 public class AuthorizedServer extends AbstractBusTestServerBase {
+    static final String PORT = allocatePort(AuthorizedServer.class);
 
     private static String configFileName =
         "org/apache/cxf/systest/ws/wssec10/server/server_restricted_authorized.xml";

Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java
Fri Jun  4 20:13:17 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/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml
Fri Jun  4 20:13:17 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/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml
Fri Jun  4 20:13:17 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/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted_authorized.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted_authorized.xml?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted_authorized.xml
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted_authorized.xml
Fri Jun  4 20:13:17 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>
@@ -52,23 +53,7 @@
 
     <bean id="customUTInterceptor" class="org.apache.cxf.systest.ws.wssec10.server.CustomUsernameTokenInterceptor"/>
 
-    <!-- -->
-    <!-- Any services listening on port 9001 must use the following -->
-    <!-- Transport Layer Security (TLS) settings -->
-    <!-- -->
-    <httpj:engine-factory id="tls-settings">
-        <httpj:engine port="9001">
-            <httpj:tlsServerParameters>
-                <sec:keyManagers keyPassword="password">
-                    <sec:keyStore type="jks" password="password" resource="org/apache/cxf/systest/ws/wssec10/certs/restricted/bob.jks"/>
-                </sec:keyManagers>
-                <sec:trustManagers>
-                    <sec:keyStore type="jks" password="password" resource="org/apache/cxf/systest/ws/wssec10/certs/restricted/alice.jks"/>
-                </sec:trustManagers> 
-            </httpj:tlsServerParameters>
-        </httpj:engine>
-    </httpj:engine-factory>
-    
+
     <bean id="authorizationInterceptor" class="org.apache.cxf.interceptor.security.SimpleAuthorizingInterceptor">
         <property name="methodRolesMap">
             <map>
@@ -79,11 +64,10 @@
     
     <jaxws:endpoint 
        id="UserName"
-       address="http://localhost:9003/UserName" 
+       address="http://localhost:${testutil.ports.AuthorizedServer}/UserName" 
        serviceName="interop:PingService"
        endpointName="interop:UserName_IPingService"
-       implementor="org.apache.cxf.systest.ws.wssec10.server.UserNameOverTransportRestricted"
-       depends-on="tls-settings">
+       implementor="org.apache.cxf.systest.ws.wssec10.server.UserNameOverTransportRestricted">
         
        <jaxws:inInterceptors>
             <ref bean="authorizationInterceptor"/>

Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java
Fri Jun  4 20:13:17 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/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java
Fri Jun  4 20:13:17 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/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java
Fri Jun  4 20:13:17 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/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
(original)
+++ cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
Fri Jun  4 20:13:17 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/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
(original)
+++ cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
Fri Jun  4 20:13:17 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/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java?rev=951551&r1=951550&r2=951551&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java (original)
+++ cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java Fri
Jun  4 20:13:17 2010
@@ -96,7 +96,7 @@ public class ServerLauncher {
                         break;
                     }
                 } catch (InterruptedException ex) {
-                    ex.printStackTrace();
+                    //ex.printStackTrace();
                 }
             }
             if (!inProcess) {



Mime
View raw message