cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmo...@apache.org
Subject svn commit: r979862 [18/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...
Date Tue, 27 Jul 2010 20:47:12 GMT
Modified: cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10UsernameAuthorizationTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10UsernameAuthorizationTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10UsernameAuthorizationTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10UsernameAuthorizationTest.java Tue Jul 27 20:46:55 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
@@ -60,7 +61,7 @@ public class WSSecurity10UsernameAuthori
     public void testClientServerAuthorized() {
 
         IPingService port = getPort(
-            "org/apache/cxf/systest/ws/wssec10/client/client_restricted.xml");
+            "org/apache/cxf/systest/ws/wssec10/client/client_restricted.xml", false);
         
         final String output = port.echo(INPUT);
         assertEquals(INPUT, output);
@@ -70,7 +71,7 @@ public class WSSecurity10UsernameAuthori
     public void testClientServerUnauthorized() {
 
         IPingService port = getPort(
-            "org/apache/cxf/systest/ws/wssec10/client/client_restricted_unauthorized.xml");
+            "org/apache/cxf/systest/ws/wssec10/client/client_restricted_unauthorized.xml", true);
         
         try {
             port.echo(INPUT);
@@ -80,26 +81,27 @@ public class WSSecurity10UsernameAuthori
         }
     }
     
-    private static IPingService getPort(String configName) {
+    private static IPingService getPort(String configName, boolean hashed) {
         Bus bus = new SpringBusFactory().createBus(configName);
         
         BusFactory.setDefaultBus(bus);
         BusFactory.setThreadDefaultBus(bus);
-        PingService svc = new PingService(getWsdlLocation());
+        PingService svc = new PingService(getWsdlLocation(hashed));
         final IPingService port = 
             svc.getPort(
                 new QName(
                     "http://WSSec/wssec10",
-                    "UserName_IPingService"
+                    hashed ? "UserName_IPingService_hashed" : "UserName_IPingService"
                 ),
                 IPingService.class
             );
         return port;
     }
     
-    private static URL getWsdlLocation() {
+    private static URL getWsdlLocation(boolean hashed) {
         try {
-            return new URL("http://localhost:9003/" + "UserName" + "?wsdl");
+            return new URL("http://localhost:" + PORT + "/" 
+                           + (hashed ? "HashedUserName" : "UserName") + "?wsdl");
         } catch (MalformedURLException mue) {
             return null;
         }

Modified: cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/client/UTPasswordCallback.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/client/UTPasswordCallback.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/client/UTPasswordCallback.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/client/UTPasswordCallback.java Tue Jul 27 20:46:55 2010
@@ -38,7 +38,7 @@ public class UTPasswordCallback implemen
     
     public UTPasswordCallback() {
         passwords.put("Alice", "ecilA");
-        passwords.put("Frank", "invalid-password");
+        passwords.put("Frank", "knarF");
         //for MS clients
         passwords.put("abcd", "dcba");
     }

Modified: cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/client/client_restricted_unauthorized.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/client/client_restricted_unauthorized.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/client/client_restricted_unauthorized.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/client/client_restricted_unauthorized.xml Tue Jul 27 20:46:55 2010
@@ -40,7 +40,7 @@
     </cxf:bus>
     
     
-    <jaxws:client name="{http://WSSec/wssec10}UserName_IPingService" createdFromAPI="true">
+    <jaxws:client name="{http://WSSec/wssec10}UserName_IPingService_hashed" createdFromAPI="true">
         <jaxws:properties>
             <entry key="ws-security.username" value="Frank"/>
             <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback"/>

Modified: cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/AuthorizedServer.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/AuthorizedServer.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/AuthorizedServer.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/AuthorizedServer.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/CustomUsernameTokenInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/CustomUsernameTokenInterceptor.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/CustomUsernameTokenInterceptor.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/CustomUsernameTokenInterceptor.java Tue Jul 27 20:46:55 2010
@@ -26,6 +26,7 @@ import org.apache.cxf.common.security.Si
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.wss4j.UsernameTokenInterceptor;
+import org.apache.ws.security.message.token.UsernameToken;
 
 public class CustomUsernameTokenInterceptor extends UsernameTokenInterceptor {
     
@@ -43,7 +44,11 @@ public class CustomUsernameTokenIntercep
         
         // add roles this user is in
         String roleName = "Alice".equals(name) ? "developers" : "pms";
-        
+        String expectedPassword = "Alice".equals(name) ? "ecilA" 
+            : UsernameToken.doPasswordDigest(nonce, created, "knarF");
+        if (!password.equals(expectedPassword)) {
+            throw new SecurityException("Wrong Password");
+        }
         subject.getPrincipals().add(new SimpleGroup(roleName, name));
         subject.setReadOnly();
         return subject;

Modified: cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/Server.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server.xml Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted.xml Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted_authorized.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted_authorized.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted_authorized.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec10/server/server_restricted_authorized.xml Tue Jul 27 20:46:55 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,16 +64,30 @@
     
     <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">
+       wsdlLocation = "target/test-classes/wsdl_systest_wsspec/wssec10/WsSecurity10_12_restricted_hashed.wsdl"
+       implementor="org.apache.cxf.systest.ws.wssec10.server.UserNameOverTransportRestricted">
+        
+       <jaxws:inInterceptors>
+            <ref bean="authorizationInterceptor"/>
+       </jaxws:inInterceptors>
+     
+    </jaxws:endpoint>
+    
+    <jaxws:endpoint 
+       id="UserName2"
+       address="http://localhost:${testutil.ports.AuthorizedServer}/HashedUserName" 
+       serviceName="interop:PingService"
+       endpointName="interop:UserName_IPingService_hashed"
+       wsdlLocation = "target/test-classes/wsdl_systest_wsspec/wssec10/WsSecurity10_12_restricted_hashed.wsdl"
+       implementor="org.apache.cxf.systest.ws.wssec10.server.UserNameOverTransportRestricted">
         
        <jaxws:inInterceptors>
             <ref bean="authorizationInterceptor"/>
        </jaxws:inInterceptors>
      
-    </jaxws:endpoint> 
+    </jaxws:endpoint>
     
 </beans>

Modified: cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/Server.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/wssec11/server/ServerRestricted.java Tue Jul 27 20:46:55 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/sandbox/oauth_1.0a/testutils/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/testutils/pom.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/testutils/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/testutils/pom.xml Tue Jul 27 20:46:55 2010
@@ -59,14 +59,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-antrun-plugin</artifactId>
-                <dependencies>
-                    <dependency>
-                        <groupId>ant</groupId>
-                        <artifactId>ant-trax</artifactId>
-                        <version>1.6.5</version>
-                    </dependency>
-                </dependencies>
-
                 <executions>
                     <execution>
                         <!--
@@ -273,7 +265,7 @@
                  </dependency>
                  <dependency>
                      <groupId>org.apache.geronimo.specs</groupId>
-                     <artifactId>geronimo-jaxws_2.1_spec</artifactId>
+                     <artifactId>geronimo-jaxws_2.2_spec</artifactId>
                  </dependency>
                  <dependency>
                      <groupId>javax.xml.soap</groupId>

Modified: cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java (original)
+++ cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java Tue Jul 27 20:46:55 2010
@@ -28,7 +28,6 @@ import java.util.concurrent.LinkedBlocki
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.junit.After;
@@ -109,7 +108,6 @@ public abstract class AbstractBusClientS
         bus = b;
     }
     
-    
     protected HttpURLConnection getHttpConnection(String target) throws Exception {
         URL url = new URL(target);        
         

Modified: cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java (original)
+++ cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java Tue Jul 27 20:46:55 2010
@@ -20,10 +20,19 @@
 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;
 import java.util.List;
 import java.util.Map;
 
+import javax.xml.ws.BindingProvider;
+
+import org.apache.cxf.endpoint.Client;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 
@@ -100,4 +109,71 @@ public abstract class AbstractClientServ
         
         return ok;
     }
+    
+    
+    // extra methods to help support the dynamic port allocations
+    protected void setAddress(Object o, String address) {
+        if (o instanceof BindingProvider) {
+            ((BindingProvider)o).getRequestContext()
+                .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                     address);
+        }
+        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);
+        }
+    }
+    protected void updateAddressPort(Object o, String port) 
+        throws NumberFormatException, MalformedURLException {
+        updateAddressPort(o, Integer.parseInt(port));
+    }
+    protected void updateAddressPort(Object o, int port) throws MalformedURLException {
+        String address = null;
+        if (o instanceof BindingProvider) {
+            address = ((BindingProvider)o).getRequestContext()
+                .get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY).toString();
+        } else if (o instanceof Client) {
+            Client c = (Client)o;
+            address = c.getEndpoint().getEndpointInfo().getAddress();
+        }
+        if (address != null) {
+            URL url = new URL(address);
+            url = new URL(url.getProtocol(), url.getHost(),
+                          port, url.getFile());
+            setAddress(o, url.toString());
+        }
+        //maybe simple frontend proxy?
+    }
+    
+    protected static String allocatePort(String s) {
+        return TestUtil.getPortNumber(s);
+    }
+    protected static String allocatePort(Class<?> cls) {
+        return TestUtil.getPortNumber(cls);
+    }
+    protected static String allocatePort(Class<?> cls, int count) {
+        return TestUtil.getPortNumber(cls, count);
+    }
+    
+    
 }

