cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsosno...@apache.org
Subject svn commit: r1499124 - in /cxf/trunk: rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/ rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ rt/ws/rm/src/test/java...
Date Tue, 02 Jul 2013 21:46:56 GMT
Author: dsosnoski
Date: Tue Jul  2 21:46:55 2013
New Revision: 1499124

URL: http://svn.apache.org/r1499124
Log:
CXF-4139 implement WS-RMP 1.2 handling at the message level.

Added:
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java
      - copied, changed from r1499123, cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM12PolicyWsdlTest.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTestBase.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rm10wsdl_server.xml
      - copied, changed from r1499123, cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rm12wsdl_server.xml
      - copied, changed from r1499123, cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml
Removed:
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml
Modified:
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConfiguration.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12AssertionBuilder.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml
    cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConfiguration.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConfiguration.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConfiguration.java Tue Jul  2 21:46:55 2013
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.ws.rm;
 
+import org.apache.cxf.ws.addressing.VersionTransformer.Names200408;
+
 
 /**
  * Configuration parameters for reliable messaging. These may be defined by a combination of Spring/Blueprint
@@ -208,4 +210,23 @@ public class RMConfiguration {
     public void setRM10AddressingNamespace(String addrns) {
         rm10AddressingNamespace = addrns;
     }
+    
+    public String getAddressingNamespace() {
+        
+        // determine based on RM namespace and RM 1.0 addressing namespace values
+        if (RM10Constants.NAMESPACE_URI.equals(rmNamespace)) {
+            return rm10AddressingNamespace == null
+                ? EncoderDecoder10Impl.INSTANCE.getWSANamespace() : rm10AddressingNamespace;
+        }
+        if (RM11Constants.NAMESPACE_URI.equals(rmNamespace)) {
+            return EncoderDecoder11Impl.INSTANCE.getWSANamespace();
+        }
+        
+        // should not happen, but in case RM namespace is not set
+        return Names200408.WSA_NAMESPACE_NAME;
+    }
+    
+    public ProtocolVariation getProtocolVariation() {
+        return ProtocolVariation.findVariant(getRMNamespace(), getRM10AddressingNamespace());
+    }
 }

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java Tue Jul  2 21:46:55 2013
@@ -394,32 +394,33 @@ public class RMEndpoint {
             return;
         }
 
-        EndpointInfo ei = getEndpoint(ProtocolVariation.RM10WSA200408).getEndpointInfo();
-
-        PolicyInterceptorProviderRegistry reg = manager.getBus()
-            .getExtension(PolicyInterceptorProviderRegistry.class);
-        EndpointPolicy ep = null == conduit ? engine.getServerEndpointPolicy(applicationEndpoint
-            .getEndpointInfo(), null) : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(),
-                                                                       conduit);
-
-        if (conduit != null) {
-            engine.setClientEndpointPolicy(ei, ep);
-        } else {
-            engine.setServerEndpointPolicy(ei, ep);
-        }
-
-        EffectivePolicy effectiveOutbound = new EffectivePolicyImpl(ep, reg, true, false);
-        EffectivePolicy effectiveInbound = new EffectivePolicyImpl(ep, reg, false, false);
-
-        BindingInfo bi = ei.getBinding();
-        Collection<BindingOperationInfo> bois = bi.getOperations();
-
-        for (BindingOperationInfo boi : bois) {
-            engine.setEffectiveServerRequestPolicy(ei, boi, effectiveInbound);
-            engine.setEffectiveServerResponsePolicy(ei, boi, effectiveOutbound);
-
-            engine.setEffectiveClientRequestPolicy(ei, boi, effectiveOutbound);
-            engine.setEffectiveClientResponsePolicy(ei, boi, effectiveInbound);
+        for (Endpoint endpoint : endpoints.values()) {
+            EndpointInfo ei = endpoint.getEndpointInfo();
+            PolicyInterceptorProviderRegistry reg = manager.getBus()
+                .getExtension(PolicyInterceptorProviderRegistry.class);
+            EndpointPolicy ep = null == conduit ? engine.getServerEndpointPolicy(applicationEndpoint
+                .getEndpointInfo(), null) : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(),
+                    conduit);
+            
+            if (conduit != null) {
+                engine.setClientEndpointPolicy(ei, ep);
+            } else {
+                engine.setServerEndpointPolicy(ei, ep);
+            }
+            
+            EffectivePolicy effectiveOutbound = new EffectivePolicyImpl(ep, reg, true, false);
+            EffectivePolicy effectiveInbound = new EffectivePolicyImpl(ep, reg, false, false);
+            
+            BindingInfo bi = ei.getBinding();
+            Collection<BindingOperationInfo> bois = bi.getOperations();
+            
+            for (BindingOperationInfo boi : bois) {
+                engine.setEffectiveServerRequestPolicy(ei, boi, effectiveInbound);
+                engine.setEffectiveServerResponsePolicy(ei, boi, effectiveOutbound);
+                
+                engine.setEffectiveClientRequestPolicy(ei, boi, effectiveOutbound);
+                engine.setEffectiveClientResponsePolicy(ei, boi, effectiveInbound);
+            }
         }
 
         // TODO: FaultPolicy (SequenceFault)

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java Tue Jul  2 21:46:55 2013
@@ -143,13 +143,11 @@ public class RMManager {
     // Configuration
 
     public void setRMNamespace(String uri) {
-        RMConfiguration cfg = forceConfiguration();
-        cfg.setRMNamespace(uri);
+        getConfiguration().setRMNamespace(uri);
     }
 
     public void setRM10AddressingNamespace(RM10AddressingNamespaceType addrns) {
-        RMConfiguration cfg = forceConfiguration();
-        cfg.setRM10AddressingNamespace(addrns.getUri());
+        getConfiguration().setRM10AddressingNamespace(addrns.getUri());
     }
     
     public Bus getBus() {
@@ -243,7 +241,10 @@ public class RMManager {
      * @return configuration (non-<code>null</code>)
      */
     public RMConfiguration getConfiguration() {
-        return forceConfiguration();
+        if (configuration == null) {
+            setConfiguration(new RMConfiguration());
+        }
+        return configuration;
     }
 
     /**
@@ -260,11 +261,14 @@ public class RMManager {
         this.configuration = configuration;
     }
     
-    RMConfiguration forceConfiguration() {
-        if (configuration == null) {
-            setConfiguration(new RMConfiguration());
-        }
-        return configuration;
+    /**
+     * Get configuration after applying policies.
+     * 
+     * @param msg
+     * @return configuration (non-<code>null</code>)
+     */
+    public RMConfiguration getEffectiveConfiguration(Message msg) {
+        return RMPolicyUtilities.getRMConfiguration(getConfiguration(), msg);
     }
 
     /**
@@ -307,15 +311,33 @@ public class RMManager {
             WrappedEndpoint wrappedEndpoint = (WrappedEndpoint)endpoint;
             endpoint = wrappedEndpoint.getWrappedEndpoint();
         }
-        RMConfiguration dflt = getConfiguration();
-        String rmUri = getRMNamespace(dflt, message);
-        String addrUri = getAddressingNamespace(dflt, message);
-        ProtocolVariation protocol = ProtocolVariation.findVariant(rmUri, addrUri);
-        if (protocol == null) {
-            org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(
-                "UNSUPPORTED_NAMESPACE", LOG, addrUri, rmUri);
-            LOG.log(Level.INFO, msg.toString());
-            throw new RMException(msg);
+        String rmUri = (String)message.getContextualProperty(WSRM_VERSION_PROPERTY);
+        if (rmUri == null) {
+            RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
+            if (rmps != null) {
+                rmUri = rmps.getNamespaceURI();
+            }
+        }
+        String addrUri = (String)message.getContextualProperty(WSRM_WSA_VERSION_PROPERTY);
+        if (addrUri == null) {
+            AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, false, false);
+            if (maps != null) {
+                addrUri = maps.getNamespaceURI();
+            }
+        }
+        RMConfiguration config = getConfiguration();
+        if (rmUri != null) {
+            config.setRMNamespace(rmUri);
+            ProtocolVariation protocol = ProtocolVariation.findVariant(rmUri, addrUri);
+            if (protocol == null) {
+                org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(
+                    "UNSUPPORTED_NAMESPACE", LOG, addrUri, rmUri);
+                LOG.log(Level.INFO, msg.toString());
+                throw new RMException(msg);
+            }
+        }
+        if (addrUri != null) {
+            config.setRM10AddressingNamespace(addrUri);
         }
         RMEndpoint rme = reliableEndpoints.get(endpoint);
         if (null == rme) {
@@ -331,7 +353,7 @@ public class RMManager {
                 = ei == null ? null : ei.getEndpointInfo()
                     .getProperty(MAPAggregator.DECOUPLED_DESTINATION, 
                              org.apache.cxf.transport.Destination.class);
-            RMConfiguration config = RMPolicyUtilities.getRMConfiguration(getConfiguration(), message);
+            config = RMPolicyUtilities.getRMConfiguration(config, message);
             rme.initialise(config, message.getExchange().getConduit(message), replyTo, dest);
             reliableEndpoints.put(endpoint, rme);
             LOG.fine("Created new RMEndpoint.");
@@ -339,88 +361,6 @@ public class RMManager {
         return rme;
     }
 
-    /**
-     * Get the WS-Addressing namespace being used for a message. If the WS-Addressing namespace has not been
-     * set, this returns the default from the supplied configuration.
-     * 
-     * @param config
-     * @param message
-     * @return namespace URI
-     */
-    String getAddressingNamespace(RMConfiguration config, Message message) {
-        String addrUri = (String)message.getContextualProperty(WSRM_WSA_VERSION_PROPERTY);
-        if (addrUri == null) {
-            AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, false, false);
-            if (maps != null) {
-                addrUri = maps.getNamespaceURI();
-            }
-            if (addrUri == null) {
-                addrUri = ProtocolVariation.findVariant(config.getRMNamespace(), config.getRM10AddressingNamespace())
-                    .getWSANamespace();
-            }
-        }
-        return addrUri;
-    }
-
-    /**
-     * Get the WS-Addressing namespace being used for a message. If the WS-Addressing namespace has not been set, this
-     * returns the best default.
-     * 
-     * @param message
-     * @return namespace URI
-     */
-    public String getAddressingNamespace(Message message) {
-        RMConfiguration config = null;
-        try {
-            config = getReliableEndpoint(message).getConfiguration();
-        } catch (RMException e) {
-            // only happens with invalid namespace combination, just fall back to manager default
-            config = getConfiguration();
-        }
-        return getAddressingNamespace(config, message);
-    }
-
-    /**
-     * Get the WS-RM namespace being used for a message. If the WS-RM namespace has not been set, this returns the
-     * default from the supplied configuration.
-     * 
-     * @param config
-     * @param message
-     * @return namespace URI
-     */
-    String getRMNamespace(RMConfiguration config, Message message) {
-        String rmUri = (String)message.getContextualProperty(WSRM_VERSION_PROPERTY);
-        if (rmUri == null) {
-            RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
-            if (rmps != null) {
-                rmUri = rmps.getNamespaceURI();
-            }
-            if (rmUri == null) {
-                rmUri = ProtocolVariation.findVariant(config.getRMNamespace(), config.getRM10AddressingNamespace())
-                    .getWSRMNamespace();
-            }
-        }
-        return rmUri;
-    }
-
-    /**
-     * Get the WS-RM namespace being used for a message. If the WS-RM namespace has not been set, this returns the best
-     * default.
-     * 
-     * @param message
-     * @return namespace URI
-     */
-    String getRMNamespace(Message message) {
-        RMConfiguration config = null;
-        try {
-            config = getReliableEndpoint(message).getConfiguration();
-        } catch (RMException e) {
-            // only happens with invalid namespace combination, just fall back to manager default
-            config = getConfiguration();
-        }
-        return getRMNamespace(config, message);
-    }
-
     public Destination getDestination(Message message) throws RMException {
         RMEndpoint rme = getReliableEndpoint(message);
         if (null != rme) {
@@ -442,7 +382,7 @@ public class RMManager {
 
         Source source = getSource(message);
         SourceSequence seq = source.getCurrent(inSeqId);
-        ProtocolVariation protocol = RMContextUtils.getProtocolVariation(message);
+        RMConfiguration config = getEffectiveConfiguration(message);
         if (null == seq || seq.isExpired()) {
             // TODO: better error handling
             EndpointReferenceType to = null;
@@ -451,7 +391,7 @@ public class RMManager {
             RelatesToType relatesTo = null;
             if (isServer) {
                 AddressingProperties inMaps = RMContextUtils.retrieveMAPs(message, false, false);
-                inMaps.exposeAs(getAddressingNamespace(message));
+                inMaps.exposeAs(config.getAddressingNamespace());
                 acksTo = RMUtils.createReference(inMaps.getTo().getValue());
                 to = inMaps.getReplyTo();
                 source.getReliableEndpoint().getServant().setUnattachedIdentifier(inSeqId);
@@ -486,6 +426,7 @@ public class RMManager {
                 throw new RMException(msg);
             }
             Proxy proxy = source.getReliableEndpoint().getProxy();
+            ProtocolVariation protocol = config.getProtocolVariation();
             CreateSequenceResponseType createResponse = 
                 proxy.createSequence(acksTo, relatesTo, isServer, protocol);
             if (!isServer) {
@@ -652,7 +593,7 @@ public class RMManager {
     @PostConstruct
     void initialise() {
         if (configuration == null) {
-            forceConfiguration().setExponentialBackoff(true);
+            getConfiguration().setExponentialBackoff(true);
         }
         DeliveryAssurance da = configuration.getDeliveryAssurance();
         if (da == null) {

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java Tue Jul  2 21:46:55 2013
@@ -65,21 +65,22 @@ public class RMOutInterceptor extends Ab
             return;
         }
         
-        String wsaNamespace = getManager().getAddressingNamespace(msg);
         if (isRuntimeFault(msg)) {
             LogUtils.log(LOG, Level.WARNING, "RUNTIME_FAULT_MSG");
             // in case of a SequenceFault or other WS-RM related fault, set action appropriately.
             // the received inbound maps is available to extract some values in case if needed.
             Throwable cause = msg.getContent(Exception.class).getCause();
             if (cause instanceof SequenceFault || cause instanceof RMException) {
-                maps.getAction().setValue(wsaNamespace + "/fault");
+                maps.getAction().setValue(getAddressingNamespace(maps) + "/fault");
             }
             return;
         }
 
         Source source = getManager().getSource(msg);
         
-        String rmNamespace = getManager().getRMNamespace(msg);
+        RMConfiguration config = getManager().getEffectiveConfiguration(msg);
+        String wsaNamespace = config.getAddressingNamespace();
+        String rmNamespace = config.getRMNamespace();
         ProtocolVariation protocol = ProtocolVariation.findVariant(rmNamespace, wsaNamespace);
         RMContextUtils.setProtocolVariation(msg, protocol);
         maps.exposeAs(wsaNamespace);
@@ -210,6 +211,14 @@ public class RMOutInterceptor extends Ab
         
         assertReliability(msg);
     }
+
+    private String getAddressingNamespace(AddressingProperties maps) {
+        String wsaNamespace = maps.getNamespaceURI();
+        if (wsaNamespace == null) {
+            getManager().getConfiguration().getAddressingNamespace();
+        }
+        return wsaNamespace;
+    }
     
     void addAcknowledgements(Destination destination, 
                              RMProperties rmpsOut, 

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12AssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12AssertionBuilder.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12AssertionBuilder.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12AssertionBuilder.java Tue Jul  2 21:46:55 2013
@@ -47,17 +47,17 @@ public class RM12AssertionBuilder implem
     public static final String ATMOSTONCE_NAME = "AtMostOnce";
     public static final String INORDER_NAME = "InOrder";
     
-    private static final QName SEQSTR_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, SEQUENCESTR_NAME);
-    private static final QName SEQTRANSSEC_QNAME =
+    public static final QName SEQSTR_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, SEQUENCESTR_NAME);
+    public static final QName SEQTRANSSEC_QNAME =
         new QName(RM11Constants.WSRMP_NAMESPACE_URI, SEQUENCETRANSEC_NAME);
-    private static final QName DELIVERYASSURANCE_QNAME =
+    public static final QName DELIVERYASSURANCE_QNAME =
         new QName(RM11Constants.WSRMP_NAMESPACE_URI, DELIVERYASSURANCE_NAME);
-    private static final QName EXACTLYONCE_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, EXACTLYONCE_NAME);
-    private static final QName ATLEASTONCE_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, ATLEASTONCE_NAME);
-    private static final QName ATMOSTONCE_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, ATMOSTONCE_NAME);
-    private static final QName INORDER_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, INORDER_NAME);
+    public static final QName EXACTLYONCE_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, EXACTLYONCE_NAME);
+    public static final QName ATLEASTONCE_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, ATLEASTONCE_NAME);
+    public static final QName ATMOSTONCE_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, ATMOSTONCE_NAME);
+    public static final QName INORDER_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, INORDER_NAME);
     
