You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2011/12/01 17:45:44 UTC

svn commit: r1209145 [1/2] - in /cxf/branches/2.4.x-fixes/systests/ws-security: ./ src/test/java/org/apache/cxf/systest/ws/common/ src/test/java/org/apache/cxf/systest/ws/saml/ src/test/java/org/apache/cxf/systest/ws/saml/server/ src/test/java/org/apac...

Author: coheigea
Date: Thu Dec  1 16:45:41 2011
New Revision: 1209145

URL: http://svn.apache.org/viewvc?rev=1209145&view=rev
Log:
Refactor of the WS-Security systests - part I

Added:
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/DoubleItImpl.java
      - copied, changed from r1209102, cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/server/DoubleItImpl.java
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/DoubleItPortTypeImpl.java
      - copied, changed from r1209102, cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/DoubleItLogical.wsdl
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/DoubleItSaml.wsdl
      - copied, changed from r1209102, cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/saml/DoubleItSaml.wsdl
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl
      - copied, changed from r1209102, cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/DoubleIt.wsdl
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/DoubleItUt.wsdl
      - copied, changed from r1209102, cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/ut/DoubleItUt.wsdl
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl
      - copied, changed from r1209102, cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/x509/DoubleItX509.wsdl
Removed:
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/server/DoubleItImpl.java
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/server/DoubleItImpl.java
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/DoubleIt.wsdl
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/saml/DoubleItSaml.wsdl
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/ut/DoubleItUt.wsdl
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/x509/DoubleItX509.wsdl
Modified:
    cxf/branches/2.4.x-fixes/systests/ws-security/pom.xml
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/client/client.xml
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/server/server.xml
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/https_config.xml
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/client/client.xml
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/server/server.xml
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml
    cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml

