cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r687194 - in /cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ api/src/main/java/org/apache/cxf/ws/policy/ api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/ api/src/main/java/org/apache/cxf/ws/policy/builder/xml/ api/s...
Date Tue, 19 Aug 2008 23:25:54 GMT
Author: dkulp
Date: Tue Aug 19 16:25:53 2008
New Revision: 687194

URL: http://svn.apache.org/viewvc?rev=687194&view=rev
Log:
Next step in ws-secpol support (make sure we can actually parse some policy)
Output better error message when policy isn't asserted
Move systests wsdl dir to new name to not conflict with testutils

Added:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java   (with props)
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/DoubleItImpl.java   (with props)
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java   (with props)
    cxf/trunk/systests/src/test/resources/wsdl_systest/   (props changed)
      - copied from r687066, cxf/trunk/systests/src/test/resources/wsdl/
    cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl   (with props)
Removed:
    cxf/trunk/systests/src/test/resources/wsdl/
Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java
    cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/LayoutBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/UsernameTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS10Builder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS11Builder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
    cxf/trunk/systests/pom.xml
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/cxf993/Cxf993Test.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/resolver/JarServiceContractResolver.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitServerImpl.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_disable/Server.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/Server.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPServerPolicyTest.java
    cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java Tue Aug 19 16:25:53 2008
@@ -62,7 +62,17 @@
         }
     }
     