Modified: cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractTestServerBase.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractTestServerBase.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractTestServerBase.java (original)
+++ cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractTestServerBase.java Tue Jul 27 20:46:55 2010
@@ -116,5 +116,13 @@ public abstract class AbstractTestServer
      */
     protected boolean verify(Logger log) {
         return true;
-    }    
+    }
+    
+    protected static String allocatePort(Class<?> cls) {
+        return TestUtil.getPortNumber(cls);
+    }
+    protected static String allocatePort(Class<?> cls, int i) {
+        return TestUtil.getPortNumber(cls, i);
+    }
+    
 }

Modified: cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java (original)
+++ cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java Tue Jul 27 20:46:55 2010
@@ -19,15 +19,79 @@
 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 {
+            if (bus == null) {
+                bus = BusFactory.getThreadDefaultBus();
+            }
+            Definition def = bus.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/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java (original)
+++ cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java Tue Jul 27 20:46:55 2010
@@ -96,7 +96,7 @@ public class ServerLauncher {
                         break;
                     }
                 } catch (InterruptedException ex) {
-                    ex.printStackTrace();
+                    //ex.printStackTrace();
                 }
             }
             if (!inProcess) {
@@ -340,6 +340,9 @@ public class ServerLauncher {
                 cmd.add("-D" + entry.getKey() + "=" + entry.getValue());
             }
         }
+        for (Map.Entry<Object, Object> entry : TestUtil.getAllPorts().entrySet()) {
+            cmd.add("-D" + entry.getKey() + "=" + entry.getValue());
+        }
         if (Boolean.getBoolean("java.awt.headless")) {
             cmd.add("-Djava.awt.headless=true");
         }

Modified: cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java (original)
+++ cxf/sandbox/oauth_1.0a/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java Tue Jul 27 20:46:55 2010
@@ -20,14 +20,20 @@
 package org.apache.cxf.testutil.common;
 
 import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.Method;
+import java.net.ServerSocket;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.Properties;
 
 
 public final class TestUtil {
-
+    private static boolean useRandomPorts = Boolean.getBoolean("useRandomPorts");
+    private static int portNum = 9000;
+    private static Properties ports = new Properties();
+    
     private TestUtil() {
         //Complete
     }
@@ -73,5 +79,39 @@ public final class TestUtil {
             }
         }
         return null;