Modified: cxf/branches/2.4.x-fixes/systests/ws-security/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/pom.xml?rev=1209145&r1=1209144&r2=1209145&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/pom.xml (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/pom.xml Thu Dec  1 16:45:41 2011
@@ -1,4 +1,3 @@
-<?xml version="1.0"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements. See the NOTICE file
@@ -31,7 +30,24 @@
     <version>2.4.5-SNAPSHOT</version>
     <description>Apache CXF WS-Security System Tests</description>
     <url>http://cxf.apache.org</url>
+    
     <build>
+        <testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
+        <testResources>
+            <testResource>
+                <directory>src/test/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </testResource>
+            <testResource>
+                <directory>src/test/resources</directory>
+                <includes>
+                    <include>**/*</include>
+                </includes>
+            </testResource>
+        </testResources>
+        
         <plugins>
             <plugin>
                 <groupId>org.apache.cxf</groupId>
@@ -39,14 +55,15 @@
                 <version>${project.version}</version>
                 <executions>
                     <execution>
-                        <id>generate-test-sources</id>
-                        <phase>generate-test-sources</phase>
+                        <phase>generate-sources</phase>
                         <configuration>
                             <fork>${cxf.codegenplugin.forkmode}</fork>
-                            <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
-                            <testWsdlRoot>${basedir}/src/test/resources/wsdl_systest_wssec</testWsdlRoot>
+                            <sourceRoot>${basedir}/target/generated-sources</sourceRoot>
                             <wsdlOptions>
                                 <wsdlOption>
+                                    <wsdl>${basedir}/src/test/resources/DoubleItLogical.wsdl</wsdl>
+                                </wsdlOption>
+                                <wsdlOption>
                                     <wsdl>${basedir}/src/test/resources/wsdl_systest_wssec/wssec10/WsSecurity10.wsdl</wsdl>
                                 </wsdlOption>
                                 <wsdlOption>
@@ -56,15 +73,6 @@
                                     <wsdl>${basedir}/src/test/resources/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl</wsdl>
                                 </wsdlOption>
                                 <wsdlOption>
-                                    <wsdl>${basedir}/src/test/resources/wsdl_systest_wssec/saml/DoubleItSaml.wsdl</wsdl>
-                                </wsdlOption>
-                                <wsdlOption>
-                                    <wsdl>${basedir}/src/test/resources/wsdl_systest_wssec/ut/DoubleItUt.wsdl</wsdl>
-                                </wsdlOption>
-                                <wsdlOption>
-                                    <wsdl>${basedir}/src/test/resources/wsdl_systest_wssec/x509/DoubleItX509.wsdl</wsdl>
-                                </wsdlOption>
-                                <wsdlOption>
                                     <wsdl>${basedir}/src/test/resources/wsdl_systest_wssec/kerberos/DoubleItKerberos.wsdl</wsdl>
                                 </wsdlOption>
                                 <wsdlOption>

Copied: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/DoubleItImpl.java (from r1209102, cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/server/DoubleItImpl.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/DoubleItImpl.java?p2=cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/DoubleItImpl.java&p1=cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/server/DoubleItImpl.java&r1=1209102&r2=1209145&rev=1209145&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/server/DoubleItImpl.java (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/DoubleItImpl.java Thu Dec  1 16:45:41 2011
@@ -16,23 +16,21 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-package org.apache.cxf.systest.ws.ut.server;
-
-import java.math.BigInteger;
+package org.apache.cxf.systest.ws.common;
 
 import javax.jws.WebService;
+
 import org.apache.cxf.feature.Features;
-import wssec.saml.DoubleItPortType;
+import org.example.contract.doubleit.DoubleItPortType;
 
-@WebService(targetNamespace = "http://WSSec/ut", 
+@WebService(targetNamespace = "http://www.example.org/contract/DoubleIt", 
             serviceName = "DoubleItService", 
-            endpointInterface = "wssec.saml.DoubleItPortType")
+            endpointInterface = "org.example.contract.doubleit.DoubleItPortType")
 @Features(features = "org.apache.cxf.feature.LoggingFeature")              
-public class DoubleItImpl implements DoubleItPortType  {
-
-    public java.math.BigInteger doubleIt(java.math.BigInteger numberToDouble) {
-        return numberToDouble.multiply(BigInteger.valueOf(2));
+public class DoubleItImpl implements DoubleItPortType {
+    
+    public int doubleIt(int numberToDouble) {
+        return numberToDouble * 2;
     }
     
 }

Copied: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/DoubleItPortTypeImpl.java (from r1209102, cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/DoubleItPortTypeImpl.java?p2=cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/DoubleItPortTypeImpl.java&p1=cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java&r1=1209102&r2=1209145&rev=1209145&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/DoubleItPortTypeImpl.java Thu Dec  1 16:45:41 2011
@@ -16,10 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.cxf.systest.ws.common;
 
-package org.apache.cxf.systest.ws.saml.server;
-
-import java.math.BigInteger;
 import java.security.Principal;
 
 import javax.annotation.Resource;
@@ -27,26 +25,25 @@ import javax.jws.WebService;
 import javax.xml.ws.WebServiceContext;
 
 import org.apache.cxf.feature.Features;
+import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.Assert;
 
-import wssec.saml.DoubleItPortType;
-
-@WebService(targetNamespace = "http://WSSec/saml", 
+@WebService(targetNamespace = "http://www.example.org/contract/DoubleIt", 
             serviceName = "DoubleItService", 
-            endpointInterface = "wssec.saml.DoubleItPortType")
+            endpointInterface = "org.example.contract.doubleit.DoubleItPortType")
 @Features(features = "org.apache.cxf.feature.LoggingFeature")              
-public class DoubleItImpl implements DoubleItPortType {
+public class DoubleItPortTypeImpl implements DoubleItPortType {
     
     @Resource
     WebServiceContext wsContext;
 
-    public java.math.BigInteger doubleIt(java.math.BigInteger numberToDouble) {
+    public int doubleIt(int numberToDouble) {
         Principal pr = wsContext.getUserPrincipal();
         
         Assert.assertNotNull("Principal must not be null", pr);
         Assert.assertNotNull("Principal.getName() must not return null", pr.getName());
         
-        return numberToDouble.multiply(BigInteger.valueOf(2));
+        return numberToDouble * 2;
     }
     
 }

Modified: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java?rev=1209145&r1=1209144&r2=1209145&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java Thu Dec  1 16:45:41 2011
@@ -19,13 +19,14 @@
 
 package org.apache.cxf.systest.ws.saml;
 
-import java.math.BigInteger;
 import java.net.URL;
 
 import javax.crypto.Cipher;
 import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
+import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
@@ -34,10 +35,9 @@ import org.apache.cxf.systest.ws.saml.se
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.ws.security.saml.ext.builder.SAML2Constants;
 
-import org.junit.BeforeClass;
+import org.example.contract.doubleit.DoubleItPortType;
 
-import wssec.saml.DoubleItPortType;
-import wssec.saml.DoubleItService;
+import org.junit.BeforeClass;
 
 /**
  * A set of tests for SAML Tokens.
@@ -45,6 +45,9 @@ import wssec.saml.DoubleItService;
 public class SamlTokenTest extends AbstractBusClientServerTestBase {
     static final String PORT = allocatePort(Server.class);
     static final String PORT2 = allocatePort(Server.class, 2);
+    
+    private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
+    private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
 
     private boolean unrestrictedPoliciesInstalled = checkUnrestrictedPoliciesInstalled();
     
@@ -68,13 +71,15 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml1Port = service.getDoubleItSaml1TransportPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml1TransportPort");
+        DoubleItPortType saml1Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml1Port, PORT2);
         
         try {
-            saml1Port.doubleIt(BigInteger.valueOf(25));
+            saml1Port.doubleIt(25);
             fail("Expected failure on an invocation with no SAML Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
             assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
@@ -84,7 +89,7 @@ public class SamlTokenTest extends Abstr
             "ws-security.saml-callback-handler", new SamlCallbackHandler()
         );
         try {
-            saml1Port.doubleIt(BigInteger.valueOf(25));
+            saml1Port.doubleIt(25);
             fail("Expected failure on an invocation with a SAML2 Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
             assertTrue(ex.getMessage().contains("Wrong SAML Version"));
@@ -93,8 +98,8 @@ public class SamlTokenTest extends Abstr
         ((BindingProvider)saml1Port).getRequestContext().put(
             "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
         );
-        BigInteger result = saml1Port.doubleIt(BigInteger.valueOf(25));
-        assertTrue(result.equals(BigInteger.valueOf(50)));
+        int result = saml1Port.doubleIt(25);
+        assertTrue(result == 50);
     }
     
     @org.junit.Test
@@ -110,13 +115,15 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml2Port = service.getDoubleItSaml2SymmetricPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricPort");
+        DoubleItPortType saml2Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml2Port, PORT);
        
         try {
-            saml2Port.doubleIt(BigInteger.valueOf(25));
+            saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with no SAML Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
             assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
@@ -126,7 +133,7 @@ public class SamlTokenTest extends Abstr
             "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
         );
         try {
-            saml2Port.doubleIt(BigInteger.valueOf(25));
+            saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with a SAML1 Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
             assertTrue(ex.getMessage().contains("Wrong SAML Version"));
@@ -135,8 +142,8 @@ public class SamlTokenTest extends Abstr
         ((BindingProvider)saml2Port).getRequestContext().put(
             "ws-security.saml-callback-handler", new SamlCallbackHandler()
         );
-        BigInteger result = saml2Port.doubleIt(BigInteger.valueOf(25));
-        assertTrue(result.equals(BigInteger.valueOf(50)));
+        int result = saml2Port.doubleIt(25);
+        assertTrue(result == 50);
         
         try {
             SamlCallbackHandler callbackHandler = 
@@ -145,7 +152,7 @@ public class SamlTokenTest extends Abstr
             ((BindingProvider)saml2Port).getRequestContext().put(
                 "ws-security.saml-callback-handler", callbackHandler
             );
-            saml2Port.doubleIt(BigInteger.valueOf(25));
+            saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with a invalid SAML2 Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
             assertTrue(ex.getMessage().contains("SAML token security failure"));
@@ -170,9 +177,11 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml2Port = service.getDoubleItSaml2SymmetricSupportingPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricSupportingPort");
+        DoubleItPortType saml2Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml2Port, PORT);
 
         ((BindingProvider)saml2Port).getRequestContext().put(
@@ -180,7 +189,7 @@ public class SamlTokenTest extends Abstr
         );
         
         try {
-            saml2Port.doubleIt(BigInteger.valueOf(25));
+            saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with an unsigned SAML SV Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
             assertTrue(ex.getMessage().contains("Assertion fails sender-vouches requirements"));
@@ -201,13 +210,15 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml2Port = service.getDoubleItSaml2AsymmetricPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricPort");
+        DoubleItPortType saml2Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml2Port, PORT);
 
         try {
-            saml2Port.doubleIt(BigInteger.valueOf(25));
+            saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with no SAML Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
             assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
@@ -217,7 +228,7 @@ public class SamlTokenTest extends Abstr
             "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
         );
         try {
-            saml2Port.doubleIt(BigInteger.valueOf(25));
+            saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with a SAML1 Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
             assertTrue(ex.getMessage().contains("Wrong SAML Version"));
@@ -226,8 +237,8 @@ public class SamlTokenTest extends Abstr
         ((BindingProvider)saml2Port).getRequestContext().put(
             "ws-security.saml-callback-handler", new SamlCallbackHandler()
         );
-        BigInteger result = saml2Port.doubleIt(BigInteger.valueOf(25));
-        assertTrue(result.equals(BigInteger.valueOf(50)));
+        int result = saml2Port.doubleIt(25);
+        assertTrue(result == 50);
     }
     
     @org.junit.Test
@@ -240,16 +251,18 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml1Port = service.getDoubleItSaml1SelfSignedTransportPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml1SelfSignedTransportPort");
+        DoubleItPortType saml1Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml1Port, PORT2);
         
         ((BindingProvider)saml1Port).getRequestContext().put(
             "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
         );
-        BigInteger result = saml1Port.doubleIt(BigInteger.valueOf(25));
-        assertTrue(result.equals(BigInteger.valueOf(50)));
+        int result = saml1Port.doubleIt(25);
+        assertTrue(result == 50);
     }
     
     @org.junit.Test
@@ -265,9 +278,11 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml2Port = service.getDoubleItAsymmetricSamlInitiatorPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSamlInitiatorPort");
+        DoubleItPortType saml2Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml2Port, PORT);
         
         SamlCallbackHandler callbackHandler = new SamlCallbackHandler();
@@ -275,8 +290,8 @@ public class SamlTokenTest extends Abstr
         ((BindingProvider)saml2Port).getRequestContext().put(
             "ws-security.saml-callback-handler", callbackHandler
         );
-        BigInteger result = saml2Port.doubleIt(BigInteger.valueOf(25));
-        assertTrue(result.equals(BigInteger.valueOf(50)));
+        int result = saml2Port.doubleIt(25);
+        assertTrue(result == 50);
     }
     
     @org.junit.Test
@@ -292,16 +307,18 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml2Port = service.getDoubleItSaml2SymmetricSignedElementsPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricSignedElementsPort");
+        DoubleItPortType saml2Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml2Port, PORT);
         
         ((BindingProvider)saml2Port).getRequestContext().put(
             "ws-security.saml-callback-handler", new SamlCallbackHandler()
         );
-        BigInteger result = saml2Port.doubleIt(BigInteger.valueOf(25));
-        assertTrue(result.equals(BigInteger.valueOf(50)));
+        int result = saml2Port.doubleIt(25);
+        assertTrue(result == 50);
     }
     
     @org.junit.Test
@@ -314,9 +331,11 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml2Port = service.getDoubleItSaml2EndorsingTransportPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingTransportPort");
+        DoubleItPortType saml2Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml2Port, PORT2);
         
         SamlCallbackHandler callbackHandler = new SamlCallbackHandler();
@@ -325,8 +344,8 @@ public class SamlTokenTest extends Abstr
             "ws-security.saml-callback-handler", callbackHandler
         );
 
-        BigInteger result = saml2Port.doubleIt(BigInteger.valueOf(25));
-        assertTrue(result.equals(BigInteger.valueOf(50)));
+        int result = saml2Port.doubleIt(25);
+        assertTrue(result == 50);
     }
 
     @org.junit.Test
@@ -343,16 +362,18 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml2Port = service.getDoubleItSaml2AsymmetricSignedEncryptedPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricSignedEncryptedPort");
+        DoubleItPortType saml2Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml2Port, PORT);
         
         ((BindingProvider)saml2Port).getRequestContext().put(
             "ws-security.saml-callback-handler", new SamlCallbackHandler()
         );
-        BigInteger result = saml2Port.doubleIt(BigInteger.valueOf(25));
-        assertTrue(result.equals(BigInteger.valueOf(50)));
+        int result = saml2Port.doubleIt(25);
+        assertTrue(result == 50);
     }
     
     @org.junit.Test
@@ -369,9 +390,11 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml2Port = service.getDoubleItSaml2AsymmetricEncryptedPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricEncryptedPort");
+        DoubleItPortType saml2Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml2Port, PORT);
         
         SamlCallbackHandler callbackHandler = new SamlCallbackHandler();
@@ -379,8 +402,8 @@ public class SamlTokenTest extends Abstr
         ((BindingProvider)saml2Port).getRequestContext().put(
             "ws-security.saml-callback-handler", callbackHandler
         );
-        BigInteger result = saml2Port.doubleIt(BigInteger.valueOf(25));
-        assertTrue(result.equals(BigInteger.valueOf(50)));
+        int result = saml2Port.doubleIt(25);
+        assertTrue(result == 50);
     }
     
     
@@ -394,9 +417,11 @@ public class SamlTokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType saml2Port = service.getDoubleItSaml2EndorsingEncryptedTransportPort();
+        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingEncryptedTransportPort");
+        DoubleItPortType saml2Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml2Port, PORT2);
         
         SamlCallbackHandler callbackHandler = new SamlCallbackHandler();
@@ -405,8 +430,8 @@ public class SamlTokenTest extends Abstr
             "ws-security.saml-callback-handler", callbackHandler
         );
 
-        BigInteger result = saml2Port.doubleIt(BigInteger.valueOf(25));
-        assertTrue(result.equals(BigInteger.valueOf(50)));
+        int result = saml2Port.doubleIt(25);
+        assertTrue(result == 50);
     }
     
     private boolean checkUnrestrictedPoliciesInstalled() {

Modified: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java?rev=1209145&r1=1209144&r2=1209145&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java Thu Dec  1 16:45:41 2011
@@ -23,20 +23,20 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringReader;
 import java.io.StringWriter;
-import java.math.BigInteger;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.jws.WebService;
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.xml.namespace.QName;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Dispatch;
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
 import javax.xml.ws.Service.Mode;
 import javax.xml.ws.ServiceMode;
 import javax.xml.ws.WebServiceProvider;
@@ -45,9 +45,10 @@ import javax.xml.xpath.XPathConstants;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
-
 import org.xml.sax.InputSource;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.helpers.XPathUtils;
@@ -55,18 +56,18 @@ import org.apache.cxf.interceptor.Loggin
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.message.Message;
-import org.apache.cxf.policytest.doubleit.DoubleIt;
-import org.apache.cxf.policytest.doubleit.DoubleItFault_Exception;
-import org.apache.cxf.policytest.doubleit.DoubleItPortType;
-import org.apache.cxf.policytest.doubleit.DoubleItPortTypeHeader;
-import org.apache.cxf.policytest.doubleit.DoubleItResponse;
-import org.apache.cxf.policytest.doubleit.DoubleItService;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.systest.ws.common.DoubleItPortTypeImpl;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.ws.security.WSPasswordCallback;
+
+import org.example.contract.doubleit.DoubleItPortType;
+import org.example.contract.doubleit.DoubleItPortTypeHeader;
+import org.example.schema.doubleit.DoubleIt;
+
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -90,7 +91,9 @@ public class SecurityPolicyTest extends 
     public static final String POLICY_CXF3041_ADDRESS = "http://localhost:" + PORT + "/SecPolTestCXF3041";
     public static final String POLICY_CXF3042_ADDRESS = "http://localhost:" + PORT + "/SecPolTestCXF3042";
     public static final String POLICY_CXF3452_ADDRESS = "http://localhost:" + PORT + "/SecPolTestCXF3452";
-
+    
+    private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
+    private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
     
     public static class ServerPasswordCallback implements CallbackHandler {
         public void handle(Callback[] callbacks) throws IOException,
@@ -105,9 +108,6 @@ public class SecurityPolicyTest extends 
         }
     }
     
-    private DoubleItService service = new DoubleItService();
-
-    
     @BeforeClass 
     public static void init() throws Exception {
         
@@ -115,14 +115,14 @@ public class SecurityPolicyTest extends 
             .getExtension(PolicyEngine.class).setEnabled(true);
         getStaticBus().getOutInterceptors().add(new LoggingOutInterceptor());
         EndpointImpl ep = (EndpointImpl)Endpoint.publish(POLICY_HTTPS_ADDRESS,
-                                       new DoubleItImplHttps());
+                                       new DoubleItPortTypeImpl());
         ep.getServer().getEndpoint().getEndpointInfo().setProperty(SecurityConstants.CALLBACK_HANDLER,
                                                                    new ServerPasswordCallback());
         Endpoint.publish(POLICY_ADDRESS,
-                         new DoubleItImpl());
+                         new DoubleItPortTypeImpl());
         
         ep = (EndpointImpl)Endpoint.publish(POLICY_ENCSIGN_ADDRESS,
-                                            new DoubleItImplEncryptThenSign());
+                                            new DoubleItPortTypeImpl());
         
         EndpointInfo ei = ep.getServer().getEndpoint().getEndpointInfo(); 
         ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
@@ -132,7 +132,7 @@ public class SecurityPolicyTest extends 
                        SecurityPolicyTest.class.getResource("alice.properties").toString());
 
         ep = (EndpointImpl)Endpoint.publish(POLICY_SIGNENC_ADDRESS,
-                                            new DoubleItImplSignThenEncrypt());
+                                            new DoubleItPortTypeImpl());
         
         ei = ep.getServer().getEndpoint().getEndpointInfo(); 
         ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
@@ -142,7 +142,7 @@ public class SecurityPolicyTest extends 
                        SecurityPolicyTest.class.getResource("alice.properties").toString());
 
         ep = (EndpointImpl)Endpoint.publish(POLICY_SIGN_ADDRESS,
-                                            new DoubleItImplSign());
+                                            new DoubleItPortTypeImpl());
         ei = ep.getServer().getEndpoint().getEndpointInfo(); 
         ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
         ei.setProperty(SecurityConstants.SIGNATURE_PROPERTIES, 
@@ -151,7 +151,7 @@ public class SecurityPolicyTest extends 
                        SecurityPolicyTest.class.getResource("alice.properties").toString());
 
         ep = (EndpointImpl)Endpoint.publish(POLICY_XPATH_ADDRESS,
-                                            new DoubleItImplXPath());
+                                            new DoubleItPortTypeImpl());
         ei = ep.getServer().getEndpoint().getEndpointInfo(); 
         ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
         ei.setProperty(SecurityConstants.SIGNATURE_PROPERTIES, 
@@ -170,7 +170,7 @@ public class SecurityPolicyTest extends 
                        SecurityPolicyTest.class.getResource("alice.properties").toString());
         
         ep = (EndpointImpl)Endpoint.publish(POLICY_SIGNONLY_ADDRESS,
-                                            new DoubleItImplSignOnly());
+                                            new DoubleItPortTypeImpl());
         ei = ep.getServer().getEndpoint().getEndpointInfo(); 
         ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
         ei.setProperty(SecurityConstants.SIGNATURE_PROPERTIES, 
@@ -180,7 +180,7 @@ public class SecurityPolicyTest extends 
         
         
         ep = (EndpointImpl)Endpoint.publish(POLICY_CXF3041_ADDRESS,
-                                            new DoubleItImplCXF3041());
+                                            new DoubleItPortTypeImpl());
         ei = ep.getServer().getEndpoint().getEndpointInfo(); 
         ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
         ei.setProperty(SecurityConstants.SIGNATURE_PROPERTIES, 
@@ -189,7 +189,7 @@ public class SecurityPolicyTest extends 
                        SecurityPolicyTest.class.getResource("alice.properties").toString());
         
         ep = (EndpointImpl)Endpoint.publish(POLICY_CXF3042_ADDRESS,
-                                            new DoubleItImplCXF3042());
+                                            new DoubleItPortTypeImpl());
         ei = ep.getServer().getEndpoint().getEndpointInfo(); 
         ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
         ei.setProperty(SecurityConstants.SIGNATURE_PROPERTIES, 
@@ -198,7 +198,7 @@ public class SecurityPolicyTest extends 
                        SecurityPolicyTest.class.getResource("alice.properties").toString());
 
         ep = (EndpointImpl)Endpoint.publish(POLICY_CXF3452_ADDRESS,
-                                            new DoubleItImplCXF3452());
+                                            new DoubleItPortTypeImpl());
         ei = ep.getServer().getEndpoint().getEndpointInfo(); 
         ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
         ei.setProperty(SecurityConstants.SIGNATURE_PROPERTIES, 
@@ -209,10 +209,21 @@ public class SecurityPolicyTest extends 
     }
     
     @Test
+    @org.junit.Ignore
     public void testPolicy() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+
+        Bus bus = bf.createBus();
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL wsdl = SecurityPolicyTest.class.getResource("DoubleIt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        
         DoubleItPortType pt;
 
-        pt = service.getDoubleItPortXPath();
+        QName portQName = new QName(NAMESPACE, "DoubleItPortXPath");
+        pt = service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, 
                                                       new KeystorePasswordCallback());
@@ -220,10 +231,10 @@ public class SecurityPolicyTest extends 
                                                       getClass().getResource("alice.properties"));
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, 
                                                       getClass().getResource("bob.properties"));
-        assertEquals(BigInteger.valueOf(10), pt.doubleIt(BigInteger.valueOf(5)));
+        assertEquals(10, pt.doubleIt(5));
         
-        
-        pt = service.getDoubleItPortEncryptThenSign();
+        portQName = new QName(NAMESPACE, "DoubleItPortEncryptThenSign");
+        pt = service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, 
                                                       new KeystorePasswordCallback());
@@ -231,10 +242,10 @@ public class SecurityPolicyTest extends 
                                                       getClass().getResource("alice.properties"));
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, 
                                                       getClass().getResource("bob.properties"));
-        pt.doubleIt(BigInteger.valueOf(5));
+        pt.doubleIt(5);
 
-        
-        pt = service.getDoubleItPortSign();
+        portQName = new QName(NAMESPACE, "DoubleItPortSign");
+        pt = service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, 
                                                       new KeystorePasswordCallback());
@@ -242,10 +253,10 @@ public class SecurityPolicyTest extends 
                                                       getClass().getResource("alice.properties"));
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, 
                                                       getClass().getResource("bob.properties"));
-        pt.doubleIt(BigInteger.valueOf(5));
+        pt.doubleIt(5);
 
-
-        pt = service.getDoubleItPortSignThenEncrypt();
+        portQName = new QName(NAMESPACE, "DoubleItPortSignThenEncrypt");
+        pt = service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, 
                                                       new KeystorePasswordCallback());
@@ -253,17 +264,18 @@ public class SecurityPolicyTest extends 
                                                       getClass().getResource("alice.properties"));
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, 
                                                       getClass().getResource("bob.properties"));
-        pt.doubleIt(BigInteger.valueOf(5));
+        pt.doubleIt(5);
         
         ((BindingProvider)pt).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                                                       POLICY_SIGNENC_PROVIDER_ADDRESS);
-        int x = pt.doubleIt(BigInteger.valueOf(5)).intValue();
+        int x = pt.doubleIt(5);
         assertEquals(10, x);
         
-        pt = service.getDoubleItPortHttps();
+        portQName = new QName(NAMESPACE, "DoubleItPortHttps");
+        pt = service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(pt, SSL_PORT);
         try {
-            pt.doubleIt(BigInteger.valueOf(25));
+            pt.doubleIt(25);
         } catch (Exception ex) {
             String msg = ex.getMessage();
             if (!msg.contains("sername")) {
@@ -273,12 +285,13 @@ public class SecurityPolicyTest extends 
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.USERNAME, "bob");
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "bob");
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.PASSWORD, "pwd");
-        pt.doubleIt(BigInteger.valueOf(25));
+        pt.doubleIt(25);
         
         try {
-            pt = service.getDoubleItPortHttp();
+            portQName = new QName(NAMESPACE, "DoubleItPortHttp");
+            pt = service.getPort(portQName, DoubleItPortType.class);
             updateAddressPort(pt, PORT);
-            pt.doubleIt(BigInteger.valueOf(25));
+            pt.doubleIt(25);
             fail("https policy should have triggered");
         } catch (Exception ex) {
             String msg = ex.getMessage();
@@ -291,11 +304,23 @@ public class SecurityPolicyTest extends 
     }
     
     @Test
+    @org.junit.Ignore
     public void testSignedOnlyWithUnsignedMessage() throws Exception {
         //CXF-2244
+        SpringBusFactory bf = new SpringBusFactory();
+
+        Bus bus = bf.createBus();
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL wsdl = SecurityPolicyTest.class.getResource("DoubleIt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        
         DoubleItPortType pt;
 
-        pt = service.getDoubleItPortSignedOnly();
+        QName portQName = new QName(NAMESPACE, "DoubleItPortSignedOnly");
+        pt = service.getPort(portQName, DoubleItPortType.class);
+
         updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, 
                                                       new KeystorePasswordCallback());
@@ -304,16 +329,16 @@ public class SecurityPolicyTest extends 
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, 
                                                       getClass().getResource("bob.properties"));
         //This should work as it should be properly signed.
-        assertEquals(BigInteger.valueOf(10), pt.doubleIt(BigInteger.valueOf(5)));
+        assertEquals(10, pt.doubleIt(5));
         
         StringWriter swriter = new StringWriter();
         PrintWriter writer = new PrintWriter(swriter);
         try {
             ClientProxy.getClient(pt).getInInterceptors()
                 .add(new LoggingInInterceptor("CheckFaultLogging", writer));
-            pt.doubleIt(BigInteger.valueOf(-100));
+            pt.doubleIt(-100);
             fail("Should have resulted in a DoubleItFault_Exception");
-        } catch (DoubleItFault_Exception ex) {
+        } catch (Exception ex) {
             //expected
             writer.flush();
             String s = swriter.toString();
@@ -339,11 +364,12 @@ public class SecurityPolicyTest extends 
         //Try sending a message with the "TimestampOnly" policy into affect to the 
         //service running the "signed only" policy.  This SHOULD fail as the
         //body is then not signed.
-        pt = service.getDoubleItPortTimestampOnly();
+        portQName = new QName(NAMESPACE, "DoubleItPortTimestampOnly");
+        pt = service.getPort(portQName, DoubleItPortType.class);
         ((BindingProvider)pt).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                                                       POLICY_SIGNONLY_ADDRESS);
         try {
-            pt.doubleIt(BigInteger.valueOf(5));
+            pt.doubleIt(5);
             fail("should have had a security/policy exception as the body wasn't signed");
         } catch (Exception ex) {
             assertTrue(ex.getMessage().contains("policy alternatives"));
@@ -351,6 +377,7 @@ public class SecurityPolicyTest extends 
         
     }
     
+    /*
     @Test
     public void testDispatchClient() throws Exception {
         Dispatch<Source> disp = service.createDispatch(DoubleItService.DoubleItPortEncryptThenSign, 
@@ -380,81 +407,12 @@ public class SecurityPolicyTest extends 
         Object o = xp.getValue("//ns2:DoubleItResponse/doubledNumber", nd, XPathConstants.STRING);
         assertEquals(XMLUtils.toString(nd), "50", o);
     }
+    */
     
-    public abstract static class AbstractDoubleItImpl implements DoubleItPortType {
-        /** {@inheritDoc}*/
-        public BigInteger doubleIt(BigInteger numberToDouble) throws DoubleItFault_Exception {
-            if (numberToDouble.equals(BigInteger.valueOf(-100))) {
-                org.apache.cxf.policytest.doubleit.DoubleItFault f 
-                    = new org.apache.cxf.policytest.doubleit.DoubleItFault();
-                f.setReason("Number is -100.  I don't like that.");
-                throw new DoubleItFault_Exception("DoubleItException.", f);
-            }
-            return numberToDouble.multiply(new BigInteger("2"));
-        }
-    }
-    
-    
-    @WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
-                portName = "DoubleItPortHttp",
-                serviceName = "DoubleItService", 
-                endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortType",
-                wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl")
-    public static class DoubleItImpl extends AbstractDoubleItImpl {
-    }
-    
-    @WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
-                portName = "DoubleItPortHttps",
-                serviceName = "DoubleItService", 
-                endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortType",
-                wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl")
-    public static class DoubleItImplHttps extends AbstractDoubleItImpl {
-    }
-    
-    @WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
-                portName = "DoubleItPortEncryptThenSign",
-                serviceName = "DoubleItService", 
-                endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortType",
-                wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl")
-    public static class DoubleItImplEncryptThenSign extends AbstractDoubleItImpl {
-    }
-    
-    @WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
-                portName = "DoubleItPortSignThenEncrypt",
-                serviceName = "DoubleItService", 
-                endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortType",
-                wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl")
-    public static class DoubleItImplSignThenEncrypt extends AbstractDoubleItImpl {
-    }
-    
-    @WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
-                portName = "DoubleItPortSign",
-                serviceName = "DoubleItService", 
-                endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortType",
-                wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl")
-    public static class DoubleItImplSign extends AbstractDoubleItImpl {
-    }
-    
-    @WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
-                portName = "DoubleItPortXPath",
-                serviceName = "DoubleItService", 
-                endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortType",
-                wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl")
-    public static class DoubleItImplXPath extends AbstractDoubleItImpl {
-    }
-    
-    @WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
-                portName = "DoubleItPortSignedOnly",
-                serviceName = "DoubleItService", 
-                endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortType",
-                wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl")
-    public static class DoubleItImplSignOnly extends AbstractDoubleItImpl {
-    }
-    
-    @WebServiceProvider(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
+    @WebServiceProvider(targetNamespace = "http://www.example.org/contract/DoubleIt", 
                         portName = "DoubleItPortSignThenEncrypt",
                         serviceName = "DoubleItService", 
-                        wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl") 
+                        wsdlLocation = "classpath:/org/apache/cxf/systest/ws/security/DoubleIt.wsdl") 
     @ServiceMode(value = Mode.PAYLOAD)
     public static class DoubleItProvider implements Provider<Source> {
 
@@ -471,12 +429,12 @@ public class SecurityPolicyTest extends 
                 el = ((Document)el).getDocumentElement();
             }
             Map<String, String> ns = new HashMap<String, String>();
-            ns.put("ns2", "http://cxf.apache.org/policytest/DoubleIt");
+            ns.put("ns2", "http://www.example.org/contract/DoubleIt");
             XPathUtils xp = new XPathUtils(ns);
             String o = (String)xp.getValue("//ns2:DoubleIt/numberToDouble", el, XPathConstants.STRING);
             int i = Integer.parseInt(o);
             
-            String req = "<ns2:DoubleItResponse xmlns:ns2=\"http://cxf.apache.org/policytest/DoubleIt\">"
+            String req = "<ns2:DoubleItResponse xmlns:ns2=\"http://www.example.org/contract/DoubleIt\">"
                 + "<doubledNumber>" + Integer.toString(i * 2) + "</doubledNumber></ns2:DoubleItResponse>";
             return new StreamSource(new StringReader(req));
         }
@@ -484,39 +442,23 @@ public class SecurityPolicyTest extends 
     }
     
     