-    
+    public boolean containsExtensor(Object el) {
+        Object exts[] = extensors.get();
+        if (exts != null) {
+            for (Object o : exts) {
+                if (o == el) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
     public void addExtensor(Object el) {
         Object exts[] = extensors.get();
         Object exts2[];

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties Tue Aug 19 16:25:53 2008
@@ -18,5 +18,5 @@
 #    under the License.
 #
 #
-NO_ALTERNATIVE_EXC = None of the policy alternatives can be satisfied.
+NO_ALTERNATIVE_EXC = These policy alternatives can be satisfied: {0}
 NOT_ASSERTED_EXC = Assertion of type {0} could not be asserted.
\ No newline at end of file

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java Tue Aug 19 16:25:53 2008
@@ -74,27 +74,32 @@
 
     }
     
-    public boolean supportsAlternative(Collection<PolicyAssertion> alternative) {
+    public boolean supportsAlternative(Collection<PolicyAssertion> alternative,
+                                       List<QName> errors) {
+        boolean pass = true;
         for (PolicyAssertion a : alternative) {          
             if (!a.isAsserted(this)) {
-                return false;
+                errors.add(a.getName());
+                pass = false;
             }
         }
-        return true;
+        return pass;
     }
     
     public void checkEffectivePolicy(Policy policy) {
+        List<QName> errors = new ArrayList<QName>();
         Iterator alternatives = policy.getAlternatives();
         while (alternatives.hasNext()) {      
             List<PolicyAssertion> alternative = CastUtils.cast((List)alternatives.next(), 
                                                                PolicyAssertion.class);
-            if (supportsAlternative(alternative)) {
+            if (supportsAlternative(alternative, errors)) {
                 return;
             }
         }
-        throw new PolicyException(new Message("NO_ALTERNATIVE_EXC", BUNDLE));
+        throw new PolicyException(new Message("NO_ALTERNATIVE_EXC", BUNDLE, errors));
     }
-        
+
+    
     public void check() {
         for (Collection<AssertionInfo> ais : values()) {
             for (AssertionInfo ai : ais) {

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java Tue Aug 19 16:25:53 2008
@@ -35,6 +35,13 @@
 public interface PolicyInterceptorProviderRegistry 
     extends Registry<QName, PolicyInterceptorProvider> {
     
+    /**
+     * Register the builder for all qnames from the provider
+     * getAssertionTypes call.
+     * @param provider the provider to register 
+     */
+    void register(PolicyInterceptorProvider provider);
+    
     List<Interceptor> getInterceptors(Collection<PolicyAssertion> alterative, boolean out, boolean fault);
 
 }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java Tue Aug 19 16:25:53 2008
@@ -36,6 +36,13 @@
     protected Bus bus;
     private Collection<QName> knownElements = new ArrayList<QName>();
     
+    public PrimitiveAssertionBuilder() {
+        knownElements = new ArrayList<QName>();
+    }
+    public PrimitiveAssertionBuilder(Collection<QName> els) {
+        knownElements = els;
+    }
+    
     public void setBus(Bus b) {
         bus = b;
     }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java Tue Aug 19 16:25:53 2008
@@ -19,6 +19,10 @@
 
 package org.apache.cxf.ws.policy.builder.xml;
 
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
 import org.w3c.dom.Element;
 
 import org.apache.cxf.ws.policy.PolicyAssertion;
@@ -26,6 +30,14 @@
 
 public class XMLPrimitiveAssertionBuilder extends PrimitiveAssertionBuilder {
  
+    public XMLPrimitiveAssertionBuilder() {
+        super();
+    }
+    public XMLPrimitiveAssertionBuilder(Collection<QName> els) {
+        super(els);
+    }
+    
+    
     public PolicyAssertion build(Element element) {
         return new XmlPrimitiveAssertion(element, getPolicyConstants());
     }

Modified: cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java (original)
+++ cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java Tue Aug 19 16:25:53 2008
@@ -97,8 +97,8 @@
         alt2.add(c);
                 
         control.replay();
-        assertTrue(!aim.supportsAlternative(alt1));
-        assertTrue(aim.supportsAlternative(alt2));
+        assertTrue(!aim.supportsAlternative(alt1, new ArrayList<QName>()));
+        assertTrue(aim.supportsAlternative(alt2, new ArrayList<QName>()));
         control.verify();     
     }  
     

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java Tue Aug 19 16:25:53 2008
@@ -235,6 +235,17 @@
         }
         return (Element) n;
     }
+    public static Element getNextElement(Element el) {
+        Node nd = el.getNextSibling();
+        while (nd != null) {
+            if (nd.getNodeType() == Node.ELEMENT_NODE) {
+                return (Element)nd;
+            }
+            nd = nd.getNextSibling();
+        }
+        return null;
+    }
+    
     public static Element getFirstChildWithName(Element parent, QName q) { 
         String ns = q.getNamespaceURI();
         String lp = q.getLocalPart();

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Tue Aug 19 16:25:53 2008
@@ -109,7 +109,9 @@
     private void copyExtensors(AbstractPropertiesHolder info, List<?> extList) {
         if (info != null) {
             for (ExtensibilityElement ext : cast(extList, ExtensibilityElement.class)) {
-                info.addExtensor(ext);
+                if (!info.containsExtensor(ext)) {
+                    info.addExtensor(ext);
+                }
             }
         }
     }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java Tue Aug 19 16:25:53 2008
@@ -49,6 +49,12 @@
         super(interceptors.createMap());
     }    
 
+    public void register(PolicyInterceptorProvider provider) {
+        for (QName qn : provider.getAssertionTypes()) {
+            super.register(qn, provider);
+        }
+    }
+
     public Class<?> getRegistrationType() {
         return PolicyInterceptorProviderRegistry.class;
     }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java Tue Aug 19 16:25:53 2008
@@ -22,7 +22,7 @@
 
 public abstract class SPConstants {
     
-    public static final String P_NS = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+    public static final String P_NS = "http://www.w3.org/ns/ws-policy";
 
     public static final String P_PREFIX = "wsp";
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java Tue Aug 19 16:25:53 2008
@@ -25,6 +25,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
 import org.apache.cxf.ws.policy.PolicyBuilder;
+import org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry;
 import org.apache.cxf.ws.security.policy.builders.AlgorithmSuiteBuilder;
 import org.apache.cxf.ws.security.policy.builders.AsymmetricBindingBuilder;
 import org.apache.cxf.ws.security.policy.builders.ContentEncryptedElementsBuilder;
@@ -53,6 +54,7 @@
 import org.apache.cxf.ws.security.policy.builders.WSS10Builder;
 import org.apache.cxf.ws.security.policy.builders.WSS11Builder;
 import org.apache.cxf.ws.security.policy.builders.X509TokenBuilder;
+import org.apache.cxf.ws.security.policy.interceptors.WSSecurityPolicyInterceptorProvider;
 
 
 public class WSSecurityPolicyLoader {
@@ -82,7 +84,7 @@
         reg.register(new HttpsTokenBuilder(pbuild));
         reg.register(new InitiatorTokenBuilder(pbuild));
         reg.register(new IssuedTokenBuilder(pbuild));
-        reg.register(new LayoutBuilder(pbuild));
+        reg.register(new LayoutBuilder());
         reg.register(new ProtectionTokenBuilder(pbuild));
         reg.register(new RecipientTokenBuilder(pbuild));
         reg.register(new RequiredElementsBuilder());
@@ -99,13 +101,18 @@
         reg.register(new Trust10Builder());
         reg.register(new Trust13Builder());
         reg.register(new UsernameTokenBuilder(pbuild));
-        reg.register(new WSS10Builder(pbuild));
-        reg.register(new WSS11Builder(pbuild));
+        reg.register(new WSS10Builder());
+        reg.register(new WSS11Builder());
         reg.register(new X509TokenBuilder(pbuild));
     }
     
     public void registerProviders() {
         //interceptor providers for all of the above
+        PolicyInterceptorProviderRegistry reg = bus.getExtension(PolicyInterceptorProviderRegistry.class);
+        if (reg == null) {
+            return;
+        }
+        reg.register(new WSSecurityPolicyInterceptorProvider());
     }
 
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java Tue Aug 19 16:25:53 2008
@@ -18,8 +18,7 @@
  */
 package org.apache.cxf.ws.security.policy.builders;
 
-import java.util.Collections;
-import java.util.Iterator;
+import java.util.Arrays;
 import java.util.List;
 
 import javax.xml.namespace.QName;
@@ -30,10 +29,10 @@
 import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.PolicyBuilder;
-import org.apache.cxf.ws.policy.builder.xml.XmlPrimitiveAssertion;
+import org.apache.cxf.ws.security.policy.SP11Constants;
 import org.apache.cxf.ws.security.policy.SP12Constants;
+import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.cxf.ws.security.policy.model.HttpsToken;
-import org.apache.neethi.Policy;
 
 
 /**
@@ -50,6 +49,10 @@
  * 
  */
 public class HttpsTokenBuilder implements AssertionBuilder {
+    private static final List<QName> KNOWN_ELEMENTS 
+        = Arrays.asList(SP11Constants.HTTPS_TOKEN, SP12Constants.HTTPS_TOKEN);
+
+    
     PolicyBuilder builder;
     public HttpsTokenBuilder(PolicyBuilder b) {
         builder = b;
@@ -59,16 +62,37 @@
      * {@inheritDoc}
      */
     public PolicyAssertion build(Element element) {
-        HttpsToken httpsToken = new HttpsToken(SP12Constants.INSTANCE);
+        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
+            ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
+
         
-        Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy) policy.normalize(false);
+        HttpsToken httpsToken = new HttpsToken(consts);
         
-        for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
-            processAlternative((List) iterator.next(), httpsToken);
-            break; // since there should be only one alternative
+        if (consts.getVersion() == SPConstants.Version.SP_V11) {
+            String attr = DOMUtils.getAttribute(element,
+                                                SPConstants.REQUIRE_CLIENT_CERTIFICATE);
+            if (attr != null) {
+                httpsToken.setRequireClientCertificate("true".equals(attr));
+            }
+        } else if (consts.getVersion() == SPConstants.Version.SP_V11) {
+            Element polEl = DOMUtils.getFirstChildWithName(element, SPConstants.POLICY);
+             
+            if (polEl != null) {
+                Element child = DOMUtils.getFirstElement(polEl);
+                if (child != null) {
+                    if (SP12Constants.HTTP_BASIC_AUTHENTICATION.equals(DOMUtils.getElementQName(child))) {
+                        httpsToken.setHttpBasicAuthentication(true);
+                    } else if (SP12Constants.HTTP_DIGEST_AUTHENTICATION
+                            .equals(DOMUtils.getElementQName(child))) {
+                        httpsToken.setHttpDigestAuthentication(true);
+                    } else if (SP12Constants.REQUIRE_CLIENT_CERTIFICATE
+                            .equals(DOMUtils.getElementQName(child))) {
+                        httpsToken.setRequireClientCertificate(true);
+                    }
+                }
+            }
         }
-        
+
         return httpsToken;
     }
 
@@ -76,38 +100,9 @@
      * {@inheritDoc}
      */
     public List<QName> getKnownElements() {
-        return Collections.singletonList(SP12Constants.HTTPS_TOKEN);
+        return KNOWN_ELEMENTS;
     }
     
-    /**
-     * Process policy alternatives inside the HttpsToken element.
-     * Essentially this method will search for<br>
-     * <ul>
-     *  <li><code>HttpBasicAuthentication</code></li>
-     *  <li><code>HttpDigestAuthentication</code></li>
-     *  <li><code>RequireClientCertificate</code></li>
-     * </ul>
-     * elements.
-     * @param assertions the list of assertions to be searched through.
-     * @param parent the https token, that is to be populated with retrieved data.
-     */
-    private void processAlternative(List assertions, HttpsToken parent) {
-        
-        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
-            XmlPrimitiveAssertion primtive = (XmlPrimitiveAssertion) iterator.next();
-            QName qname = primtive.getName();
-            
-            if (qname != null) {
-                if (SP12Constants.HTTP_BASIC_AUTHENTICATION.equals(qname)) {
-                    parent.setHttpBasicAuthentication(true);
-                } else if (SP12Constants.HTTP_DIGEST_AUTHENTICATION.equals(qname)) {
-                    parent.setHttpDigestAuthentication(true);
-                } else if (SP12Constants.REQUIRE_CLIENT_CERTIFICATE.equals(qname)) {
-                    parent.setRequireClientCertificate(true);
-                }
-            }
-        }
-    }
 
     public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
         // TODO Auto-generated method stub

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/LayoutBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/LayoutBuilder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/LayoutBuilder.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/LayoutBuilder.java Tue Aug 19 16:25:53 2008
@@ -20,7 +20,6 @@
 
 
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.xml.namespace.QName;
@@ -30,22 +29,16 @@
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.PolicyAssertion;
-import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP11Constants;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.cxf.ws.security.policy.model.Layout;
-import org.apache.neethi.Assertion;
-import org.apache.neethi.Policy;
-
 
 public class LayoutBuilder implements AssertionBuilder {
     private static final List<QName> KNOWN_ELEMENTS 
         = Arrays.asList(SP11Constants.LAYOUT, SP12Constants.LAYOUT);
     
-    PolicyBuilder builder;
-    public LayoutBuilder(PolicyBuilder b) {
-        builder = b;
+    public LayoutBuilder() {
     }
     public List<QName> getKnownElements() {
         return KNOWN_ELEMENTS;
@@ -60,39 +53,25 @@
 
         
         Layout layout = new Layout(consts);
-
-        Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
-
-        for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
-            processAlternative((List)iterator.next(), layout, consts);
-            break; // there should be only one alternative
-        }
-
+        processAlternative(element, layout, consts);
         return layout;
     }
 
-    public void processAlternative(List assertions, Layout parent, SPConstants consts) {
-
-        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
-            Assertion assertion = (Assertion)iterator.next();
-            QName qname = assertion.getName();
-
-            if (!consts.getNamespace().equals(qname.getNamespaceURI())) {
-                continue;
+    public void processAlternative(Element element, Layout parent, SPConstants consts) {
+        Element polEl = DOMUtils.getFirstChildWithName(element, SPConstants.POLICY);
+        if (polEl != null) {
+            Element child = DOMUtils.getFirstElement(polEl);
+            if (child != null) {
+                if (SPConstants.LAYOUT_STRICT.equals(child.getLocalName())) {
+                    parent.setValue(SPConstants.LAYOUT_STRICT);
+                } else if (SPConstants.LAYOUT_LAX.equals(child.getLocalName())) {
+                    parent.setValue(SPConstants.LAYOUT_LAX);
+                } else if (SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST.equals(child.getLocalName())) {
+                    parent.setValue(SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST);
+                } else if (SPConstants.LAYOUT_LAX_TIMESTAMP_LAST.equals(child.getLocalName())) {
+                    parent.setValue(SPConstants.LAYOUT_LAX_TIMESTAMP_LAST);
+                }
             }
-
-            
-            if (SPConstants.LAYOUT_STRICT.equals(qname.getLocalPart())) {
-                parent.setValue(SPConstants.LAYOUT_STRICT);
-            } else if (SPConstants.LAYOUT_LAX.equals(qname.getLocalPart())) {
-                parent.setValue(SPConstants.LAYOUT_LAX);
-            } else if (SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST.equals(qname.getLocalPart())) {
-                parent.setValue(SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST);
-            } else if (SPConstants.LAYOUT_LAX_TIMESTAMP_LAST.equals(qname.getLocalPart())) {
-                parent.setValue(SPConstants.LAYOUT_LAX_TIMESTAMP_LAST);
-            }
-
         }
     }
     public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java Tue Aug 19 16:25:53 2008
@@ -19,7 +19,6 @@
 package org.apache.cxf.ws.security.policy.builders;
 
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.xml.namespace.QName;
@@ -38,8 +37,6 @@
 import org.apache.cxf.ws.security.policy.model.SupportingToken;
 import org.apache.cxf.ws.security.policy.model.TransportBinding;
 import org.apache.cxf.ws.security.policy.model.TransportToken;
-import org.apache.neethi.Assertion;
-import org.apache.neethi.Policy;
 
 public class TransportBindingBuilder implements AssertionBuilder {
     private static final List<QName> KNOWN_ELEMENTS 
@@ -58,18 +55,7 @@
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
 
         TransportBinding transportBinding = new TransportBinding(consts);
-
-        Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
-
-        for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
-            processAlternative((List)iterator.next(), transportBinding, consts);
-
-            /*
-             * since there should be only one alternative
-             */
-            break;
-        }
+        processAlternative(element, transportBinding, consts);
 
         return transportBinding;
     }
@@ -78,31 +64,36 @@
         return KNOWN_ELEMENTS;
     }
 
-    private void processAlternative(List assertionList, 
+    private void processAlternative(Element element, 
                                     TransportBinding parent,
                                     SPConstants consts) {
-
-        for (Iterator iterator = assertionList.iterator(); iterator.hasNext();) {
-
-            Assertion primitive = (Assertion)iterator.next();
-            QName name = primitive.getName();
-
-            if (!consts.getNamespace().equals(name.getNamespaceURI())) {
-                continue;
-            }
-            
-            if (name.getLocalPart().equals(SPConstants.ALGO_SUITE)) {
-                parent.setAlgorithmSuite((AlgorithmSuite)primitive);
-            } else if (name.getLocalPart().equals(SPConstants.TRANSPORT_TOKEN)) {
-                parent.setTransportToken((TransportToken)primitive);
-            } else if (name.getLocalPart().equals(SPConstants.INCLUDE_TIMESTAMP)) {
-                parent.setIncludeTimestamp(true);
-            } else if (name.getLocalPart().equals(SPConstants.LAYOUT)) {
-                parent.setLayout((Layout)primitive);
-            } else if (name.getLocalPart().equals(SPConstants.SIGNED_SUPPORTING_TOKENS)) {
-                parent.setSignedSupportingToken((SupportingToken)primitive);
-            } else if (name.getLocalPart().equals(SPConstants.SIGNED_ENDORSING_SUPPORTING_TOKENS)) {
-                parent.setSignedEndorsingSupportingTokens((SupportingToken)primitive);
+        Element polEl = DOMUtils.getFirstChildWithName(element, SPConstants.POLICY);
+        if (polEl != null) {
+            Element child = DOMUtils.getFirstElement(polEl);
+            while (child != null) {
+                String name = child.getLocalName();
+                if (name.equals(SPConstants.ALGO_SUITE)) {
+                    parent.setAlgorithmSuite((AlgorithmSuite)new AlgorithmSuiteBuilder().build(child));
+                } else if (name.equals(SPConstants.TRANSPORT_TOKEN)) {
+                    parent.setTransportToken((TransportToken)new TransportTokenBuilder(builder)
+                                                    .build(child));
+                } else if (name.equals(SPConstants.INCLUDE_TIMESTAMP)) {
+                    parent.setIncludeTimestamp(true);
+                } else if (name.equals(SPConstants.LAYOUT)) {
+                    parent.setLayout((Layout)new LayoutBuilder().build(child));
+                } else if (name.equals(SPConstants.SIGNED_SUPPORTING_TOKENS)
+                    || name.equals(SPConstants.SIGNED_ENDORSING_SUPPORTING_TOKENS)) {
+                    
+                    if (consts.getVersion() == SPConstants.Version.SP_V11) {
+                        parent.setSignedSupportingToken((SupportingToken)new SupportingTokensBuilder(builder)
+                                                        .build(child));
+                    } else {
+                        parent.setSignedSupportingToken((SupportingToken)
+                                                        new SupportingTokens12Builder(builder)
+                                                            .build(child));                        
+                    }
+                }
+                child = DOMUtils.getNextElement(child);
             }
         }
     }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportTokenBuilder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportTokenBuilder.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportTokenBuilder.java Tue Aug 19 16:25:53 2008
@@ -30,11 +30,10 @@
 import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.PolicyBuilder;
-import org.apache.cxf.ws.policy.builder.xml.XmlPrimitiveAssertion;
 import org.apache.cxf.ws.security.policy.SP11Constants;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.cxf.ws.security.policy.model.HttpsToken;
+import org.apache.cxf.ws.security.policy.model.Token;
 import org.apache.cxf.ws.security.policy.model.TransportToken;
 import org.apache.neethi.Policy;
 
@@ -63,7 +62,7 @@
         policy = (Policy)policy.normalize(false);
 
         for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
-            processAlternative((List)iterator.next(), transportToken);
+            transportToken.setToken((Token)(((List)iterator.next()).get(0)));
             break; // since there should be only one alternative
         }
 
@@ -74,44 +73,6 @@
         return KNOWN_ELEMENTS;
     }
 
-    private void processAlternative(List assertions, TransportToken parent) {
-
-        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
-            XmlPrimitiveAssertion primtive = (XmlPrimitiveAssertion)iterator.next();
-            QName qname = primtive.getName();
-
-            if (SP11Constants.HTTPS_TOKEN.equals(qname)) {
-                HttpsToken httpsToken = new HttpsToken(SP11Constants.INSTANCE);
-                String attr = DOMUtils.getAttribute(primtive.getValue(),
-                                                    SPConstants.REQUIRE_CLIENT_CERTIFICATE);
-                if (attr != null) {
-                    httpsToken.setRequireClientCertificate("true".equals(attr));
-                }
-                parent.setToken(httpsToken);
-            } else if (SP12Constants.HTTPS_TOKEN.equals(qname)) {
-                HttpsToken httpsToken = new HttpsToken(SP12Constants.INSTANCE);
-                                 
-                Element element = DOMUtils.getFirstChildWithName(primtive.getValue(), SPConstants.POLICY);
-                 
-                if (element != null) {
-                    Element child = DOMUtils.getFirstElement(element);
-                    if (child != null) {
-                        if (SP12Constants.HTTP_BASIC_AUTHENTICATION.equals(DOMUtils.getElementQName(child))) {
-                            httpsToken.setHttpBasicAuthentication(true);
-                        } else if (SP12Constants.HTTP_DIGEST_AUTHENTICATION
-                                .equals(DOMUtils.getElementQName(child))) {
-                            httpsToken.setHttpDigestAuthentication(true);
-                        } else if (SP12Constants.REQUIRE_CLIENT_CERTIFICATE
-                                .equals(DOMUtils.getElementQName(child))) {
-                            httpsToken.setRequireClientCertificate(true);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-
     public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
         // TODO Auto-generated method stub
         return null;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/UsernameTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/UsernameTokenBuilder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/UsernameTokenBuilder.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/UsernameTokenBuilder.java Tue Aug 19 16:25:53 2008
@@ -19,7 +19,6 @@
 package org.apache.cxf.ws.security.policy.builders;
 
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.xml.namespace.QName;
@@ -34,8 +33,6 @@
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.cxf.ws.security.policy.model.UsernameToken;
-import org.apache.neethi.Assertion;
-import org.apache.neethi.Policy;
 
 
 public class UsernameTokenBuilder implements AssertionBuilder {
@@ -59,23 +56,28 @@
             usernameToken.setInclusion(consts.getInclusionFromAttributeValue(attribute));
         }
 
-        Element policyElement = DOMUtils.getFirstElement(element);
-
-        if (policyElement != null) {
-
-            Policy policy = builder.getPolicy(policyElement);
-            policy = (Policy)policy.normalize(false);
-
-            for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
-                processAlternative((List)iterator.next(), usernameToken, consts);
-
-                /*
-                 * since there should be only one alternative
-                 */
-                break;
+        Element polEl = DOMUtils.getFirstChildWithName(element, SPConstants.POLICY);
+        if (polEl != null) {
+            Element child = DOMUtils.getFirstElement(polEl);
+            if (child != null) {
+                QName qname = new QName(child.getNamespaceURI(), child.getLocalName());
+                if (SPConstants.USERNAME_TOKEN10.equals(qname.getLocalPart())) {
+                    usernameToken.setUseUTProfile10(true);
+                } else if (SPConstants.USERNAME_TOKEN11.equals(qname.getLocalPart())) {
+                    usernameToken.setUseUTProfile11(true);
+                } else if (SP12Constants.NO_PASSWORD.equals(qname)) {
+                    usernameToken.setNoPassword(true);
+                } else if (SP12Constants.HASH_PASSWORD.equals(qname)) {
+                    usernameToken.setHashPassword(true);
+                } else if (SP12Constants.REQUIRE_DERIVED_KEYS.equals(qname)) {
+                    usernameToken.setDerivedKeys(true);
+                } else if (SP12Constants.REQUIRE_EXPLICIT_DERIVED_KEYS.equals(qname)) {
+                    usernameToken.setExplicitDerivedKeys(true);
+                } else if (SP12Constants.REQUIRE_IMPLIED_DERIVED_KEYS.equals(qname)) {
+                    usernameToken.setImpliedDerivedKeys(true);
+                }
             }
         }
-
         return usernameToken;
     }
 
@@ -83,34 +85,6 @@
         return KNOWN_ELEMENTS;
     }
 
-    private void processAlternative(List assertions, UsernameToken parent, SPConstants consts) {
-
-        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
-            Assertion assertion = (Assertion)iterator.next();
-            QName qname = assertion.getName();
-
-            if (!consts.getNamespace().equals(qname.getNamespaceURI())) {
-                continue;
-            }
-            
-            if (SPConstants.USERNAME_TOKEN10.equals(qname.getLocalPart())) {
-                parent.setUseUTProfile10(true);
-            } else if (SPConstants.USERNAME_TOKEN11.equals(qname.getLocalPart())) {
-                parent.setUseUTProfile11(true);
-            } else if (SP12Constants.NO_PASSWORD.equals(qname)) {
-                parent.setNoPassword(true);
-            } else if (SP12Constants.HASH_PASSWORD.equals(qname)) {
-                parent.setHashPassword(true);
-            } else if (SP12Constants.REQUIRE_DERIVED_KEYS.equals(qname)) {
-                parent.setDerivedKeys(true);
-            } else if (SP12Constants.REQUIRE_EXPLICIT_DERIVED_KEYS.equals(qname)) {
-                parent.setExplicitDerivedKeys(true);
-            } else if (SP12Constants.REQUIRE_IMPLIED_DERIVED_KEYS.equals(qname)) {
-                parent.setImpliedDerivedKeys(true);
-            }
-        }
-    }
-
     public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
         // TODO Auto-generated method stub
         return null;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS10Builder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS10Builder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS10Builder.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS10Builder.java Tue Aug 19 16:25:53 2008
@@ -19,7 +19,6 @@
 package org.apache.cxf.ws.security.policy.builders;
 
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.xml.namespace.QName;
@@ -29,22 +28,17 @@
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.PolicyAssertion;
-import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP11Constants;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.cxf.ws.security.policy.model.Wss10;
-import org.apache.neethi.Assertion;
-import org.apache.neethi.Policy;
 
 
 public class WSS10Builder implements AssertionBuilder {
     private static final List<QName> KNOWN_ELEMENTS 
         = Arrays.asList(SP11Constants.WSS10, SP12Constants.WSS10);
     
-    PolicyBuilder builder;
-    public WSS10Builder(PolicyBuilder b) {
-        builder = b;
+    public WSS10Builder() {
     }
     public List<QName> getKnownElements() {
         return KNOWN_ELEMENTS;
@@ -57,44 +51,26 @@
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
         
         Wss10 wss10 = new Wss10(consts);
-
-        Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
-
-        for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
-            processAlternative((List)iterator.next(), wss10, consts);
-            /*
-             * since there should be only one alternative
-             */
-            break;
-        }
-
+        processAlternative(element, wss10, consts);
         return wss10;
     }
 
-    private void processAlternative(List assertions, Wss10 parent, SPConstants consts) {
-
-        Assertion assertion;
-        QName name;
-
-        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
-            assertion = (Assertion)iterator.next();
-            name = assertion.getName();
-
-            if (!consts.getNamespace().equals(name.getNamespaceURI())) {
-                continue;
-            }
-            if (SPConstants.MUST_SUPPORT_REF_KEY_IDENTIFIER.equals(name.getLocalPart())) {
-                parent.setMustSupportRefKeyIdentifier(true);
-
-            } else if (SPConstants.MUST_SUPPORT_REF_ISSUER_SERIAL.equals(name.getLocalPart())) {
-                parent.setMustSupportRefIssuerSerial(true);
-
-            } else if (SPConstants.MUST_SUPPORT_REF_EXTERNAL_URI.equals(name.getLocalPart())) {
-                parent.setMustSupportRefExternalURI(true);
-
-            } else if (SPConstants.MUST_SUPPORT_REF_EMBEDDED_TOKEN.equals(name.getLocalPart())) {
-                parent.setMustSupportRefEmbeddedToken(true);
+    private void processAlternative(Element element, Wss10 parent, SPConstants consts) {
+        Element polEl = DOMUtils.getFirstChildWithName(element, SPConstants.POLICY);
+        if (polEl != null) {
+            Element child = DOMUtils.getFirstElement(polEl);
+            while (child != null) {
+                String name = child.getLocalName();
+                if (SPConstants.MUST_SUPPORT_REF_KEY_IDENTIFIER.equals(name)) {
+                    parent.setMustSupportRefKeyIdentifier(true);
+                } else if (SPConstants.MUST_SUPPORT_REF_ISSUER_SERIAL.equals(name)) {
+                    parent.setMustSupportRefIssuerSerial(true);
+                } else if (SPConstants.MUST_SUPPORT_REF_EXTERNAL_URI.equals(name)) {
+                    parent.setMustSupportRefExternalURI(true);
+                } else if (SPConstants.MUST_SUPPORT_REF_EMBEDDED_TOKEN.equals(name)) {
+                    parent.setMustSupportRefEmbeddedToken(true);
+                }
+                child = DOMUtils.getNextElement(child);
             }
         }
     }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS11Builder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS11Builder.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS11Builder.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS11Builder.java Tue Aug 19 16:25:53 2008
@@ -19,7 +19,6 @@
 package org.apache.cxf.ws.security.policy.builders;
 
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.xml.namespace.QName;
@@ -29,83 +28,58 @@
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.PolicyAssertion;
-import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP11Constants;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.cxf.ws.security.policy.model.Wss11;
-import org.apache.neethi.Assertion;
-import org.apache.neethi.Policy;
 
 
 public class WSS11Builder implements AssertionBuilder {
     private static final List<QName> KNOWN_ELEMENTS 
         = Arrays.asList(SP11Constants.WSS11, SP12Constants.WSS11);
 
-    PolicyBuilder builder;
-    public WSS11Builder(PolicyBuilder b) {
-        builder = b;
+    public WSS11Builder() {
     }
 
     
-    
     public PolicyAssertion build(Element element)
         throws IllegalArgumentException {
         SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
         Wss11 wss11 = new Wss11(consts);
-
-        Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
-
-        for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
-            processAlternative((List)iterator.next(), wss11, consts);
-            /*
-             * since there should be only one alternative
-             */
-            break;
-        }
-
+        processAlternative(element, wss11, consts);
         return wss11;
     }
 
     public List<QName> getKnownElements() {
         return KNOWN_ELEMENTS;
     }
-
-    private void processAlternative(List assertions, Wss11 parent, SPConstants consts) {
-
-        Assertion assertion;
-        QName name;
-
-        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
-            assertion = (Assertion)iterator.next();
-            name = assertion.getName();
-
-            if (!consts.getNamespace().equals(name.getNamespaceURI())) {
-                continue;
-            }
-
-            if (SPConstants.MUST_SUPPORT_REF_KEY_IDENTIFIER.equals(name.getLocalPart())) {
-                parent.setMustSupportRefKeyIdentifier(true);
-
-            } else if (SPConstants.MUST_SUPPORT_REF_ISSUER_SERIAL.equals(name.getLocalPart())) {
-                parent.setMustSupportRefIssuerSerial(true);
-
-            } else if (SPConstants.MUST_SUPPORT_REF_EXTERNAL_URI.equals(name.getLocalPart())) {
-                parent.setMustSupportRefExternalURI(true);
-
-            } else if (SPConstants.MUST_SUPPORT_REF_EMBEDDED_TOKEN.equals(name.getLocalPart())) {
-                parent.setMustSupportRefEmbeddedToken(true);
-
-            } else if (SPConstants.MUST_SUPPORT_REF_THUMBPRINT.equals(name.getLocalPart())) {
-                parent.setMustSupportRefThumbprint(true);
-
-            } else if (SPConstants.MUST_SUPPORT_REF_ENCRYPTED_KEY.equals(name.getLocalPart())) {
-                parent.setMustSupportRefEncryptedKey(true);
-
-            } else if (SPConstants.REQUIRE_SIGNATURE_CONFIRMATION.equals(name.getLocalPart())) {
-                parent.setRequireSignatureConfirmation(true);
+    private void processAlternative(Element element, Wss11 parent, SPConstants consts) {
+        Element polEl = DOMUtils.getFirstChildWithName(element, SPConstants.POLICY);
+        if (polEl != null) {
+            Element child = DOMUtils.getFirstElement(polEl);
+            while (child != null) {
+                String name = child.getLocalName();
+
+                if (SPConstants.MUST_SUPPORT_REF_KEY_IDENTIFIER.equals(name)) {
+                    parent.setMustSupportRefKeyIdentifier(true);
+                } else if (SPConstants.MUST_SUPPORT_REF_ISSUER_SERIAL.equals(name)) {
+                    parent.setMustSupportRefIssuerSerial(true);
+                } else if (SPConstants.MUST_SUPPORT_REF_EXTERNAL_URI.equals(name)) {
+                    parent.setMustSupportRefExternalURI(true);
+                } else if (SPConstants.MUST_SUPPORT_REF_EMBEDDED_TOKEN.equals(name)) {
+                    parent.setMustSupportRefEmbeddedToken(true);
+    
+                } else if (SPConstants.MUST_SUPPORT_REF_THUMBPRINT.equals(name)) {
+                    parent.setMustSupportRefThumbprint(true);
+    
+                } else if (SPConstants.MUST_SUPPORT_REF_ENCRYPTED_KEY.equals(name)) {
+                    parent.setMustSupportRefEncryptedKey(true);
+    
+                } else if (SPConstants.REQUIRE_SIGNATURE_CONFIRMATION.equals(name)) {
+                    parent.setRequireSignatureConfirmation(true);
+                }
+                child = DOMUtils.getNextElement(child);
             }
         }
     }

Added: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java?rev=687194&view=auto
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java (added)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java Tue Aug 19 16:25:53 2008
@@ -0,0 +1,54 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.ws.security.policy.interceptors;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.ws.policy.AbstractPolicyInterceptorProvider;
+import org.apache.cxf.ws.security.policy.SP11Constants;
+
+/**
+ * 
+ */
+public class WSSecurityPolicyInterceptorProvider extends AbstractPolicyInterceptorProvider {
+    private static final Collection<QName> ASSERTION_TYPES;
+    static {
+        ASSERTION_TYPES = new ArrayList<QName>();
+        ASSERTION_TYPES.add(SP11Constants.TRANSPORT_BINDING);
+        ASSERTION_TYPES.add(SP11Constants.TRANSPORT_TOKEN);
+        ASSERTION_TYPES.add(SP11Constants.HTTPS_TOKEN);
+        ASSERTION_TYPES.add(SP11Constants.LAYOUT);
+        ASSERTION_TYPES.add(SP11Constants.INCLUDE_TIMESTAMP);
+        ASSERTION_TYPES.add(SP11Constants.ALGORITHM_SUITE);
+        ASSERTION_TYPES.add(SP11Constants.WSS10);
+        ASSERTION_TYPES.add(SP11Constants.WSS11);
+        ASSERTION_TYPES.add(SP11Constants.SIGNED_SUPPORTING_TOKENS);
+        ASSERTION_TYPES.add(SP11Constants.USERNAME_TOKEN);
+        
+        
+    }
+
+    public WSSecurityPolicyInterceptorProvider() {
+        super(ASSERTION_TYPES);
+    }
+}

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java Tue Aug 19 16:25:53 2008
@@ -86,7 +86,7 @@
         AlgorithmSuite algorithmSuite = getAlgorithmSuite();
         List configurations = algorithmSuite.getConfigurations();
 
-        if (configurations != null && configurations.size() == 1) {
+        if (configurations == null || configurations.size() == 1) {
             setNormalized(true);
             return this;
         }

Modified: cxf/trunk/systests/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/pom.xml?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/pom.xml (original)
+++ cxf/trunk/systests/pom.xml Tue Aug 19 16:25:53 2008
@@ -65,7 +65,7 @@
                         <phase>generate-test-sources</phase>
                         <configuration>
                             <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
-                            <testWsdlRoot>${basedir}/src/test/resources/wsdl</testWsdlRoot>
+                            <testWsdlRoot>${basedir}/src/test/resources/wsdl_systest</testWsdlRoot>
                         </configuration>
                         <goals>
                             <goal>wsdl2java</goal>
@@ -82,10 +82,10 @@
                         <id>generate-sources</id>
                         <phase>generate-sources</phase>
                         <configuration>
-                            <outputDir>${basedir}/target/generated/src/test/resources/wsdl/type_test_corba/</outputDir>
+                            <outputDir>${basedir}/target/generated/src/test/resources/wsdl_systest/type_test_corba/</outputDir>
                             <wsdltoidlOptions>
                                 <wsdltoidlOption>
-                                    <wsdl>${basedir}/src/test/resources/wsdl/type_test_corba/type_test_corba.wsdl</wsdl>
+                                    <wsdl>${basedir}/src/test/resources/wsdl_systest/type_test_corba/type_test_corba.wsdl</wsdl>
                                     <corbabinding>true</corbabinding>
                                 </wsdltoidlOption>
                             </wsdltoidlOptions>

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/cxf993/Cxf993Test.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/cxf993/Cxf993Test.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/cxf993/Cxf993Test.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/cxf993/Cxf993Test.java Tue Aug 19 16:25:53 2008
@@ -44,7 +44,7 @@
     }
 
     private NotificationServicePort getPort() {
-        URL wsdl = getClass().getResource("/wsdl/cxf-993.wsdl");
+        URL wsdl = getClass().getResource("/wsdl_systest/cxf-993.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
         NotificationService service = new NotificationService(wsdl, serviceName);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java Tue Aug 19 16:25:53 2008
@@ -76,7 +76,9 @@
         
         Node res = invoke(address, "http://schemas.xmlsoap.org/soap/http", "nonmtom.xml");
         
-        assertValid("//faultstring[text()='None of the policy alternatives can be satisfied.']", res);
+        assertValid("//faultstring[text()='These policy alternatives can be satisfied: "
+                    + "[{http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization}"
+                    + "OptimizedMimeSerialization]']", res);
     }
     
     @Test

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java Tue Aug 19 16:25:53 2008
@@ -124,7 +124,7 @@
     }
 
     private Hello getPort() {
-        URL wsdl = getClass().getResource("/wsdl/mtom.wsdl");
+        URL wsdl = getClass().getResource("/wsdl_systest/mtom.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
         HelloService service = new HelloService(wsdl, serviceName);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom_feature/MtomFeatureClientServerTest.java Tue Aug 19 16:25:53 2008
@@ -118,7 +118,7 @@
     }
 
     private Hello getPort() {
-        URL wsdl = getClass().getResource("/wsdl/mtom.wsdl");
+        URL wsdl = getClass().getResource("/wsdl_systest/mtom.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
         HelloService service = new HelloService(wsdl, serviceName);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/resolver/JarServiceContractResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/resolver/JarServiceContractResolver.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/resolver/JarServiceContractResolver.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/resolver/JarServiceContractResolver.java Tue Aug 19 16:25:53 2008
@@ -55,7 +55,7 @@
         }
         path.append(local).append(".wsdl");
         try {
-            URL jarURL = this.getClass().getResource("/wsdl/hello_world_resolver.jar");
+            URL jarURL = this.getClass().getResource("/wsdl_systest/hello_world_resolver.jar");
             JarFile jar = new JarFile(new File(jarURL.toURI()));
             JarEntry jarEntry = jar.getJarEntry(path.toString());
             uri = new URI("jar:" + jarURL + "!/" + jarEntry.toString());

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java Tue Aug 19 16:25:53 2008
@@ -83,7 +83,7 @@
     }
 
     private Pizza getPort() {
-        URL wsdl = getClass().getResource("/wsdl/pizza_service.wsdl");
+        URL wsdl = getClass().getResource("/wsdl_systest/pizza_service.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
         PizzaService service = new PizzaService(wsdl, serviceName);
@@ -93,7 +93,7 @@
     }
     
     private PizzaNoHeader getPortNoHeader() {
-        URL wsdl = getClass().getResource("/wsdl/pizza_service.wsdl");
+        URL wsdl = getClass().getResource("/wsdl_systest/pizza_service.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
         PizzaService service = new PizzaService(wsdl, serviceName);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java Tue Aug 19 16:25:53 2008
@@ -33,7 +33,7 @@
 
 public class CORBADocLitClientTypeTest extends AbstractTypeTestClient5 {
     protected static final String WSDL_PATH 
-        = "/wsdl/type_test_corba/type_test_corba-corba.wsdl";
+        = "/wsdl_systest/type_test_corba/type_test_corba-corba.wsdl";
     
     
     protected static final QName SERVICE_NAME = new QName("http://apache.org/type_test/doc",

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitServerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitServerImpl.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitServerImpl.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitServerImpl.java Tue Aug 19 16:25:53 2008
@@ -56,7 +56,7 @@
     @WebService(serviceName = "TypeTestCORBAService", portName = "TypeTestCORBAPort",
                 endpointInterface = "org.apache.type_test.doc.TypeTestPortType",
                 targetNamespace = "http://apache.org/type_test/doc",
-                wsdlLocation = "classpath:/wsdl/type_test_corba/type_test_corba-corba.wsdl")
+                wsdlLocation = "classpath:/wsdl_systest/type_test_corba/type_test_corba-corba.wsdl")
     class CORBATypeTestImpl extends TypeTestImpl implements TypeTestPortType {
     }
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_disable/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_disable/Server.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_disable/Server.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_disable/Server.java Tue Aug 19 16:25:53 2008
@@ -38,7 +38,7 @@
     
     private String getWsdl() {
         try {
-            java.net.URL wsdl = getClass().getResource("/wsdl/add_numbers.wsdl");
+            java.net.URL wsdl = getClass().getResource("/wsdl_systest/add_numbers.wsdl");
             return wsdl.toString();
         } catch (Exception e) {
             e.printStackTrace();

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java Tue Aug 19 16:25:53 2008
@@ -87,7 +87,7 @@
     }
 
     private AddNumbersService getService() {
-        URL wsdl = getClass().getResource("/wsdl/add_numbers.wsdl");
+        URL wsdl = getClass().getResource("/wsdl_systest/add_numbers.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
         AddNumbersService service = new AddNumbersService(wsdl, serviceName);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java Tue Aug 19 16:25:53 2008
@@ -102,7 +102,7 @@
     }
 
     private AddNumbersPortType getPort() {
-        URL wsdl = getClass().getResource("/wsdl/add_numbers.wsdl");
+        URL wsdl = getClass().getResource("/wsdl_systest/add_numbers.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
         AddNumbersService service = new AddNumbersService(wsdl, serviceName);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java Tue Aug 19 16:25:53 2008
@@ -142,7 +142,7 @@
     }
 
     private AddNumberImpl getPort() {
-        URL wsdl = getClass().getResource("/wsdl/add_numbers-fromjava.wsdl");
+        URL wsdl = getClass().getResource("/wsdl_systest/add_numbers-fromjava.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
         AddNumberImplService service = new AddNumberImplService(wsdl);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/Server.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/Server.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/Server.java Tue Aug 19 16:25:53 2008
@@ -42,7 +42,7 @@
 
     private String getWsdl() {
         try {
-            java.net.URL wsdl = getClass().getResource("/wsdl/add_numbers.wsdl");
+            java.net.URL wsdl = getClass().getResource("/wsdl_systest/add_numbers.wsdl");
             return wsdl.toString();
         } catch (Exception e) {
             e.printStackTrace();

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java Tue Aug 19 16:25:53 2008
@@ -147,7 +147,7 @@
     }
 
     private AddNumbersPortType getPort() {
-        URL wsdl = getClass().getResource("/wsdl/add_numbers.wsdl");
+        URL wsdl = getClass().getResource("/wsdl_systest/add_numbers.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
         AddNumbersService service = new AddNumbersService(wsdl, serviceName);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java Tue Aug 19 16:25:53 2008
@@ -40,7 +40,7 @@
     
     private String getWsdl() {
         try {
-            java.net.URL wsdl = getClass().getResource("/wsdl/add_numbers.wsdl");
+            java.net.URL wsdl = getClass().getResource("/wsdl_systest/add_numbers.wsdl");
             return wsdl.toString();
         } catch (Exception e) {
             e.printStackTrace();

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java Tue Aug 19 16:25:53 2008
@@ -67,7 +67,7 @@
     }
 
     private AddNumbersPortType getPort() {
-        URL wsdl = getClass().getResource("/wsdl/add_numbers.wsdl");
+        URL wsdl = getClass().getResource("/wsdl_systest/add_numbers.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
         AddNumbersService service = new AddNumbersService(wsdl, serviceName);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPServerPolicyTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPServerPolicyTest.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPServerPolicyTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPServerPolicyTest.java Tue Aug 19 16:25:53 2008
@@ -119,7 +119,9 @@
         } catch (WebServiceException wse) {
             SoapFault sf = (SoapFault)wse.getCause();
             assertEquals("Server", sf.getFaultCode().getLocalPart());
-            assertEquals("None of the policy alternatives can be satisfied.", sf.getMessage());
+            assertEquals("These policy alternatives can be satisfied: "
+                         + "[{http://cxf.apache.org/transports/http/configuration}server]",
+                         sf.getMessage());
             // assertEquals("INCOMPATIBLE_HTTPSERVERPOLICY_ASSERTIONS", ex.getCode());
         }
         

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/DoubleItImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/DoubleItImpl.java?rev=687194&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/DoubleItImpl.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/DoubleItImpl.java Tue Aug 19 16:25:53 2008
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.systest.ws.security;
+
+import java.math.BigInteger;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.policytest.doubleit.DoubleItPortType;
+
+/**
+ * 
+ */
+@WebService(targetNamespace = "http://cxf.apache.org/policytest/DoubleIt", 
+            portName = "DoubleItPort",
+            serviceName = "DoubleItService", 
+            endpointInterface = "org.apache.cxf.policytest.doubleit.DoubleItPortType",
+            wsdlLocation = "classpath:/wsdl_systest/DoubleIt.wsdl")
+public class DoubleItImpl implements DoubleItPortType {
+    /** {@inheritDoc}*/
+    public BigInteger doubleIt(BigInteger numberToDouble) {
+        return numberToDouble.multiply(new BigInteger("2"));
+    }
+}

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/DoubleItImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/DoubleItImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java?rev=687194&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java Tue Aug 19 16:25:53 2008
@@ -0,0 +1,61 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.systest.ws.security;
+
+import java.math.BigInteger;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.apache.cxf.policytest.doubleit.DoubleItPortType;
+import org.apache.cxf.policytest.doubleit.DoubleItService;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.cxf.ws.policy.PolicyException;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
+    public static final String POLICY_ADDRESS = "http://localhost:9009/SecPolTest";
+    @BeforeClass 
+    public static void init() throws Exception {
+        createStaticBus().getExtension(PolicyEngine.class).setEnabled(true);
+        Endpoint.publish(POLICY_ADDRESS,
+                         new DoubleItImpl());
+    }
+    
+    @Test
+    public void testPolicy() throws Exception {
+        DoubleItService service = new DoubleItService();
+        DoubleItPortType pt = service.getDoubleItPort();
+        ((BindingProvider)pt).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                                                      POLICY_ADDRESS);
+        try {
+            pt.doubleIt(BigInteger.valueOf(25));
+        } catch (SOAPFaultException ex) {
+            assertTrue(ex.getCause().getCause() instanceof PolicyException);
+            //expected - we don't support any of the policies yet
+        }
+    }
+    
+    
+}

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/src/test/resources/wsdl_systest/
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl?rev=687194&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl (added)
+++ cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl Tue Aug 19 16:25:53 2008
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+ * 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:tns="http://cxf.apache.org/policytest/DoubleIt"
+   targetNamespace="http://cxf.apache.org/policytest/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://schemas.xmlsoap.org/ws/2005/07/securitypolicy" 
+   xmlns:wspp="http://java.sun.com/xml/ns/wsit/policy">
+   <wsdl:types>
+      <xsd:schema targetNamespace="http://cxf.apache.org/policytest/DoubleIt">
+         <xsd:element name="DoubleIt">
+            <xsd:complexType>
+               <xsd:sequence>
+                  <xsd:element name="numberToDouble" type="xsd:integer"/>
+               </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: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:portType name="DoubleItPortType">
+      <wsdl:operation name="DoubleIt">
+         <wsdl:input message="tns:DoubleItRequest" />
+         <wsdl:output message="tns:DoubleItResponse" />
+      </wsdl:operation>
+   </wsdl:portType>
+   <wsdl:binding name="DoubleItBinding" type="tns:DoubleItPortType">
+      <wsp:PolicyReference URI="#DoubleItBindingPolicy"/>
+      <soap:binding style="document"
+         transport="http://schemas.xmlsoap.org/soap/http" />
+      <wsdl:operation name="DoubleIt">
+         <soap:operation soapAction=""/>
+         <wsdl:input><soap:body use="literal"/></wsdl:input>
+         <wsdl:output><soap:body use="literal"/></wsdl:output>
+      </wsdl:operation>
+   </wsdl:binding>
+   <wsdl:service name="DoubleItService">
+      <wsdl:port name="DoubleItPort" binding="tns:DoubleItBinding">
+         <soap:address 
+            location="http://localhost:9009/doubleit/services/doubleit"/>
+      </wsdl:port>
+   </wsdl:service>
+   
+   <wsp:Policy wsu:Id="DoubleItBindingPolicy">
+      <wsp:ExactlyOne>
+         <wsp:All>
+            <wsaws:UsingAddressing xmlns:wsaws="http://www.w3.org/2006/05/addressing/wsdl"/>
+            <sp:TransportBinding>
+               <wsp:Policy>
+                  <sp:TransportToken>
+                     <wsp:Policy>
+                        <sp:HttpsToken RequireClientCertificate="false"/>
+                     </wsp:Policy>
+                  </sp:TransportToken>
+                  <sp:Layout>
+                     <wsp:Policy>
+                        <sp:Lax/>
+                     </wsp:Policy>
+                  </sp:Layout>
+                  <sp:IncludeTimestamp/>
+                  <sp:AlgorithmSuite>
+                     <wsp:Policy>
+                        <sp:Basic128/>
+                     </wsp:Policy>
+                  </sp:AlgorithmSuite>
+               </wsp:Policy>
+            </sp:TransportBinding>
+            <sp:Wss10>
+               <wsp:Policy>
+                  <sp:MustSupportRefKeyIdentifier/>
+               </wsp:Policy>
+            </sp:Wss10>
+            <sp:SignedSupportingTokens>
+               <wsp:Policy>
+                  <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+                     <wsp:Policy>
+                        <sp:WssUsernameToken10/>
+                     </wsp:Policy>
+                  </sp:UsernameToken>
+               </wsp:Policy>
+            </sp:SignedSupportingTokens>
+         </wsp:All>
+      </wsp:ExactlyOne>
+   </wsp:Policy>
+
+</wsdl:definitions>

Propchange: cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java?rev=687194&r1=687193&r2=687194&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java (original)
+++ cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java Tue Aug 19 16:25:53 2008
@@ -60,17 +60,18 @@
         BusFactory.setDefaultBus(bus);
     }
     
-    public static void createStaticBus(String config) throws Exception {
+    public static Bus createStaticBus(String config) throws Exception {
         defaultConfigFileName = config;
-        createStaticBus();
+        return createStaticBus();
     }
-    public static void createStaticBus() throws Exception {
+    public static Bus createStaticBus() throws Exception {
         if (defaultConfigFileName != null) {
             System.setProperty("cxf.config.file", defaultConfigFileName);
         }
         BusFactory bf = BusFactory.newInstance();
         staticBus = bf.createBus();
-        BusFactory.setDefaultBus(staticBus);  
+        BusFactory.setDefaultBus(staticBus);
+        return staticBus;
     }
     
     @After



Mime
View raw message