-    }    
+    }
+    public static Properties getAllPorts() {
+        return ports;
+    }
+    public static String getPortNumber(Class<?> cls) {
+        return getPortNumber(cls.getSimpleName());
+    }
+    public static String getPortNumber(Class<?> cls, int count) {
+        return getPortNumber(cls.getSimpleName() + "." + count);
+    }
+    public static String getPortNumber(String name) {
+        String p = ports.getProperty("testutil.ports." + name);
+        if (p == null) {
+            p = System.getProperty("testutil.ports." + name);
+            if (p != null) {
+                ports.setProperty("testutil.ports." + name, p);
+            }
+        }
+        if (p == null) {
+            if (useRandomPorts) {
+                try {
+                    ServerSocket sock = new ServerSocket(0);
+                    p = Integer.toString(sock.getLocalPort());
+                    sock.close();
+                } catch (IOException ex) {
+                    //
+                }
+            } else {
+                p = Integer.toString(portNum++);
+            }
+            ports.put("testutil.ports." + name, p);
+            System.setProperty("testutil.ports." + name, p);
+        }
+        return p;
+    }
 }

Modified: cxf/sandbox/oauth_1.0a/tools/common/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/common/pom.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/common/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/tools/common/pom.xml Tue Jul 27 20:46:55 2010
@@ -103,7 +103,7 @@
                 </dependency>
                 <dependency>
                     <groupId>org.apache.geronimo.specs</groupId>
-                    <artifactId>geronimo-jaxws_2.1_spec</artifactId>
+                    <artifactId>geronimo-jaxws_2.2_spec</artifactId>
                     <scope>test</scope>
                 </dependency>
             </dependencies>

Modified: cxf/sandbox/oauth_1.0a/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java Tue Jul 27 20:46:55 2010
@@ -54,7 +54,8 @@ public class ProcessorTestBase extends A
     public static final List<String> DEFAULT_IGNORE_ATTR = Arrays.asList(new String[]{"attributeFormDefault",
                                                                                       "elementFormDefault", 
                                                                                       "form",
-                                                                                      "version"});
+                                                                                      "version",
+                                                                                      "part@name"});
     public static final List<String> DEFAULT_IGNORE_TAG = Arrays.asList(new String[]{"sequence"});
 
     //CHECKSTYLE:OFF