-    
-    @WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
-                portName = "DoubleItPortCXF3041",
-                serviceName = "DoubleItService", 
-                endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortType",
-                wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl")
-    public static class DoubleItImplCXF3041 extends AbstractDoubleItImpl {
-    }
-    
-    @WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
-                portName = "DoubleItPortCXF3042",
-                serviceName = "DoubleItService", 
-                endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortType",
-                wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl")
-    public static class DoubleItImplCXF3042 extends AbstractDoubleItImpl {
-    }
-    @WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
-                portName = "DoubleItPortCXF3452",
-                serviceName = "DoubleItService", 
-                endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortTypeHeader",
-                wsdlLocation = "classpath:/wsdl_systest_wssec/DoubleIt.wsdl")
-    public static class DoubleItImplCXF3452 implements DoubleItPortTypeHeader {
-        public DoubleItResponse doubleIt(DoubleIt parameters, int header) throws DoubleItFault_Exception {
-            DoubleItResponse r = new DoubleItResponse();
-            r.setDoubledNumber(parameters.getNumberToDouble().shiftLeft(header));
-            return r;
-        }
-    }
     @Test
+    @org.junit.Ignore
     public void testCXF3041() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+
+        Bus bus = bf.createBus();
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL wsdl = SecurityPolicyTest.class.getResource("DoubleIt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        
         DoubleItPortType pt;
 
-        pt = service.getDoubleItPortCXF3041();
+        QName portQName = new QName(NAMESPACE, "DoubleItPortCXF3041");
+        pt = service.getPort(portQName, DoubleItPortType.class);
+
         updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, 
                                                       new KeystorePasswordCallback());