-    private static final QName[] KNOWN_ELEMENTS = {
+    public static final QName[] KNOWN_ELEMENTS = {
         RM11Constants.WSRMP_RMASSERTION_QNAME,
         SEQSTR_QNAME,
         SEQTRANSSEC_QNAME,

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java Tue Jul  2 21:46:55 2013
@@ -21,12 +21,14 @@ package org.apache.cxf.ws.rm.policy;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
+
+import javax.xml.namespace.QName;
 
 import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.policy.AssertionInfo;
 import org.apache.cxf.ws.policy.AssertionInfoMap;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
-import org.apache.cxf.ws.rm.RM10Constants;
 import org.apache.cxf.ws.rm.RM11Constants;
 import org.apache.cxf.ws.rm.RMConfiguration;
 import org.apache.cxf.ws.rm.RMConfiguration.DeliveryAssurance;
@@ -39,6 +41,15 @@ import org.apache.neethi.builders.Primit
  */
 public final class RMPolicyUtilities {
     
+    private static final List<QName> ASSERTION_NAMES;
+    static {
+        ASSERTION_NAMES = new ArrayList<QName>();
+        ASSERTION_NAMES.addAll(RM10AssertionBuilder.KNOWN_ELEMENTS);
+        for (QName qn : RM12AssertionBuilder.KNOWN_ELEMENTS) {
+            ASSERTION_NAMES.add(qn);
+        }
+    }
+    
     private RMPolicyUtilities() {
     }
     
@@ -76,13 +87,11 @@ public final class RMPolicyUtilities {
     public static Collection<AssertionInfo> collectRMAssertions(AssertionInfoMap aim) {
         Collection<AssertionInfo> mergedAsserts = new ArrayList<AssertionInfo>();
         if (aim != null) {
-            Collection<AssertionInfo> ais = aim.get(RM10Constants.WSRMP_RMASSERTION_QNAME);
-            if (ais != null) {
-                mergedAsserts.addAll(ais);
-            }
-            ais = aim.get(RM11Constants.WSRMP_RMASSERTION_QNAME);
-            if (ais != null) {
-                mergedAsserts.addAll(ais);
+            for (QName qn : ASSERTION_NAMES) {
+                Collection<AssertionInfo> ais = aim.get(qn);
+                if (ais != null) {
+                    mergedAsserts.addAll(ais);
+                }
             }
         }
         return mergedAsserts;

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java Tue Jul  2 21:46:55 2013
@@ -69,6 +69,7 @@ import org.apache.cxf.ws.rm.EncoderDecod
 import org.apache.cxf.ws.rm.ProtocolVariation;
 import org.apache.cxf.ws.rm.RM10Constants;
 import org.apache.cxf.ws.rm.RM11Constants;
+import org.apache.cxf.ws.rm.RMConfiguration;
 import org.apache.cxf.ws.rm.RMConstants;
 import org.apache.cxf.ws.rm.RMContextUtils;
 import org.apache.cxf.ws.rm.RMEndpoint;
@@ -285,7 +286,8 @@ public class RMSoapInterceptor extends A
                             String wsauri = null;
                             AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, false, false);
                             if (maps == null) {
-                                wsauri = getManager(message).getAddressingNamespace(message);
+                                RMConfiguration config = getManager(message).getEffectiveConfiguration(message);
+                                wsauri = config.getAddressingNamespace();
                             } else {
                                 wsauri = maps.getNamespaceURI();
                             }

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java Tue Jul  2 21:46:55 2013
@@ -69,7 +69,6 @@ import org.apache.cxf.ws.rm.RetryStatus;
 import org.apache.cxf.ws.rm.SourceSequence;
 import org.apache.cxf.ws.rm.manager.RetryPolicyType;
 import org.apache.cxf.ws.rm.persistence.RMStore;
-import org.apache.cxf.ws.rm.policy.RMPolicyUtilities;
 import org.apache.cxf.ws.rm.v200702.Identifier;
 import org.apache.cxf.ws.rm.v200702.SequenceType;
 import org.apache.cxf.ws.rmp.v200502.RMAssertion;
@@ -505,7 +504,7 @@ public class RetransmissionQueueImpl imp
             message = m;
             retries = 0;
             out = m.getContent(OutputStream.class);
-            RMConfiguration cfg = RMPolicyUtilities.getRMConfiguration(manager.getConfiguration(), message);
+            RMConfiguration cfg = manager.getEffectiveConfiguration(message);
             long baseRetransmissionInterval = 
                 cfg.getBaseRetransmissionInterval().longValue();
             backoff = cfg.isExponentialBackoff()  ? RetransmissionQueue.DEFAULT_EXPONENTIAL_BACKOFF : 1;

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java Tue Jul  2 21:46:55 2013
@@ -22,7 +22,6 @@ package org.apache.cxf.ws.rm;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 
 import javax.wsdl.extensions.ExtensibilityElement;
@@ -37,7 +36,6 @@ import org.apache.cxf.interceptor.Interc
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingInfo;
-import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.InterfaceInfo;
 import org.apache.cxf.service.model.OperationInfo;
@@ -271,52 +269,6 @@ public class RMEndpointTest extends Asse
     }
 
     @Test
-    public void testSetPolicies() throws NoSuchMethodException {
-        Method m = RMEndpoint.class.getDeclaredMethod("getEndpoint", new Class[] {ProtocolVariation.class});
-        rme = EasyMock.createMockBuilder(RMEndpoint.class)
-            .addMockedMethod(m).createMock(control);
-        rme.setAplicationEndpoint(ae);
-        rme.setManager(manager);
-        Endpoint e = control.createMock(Endpoint.class);
-        EasyMock.expect(rme.getEndpoint(ProtocolVariation.RM10WSA200408)).andReturn(e);
-        EndpointInfo ei = control.createMock(EndpointInfo.class);
-        EasyMock.expect(e.getEndpointInfo()).andReturn(ei);
-        Bus bus = control.createMock(Bus.class);
-        EasyMock.expect(manager.getBus()).andReturn(bus).times(2);
-        PolicyEngine pe = control.createMock(PolicyEngine.class);
-        EasyMock.expect(bus.getExtension(PolicyEngine.class)).andReturn(pe);
-        EasyMock.expect(pe.isEnabled()).andReturn(true);
-        PolicyInterceptorProviderRegistry reg = control.createMock(PolicyInterceptorProviderRegistry.class);
-        EasyMock.expect(bus.getExtension(PolicyInterceptorProviderRegistry.class)).andReturn(reg);
-        EndpointInfo aei = control.createMock(EndpointInfo.class);
-        EasyMock.expect(ae.getEndpointInfo()).andReturn(aei);
-        EndpointPolicy epi = control.createMock(EndpointPolicy.class);
-        EasyMock.expect(pe.getServerEndpointPolicy(aei, null)).andReturn(epi);
-        EasyMock.expect(epi.getChosenAlternative()).andReturn(new ArrayList<Assertion>());
-
-        pe.setServerEndpointPolicy(ei, epi);
-        EasyMock.expectLastCall();
-        BindingInfo bi = control.createMock(BindingInfo.class);
-        EasyMock.expect(ei.getBinding()).andReturn(bi);
-        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
-        EasyMock.expect(bi.getOperations()).andReturn(Collections.singletonList(boi));
-        pe.setEffectiveServerRequestPolicy(EasyMock.eq(ei), EasyMock.eq(boi), EasyMock
-            .isA(EffectivePolicy.class));
-        EasyMock.expectLastCall();
-        pe.setEffectiveServerResponsePolicy(EasyMock.eq(ei), EasyMock.eq(boi), EasyMock
-            .isA(EffectivePolicy.class));
-        EasyMock.expectLastCall();
-        pe.setEffectiveClientRequestPolicy(EasyMock.eq(ei), EasyMock.eq(boi), EasyMock
-            .isA(EffectivePolicy.class));
-        EasyMock.expectLastCall();
-        pe.setEffectiveClientResponsePolicy(EasyMock.eq(ei), EasyMock.eq(boi), EasyMock
-            .isA(EffectivePolicy.class));
-        EasyMock.expectLastCall();
-        control.replay();
-        rme.setPolicies();
-    }
-
-    @Test
     public void testShutdown() {
         DestinationSequence ds = control.createMock(DestinationSequence.class);
         Identifier did = control.createMock(Identifier.class);

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java Tue Jul  2 21:46:55 2013
@@ -465,10 +465,10 @@ public class RMInInterceptorTest extends
         EasyMock.expect(exchange.getDestination()).andReturn(td);
         
         manager = control.createMock(RMManager.class);
-        EasyMock.expect(manager.getRMNamespace(EasyMock.same(message)))
-            .andReturn(RM10Constants.NAMESPACE_URI).anyTimes();
-        EasyMock.expect(manager.getAddressingNamespace(EasyMock.same(message)))
-            .andReturn(Names200408.WSA_NAMESPACE_NAME).anyTimes();
+        RMConfiguration config = new RMConfiguration();
+        config.setRMNamespace(RM10Constants.NAMESPACE_URI);
+        config.setRM10AddressingNamespace(RM10Constants.NAMESPACE_URI);
+        EasyMock.expect(manager.getEffectiveConfiguration(message)).andReturn(config).anyTimes();
         interceptor.setManager(manager);
         rme = control.createMock(RMEndpoint.class);
         EasyMock.expect(manager.getReliableEndpoint(message)).andReturn(rme);

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java Tue Jul  2 21:46:55 2013
@@ -51,7 +51,6 @@ import org.apache.cxf.ws.addressing.Attr
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.addressing.JAXWSAConstants;
 import org.apache.cxf.ws.addressing.RelatesToType;
-import org.apache.cxf.ws.addressing.VersionTransformer.Names200408;
 import org.apache.cxf.ws.addressing.impl.AddressingPropertiesImpl;
 import org.apache.cxf.ws.rm.manager.SequenceTerminationPolicyType;
 import org.apache.cxf.ws.rm.manager.SourcePolicyType;
@@ -294,14 +293,13 @@ public class RMManagerTest extends Asser
     public void testGetReliableEndpointExisting() throws NoSuchMethodException, RMException {
         Method m1 = RMManager.class.getDeclaredMethod("createReliableEndpoint", 
             new Class[] {Endpoint.class});
-        Method m2 = RMManager.class.getDeclaredMethod("getRMNamespace",  new Class[] {Message.class});
-        Method m3 = RMManager.class.getDeclaredMethod("getAddressingNamespace",  new Class[] {Message.class});
-        manager = control.createMock(RMManager.class, new Method[] {m1, m2, m3});
+        manager = control.createMock(RMManager.class, new Method[] {m1});
         manager.setReliableEndpointsMap(new HashMap<Endpoint, RMEndpoint>());
         Message message = control.createMock(Message.class);
-        EasyMock.expect(manager.getRMNamespace(message)).andReturn(RM10Constants.NAMESPACE_URI).anyTimes();
-        EasyMock.expect(manager.getAddressingNamespace(message)).andReturn(Names200408.WSA_NAMESPACE_NAME)
-            .anyTimes();
+        RMConfiguration config = new RMConfiguration();
+        config.setRMNamespace(RM10Constants.NAMESPACE_URI);
+        config.setRM10AddressingNamespace(RM10Constants.NAMESPACE_URI);
+        EasyMock.expect(manager.getEffectiveConfiguration(message)).andReturn(config).anyTimes();
         Exchange exchange = control.createMock(Exchange.class);
         EasyMock.expect(message.getExchange()).andReturn(exchange);
         Endpoint endpoint = control.createMock(Endpoint.class);
@@ -384,8 +382,6 @@ public class RMManagerTest extends Asser
         Method m = RMManager.class.getDeclaredMethod("getSource", new Class[] {Message.class});
         manager = control.createMock(RMManager.class, new Method[] {m});
         Message message = control.createMock(Message.class);
-        EasyMock.expect(RMContextUtils.getProtocolVariation(message))
-            .andReturn(ProtocolVariation.RM10WSA200408);
         Exchange exchange = control.createMock(Exchange.class);
         EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes();
         EasyMock.expect(exchange.getOutMessage()).andReturn(message).anyTimes();

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java Tue Jul  2 21:46:55 2013
@@ -146,8 +146,7 @@ public class RMOutInterceptorTest extend
         config.setRMNamespace(RM10Constants.NAMESPACE_URI);
         config.setRM10AddressingNamespace(Names200408.WSA_NAMESPACE_NAME);
         EasyMock.expect(rme.getConfiguration()).andReturn(config).anyTimes();
-        EasyMock.expect(manager.getRMNamespace(message)).andReturn(RM10Constants.NAMESPACE_URI).anyTimes();
-        EasyMock.expect(manager.getAddressingNamespace(message)).andReturn(Names200408.WSA_NAMESPACE_NAME).anyTimes();
+        EasyMock.expect(manager.getEffectiveConfiguration(message)).andReturn(config).anyTimes();
         Source source = control.createMock(Source.class);
         EasyMock.expect(source.getReliableEndpoint()).andReturn(rme).anyTimes();
         EasyMock.expect(manager.getSource(message)).andReturn(source).anyTimes();

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java Tue Jul  2 21:46:55 2013
@@ -26,7 +26,6 @@ import java.util.List;
 import java.util.concurrent.Executor;
 
 import org.apache.cxf.message.Message;
-import org.apache.cxf.ws.policy.AssertionInfoMap;
 import org.apache.cxf.ws.rm.RMConfiguration;
 import org.apache.cxf.ws.rm.RMManager;
 import org.apache.cxf.ws.rm.RMMessageConstants;
@@ -365,9 +364,8 @@ public class RetransmissionQueueImplTest
     }
     
     private void setupMessagePolicies(Message message) {
-        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(null);
         RMConfiguration cfg = new RMConfiguration();
-        EasyMock.expect(manager.getConfiguration()).andReturn(cfg);
+        EasyMock.expect(manager.getEffectiveConfiguration(message)).andReturn(cfg);
         cfg.setBaseRetransmissionInterval(new Long(5000));
         cfg.setExponentialBackoff(true);
     }

Copied: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java (from r1499123, cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java?p2=cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java&p1=cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java&r1=1499123&r2=1499124&rev=1499124&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java (original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java Tue Jul  2 21:46:55 2013
@@ -20,88 +20,32 @@
 package org.apache.cxf.systest.ws.policy;
 
 import java.io.Closeable;
-import java.util.List;
 import java.util.logging.Logger;
 
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.endpoint.ServerRegistry;
 import org.apache.cxf.greeter_control.Greeter;
 import org.apache.cxf.greeter_control.PingMeFault;
 import org.apache.cxf.greeter_control.ReliableGreeterService;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.systest.ws.util.ConnectionHelper;
 import org.apache.cxf.systest.ws.util.MessageFlow;
-import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.cxf.testutil.common.TestUtil;
-import org.apache.cxf.testutil.recorders.InMessageRecorder;
 import org.apache.cxf.testutil.recorders.MessageRecorder;
-import org.apache.cxf.testutil.recorders.OutMessageRecorder;
-import org.apache.cxf.ws.policy.PolicyAssertion;
-import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.ws.rm.RM10Constants;
-import org.apache.neethi.All;
-import org.apache.neethi.ExactlyOne;
-import org.apache.neethi.Policy;
+
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-
 /**
- * Tests the use of the WS-Policy Framework to automatically engage WS-RM
- * in response to Policies defined for the endpoint via an direct attachment to the wsdl.
+ * Tests the use of the WS-Policy Framework to automatically engage WS-RM 1.0 in response to Policies defined for the
+ * endpoint via an direct attachment to the wsdl.
  */
-public class RMPolicyWsdlTest extends AbstractBusClientServerTestBase {
+public class RM10PolicyWsdlTest extends RMPolicyWsdlTestBase {
+    
     public static final String PORT = allocatePort(Server.class);
-       
-    private static final Logger LOG = LogUtils.getLogger(RMPolicyWsdlTest.class);
-    private static final String GREETMEONEWAY_ACTION 
-        = "http://cxf.apache.org/greeter_control/Greeter/greetMeOneWayRequest";
-    private static final String GREETME_ACTION 
-        = "http://cxf.apache.org/greeter_control/Greeter/greetMeRequest";
-    private static final String GREETME_RESPONSE_ACTION 
-        = "http://cxf.apache.org/greeter_control/Greeter/greetMeResponse";
-    private static final String PINGME_ACTION = "http://cxf.apache.org/greeter_control/Greeter/pingMeRequest";
-    private static final String PINGME_RESPONSE_ACTION 
-        = "http://cxf.apache.org/greeter_control/Greeter/pingMeResponse";
-    private static final String GREETER_FAULT_ACTION
-        = "http://cxf.apache.org/greeter_control/Greeter/pingMe/Fault/faultDetail";
-
-
-    public static class Server extends AbstractBusTestServerBase {
-        protected void run()  {            
-            SpringBusFactory bf = new SpringBusFactory();
-            Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/rmwsdl_server.xml");
-            BusFactory.setDefaultBus(bus);
-            setBus(bus);
-            
-            ServerRegistry sr = bus.getExtension(ServerRegistry.class);
-            PolicyEngine pe = bus.getExtension(PolicyEngine.class);
-            
-            List<PolicyAssertion> assertions1 
-                = getAssertions(pe, sr.getServers().get(0));
-            assertEquals("2 assertions should be available", 2, assertions1.size());
-            List<PolicyAssertion> assertions2 = 
-                getAssertions(pe, sr.getServers().get(1));
-            assertEquals("1 assertion should be available", 1, assertions2.size());
-            
-            LOG.info("Published greeter endpoints.");
-        }
-        
-        protected List<PolicyAssertion> getAssertions(PolicyEngine pe, org.apache.cxf.endpoint.Server s) {
-            Policy p1 = pe.getServerEndpointPolicy(
-                             s.getEndpoint().getEndpointInfo(), null).getPolicy();
-            List<ExactlyOne> pops = 
-                CastUtils.cast(p1.getPolicyComponents(), ExactlyOne.class);
-            assertEquals("New policy must have 1 top level policy operator", 1, pops.size());
-            List<All> alts = 
-                CastUtils.cast(pops.get(0).getPolicyComponents(), All.class);
-            assertEquals("1 alternatives should be available", 1, alts.size());
-            return CastUtils.cast(alts.get(0).getAssertions(), PolicyAssertion.class);
-        }
+    
+    private static final Logger LOG = LogUtils.getLogger(RM10PolicyWsdlTest.class);
+    
+    public static class Server extends ServerBase {
         
         public static void main(String[] args) {
             try { 
@@ -114,7 +58,13 @@ public class RMPolicyWsdlTest extends Ab
                 System.out.println("done!");
             }
         }
-    }    
+
+        @Override
+        protected String getConfigPath() {
+            return "org/apache/cxf/systest/ws/policy/rm10wsdl_server.xml";
+        }
+    }
+    
     
     @BeforeClass
     public static void startServers() throws Exception {
@@ -124,16 +74,9 @@ public class RMPolicyWsdlTest extends Ab
          
     @Test
     public void testUsingRM() throws Exception {
-        SpringBusFactory bf = new SpringBusFactory();
-        bus = bf.createBus("org/apache/cxf/systest/ws/policy/rmwsdl.xml");
-        BusFactory.setDefaultBus(bus);
-        OutMessageRecorder outRecorder = new OutMessageRecorder();
-        bus.getOutInterceptors().add(outRecorder);
-        InMessageRecorder inRecorder = new InMessageRecorder();
-        bus.getInInterceptors().add(inRecorder);
-        
+        setUpBus(PORT);
         ReliableGreeterService gs = new ReliableGreeterService();
-        final Greeter greeter = gs.getGreeterPort();
+        Greeter greeter = gs.getGreeterPort();
         updateAddressPort(greeter, PORT);
         LOG.fine("Created greeter client.");
 

Added: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM12PolicyWsdlTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM12PolicyWsdlTest.java?rev=1499124&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM12PolicyWsdlTest.java (added)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM12PolicyWsdlTest.java Tue Jul  2 21:46:55 2013
@@ -0,0 +1,144 @@
+/**
+ * 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.policy;
+
+import java.io.Closeable;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.PingMeFault;
+import org.apache.cxf.greeter_control.Reliable12GreeterService;
+import org.apache.cxf.systest.ws.util.MessageFlow;
+import org.apache.cxf.testutil.common.TestUtil;
+import org.apache.cxf.testutil.recorders.MessageRecorder;
+import org.apache.cxf.ws.rm.RM11Constants;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the use of the WS-Policy Framework to automatically engage WS-RM 1.2 in response to Policies defined for the
+ * endpoint via an direct attachment to the wsdl.
+ */
+public class RM12PolicyWsdlTest extends RMPolicyWsdlTestBase {
+    
+    public static final String PORT = allocatePort(Server.class);
+    
+    private static final Logger LOG = LogUtils.getLogger(RM12PolicyWsdlTest.class);
+    
+    public static class Server extends ServerBase {
+        
+        public static void main(String[] args) {
+            try { 
+                Server s = new Server(); 
+                s.start();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                System.exit(-1);
+            } finally { 
+                System.out.println("done!");
+            }
+        }
+
+        @Override
+        protected String getConfigPath() {
+            return "org/apache/cxf/systest/ws/policy/rm12wsdl_server.xml";
+        }
+    }
+    
+    
+    @BeforeClass
+    public static void startServers() throws Exception {
+        TestUtil.getNewPortNumber("decoupled");
+        assertTrue("server did not launch correctly", launchServer(Server.class, true));
+    }
+         
+    @Test
+    public void testUsingRM12() throws Exception {
+        setUpBus(PORT);
+        Reliable12GreeterService gs = new Reliable12GreeterService();
+        Greeter greeter = gs.getGreeterPort();
+        updateAddressPort(greeter, PORT);
+        LOG.fine("Created greeter client.");
+
+        // oneway
+
+        greeter.greetMeOneWay("CXF");
+
+        // two-way
+
+        assertEquals("CXF", greeter.greetMe("cxf")); 
+     
+        // exception
+
+        try {
+            greeter.pingMe();
+        } catch (PingMeFault ex) {
+            fail("First invocation should have succeeded.");
+        } 
+       
+        try {
+            greeter.pingMe();
+            fail("Expected PingMeFault not thrown.");
+        } catch (PingMeFault ex) {
+            assertEquals(2, ex.getFaultInfo().getMajor());
+            assertEquals(1, ex.getFaultInfo().getMinor());
+        } 
+
+        MessageRecorder mr = new MessageRecorder(outRecorder, inRecorder);
+        mr.awaitMessages(5, 4, 5000);
+//        mr.awaitMessages(5, 9, 5000);
+
+        MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(),
+                                         inRecorder.getInboundMessages(),
+                                         "http://www.w3.org/2005/08/addressing",
+                                         "http://docs.oasis-open.org/ws-rx/wsrm/200702");
+        
+        
+        mf.verifyMessages(5, true);
+        String[] expectedActions = new String[] {RM11Constants.INSTANCE.getCreateSequenceAction(), 
+                                                 GREETMEONEWAY_ACTION,
+                                                 GREETME_ACTION, 
+                                                 PINGME_ACTION,
+                                                 PINGME_ACTION};
+        mf.verifyActions(expectedActions, true);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3", "4"}, true);
+        mf.verifyLastMessage(new boolean[] {false, false, false, false, false}, true);
+        mf.verifyAcknowledgements(new boolean[] {false, false, false, true, true}, true);
+
+        mf.verifyMessages(4, false);
+//        mf.verifyMessages(9, false);
+//        mf.verifyPartialResponses(5);      
+//        mf.purgePartialResponses();
+
+        expectedActions = new String[] {
+            RM11Constants.INSTANCE.getCreateSequenceResponseAction(),
+            GREETME_RESPONSE_ACTION,
+            PINGME_RESPONSE_ACTION,
+            GREETER_FAULT_ACTION
+        };
+        mf.verifyActions(expectedActions, false);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3"}, false);
+        mf.verifyLastMessage(new boolean[] {false, false, false, false}, false);
+        mf.verifyAcknowledgements(new boolean[] {false, true, true, true}, false);
+        ((Closeable)greeter).close();
+    }
+}

Added: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTestBase.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTestBase.java?rev=1499124&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTestBase.java (added)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTestBase.java Tue Jul  2 21:46:55 2013
@@ -0,0 +1,107 @@
+/**
+ * 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.policy;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.ServerRegistry;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.recorders.InMessageRecorder;
+import org.apache.cxf.testutil.recorders.OutMessageRecorder;
+import org.apache.cxf.ws.policy.PolicyAssertion;
+import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.neethi.All;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
+
+/**
+ * Base class for testing WS-Policy Framework using engage WS-RM Policy to engage WS-RM.
+ */
+public class RMPolicyWsdlTestBase extends AbstractBusClientServerTestBase {
+    protected static final String GREETMEONEWAY_ACTION 
+        = "http://cxf.apache.org/greeter_control/Greeter/greetMeOneWayRequest";
+    protected static final String GREETME_ACTION 
+        = "http://cxf.apache.org/greeter_control/Greeter/greetMeRequest";
+    protected static final String GREETME_RESPONSE_ACTION 
+        = "http://cxf.apache.org/greeter_control/Greeter/greetMeResponse";
+    protected static final String PINGME_ACTION = "http://cxf.apache.org/greeter_control/Greeter/pingMeRequest";
+    protected static final String PINGME_RESPONSE_ACTION 
+        = "http://cxf.apache.org/greeter_control/Greeter/pingMeResponse";
+    protected static final String GREETER_FAULT_ACTION
+        = "http://cxf.apache.org/greeter_control/Greeter/pingMe/Fault/faultDetail";
+    
+    private static final Logger LOG = LogUtils.getLogger(RMPolicyWsdlTestBase.class);
+    
+    protected OutMessageRecorder outRecorder;
+    protected InMessageRecorder inRecorder;
+
+    public abstract static class ServerBase extends AbstractBusTestServerBase {
+        
+        protected abstract String getConfigPath();
+        
+        protected void run()  {            
+            SpringBusFactory bf = new SpringBusFactory();
+            Bus bus = bf.createBus(getConfigPath());
+            BusFactory.setDefaultBus(bus);
+            setBus(bus);
+            
+            ServerRegistry sr = bus.getExtension(ServerRegistry.class);
+            PolicyEngine pe = bus.getExtension(PolicyEngine.class);
+            
+            List<PolicyAssertion> assertions1 
+                = getAssertions(pe, sr.getServers().get(0));
+            assertEquals("2 assertions should be available", 2, assertions1.size());
+            List<PolicyAssertion> assertions2 = 
+                getAssertions(pe, sr.getServers().get(1));
+            assertEquals("1 assertion should be available", 1, assertions2.size());
+            
+            LOG.info("Published greeter endpoints.");
+        }
+        
+        protected List<PolicyAssertion> getAssertions(PolicyEngine pe, org.apache.cxf.endpoint.Server s) {
+            Policy p1 = pe.getServerEndpointPolicy(
+                             s.getEndpoint().getEndpointInfo(), null).getPolicy();
+            List<ExactlyOne> pops = 
+                CastUtils.cast(p1.getPolicyComponents(), ExactlyOne.class);
+            assertEquals("New policy must have 1 top level policy operator", 1, pops.size());
+            List<All> alts = 
+                CastUtils.cast(pops.get(0).getPolicyComponents(), All.class);
+            assertEquals("1 alternatives should be available", 1, alts.size());
+            return CastUtils.cast(alts.get(0).getAssertions(), PolicyAssertion.class);
+        }
+    }
+    
+    public void setUpBus(String port) throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        bus = bf.createBus("org/apache/cxf/systest/ws/policy/rmwsdl.xml");
+        BusFactory.setDefaultBus(bus);
+        outRecorder = new OutMessageRecorder();
+        bus.getOutInterceptors().add(outRecorder);
+        inRecorder = new InMessageRecorder();
+        bus.getInInterceptors().add(inRecorder);
+    }
+}

Copied: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rm10wsdl_server.xml (from r1499123, cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml)
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rm10wsdl_server.xml?p2=cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rm10wsdl_server.xml&p1=cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml&r1=1499123&r2=1499124&rev=1499124&view=diff
==============================================================================
    (empty)

Copied: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rm12wsdl_server.xml (from r1499123, cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml)
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rm12wsdl_server.xml?p2=cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rm12wsdl_server.xml&p1=cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml&r1=1499123&r2=1499124&rev=1499124&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml (original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rm12wsdl_server.xml Tue Jul  2 21:46:55 2013
@@ -72,18 +72,29 @@ http://www.springframework.org/schema/be
 		</jaxws:features>
 	</jaxws:endpoint>
 
-    <wsp:Policy wsu:Id="AddressingPolicy"
+  <wsp:Policy wsu:Id="AddressingPolicy"
 		xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
 		<wsam:Addressing>
 			<wsp:Policy />
 		</wsam:Addressing>
 	</wsp:Policy>
 	<wsp:Policy wsu:Id="AddressingRmPolicy">
-                <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
-                    <wsp:Policy/>
-                </wsam:Addressing>
-                <wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
-                    <wsrmp:BaseRetransmissionInterval Milliseconds="30000"/>
-                </wsrmp:RMAssertion>
+	    <wsp:ExactlyOne>
+	      <wsp:All>
+          <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
+            <wsp:Policy/>
+          </wsam:Addressing>
+	        <wsrmp:RMAssertion xmlns:wsrmp="http://docs.oasis-open.org/ws-rx/wsrmp/200702">
+	          <wsp:Policy>
+	            <wsrmp:DeliveryAssurance>
+	              <wsp:Policy>
+	                <wsrmp:ExactlyOnce/>
+	                <wsrmp:InOrder/>
+	              </wsp:Policy>
+	            </wsrmp:DeliveryAssurance>
+	          </wsp:Policy>
+	        </wsrmp:RMAssertion>
+	      </wsp:All>
+	    </wsp:ExactlyOne>
     </wsp:Policy>
 </beans>

Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml (original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml Tue Jul  2 21:46:55 2013
@@ -20,7 +20,6 @@
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:http="http://cxf.apache.org/transports/http/configuration"
-       xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
        xsi:schemaLocation="
 http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

Modified: cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl?rev=1499124&r1=1499123&r2=1499124&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl (original)
+++ cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl Tue Jul  2 21:46:55 2013
@@ -327,6 +327,40 @@
         </wsdl:port>
         
     </wsdl:service>
+    
+    <wsdl:service name="Reliable12GreeterService">
+        <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort">
+            <soap:address location="http://localhost:9020/SoapContext/GreeterPort"/>
+            <wsp:Policy xmlns:wsp="http://www.w3.org/2006/07/ws-policy">
+              <wsp:ExactlyOne>
+                <wsp:All>
+                  <wsrmp:RMAssertion xmlns:wsrmp="http://docs.oasis-open.org/ws-rx/wsrmp/200702">
+                    <wsp:Policy>
+                      <wsrmp:DeliveryAssurance>
+                        <wsp:Policy>
+                          <wsrmp:ExactlyOnce/>
+                          <wsrmp:InOrder/>
+                        </wsp:Policy>
+                      </wsrmp:DeliveryAssurance>
+                    </wsp:Policy>
+                  </wsrmp:RMAssertion>
+                  <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
+                      <wsp:Policy/>
+                  </wsam:Addressing>
+                </wsp:All>
+              </wsp:ExactlyOne>
+            </wsp:Policy>
+        </wsdl:port> 
+        <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort2">
+            <soap:address location="http://localhost:9020/SoapContext/GreeterPort2"/>
+            <wsp:Policy xmlns:wsp="http://www.w3.org/2006/07/ws-policy">
+                <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
+                    <wsp:Policy/>
+                </wsam:Addressing>
+            </wsp:Policy>
+        </wsdl:port>
+        
+    </wsdl:service>
    
     <wsdl:service name="BasicGreeterService">
         <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort">



Mime
View raw message