@@ -247,7 +248,9 @@ public class ProcessorTestBase extends A
                                           Map<QName, String> q2, 
                                           Collection<String> ignoreAttr) {
         for (Map.Entry<QName, String>  attr : q1.entrySet()) {
-            if (ignoreAttr.contains(attr.getKey().getLocalPart())) {
+            if (ignoreAttr.contains(attr.getKey().getLocalPart())
+                || ignoreAttr.contains(element.getLocalPart() + "@"
+                                       + attr.getKey().getLocalPart())) {
                 continue;
             }
             

Modified: cxf/sandbox/oauth_1.0a/tools/common/src/main/java/org/apache/cxf/tools/common/Tag.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/common/src/main/java/org/apache/cxf/tools/common/Tag.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/common/src/main/java/org/apache/cxf/tools/common/Tag.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/common/src/main/java/org/apache/cxf/tools/common/Tag.java Tue Jul 27 20:46:55 2010
@@ -153,7 +153,8 @@ public class Tag {
             return false;
         }
         for (QName attr : getAttributes().keySet()) {
-            if (getIgnoreAttr().contains(attr.getLocalPart())) {
+            if (getIgnoreAttr().contains(attr.getLocalPart())
+                || getIgnoreAttr().contains(getName().getLocalPart() + "@" + attr.getLocalPart())) {
                 continue;
             }
             if (!tag.getAttributes().containsKey(attr)) {

Modified: cxf/sandbox/oauth_1.0a/tools/javato/ws/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/javato/ws/pom.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/javato/ws/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/tools/javato/ws/pom.xml Tue Jul 27 20:46:55 2010
@@ -128,7 +128,6 @@
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-frontend-jaxws</artifactId>
             <version>${project.version}</version>
-            <scope>test</scope>
             <exclusions>
                 <exclusion>
                     <groupId>org.apache.cxf</groupId>
@@ -218,7 +217,7 @@
                 </dependency>
                 <dependency>
                     <groupId>org.apache.geronimo.specs</groupId>
-                    <artifactId>geronimo-jaxws_2.1_spec</artifactId>
+                    <artifactId>geronimo-jaxws_2.2_spec</artifactId>
                 </dependency>
             </dependencies>
         </profile>

Modified: cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java Tue Jul 27 20:46:55 2010
@@ -37,7 +37,6 @@ import javax.xml.ws.soap.SOAPBinding;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
-import org.apache.cxf.bus.spring.BusApplicationContext;
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -56,41 +55,12 @@ import org.apache.cxf.tools.common.ToolC
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.java2wsdl.processor.internal.ServiceBuilderFactory;
 import org.apache.cxf.tools.util.AnnotationUtil;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.FileSystemResource;
 
 public class JavaToJSProcessor implements Processor {
     private static final Logger LOG = LogUtils.getL7dLogger(JavaToJSProcessor.class);
     private static final String JAVA_CLASS_PATH = "java.class.path";
     private static final Charset UTF8 = Charset.forName("utf-8");
     private ToolContext context;
-    private ApplicationContext applicationContext;
-
-    /**
-     * This is factored out to permit use in a unit test.
-     * 
-     * @param bus
-     * @return
-     */
-    public static ApplicationContext getApplicationContext(Bus bus, List<String> additionalFilePathnames) {
-        BusApplicationContext busApplicationContext = bus.getExtension(BusApplicationContext.class);
-        GenericApplicationContext appContext = new GenericApplicationContext(busApplicationContext);
-        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
-        reader.loadBeanDefinitions(new ClassPathResource("META-INF/cxf/java2wsbeans.xml"));
-        for (String pathname : additionalFilePathnames) {
-            try {
-                reader.loadBeanDefinitions(new FileSystemResource(pathname));
-            } catch (BeanDefinitionStoreException bdse) {
-                throw new ToolException("Unable to open bean definition file " + pathname, bdse.getCause());
-            }
-        }
-
-        return appContext;
-    }
 
     public void process() throws ToolException {
         String oldClassPath = System.getProperty(JAVA_CLASS_PATH);
@@ -117,10 +87,10 @@ public class JavaToJSProcessor implement
             if (null != context.get(ToolConstants.CFG_JAVASCRIPT_UTILS)) {
                 JavascriptQueryHandler.writeUtilsToResponseStream(JavaToJSProcessor.class, fileOutputStream);
             }
-            
+
             OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, UTF8);
             BufferedWriter writer = new BufferedWriter(outputStreamWriter);
-                
+
             for (SchemaInfo schema : schemata) {
                 SchemaJavascriptBuilder jsBuilder = new SchemaJavascriptBuilder(serviceInfo
                     .getXmlSchemaCollection(), prefixManager, nameManager);
@@ -128,10 +98,8 @@ public class JavaToJSProcessor implement
                 writer.append(allThatJavascript);
             }
 
-            ServiceJavascriptBuilder serviceBuilder = new ServiceJavascriptBuilder(serviceInfo, 
-                                                                                   null,
-                                                                                   prefixManager,
-                                                                                   nameManager);
+            ServiceJavascriptBuilder serviceBuilder = new ServiceJavascriptBuilder(serviceInfo, null,
+                                                                                 prefixManager, nameManager);
             serviceBuilder.walk();
             String serviceJavascript = serviceBuilder.getCode();
             writer.append(serviceJavascript);
@@ -157,14 +125,13 @@ public class JavaToJSProcessor implement
                 // is there a better way to avoid the warning?
                 beanDefinitions.addAll((List<String>)beanFilesParameter);
             } else {
-                String list[] = (String[]) beanFilesParameter;
+                String list[] = (String[])beanFilesParameter;
                 for (String b : list) {
                     beanDefinitions.add(b);
                 }
             }
         }
-        applicationContext = getApplicationContext(getBus(), beanDefinitions);
-        ServiceBuilderFactory builderFactory = ServiceBuilderFactory.getInstance();
+        ServiceBuilderFactory builderFactory = ServiceBuilderFactory.getInstance(beanDefinitions);
         Class<?> clz = getServiceClass();
         context.put(Class.class, clz);
         if (clz.isInterface()) {
@@ -183,7 +150,7 @@ public class JavaToJSProcessor implement
         builderFactory.setDatabindingName(getDataBindingName());
         // The service class determines the frontend, so no need to pass it in
         // twice.
-        ServiceBuilder builder = builderFactory.newBuilder(applicationContext);
+        ServiceBuilder builder = builderFactory.newBuilder();
 
         builder.validate();
 
@@ -223,13 +190,12 @@ public class JavaToJSProcessor implement
     protected File getOutputDir(File wsdlLocation) {
         String dir = (String)context.get(ToolConstants.CFG_OUTPUTDIR);
         if (dir == null) {
-            if (wsdlLocation == null 
-                || wsdlLocation.getParentFile() == null
+            if (wsdlLocation == null || wsdlLocation.getParentFile() == null
                 || !wsdlLocation.getParentFile().exists()) {
                 dir = "./";
             } else {
                 dir = wsdlLocation.getParent();
-            } 
+            }
         }
         return new File(dir);
     }

Modified: cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java Tue Jul 27 20:46:55 2010
@@ -31,7 +31,6 @@ import javax.xml.ws.soap.SOAPBinding;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
-import org.apache.cxf.bus.spring.BusApplicationContext;
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -49,12 +48,7 @@ import org.apache.cxf.tools.java2wsdl.ge
 import org.apache.cxf.tools.java2wsdl.generator.wsdl11.WrapperBeanGenerator;
 import org.apache.cxf.tools.java2wsdl.processor.internal.ServiceBuilderFactory;
 import org.apache.cxf.tools.util.AnnotationUtil;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.FileSystemResource;
+
 
 public class JavaToWSDLProcessor implements Processor {
     private static final Logger LOG = LogUtils.getL7dLogger(JavaToWSDLProcessor.class);
@@ -62,7 +56,6 @@ public class JavaToWSDLProcessor impleme
     private static final String JAVA_CLASS_PATH = "java.class.path";
     private ToolContext context;
     private final List<AbstractGenerator> generators = new ArrayList<AbstractGenerator>();
-    private ApplicationContext applicationContext;
     
     private void customize(ServiceInfo service) {
         if (context.containsKey(ToolConstants.CFG_TNS)) {
@@ -91,26 +84,6 @@ public class JavaToWSDLProcessor impleme
         
     }
     
-    /**
-     * This is factored out to permit use in a unit test.
-     * @param bus
-     * @return
-     */
-    public static ApplicationContext getApplicationContext(Bus bus, List<String> additionalFilePathnames) {
-        BusApplicationContext busApplicationContext = bus.getExtension(BusApplicationContext.class);
-        GenericApplicationContext appContext = new GenericApplicationContext(busApplicationContext);
-        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
-        reader.loadBeanDefinitions(new ClassPathResource("META-INF/cxf/java2wsbeans.xml"));
-        for (String pathname : additionalFilePathnames) {
-            try {
-                reader.loadBeanDefinitions(new FileSystemResource(pathname));
-            } catch (BeanDefinitionStoreException bdse) {
-                throw new ToolException("Unable to open bean definition file " + pathname, bdse.getCause());
-            }
-        }
-            
-        return appContext;
-    }
     
     public void process() throws ToolException {
         String oldClassPath = System.getProperty(JAVA_CLASS_PATH);
@@ -199,8 +172,8 @@ public class JavaToWSDLProcessor impleme
                 }
             }
         }
-        applicationContext = getApplicationContext(getBus(), beanDefinitions);
-        ServiceBuilderFactory builderFactory = ServiceBuilderFactory.getInstance();
+        
+        ServiceBuilderFactory builderFactory = ServiceBuilderFactory.getInstance(beanDefinitions);
         Class<?> clz = getServiceClass();
         context.put(Class.class, clz);
         if (clz.isInterface()) {
@@ -218,7 +191,7 @@ public class JavaToWSDLProcessor impleme
         builderFactory.setServiceClass(clz);
         builderFactory.setDatabindingName(getDataBindingName());
         // The service class determines the frontend, so no need to pass it in twice.
-        ServiceBuilder builder = builderFactory.newBuilder(applicationContext);
+        ServiceBuilder builder = builderFactory.newBuilder();
 
         builder.validate();
 

Modified: cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactory.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactory.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactory.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactory.java Tue Jul 27 20:46:55 2010
@@ -19,98 +19,54 @@
 
 package org.apache.cxf.tools.java2wsdl.processor.internal;
 
-import org.apache.cxf.databinding.DataBinding;
-import org.apache.cxf.frontend.AbstractServiceFactory;
+import java.util.List;
+
 import org.apache.cxf.service.ServiceBuilder;
 import org.apache.cxf.tools.common.ToolConstants;
-import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.java2wsdl.processor.FrontendFactory;
-import org.apache.cxf.tools.util.NameUtil;
 
-import org.springframework.context.ApplicationContext;
 /**
- * This class constructs ServiceBuilder objects. These objects are used to access the services
- * and the data bindings to generate the wsdl.
+ * This class constructs ServiceBuilder objects. These objects are used to access the services and the data
+ * bindings to generate the wsdl.
  */
-public final class ServiceBuilderFactory {
-    private static ServiceBuilderFactory instance;
-    private static FrontendFactory frontend;
-    private static String databindingName;
-    private Class serviceClass;
-    
-    private ServiceBuilderFactory() {
+public abstract class ServiceBuilderFactory {
+    protected FrontendFactory frontend;
+    protected String databindingName;
+    protected Class<?> serviceClass;
+
+    protected ServiceBuilderFactory() {
         frontend = FrontendFactory.getInstance();
         databindingName = ToolConstants.DEFAULT_DATA_BINDING_NAME;
     }
-    
-    public static ServiceBuilderFactory getInstance() {
-        if (instance == null) {
-            instance = new ServiceBuilderFactory();
-        }
-        return instance;
-    }
 
-    public ServiceBuilder newBuilder(ApplicationContext applicationContext) {
-        return newBuilder(applicationContext, getStyle());
-    }
-    
-    /**
-     * Convert a parameter value to the name of a bean we'd use for a data binding.
-     * @param databindingName
-     * @return
-     */
-    public static String databindingNameToBeanName(String dbName) {
-        return NameUtil.capitalize(dbName.toLowerCase()) + ToolConstants.DATABIND_BEAN_NAME_SUFFIX;
-    }
-
-    public ServiceBuilder newBuilder(ApplicationContext applicationContext, FrontendFactory.Style s) {
-        DataBinding dataBinding;
-        String databindingBeanName = databindingNameToBeanName(databindingName);
-        try {
-            dataBinding = (DataBinding)applicationContext.getBean(databindingBeanName);
-        } catch (RuntimeException e) {
-            throw new ToolException("Cannot get databinding bean " + databindingBeanName 
-                                    + " for databinding " + databindingName);
-        }
-
-        String beanName = getBuilderBeanName(s);
-        ServiceBuilder builder = null;
-
-        try {
-            builder = (ServiceBuilder) applicationContext.getBean(beanName, ServiceBuilder.class);
-            AbstractServiceFactory serviceFactory = (AbstractServiceFactory)builder;
-            serviceFactory.setDataBinding(dataBinding);
-        } catch (RuntimeException e) {
-            throw new ToolException("Can not get ServiceBuilder bean " + beanName 
-                                    + "to initialize the ServiceBuilder for style: " + s
-                                    + " Reason: \n" + e.getMessage(),
-                                    e);
+    public static ServiceBuilderFactory getInstance(List<String> beanDefinitions) {
+        ServiceBuilderFactory factory;
+        if (beanDefinitions == null || beanDefinitions.isEmpty()) {
+            factory = new DefaultServiceBuilderFactory();
+        } else {
+            factory = new SpringServiceBuilderFactory(beanDefinitions);
         }
-        builder.setServiceClass(serviceClass);
-        return builder;
+        return factory;
     }
 
-    /**
-     * Return the name of a prototype bean from Spring that can provide the service. The use of a bean
-     * allows for the possibility of an override.
-     * @param s Style of service
-     * @return name of bean.
-     */
-    protected String getBuilderBeanName(FrontendFactory.Style s) {
-        return s + "ServiceBuilderBean";
+    public ServiceBuilder newBuilder() {
+        return newBuilder(getStyle());
     }
 
+    public abstract ServiceBuilder newBuilder(FrontendFactory.Style s);
+
     public FrontendFactory.Style getStyle() {
         frontend.setServiceClass(this.serviceClass);
         return frontend.discoverStyle();
     }
 
-    public void setServiceClass(Class c) {
+    public void setServiceClass(Class<?> c) {
         this.serviceClass = c;
     }
 
     /**
      * Return the databinding name.
+     * 
      * @return
      */
     public String getDatabindingName() {
@@ -119,6 +75,7 @@ public final class ServiceBuilderFactory
 
     /**
      * Set the databinding name
+     * 
      * @param databindingName
      */
     public void setDatabindingName(String arg) {

Modified: cxf/sandbox/oauth_1.0a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactoryTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactoryTest.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactoryTest.java Tue Jul 27 20:46:55 2010
@@ -21,43 +21,21 @@ package org.apache.cxf.tools.java2wsdl.p
 
 import java.util.ArrayList;
 
-import org.apache.cxf.BusFactory;
 import org.apache.cxf.jaxws.JaxwsServiceBuilder;
 import org.apache.cxf.service.ServiceBuilder;
 import org.apache.cxf.simple.SimpleServiceBuilder;
 import org.apache.cxf.tools.fortest.classnoanno.docbare.Stock;
 import org.apache.cxf.tools.fortest.simple.Hello;
-import org.apache.cxf.tools.java2wsdl.processor.FrontendFactory;
-import org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
-import org.springframework.context.ApplicationContext;
 
 public class ServiceBuilderFactoryTest extends Assert {
-    ServiceBuilderFactory factory = ServiceBuilderFactory.getInstance();
-    private ApplicationContext applicationContext;
-    
-    @Before
-    public void setUp() {
-        applicationContext = JavaToWSDLProcessor.getApplicationContext(BusFactory.getDefaultBus(), 
-                                                                       new ArrayList<String>());
-    }
-    
-    @Test
-    public void testGetBuilderBeanName() {
-        assertNotNull(factory);
-        assertEquals("JaxwsServiceBuilderBean",
-                     factory.getBuilderBeanName(FrontendFactory.Style.Jaxws));
-
-        assertEquals("SimpleServiceBuilderBean",
-                     factory.getBuilderBeanName(FrontendFactory.Style.Simple));
-    }
+    ServiceBuilderFactory factory = ServiceBuilderFactory.getInstance(new ArrayList<String>());
 
     @Test
     public void testGetJaxwsBuilder() {
         factory.setServiceClass(Stock.class);
-        ServiceBuilder builder = factory.newBuilder(applicationContext);
+        ServiceBuilder builder = factory.newBuilder();
         assertNotNull(builder);
         assertTrue(builder instanceof JaxwsServiceBuilder);
     }
@@ -65,7 +43,7 @@ public class ServiceBuilderFactoryTest e
     @Test
     public void testGetSimpleBuilder() {
         factory.setServiceClass(Hello.class);
-        ServiceBuilder builder = factory.newBuilder(applicationContext);
+        ServiceBuilder builder = factory.newBuilder();
         assertNotNull(builder);
         assertTrue(builder instanceof SimpleServiceBuilder);
     }

Modified: cxf/sandbox/oauth_1.0a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java Tue Jul 27 20:46:55 2010
@@ -20,8 +20,13 @@
 package org.apache.cxf.tools.validator.internal;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.URI;
 import java.net.URL;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.stream.StreamSource;
 
 import org.w3c.dom.Document;
@@ -36,8 +41,6 @@ public class Stax2DOM {
     public Stax2DOM() {
     }
 
-
-
     public Document getDocument(String wsdl) throws ToolException {
         try {
             URI wsdlURI = new URI(URIParserUtil.getAbsoluteURI(wsdl));
@@ -53,22 +56,49 @@ public class Stax2DOM {
     }
 
     public Document getDocument(URL url) throws ToolException {
+        InputStream input = null;
         try {
-            StreamSource src = new StreamSource(url.openStream(), url.toExternalForm());
+            input = url.openStream();
+            StreamSource src = new StreamSource(input, url.toExternalForm());
             return StaxUtils.read(StaxUtils.createXMLStreamReader(src), true);
         } catch (Exception e) {
             throw new ToolException(e);
+        } finally {
+            if (input != null) {
+                try {
+                    input.close();
+                } catch (IOException e) {
+                    // throw or change do nothing.
+                    throw new ToolException(e);
+                }
+            }
         }
     }
 
     public Document getDocument(File wsdl) throws ToolException {
+        XMLStreamReader reader = null;
         try {
-            StreamSource src = new StreamSource(wsdl);
-            return StaxUtils.read(StaxUtils.createXMLStreamReader(src), true);
+            StreamSource source = new StreamSource(wsdl);
+            reader = StaxUtils.createXMLStreamReader(source);
+            return StaxUtils.read(reader, true);
         } catch (Exception e) {
             throw new ToolException(e);
+        } finally {
+            try {
+                try {
+                    //on woodstox, calling closeCompletely will allow any 
+                    //cached things like dtds and such to be completely
+                    //closed and cleaned up.
+                    reader.getClass().getMethod("closeCompletely").invoke(reader);
+                } catch (Throwable t) {
+                    //ignore
+                }
+                reader.close();
+            } catch (XMLStreamException e) {
+                // throw or change do nothing.
+                throw new ToolException(e);
+            }
         }
     }
 
-
 }

Modified: cxf/sandbox/oauth_1.0a/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/Stax2DOMTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/Stax2DOMTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/Stax2DOMTest.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/Stax2DOMTest.java Tue Jul 27 20:46:55 2010
@@ -20,9 +20,14 @@
 package org.apache.cxf.tools.validator.internal;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URISyntaxException;
 
 import org.w3c.dom.Document;
 
+import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.helpers.XMLUtils;
 import org.junit.Assert;
 import org.junit.Test;
@@ -31,11 +36,63 @@ public class Stax2DOMTest extends Assert
 
     @Test
     public void testGetDocument() throws Exception {
-        File wsdl = new File(getClass().getResource("/validator_wsdl/jms_test.wsdl").toURI());
-        Document doc = new Stax2DOM().getDocument(wsdl);
+        File wsdlFile = new File(getClass().getResource(
+                "/validator_wsdl/jms_test.wsdl").toURI());
+        Document doc = new Stax2DOM().getDocument(wsdlFile);
+        assertDocumentContent(doc);
+    }
+
+    public void assertDocumentContent(Document doc) {
         String content = XMLUtils.toString(doc);
-        assertTrue(content, content.indexOf("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"") != -1);
-        assertTrue(content, content.indexOf("xmlns:x1=\"http://cxf.apache.org/hello_world_jms/types\"")
-                                           != -1);
+        assertTrue(
+                content,
+                content.indexOf("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"") != -1);
+        assertTrue(
+                content,
+                content.indexOf("xmlns:x1=\"http://cxf.apache.org/hello_world_jms/types\"") != -1);
+    }
+
+    @Test
+    public void testGetDocumentURL() throws Exception {
+        File tempFile = createTempWsdlFile();
+        Document doc = new Stax2DOM().getDocument(tempFile.toURI().toURL());
+        assertDocumentContent(doc);
+        assertDelete(tempFile);
+    }
+
+    @Test
+    public void testGetDocumentString() throws Exception {
+        File tempFile = createTempWsdlFile();
+        Document doc = new Stax2DOM().getDocument(tempFile.toURI().toString());
+        assertDocumentContent(doc);
+        assertDelete(tempFile);
+    }
+
+    public void assertDelete(File tempFile) {
+        boolean deleted = tempFile.delete();
+        if (!deleted) {
+            tempFile.deleteOnExit();
+        }
+        Assert.assertTrue(
+                "Stax2DOM left the input stream open, file cannot be deleted: "
+                        + tempFile, deleted);
+    }
+
+    public File createTempWsdlFile() throws URISyntaxException, IOException {
+        File wsdlFile = new File(getClass().getResource(
+                "/validator_wsdl/jms_test.wsdl").toURI());
+        File tempFile = File.createTempFile("Stax2DOMTest", ".wsdl");
+        FileOutputStream output = new FileOutputStream(tempFile);
+        IOUtils.copyAndCloseInput(new FileInputStream(wsdlFile), output);
+        output.close();
+        return tempFile;
+    }
+
+    @Test
+    public void testGetDocumentFile() throws Exception {
+        File tempFile = createTempWsdlFile();
+        Document doc = new Stax2DOM().getDocument(tempFile);
+        assertDocumentContent(doc);
+        assertDelete(tempFile);
     }
 }

Modified: cxf/sandbox/oauth_1.0a/tools/wsdlto/core/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/wsdlto/core/pom.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/wsdlto/core/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/tools/wsdlto/core/pom.xml Tue Jul 27 20:46:55 2010
@@ -136,7 +136,7 @@
             <dependencies>
                 <dependency>
                     <groupId>org.apache.geronimo.specs</groupId>
-                    <artifactId>geronimo-jaxws_2.1_spec</artifactId>
+                    <artifactId>geronimo-jaxws_2.2_spec</artifactId>
                 </dependency>
                 <dependency>
                     <groupId>javax.xml.soap</groupId>

Modified: cxf/sandbox/oauth_1.0a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java Tue Jul 27 20:46:55 2010
@@ -296,7 +296,6 @@ public class WSDLToJavaContainer extends
             }
         }
         String serviceName = (String)context.get(ToolConstants.CFG_SERVICENAME);
-        QName qname = null;
         for (Definition definition : defs) {
             if (serviceName != null) {
                 for (Iterator<QName> ite = definition.getServices().keySet().iterator(); ite.hasNext();) {
@@ -308,12 +307,8 @@ public class WSDLToJavaContainer extends
             }
         }
 
-        if (qname == null) {
-            Message msg = new Message("SERVICE_NOT_FOUND", LOG, new Object[] {serviceName});
-            throw new ToolException(msg);
-        }
-
-        return qname;
+        Message msg = new Message("SERVICE_NOT_FOUND", LOG, new Object[] {serviceName});
+        throw new ToolException(msg);
     }
 
     public void loadDefaultNSPackageMapping(ToolContext env) {

Modified: cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBBindErrorListener.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBBindErrorListener.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBBindErrorListener.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBBindErrorListener.java Tue Jul 27 20:46:55 2010
@@ -24,7 +24,7 @@ import org.apache.cxf.tools.common.ToolE
 
 public class JAXBBindErrorListener implements ErrorListener {
     private boolean isVerbose;
-    private String prefix = "Thrown by JAXB : ";
+    private String prefix = "Thrown by JAXB: ";
 
     public JAXBBindErrorListener(boolean verbose) {
         isVerbose = verbose;

Modified: cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java Tue Jul 27 20:46:55 2010
@@ -646,7 +646,7 @@ public class JAXBDataBinding implements 
     }
     private String getPluginUsageString(Options opts) {
         StringBuilder buf = new StringBuilder();
-        buf.append("\navaliable plugin options:\n");
+        buf.append("\nAvailable plugin options:\n");
         for (Plugin pl : opts.getAllPlugins()) {
             buf.append(pl.getUsage());
             buf.append('\n');

Modified: cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/Messages.properties?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/Messages.properties (original)
+++ cxf/sandbox/oauth_1.0a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/Messages.properties Tue Jul 27 20:46:55 2010
@@ -20,7 +20,7 @@
 #
 GENERATE_TYPES_ERROR = Error generating types.
 FAIL_TO_GENERATE_TYPES = Failed to generate types.
-FAIL_TO_CREATE_JAXBBINIDNG_FILE = Fail to create a JAX-B binding file to customize the namepace to package mapping
+FAIL_TO_CREATE_JAXBBINIDNG_FILE = Fail to create a JAXB binding file to customize the namepace to package mapping
 
 
 

Modified: cxf/sandbox/oauth_1.0a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java Tue Jul 27 20:46:55 2010
@@ -238,7 +238,9 @@ public final class CustomizationParser {
     }
 
     protected void copyAllJaxbDeclarations(final Node schemaNode, final Element jaxwsBindingNode) {
-        appendJaxbVersion((Element)schemaNode);
+        if (isSchemaElement((Element)schemaNode)) {
+            appendJaxbVersion((Element)schemaNode);
+        }
 
         Node[] embededNodes = getAnnotationNodes(schemaNode);
         Node annotationNode = embededNodes[0];
@@ -247,15 +249,18 @@ public final class CustomizationParser {
         for (Node childNode = jaxwsBindingNode.getFirstChild();
             childNode != null;
             childNode = childNode.getNextSibling()) {
-            
-            copyJaxbAttributes(childNode, (Element)schemaNode);
-            
-            if (!isJaxbBindings(childNode)) {
+
+            if (isSchemaElement((Element)schemaNode)) {
+                copyJaxbAttributes(childNode, (Element)schemaNode);
+            }
+
+            //TODO: check for valid extension namespaces
+            if (!(childNode instanceof Element)) { //!isJaxbBindings(childNode)) {
                 continue;
             }
             
             Element childEl = (Element)childNode;
-            if (isJaxbBindingsElement(childEl)) {
+            if (isJaxbBindings(childNode) && isJaxbBindingsElement(childEl)) {
                 
                 NodeList nlist = nodeSelector.queryNodes(schemaNode, childEl.getAttribute("node"));
                 for (int i = 0; i < nlist.getLength(); i++) {
@@ -307,7 +312,7 @@ public final class CustomizationParser {
                         String pfxs = attr.getValue();
                         while (pfxs.length() > 0) {
                             String pfx = pfxs;
-                            int idx = pfx.indexOf(',');
+                            int idx = pfx.indexOf(' ');
                             if (idx != -1) {
                                 pfxs = pfxs.substring(idx + 1);
                                 pfx = pfx.substring(0, idx);
@@ -598,6 +603,11 @@ public final class CustomizationParser {
         return this.wsdlNode;
     }
 
+    private boolean isSchemaElement(Node schema) {
+        return ToolConstants.SCHEMA_URI.equals(schema.getNamespaceURI())
+               && "schema".equals(schema.getLocalName());
+    }
+
     private boolean isJAXWSBindings(Node bindings) {
         return ToolConstants.NS_JAXWS_BINDINGS.equals(bindings.getNamespaceURI())
                && "bindings".equals(bindings.getLocalName());

Modified: cxf/sandbox/oauth_1.0a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java Tue Jul 27 20:46:55 2010
@@ -441,11 +441,9 @@ public class ParameterProcessor extends 
                     jreturn.setTargetNamespace("");
                 }
                 method.setReturn(jreturn);
-                return;
             }
-
+            return;
         }
-
         for (QName outElement : outputWrapElement) {
             if ("return".equals(outElement.getLocalPart())) {
                 if (method.getReturn() != null) {
@@ -500,7 +498,7 @@ public class ParameterProcessor extends 
                         }
                     }
                 }
-
+    
                 addParameter(method, jp);
             }
         }

Modified: cxf/sandbox/oauth_1.0a/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java (original)
+++ cxf/sandbox/oauth_1.0a/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java Tue Jul 27 20:46:55 2010
@@ -69,7 +69,7 @@ public class WSDLToServiceProcessorTest 
                 fail("Element wsdl:service serviceins Missed!");
             }
             Iterator it = service.getPort("portins").getExtensibilityElements().iterator();
-            if (service == null) {
+            if (it == null || !it.hasNext()) {
                 fail("Element wsdl:port portins Missed!");
             }
             boolean found = false;
@@ -117,7 +117,7 @@ public class WSDLToServiceProcessorTest 
                 fail("Element wsdl:service serviceins Missed!");
             }
             Iterator it = service.getPort("SoapPort").getExtensibilityElements().iterator();
-            if (service == null) {
+            if (it == null || !it.hasNext()) {
                 fail("Element wsdl:port portins Missed!");
             }
 
@@ -159,7 +159,7 @@ public class WSDLToServiceProcessorTest 
                 fail("Element wsdl:service serviceins Missed!");
             }
             Iterator it = service.getPort("portins").getExtensibilityElements().iterator();
-            if (service == null) {
+            if (it == null || !it.hasNext()) {
                 fail("Element wsdl:port portins Missed!");
             }
             boolean found = false;
@@ -208,7 +208,7 @@ public class WSDLToServiceProcessorTest 
                 fail("Element wsdl:service serviceins Missed!");
             }
             Iterator it = service.getPort("portins").getExtensibilityElements().iterator();
-            if (service == null) {
+            if (it == null || !it.hasNext()) {
                 fail("Element wsdl:port portins Missed!");
             }
             boolean found = false;
@@ -265,7 +265,7 @@ public class WSDLToServiceProcessorTest 
                 fail("Element wsdl:service serviceins Missed!");
             }
             Iterator it = service.getPort("portins").getExtensibilityElements().iterator();
-            if (service == null) {
+            if (it == null || !it.hasNext()) {
                 fail("Element wsdl:port portins Missed!");
             }
             boolean found = false;

Modified: cxf/sandbox/oauth_1.0a/tools/wsdlto/test/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/tools/wsdlto/test/pom.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/tools/wsdlto/test/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/tools/wsdlto/test/pom.xml Tue Jul 27 20:46:55 2010
@@ -75,14 +75,14 @@
           </dependency>
 
         <dependency>
-            <groupId>org.mortbay.jetty</groupId>
-            <artifactId>jetty</artifactId>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-server</artifactId>
             <version>${jetty.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_2.5_spec</artifactId>
+            <groupId>${servlet-api.group}</groupId>
+            <artifactId>${servlet-api.artifact}</artifactId>
             <scope>test</scope>
         </dependency>
 



Mime
View raw message