@@ -524,13 +466,26 @@ public class SecurityPolicyTest extends 
                                                       getClass().getResource("alice.properties"));
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, 
                                                       getClass().getResource("bob.properties"));
-        assertEquals(BigInteger.valueOf(10), pt.doubleIt(BigInteger.valueOf(5)));
+        assertEquals(10, pt.doubleIt(5));
     }
 
     @Test
+    @org.junit.Ignore
     public void testCXF3042() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+
+        Bus bus = bf.createBus();
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL wsdl = SecurityPolicyTest.class.getResource("DoubleIt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        
         DoubleItPortType pt;
-        pt = service.getDoubleItPortCXF3042();
+
+        QName portQName = new QName(NAMESPACE, "DoubleItPortCXF3042");
+        pt = service.getPort(portQName, DoubleItPortType.class);
+
         updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, 
                                                       new KeystorePasswordCallback());
@@ -538,12 +493,26 @@ public class SecurityPolicyTest extends 
                                                       getClass().getResource("alice.properties"));
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, 
                                                       getClass().getResource("alice.properties"));
-        assertEquals(BigInteger.valueOf(10), pt.doubleIt(BigInteger.valueOf(5)));
+        assertEquals(10, pt.doubleIt(5));
     }
+    
     @Test
+    @org.junit.Ignore
     public void testCXF3452() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+
+        Bus bus = bf.createBus();
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL wsdl = SecurityPolicyTest.class.getResource("DoubleIt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        
         DoubleItPortTypeHeader pt;
-        pt = service.getDoubleItPortCXF3452();
+
+        QName portQName = new QName(NAMESPACE, "DoubleItPortCXF3452");
+        pt = service.getPort(portQName, DoubleItPortTypeHeader.class);
+        
         updateAddressPort(pt, PORT);
         ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, 
                                                       new KeystorePasswordCallback());
@@ -553,7 +522,7 @@ public class SecurityPolicyTest extends 
                                                       getClass().getResource("alice.properties"));
         
         DoubleIt di = new DoubleIt();
-        di.setNumberToDouble(BigInteger.valueOf(5));
-        assertEquals(BigInteger.valueOf(10), pt.doubleIt(di, 1).getDoubledNumber());
+        di.setNumberToDouble(5);
+        assertEquals(10, pt.doubleIt(di, 1).getDoubledNumber());
     }
 }

Modified: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java?rev=1209145&r1=1209144&r2=1209145&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java Thu Dec  1 16:45:41 2011
@@ -19,24 +19,28 @@
 
 package org.apache.cxf.systest.ws.ut;
 
-import java.math.BigInteger;
 import java.net.URL;
 
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.systest.ws.ut.server.Server;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
-import org.junit.BeforeClass;
+import org.example.contract.doubleit.DoubleItPortType;
 
-import wssec.ut.DoubleItPortType;
-import wssec.ut.DoubleItService;
+import org.junit.BeforeClass;
 
 /**
  * A set of tests for Username Tokens over the Transport Binding.
  */
 public class UsernameTokenTest extends AbstractBusClientServerTestBase {
     static final String PORT = allocatePort(Server.class);
+    
+    private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
+    private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
 
     @BeforeClass
     public static void startServers() throws Exception {
@@ -58,11 +62,14 @@ public class UsernameTokenTest extends A
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType utPort = service.getDoubleItPlaintextPort();
+        URL wsdl = UsernameTokenTest.class.getResource("DoubleItUt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItPlaintextPort");
+        DoubleItPortType utPort = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(utPort, PORT);
-        utPort.doubleIt(BigInteger.valueOf(25));
+        
+        utPort.doubleIt(25);
     }
     
     @org.junit.Test
@@ -75,12 +82,14 @@ public class UsernameTokenTest extends A
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType utPort = service.getDoubleItPlaintextCreatedPort();
+        URL wsdl = UsernameTokenTest.class.getResource("DoubleItUt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItPlaintextCreatedPort");
+        DoubleItPortType utPort = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(utPort, PORT);
         
-        utPort.doubleIt(BigInteger.valueOf(25));
+        utPort.doubleIt(25);
     }
     
     @org.junit.Test
@@ -93,12 +102,14 @@ public class UsernameTokenTest extends A
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType utPort = service.getDoubleItHashedPort();
+        URL wsdl = UsernameTokenTest.class.getResource("DoubleItUt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItHashedPort");
+        DoubleItPortType utPort = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(utPort, PORT);
         
-        utPort.doubleIt(BigInteger.valueOf(25));
+        utPort.doubleIt(25);
     }
     
     @org.junit.Test
@@ -111,12 +122,14 @@ public class UsernameTokenTest extends A
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType utPort = service.getDoubleItNoPasswordPort();
+        URL wsdl = UsernameTokenTest.class.getResource("DoubleItUt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItNoPasswordPort");
+        DoubleItPortType utPort = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(utPort, PORT);
         
-        utPort.doubleIt(BigInteger.valueOf(25));
+        utPort.doubleIt(25);
     }
     
     @org.junit.Test
@@ -129,11 +142,13 @@ public class UsernameTokenTest extends A
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType utPort = service.getDoubleItSignedEndorsingPort();
+        URL wsdl = UsernameTokenTest.class.getResource("DoubleItUt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSignedEndorsingPort");
+        DoubleItPortType utPort = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(utPort, PORT);
-        utPort.doubleIt(BigInteger.valueOf(25));
+        utPort.doubleIt(25);
     }
     
     @org.junit.Test
@@ -146,11 +161,13 @@ public class UsernameTokenTest extends A
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType utPort = service.getDoubleItSignedEncryptedPort();
+        URL wsdl = UsernameTokenTest.class.getResource("DoubleItUt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSignedEncryptedPort");
+        DoubleItPortType utPort = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(utPort, PORT);
-        utPort.doubleIt(BigInteger.valueOf(25));
+        utPort.doubleIt(25);
     }
     
     @org.junit.Test
@@ -163,11 +180,13 @@ public class UsernameTokenTest extends A
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        
-        DoubleItPortType utPort = service.getDoubleItEncryptedPort();
+        URL wsdl = UsernameTokenTest.class.getResource("DoubleItUt.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItEncryptedPort");
+        DoubleItPortType utPort = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(utPort, PORT);
-        utPort.doubleIt(BigInteger.valueOf(25));
+        utPort.doubleIt(25);
     }
     
 }

Modified: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java?rev=1209145&r1=1209144&r2=1209145&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java Thu Dec  1 16:45:41 2011
@@ -19,22 +19,22 @@
 
 package org.apache.cxf.systest.ws.x509;
 
-import java.math.BigInteger;
 import java.net.URL;
 
 import javax.crypto.Cipher;
 import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.systest.ws.x509.server.Server;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
-import org.junit.BeforeClass;
+import org.example.contract.doubleit.DoubleItPortType;
 
-import wssec.x509.DoubleItPortType;
-import wssec.x509.DoubleItService;
+import org.junit.BeforeClass;
 
 /**
  * A set of tests for X.509 Tokens.
@@ -43,6 +43,9 @@ public class X509TokenTest extends Abstr
     static final String PORT = allocatePort(Server.class);
     static final String PORT2 = allocatePort(Server.class, 2);
 
+    private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
+    private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
+
     private boolean unrestrictedPoliciesInstalled = checkUnrestrictedPoliciesInstalled();
     
     @BeforeClass
@@ -67,11 +70,14 @@ public class X509TokenTest extends Abstr
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
-
-        DoubleItService service = new DoubleItService();
-        DoubleItPortType x509Port = service.getDoubleItKeyIdentifierPort();
+        
+        URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItKeyIdentifierPort");
+        DoubleItPortType x509Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
-        x509Port.doubleIt(BigInteger.valueOf(25));
+        x509Port.doubleIt(25);
     }
     
     @org.junit.Test
@@ -87,10 +93,13 @@ public class X509TokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        DoubleItPortType x509Port = service.getDoubleItIssuerSerialPort();
+        URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItIssuerSerialPort");
+        DoubleItPortType x509Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
-        x509Port.doubleIt(BigInteger.valueOf(25));
+        x509Port.doubleIt(25);
     }
     
     @org.junit.Test
@@ -106,10 +115,13 @@ public class X509TokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        DoubleItPortType x509Port = service.getDoubleItThumbprintPort();
+        URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItThumbprintPort");
+        DoubleItPortType x509Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
-        x509Port.doubleIt(BigInteger.valueOf(25));
+        x509Port.doubleIt(25);
     }
     
     @org.junit.Test
@@ -125,10 +137,13 @@ public class X509TokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        DoubleItPortType x509Port = service.getDoubleItAsymmetricIssuerSerialPort();
+        URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricIssuerSerialPort");
+        DoubleItPortType x509Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
-        x509Port.doubleIt(BigInteger.valueOf(25));
+        x509Port.doubleIt(25);
     }
     
     @org.junit.Test
@@ -144,10 +159,13 @@ public class X509TokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        DoubleItPortType x509Port = service.getDoubleItAsymmetricProtectTokensPort();
+        URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricProtectTokensPort");
+        DoubleItPortType x509Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
-        x509Port.doubleIt(BigInteger.valueOf(25));
+        x509Port.doubleIt(25);
     }
     
     @org.junit.Test
@@ -163,10 +181,13 @@ public class X509TokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        DoubleItPortType x509Port = service.getDoubleItSymmetricProtectTokensPort();
+        URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSymmetricProtectTokensPort");
+        DoubleItPortType x509Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
-        x509Port.doubleIt(BigInteger.valueOf(25));
+        x509Port.doubleIt(25);
     }
     
     @org.junit.Test
@@ -182,10 +203,13 @@ public class X509TokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        DoubleItPortType x509Port = service.getDoubleItTransportEndorsingPort();
+        URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItTransportEndorsingPort");
+        DoubleItPortType x509Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT2);
-        x509Port.doubleIt(BigInteger.valueOf(25));
+        x509Port.doubleIt(25);
     }
     
     @org.junit.Test
@@ -201,10 +225,13 @@ public class X509TokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        DoubleItPortType x509Port = service.getDoubleItTransportSignedEndorsingPort();
+        URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItTransportSignedEndorsingPort");
+        DoubleItPortType x509Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT2);
-        x509Port.doubleIt(BigInteger.valueOf(25));
+        x509Port.doubleIt(25);
     }
     
     @org.junit.Test
@@ -220,10 +247,13 @@ public class X509TokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        DoubleItPortType x509Port = service.getDoubleItTransportEndorsingEncryptedPort();
+        URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItTransportEndorsingEncryptedPort");
+        DoubleItPortType x509Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT2);
-        x509Port.doubleIt(BigInteger.valueOf(25));
+        x509Port.doubleIt(25);
     }
     
     @org.junit.Test
@@ -239,10 +269,13 @@ public class X509TokenTest extends Abstr
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        DoubleItService service = new DoubleItService();
-        DoubleItPortType x509Port = service.getDoubleItTransportSignedEndorsingEncryptedPort();
+        URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItTransportSignedEndorsingEncryptedPort");
+        DoubleItPortType x509Port = 
+                service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT2);
-        x509Port.doubleIt(BigInteger.valueOf(25));
+        x509Port.doubleIt(25);
     }
     
     private boolean checkUnrestrictedPoliciesInstalled() {

Added: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/DoubleItLogical.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/DoubleItLogical.wsdl?rev=1209145&view=auto
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/DoubleItLogical.wsdl (added)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/DoubleItLogical.wsdl Thu Dec  1 16:45:41 2011
@@ -0,0 +1,72 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<wsdl:definitions name="DoubleIt"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:di="http://www.example.org/schema/DoubleIt"
+	xmlns:tns="http://www.example.org/contract/DoubleIt" xmlns:wsp="http://www.w3.org/ns/ws-policy"
+	xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+	xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
+	xmlns:t="http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:wsaw="http://www.w3.org/2005/08/addressing"
+	xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" targetNamespace="http://www.example.org/contract/DoubleIt">
+	<!-- Replaced for wsp: http://schemas.xmlsoap.org/ws/2004/09/policy -->
+	
+	<wsdl:types>
+		<xsd:schema targetNamespace="http://www.example.org/schema/DoubleIt">
+			<xsd:element name="DoubleIt">
+				<xsd:complexType>
+					<xsd:sequence>
+						<xsd:element name="numberToDouble" type="xsd:int" />
+					</xsd:sequence>
+				</xsd:complexType>
+			</xsd:element>
+			<xsd:element name="DoubleItResponse">
+				<xsd:complexType>
+					<xsd:sequence>
+						<xsd:element name="doubledNumber" type="xsd:int" />
+					</xsd:sequence>
+				</xsd:complexType>
+			</xsd:element>
+			<xsd:element name="DoubleItHeader" type="xsd:int"/>
+		</xsd:schema>
+	</wsdl:types>
+	<wsdl:message name="DoubleItRequest">
+		<wsdl:part element="di:DoubleIt" name="parameters" />
+	</wsdl:message>
+	<wsdl:message name="DoubleItRequestHeader">
+        <wsdl:part element="di:DoubleIt" name="parameters" />
+        <wsdl:part element="di:DoubleItHeader" name="header" />
+    </wsdl:message>
+	<wsdl:message name="DoubleItResponse">
+		<wsdl:part element="di:DoubleItResponse" name="parameters" />
+	</wsdl:message>
+	<wsdl:portType name="DoubleItPortType">
+		<wsdl:operation name="DoubleIt">
+			<wsdl:input message="tns:DoubleItRequest" />
+			<wsdl:output message="tns:DoubleItResponse" />
+		</wsdl:operation>
+	</wsdl:portType>
+    <wsdl:portType name="DoubleItPortTypeHeader">
+        <wsdl:operation name="DoubleIt">
+            <wsdl:input message="tns:DoubleItRequestHeader" />
+            <wsdl:output message="tns:DoubleItResponse" />
+        </wsdl:operation>
+    </wsdl:portType>
+	
+	
+</wsdl:definitions>

Copied: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/DoubleItSaml.wsdl (from r1209102, cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/saml/DoubleItSaml.wsdl)
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/DoubleItSaml.wsdl?p2=cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/DoubleItSaml.wsdl&p1=cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/saml/DoubleItSaml.wsdl&r1=1209102&r2=1209145&rev=1209145&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/saml/DoubleItSaml.wsdl (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/DoubleItSaml.wsdl Thu Dec  1 16:45:41 2011
@@ -19,60 +19,17 @@
 -->
 <wsdl:definitions name="DoubleIt"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
-    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://WSSec/saml"
-    targetNamespace="http://WSSec/saml" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/contract/DoubleIt"
+    targetNamespace="http://www.example.org/contract/DoubleIt" 
     xmlns:wsp="http://www.w3.org/ns/ws-policy"
     xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
     xmlns:wsaws="http://www.w3.org/2005/08/addressing" 
     xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
     xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
-    <wsdl:types>
-        <xsd:schema targetNamespace="http://WSSec/saml">
-            <xsd:element name="DoubleIt">
-                <xsd:complexType>
-                    <xsd:sequence>
-                        <xsd:element name="numberToDouble">
-                            <xsd:simpleType>
-                                <xsd:restriction base="xsd:integer">
-                                    <xsd:minInclusive value="0"/>
-                                </xsd:restriction>
-                            </xsd:simpleType>
-                        </xsd:element>
-                    </xsd:sequence>
-                </xsd:complexType>
-            </xsd:element>
-            <xsd:element name="DoubleItResponse">
-                <xsd:complexType>
-                    <xsd:sequence>
-                        <xsd:element name="doubledNumber" type="xsd:integer" />
-                    </xsd:sequence>
-                </xsd:complexType>
-            </xsd:element>
-            <xsd:element name="DoubleItFault">
-                <xsd:complexType>
-                    <xsd:sequence>
-                        <xsd:element name="reason" type="xsd:string" />
-                    </xsd:sequence>
-                </xsd:complexType>
-            </xsd:element>
-        </xsd:schema>
-    </wsdl:types>
-    <wsdl:message name="DoubleItRequest">
-        <wsdl:part element="tns:DoubleIt" name="parameters" />
-    </wsdl:message>
-    <wsdl:message name="DoubleItResponse">
-        <wsdl:part element="tns:DoubleItResponse" name="parameters" />
-    </wsdl:message>
-    <wsdl:message name="DoubleItFault">
-        <wsdl:part element="tns:DoubleItFault" name="fault" />
-    </wsdl:message>
-    <wsdl:portType name="DoubleItPortType">
-        <wsdl:operation name="DoubleIt">
-            <wsdl:input message="tns:DoubleItRequest" />
-            <wsdl:output message="tns:DoubleItResponse" />
-            <wsdl:fault name="DoubleItFault" message="tns:DoubleItFault" />
-        </wsdl:operation>
-    </wsdl:portType>
+
+    <wsdl:import location="src/test/resources/DoubleItLogical.wsdl" 
+                 namespace="http://www.example.org/contract/DoubleIt"/>
+
     <wsdl:binding name="DoubleItSaml1TransportBinding" type="tns:DoubleItPortType">
         <wsp:PolicyReference URI="#DoubleItSaml1TransportPolicy" />
         <soap:binding style="document"

Modified: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/client/client.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/client/client.xml?rev=1209145&r1=1209144&r2=1209145&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/client/client.xml (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/saml/client/client.xml Thu Dec  1 16:45:41 2011
@@ -52,7 +52,7 @@
         </http:tlsClientParameters>
     </http:conduit>  
     
-    <jaxws:client name="{http://WSSec/saml}DoubleItSaml2SymmetricPort" 
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSaml2SymmetricPort" 
                   createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.encryption.properties" 
@@ -61,7 +61,7 @@
        </jaxws:properties>
     </jaxws:client>
     
-    <jaxws:client name="{http://WSSec/saml}DoubleItSaml2SymmetricSupportingPort" 
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSaml2SymmetricSupportingPort" 
                   createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.encryption.properties" 
@@ -70,7 +70,7 @@
        </jaxws:properties>
     </jaxws:client>  
    
-    <jaxws:client name="{http://WSSec/saml}DoubleItSaml2AsymmetricPort" 
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSaml2AsymmetricPort" 
                   createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.callback-handler" 
@@ -84,7 +84,7 @@
        </jaxws:properties>
     </jaxws:client> 
 
-    <jaxws:client name="{http://WSSec/saml}DoubleItSaml1SelfSignedTransportPort" 
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSaml1SelfSignedTransportPort" 
                   createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.callback-handler" 
@@ -96,7 +96,7 @@
        </jaxws:properties>
     </jaxws:client>  
     
-    <jaxws:client name="{http://WSSec/saml}DoubleItSaml2EndorsingTransportPort" 
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSaml2EndorsingTransportPort" 
                   createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.callback-handler" 
@@ -108,7 +108,7 @@
        </jaxws:properties>
     </jaxws:client>  
    
-    <jaxws:client name="{http://WSSec/saml}DoubleItAsymmetricSamlInitiatorPort" 
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItAsymmetricSamlInitiatorPort" 
                   createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.callback-handler" 
@@ -123,7 +123,7 @@
        </jaxws:properties>
     </jaxws:client> 
     
-    <jaxws:client name="{http://WSSec/saml}DoubleItSaml2SymmetricSignedElementsPort" 
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSaml2SymmetricSignedElementsPort" 
                   createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.encryption.properties" 
@@ -132,7 +132,7 @@
        </jaxws:properties>
     </jaxws:client>
     
-    <jaxws:client name="{http://WSSec/saml}DoubleItSaml2AsymmetricSignedEncryptedPort" 
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSaml2AsymmetricSignedEncryptedPort" 
                   createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.callback-handler" 
@@ -146,7 +146,7 @@
        </jaxws:properties>
     </jaxws:client> 
     
-    <jaxws:client name="{http://WSSec/saml}DoubleItSaml2AsymmetricEncryptedPort" 
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSaml2AsymmetricEncryptedPort" 
                   createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.callback-handler" 
@@ -160,7 +160,7 @@
        </jaxws:properties>
     </jaxws:client> 
     
-    <jaxws:client name="{http://WSSec/saml}DoubleItSaml2EndorsingEncryptedTransportPort" 
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSaml2EndorsingEncryptedTransportPort" 
                   createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.callback-handler"