You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/10/16 21:14:46 UTC

svn commit: r1532864 [1/2] - in /cxf/trunk: core/src/main/java/org/apache/cxf/policy/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/ rt/ws/policy/src/main/java/org/apache/cxf/ws/...

Author: dkulp
Date: Wed Oct 16 19:14:45 2013
New Revision: 1532864

URL: http://svn.apache.org/r1532864
Log:
Update policy stuff to pass the current message in when appropriate so AlternativeSelector can consider contextual information while selecting a policy.

Modified:
    cxf/trunk/core/src/main/java/org/apache/cxf/policy/PolicyDataEngine.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AlternativeSelector.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyDataEngineImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptorTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptorTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelectorTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/MinimalMaximalAlternativeSelectorTest.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/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
    cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/batch/SimpleBatchSTSClient.java
    cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/PolicyLoggingInterceptor.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTestBase.java

Modified: cxf/trunk/core/src/main/java/org/apache/cxf/policy/PolicyDataEngine.java
URL: http://svn.apache.org/viewvc/cxf/trunk/core/src/main/java/org/apache/cxf/policy/PolicyDataEngine.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/core/src/main/java/org/apache/cxf/policy/PolicyDataEngine.java (original)
+++ cxf/trunk/core/src/main/java/org/apache/cxf/policy/PolicyDataEngine.java Wed Oct 16 19:14:45 2013
@@ -26,9 +26,9 @@ import org.apache.cxf.transport.Destinat
 public interface PolicyDataEngine {
     <T> T getPolicy(Message message, T confPolicy, PolicyCalculator<T> intersector);
 
-    <T> T getClientEndpointPolicy(EndpointInfo ei, Conduit c, PolicyCalculator<T> policyCalculator);
+    <T> T getClientEndpointPolicy(Message m, EndpointInfo ei, Conduit c, PolicyCalculator<T> policyCalculator);
 
-    <T> T getServerEndpointPolicy(EndpointInfo ei, Destination d, PolicyCalculator<T> policyCalculator);
+    <T> T getServerEndpointPolicy(Message m, EndpointInfo ei, Destination d, PolicyCalculator<T> policyCalculator);
 
     <T> void assertMessage(Message message, T confPol, PolicyCalculator<T> policyCalculator);
 }

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java Wed Oct 16 19:14:45 2013
@@ -109,7 +109,7 @@ public class PolicyAnnotationTest extend
             
             
             EndpointPolicy policy = bus.getExtension(PolicyEngine.class)
-                .getServerEndpointPolicy(s.getEndpoint().getEndpointInfo(), null);
+                .getServerEndpointPolicy(s.getEndpoint().getEndpointInfo(), null, null);
             assertNotNull(policy);
             assertEquals(1, policy.getChosenAlternative().size());
         } finally {

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Wed Oct 16 19:14:45 2013
@@ -109,14 +109,16 @@ public abstract class AbstractHTTPDestin
     protected final String path;
 
     // Configuration values
-    protected HTTPServerPolicy server;
+    protected HTTPServerPolicy serverPolicy;
     protected String contextMatchStrategy = "stem";
     protected boolean fixedParameterOrder;
     protected boolean multiplexWithAddress;
     protected CertConstraints certConstraints;
     protected boolean isServlet3;
     protected ContinuationProviderFactory cproviderFactory;
-    
+
+    private volatile boolean serverPolicyCalced; 
+
     /**
      * Constructor
      * 
@@ -484,18 +486,24 @@ public abstract class AbstractHTTPDestin
     }
 
     private void initConfig() {
-        PolicyDataEngine pde = bus.getExtension(PolicyDataEngine.class);
-        if (pde != null) {
-            server = pde.getServerEndpointPolicy(endpointInfo, this, new ServerPolicyCalculator());
-        }
-        if (null == server) {
-            server = endpointInfo.getTraversedExtensor(
-                    new HTTPServerPolicy(), HTTPServerPolicy.class);
-        }
         
         cproviderFactory = bus.getExtension(ContinuationProviderFactory.class);
     }
 
+    private void calcServerPolicy(Message m) {
+        if (!serverPolicyCalced) {
+            PolicyDataEngine pde = bus.getExtension(PolicyDataEngine.class);
+            if (pde != null) {
+                serverPolicy = pde.getServerEndpointPolicy(m, endpointInfo, this, new ServerPolicyCalculator());
+            }
+            if (null == serverPolicy) {
+                serverPolicy = endpointInfo.getTraversedExtensor(
+                        new HTTPServerPolicy(), HTTPServerPolicy.class);
+            }
+        }
+        serverPolicyCalced = true;
+    }
+    
     /**
      * On first write, we need to make sure any attachments and such that are still on the incoming stream 
      * are read in.  Otherwise we can get into a deadlock where the client is still trying to send the 
@@ -538,8 +546,9 @@ public abstract class AbstractHTTPDestin
         }
 
         cacheInput(outMessage);
-        if (server != null) {
-            new Headers(outMessage).setFromServerPolicy(server);
+        calcServerPolicy(outMessage);
+        if (serverPolicy != null) {
+            new Headers(outMessage).setFromServerPolicy(serverPolicy);
         }
 
         OutputStream responseStream = null;
@@ -837,16 +846,20 @@ public abstract class AbstractHTTPDestin
     }
 
     public HTTPServerPolicy getServer() {
-        return server;
+        calcServerPolicy(null);
+        return serverPolicy;
     }
 
     public void setServer(HTTPServerPolicy server) {
-        this.server = server;
+        this.serverPolicy = server;
+        if (server != null) {
+            serverPolicyCalced = true;
+        }
     }
     
     public void assertMessage(Message message) {
         PolicyDataEngine pde = bus.getExtension(PolicyDataEngine.class);
-        pde.assertMessage(message, server, new ServerPolicyCalculator());
+        pde.assertMessage(message, serverPolicy, new ServerPolicyCalculator());
     }
 
     public boolean canAssert(QName type) {

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Wed Oct 16 19:14:45 2013
@@ -258,6 +258,9 @@ public abstract class HTTPConduit 
     protected Cookies cookies;
     
     protected CertConstraints certConstraints;
+    
+    private volatile boolean clientSidePolicyCalced;
+    
 
     /**
      * Constructor
@@ -293,7 +296,6 @@ public abstract class HTTPConduit 
         }
         proxyFactory = new ProxyFactory();
         cookies = new Cookies();
-        updateClientPolicy();
     }
 
     /**
@@ -304,12 +306,21 @@ public abstract class HTTPConduit 
      * wsdl extensors are superseded by policies which in 
      * turn are superseded by injection
      */
-    private void updateClientPolicy() {
-        PolicyDataEngine policyEngine = bus.getExtension(PolicyDataEngine.class);
-        if (policyEngine != null && endpointInfo.getService() != null) {
-            clientSidePolicy = policyEngine.getClientEndpointPolicy(endpointInfo, 
-                                                                    this, new ClientPolicyCalculator());
+    private void updateClientPolicy(Message m) {
+        if (!clientSidePolicyCalced) {
+            PolicyDataEngine policyEngine = bus.getExtension(PolicyDataEngine.class);
+            if (policyEngine != null && endpointInfo.getService() != null) {
+                clientSidePolicy = policyEngine.getClientEndpointPolicy(m,
+                                                                        endpointInfo, 
+                                                                        this,
+                                                                        new ClientPolicyCalculator());
+                if (clientSidePolicy != null) {
+                    clientSidePolicy.removePropertyChangeListener(this); //make sure we aren't added twice
+                    clientSidePolicy.addPropertyChangeListener(this);
+                }
+            }
         }
+        clientSidePolicyCalced = true;
     }
 
     /**
@@ -417,10 +428,6 @@ public abstract class HTTPConduit 
             this.endpointInfo.setProperty("org.apache.cxf.ws.addressing.replyto",
                                           getClient().getDecoupledEndpoint());
         }
-        if (clientSidePolicy != null) {
-            clientSidePolicy.removePropertyChangeListener(this); //make sure we aren't added twice
-            clientSidePolicy.addPropertyChangeListener(this);
-        }
     }
     
     /**
@@ -815,6 +822,7 @@ public abstract class HTTPConduit 
     public HTTPClientPolicy getClient(Message message) {
         ClientPolicyCalculator cpc = new ClientPolicyCalculator();
         HTTPClientPolicy pol = message.get(HTTPClientPolicy.class);
+        updateClientPolicy(message);
         if (pol != null) {
             pol = cpc.intersect(pol, clientSidePolicy);
         } else {
@@ -833,6 +841,7 @@ public abstract class HTTPConduit 
      * HTTPConduit.
      */
     public HTTPClientPolicy getClient() {
+        updateClientPolicy(null);
         return clientSidePolicy;
     }
 
@@ -844,6 +853,7 @@ public abstract class HTTPConduit 
         if (this.clientSidePolicy != null) {
             this.clientSidePolicy.removePropertyChangeListener(this);
         }
+        this.clientSidePolicyCalced = true;
         this.clientSidePolicy = client;
         clientSidePolicy.removePropertyChangeListener(this); //make sure we aren't added twice
         clientSidePolicy.addPropertyChangeListener(this);

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AlternativeSelector.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AlternativeSelector.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AlternativeSelector.java Wed Oct 16 19:14:45 2013
@@ -22,6 +22,7 @@ package org.apache.cxf.ws.policy;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.cxf.message.Message;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
 
@@ -48,7 +49,8 @@ public interface AlternativeSelector {
      */
     Collection<Assertion> selectAlternative(Policy policy, 
                                             PolicyEngine engine, 
-                                            Assertor assertor, 
-                                            List<List<Assertion>> request);
+                                            Assertor assertor,
+                                            List<List<Assertion>> request,
+                                            Message msg);
     
 }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java Wed Oct 16 19:14:45 2013
@@ -84,7 +84,7 @@ public class ClientPolicyInFaultIntercep
         if (p != null) {
             EndpointPolicyImpl endpi = new EndpointPolicyImpl(p);
             EffectivePolicyImpl effectivePolicy = new EffectivePolicyImpl();
-            effectivePolicy.initialise(endpi, (PolicyEngineImpl)pe, true, true);
+            effectivePolicy.initialise(endpi, (PolicyEngineImpl)pe, true, true, msg);
             PolicyUtils.logPolicy(LOG, Level.FINEST, "Using effective policy: ", 
                                   effectivePolicy.getPolicy());
             
@@ -95,7 +95,7 @@ public class ClientPolicyInFaultIntercep
             // We do not know the underlying message type yet - so we pre-emptively add interceptors 
             // that can deal with all faults returned to this client endpoint.
             
-            EndpointPolicy ep = pe.getClientEndpointPolicy(ei, conduit);        
+            EndpointPolicy ep = pe.getClientEndpointPolicy(ei, conduit, msg);        
             LOG.fine("ep: " + ep);
             if (ep != null) {
                 faultInterceptors.addAll(ep.getFaultInterceptors());

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java Wed Oct 16 19:14:45 2013
@@ -32,9 +32,9 @@ import java.util.logging.Logger;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.i18n.BundleUtils;
-import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -57,6 +57,9 @@ public class EffectivePolicyImpl impleme
     protected Collection<Assertion> chosenAlternative;
     protected List<Interceptor<? extends org.apache.cxf.message.Message>> interceptors;
     
+    public EffectivePolicyImpl() {
+    }
+    
     public Policy getPolicy() {
         return policy;        
     }
@@ -69,15 +72,15 @@ public class EffectivePolicyImpl impleme
         return chosenAlternative;
     }
     
-    public void initialise(EndpointPolicy epi, PolicyEngine engine, boolean inbound) {
-        initialise(epi, engine, inbound, false);
+    public void initialise(EndpointPolicy epi, PolicyEngine engine, boolean inbound, Message m) {
+        initialise(epi, engine, inbound, false, m);
     }
 
-    public void initialise(EndpointPolicy epi, PolicyEngine engine, boolean inbound, boolean fault) {
+    public void initialise(EndpointPolicy epi, PolicyEngine engine, boolean inbound, boolean fault, Message m) {
         policy = epi.getPolicy();
         chosenAlternative = epi.getChosenAlternative();
         if (chosenAlternative == null) {
-            chooseAlternative(engine, null);
+            chooseAlternative(engine, null, m);
         }
         initialiseInterceptors(engine, inbound, fault);  
     }
@@ -87,9 +90,10 @@ public class EffectivePolicyImpl impleme
                     PolicyEngine engine, 
                     Assertor assertor,
                     boolean requestor,
-                    boolean request) {
-        initialisePolicy(ei, boi, engine, requestor, request, assertor);
-        chooseAlternative(engine, assertor);
+                    boolean request,
+                    Message m) {
+        initialisePolicy(ei, boi, engine, requestor, request, assertor, m);
+        chooseAlternative(engine, assertor, m);
         initialiseInterceptors(engine, false);  
     }
     
@@ -97,21 +101,21 @@ public class EffectivePolicyImpl impleme
                     BindingOperationInfo boi, 
                     PolicyEngine engine, 
                     Assertor assertor,
-                    boolean requestor,
-                    boolean request,
-                    List<List<Assertion>> incoming) {
-        initialisePolicy(ei, boi, engine, requestor, request, assertor);
-        chooseAlternative(engine, assertor, incoming);
+                    List<List<Assertion>> incoming,
+                    Message m) {
+        initialisePolicy(ei, boi, engine, false, false, assertor, m);
+        chooseAlternative(engine, assertor, incoming, m);
         initialiseInterceptors(engine, false);  
     }
     
     public void initialise(EndpointInfo ei, 
                     BindingOperationInfo boi, 
                     PolicyEngine engine, 
-                    boolean requestor, boolean request) {
-        Assertor assertor = initialisePolicy(ei, boi, engine, requestor, request, null);
+                    boolean requestor, boolean request,
+                    Message m) {
+        Assertor assertor = initialisePolicy(ei, boi, engine, requestor, request, null, m);
         if (requestor || !request) {
-            chooseAlternative(engine, assertor);
+            chooseAlternative(engine, assertor, m);
             initialiseInterceptors(engine, requestor);
         } else {
             //incoming server should not choose an alternative, need to include all the policies
@@ -124,9 +128,10 @@ public class EffectivePolicyImpl impleme
                     BindingOperationInfo boi, 
                     BindingFaultInfo bfi, 
                     PolicyEngine engine, 
-                    Assertor assertor) {
-        initialisePolicy(ei, boi, bfi, engine);
-        chooseAlternative(engine, assertor);
+                    Assertor assertor,
+                    Message m) {
+        initialisePolicy(ei, boi, bfi, engine, m);
+        chooseAlternative(engine, assertor, m);
         initialiseInterceptors(engine, false);  
     }
     
@@ -144,8 +149,10 @@ public class EffectivePolicyImpl impleme
     Assertor initialisePolicy(EndpointInfo ei,
                           BindingOperationInfo boi,  
                           PolicyEngine engine, 
-                          boolean requestor, boolean request,
-                          Assertor assertor) {
+                          boolean requestor,
+                          boolean request,
+                          Assertor assertor,
+                          Message m) {
         
         if (boi.isUnwrapped()) {
             boi = boi.getUnwrappedOperation();
@@ -154,9 +161,9 @@ public class EffectivePolicyImpl impleme
         BindingMessageInfo bmi = request ? boi.getInput() : boi.getOutput();
         EndpointPolicy ep;
         if (requestor) {
-            ep = engine.getClientEndpointPolicy(ei, getAssertorAs(assertor, Conduit.class));
+            ep = engine.getClientEndpointPolicy(ei, getAssertorAs(assertor, Conduit.class), m);
         } else {
-            ep = engine.getServerEndpointPolicy(ei, getAssertorAs(assertor, Destination.class));
+            ep = engine.getServerEndpointPolicy(ei, getAssertorAs(assertor, Destination.class), m);
         }
         policy = ep.getPolicy();
         if (ep instanceof EndpointPolicyImpl) {
@@ -172,8 +179,8 @@ public class EffectivePolicyImpl impleme
     }
     
     void initialisePolicy(EndpointInfo ei, BindingOperationInfo boi,
-                          BindingFaultInfo bfi, PolicyEngine engine) {
-        policy = engine.getServerEndpointPolicy(ei, (Destination)null).getPolicy();         
+                          BindingFaultInfo bfi, PolicyEngine engine, Message m) {
+        policy = engine.getServerEndpointPolicy(ei, (Destination)null, m).getPolicy();         
         policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedOperationPolicy(boi));
         if (bfi != null) {
             policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedFaultPolicy(bfi));
@@ -181,15 +188,15 @@ public class EffectivePolicyImpl impleme
         policy = policy.normalize(engine.getRegistry(), true);
     }
 
-    void chooseAlternative(PolicyEngine engine, Assertor assertor) {
-        chooseAlternative(engine, assertor, null);
+    void chooseAlternative(PolicyEngine engine, Assertor assertor, Message m) {
+        chooseAlternative(engine, assertor, null, m);
     }
-    void chooseAlternative(PolicyEngine engine, Assertor assertor, List<List<Assertion>> incoming) {
+    void chooseAlternative(PolicyEngine engine, Assertor assertor, List<List<Assertion>> incoming, Message m) {
         Collection<Assertion> alternative = engine.getAlternativeSelector()
-            .selectAlternative(policy, engine, assertor, incoming);
+            .selectAlternative(policy, engine, assertor, incoming, m);
         if (null == alternative) {
             PolicyUtils.logPolicy(LOG, Level.FINE, "No alternative supported.", getPolicy());
-            throw new PolicyException(new Message("NO_ALTERNATIVE_EXC", BUNDLE));
+            throw new PolicyException(new org.apache.cxf.common.i18n.Message("NO_ALTERNATIVE_EXC", BUNDLE));
         } else {
             setChosenAlternative(alternative);
         }   

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java Wed Oct 16 19:14:45 2013
@@ -99,7 +99,7 @@ public class EndpointPolicyImpl implemen
         }
         
         epi.checkExactlyOnes();
-        epi.finalizeConfig();
+        epi.finalizeConfig(null);
         return epi;
     }
     
@@ -109,40 +109,40 @@ public class EndpointPolicyImpl implemen
     
     public synchronized Collection<Assertion> getVocabulary() {
         if (vocabulary == null) {
-            initializeVocabulary();
+            initializeVocabulary(null);
         }
         return vocabulary;
     }
     
     public synchronized Collection<Assertion> getFaultVocabulary() {
         if (vocabulary == null) {
-            initializeVocabulary();
+            initializeVocabulary(null);
         }
         return faultVocabulary;
     }    
     
     public synchronized List<Interceptor<? extends Message>> getInterceptors() {
         if (interceptors == null) {
-            initializeInterceptors();
+            initializeInterceptors(null);
         }
         return interceptors;
     }
     
     public synchronized List<Interceptor<? extends Message>> getFaultInterceptors() {
         if (interceptors == null) {
-            initializeInterceptors();
+            initializeInterceptors(null);
         }
         return faultInterceptors;
     }
     
-    public void initialize() {
+    public void initialize(Message m) {
         initializePolicy();
         checkExactlyOnes();
-        finalizeConfig();
+        finalizeConfig(m);
     }
     
-    void finalizeConfig() {
-        chooseAlternative();
+    void finalizeConfig(Message m) {
+        chooseAlternative(m);
     }
    
     void initializePolicy() {
@@ -155,10 +155,10 @@ public class EndpointPolicyImpl implemen
         }
     }
 
-    void chooseAlternative() {
+    void chooseAlternative(Message m) {
         Collection<Assertion> alternative = null;
         if (requestor) {
-            alternative = engine.getAlternativeSelector().selectAlternative(policy, engine, assertor, null);
+            alternative = engine.getAlternativeSelector().selectAlternative(policy, engine, assertor, null, m);
         } else {
             alternative = getSupportedAlternatives();
         }
@@ -189,7 +189,7 @@ public class EndpointPolicyImpl implemen
         }
     }
     
-    void initializeVocabulary() {
+    void initializeVocabulary(Message m) {
         vocabulary = new ArrayList<Assertion>();
         if (requestor) {
             faultVocabulary = new ArrayList<Assertion>();
@@ -213,13 +213,13 @@ public class EndpointPolicyImpl implemen
         for (BindingOperationInfo boi : ei.getBinding().getOperations()) {
             EffectivePolicy p = null;
             if (!this.requestor) {
-                p = engine.getEffectiveServerRequestPolicy(ei, boi);
+                p = engine.getEffectiveServerRequestPolicy(ei, boi, m);
                 Collection<Assertion> c = engine.getAssertions(p, false);
                 if (c != null) {
                     addAll(vocabulary, c);
                 }
             } else {
-                p = engine.getEffectiveClientResponsePolicy(ei, boi);
+                p = engine.getEffectiveClientResponsePolicy(ei, boi, m);
                 Collection<Assertion> c = engine.getAssertions(p, false);
                 if (c != null) {
                     addAll(vocabulary, c);
@@ -229,7 +229,7 @@ public class EndpointPolicyImpl implemen
                 }
                 if (boi.getFaults() != null && null != faultVocabulary) {
                     for (BindingFaultInfo bfi : boi.getFaults()) {
-                        p = engine.getEffectiveClientFaultPolicy(ei, boi, bfi);
+                        p = engine.getEffectiveClientFaultPolicy(ei, boi, bfi, m);
                         c = engine.getAssertions(p, false);
                         if (c != null) {
                             addAll(faultVocabulary, c);
@@ -269,7 +269,7 @@ public class EndpointPolicyImpl implemen
         }
     }
 
-    void initializeInterceptors() {
+    void initializeInterceptors(Message m) {
         if (engine == null || engine.getBus() == null
             || engine.getBus().getExtension(PolicyInterceptorProviderRegistry.class) == null) {
             return;
@@ -293,7 +293,7 @@ public class EndpointPolicyImpl implemen
             faultInterceptors = new ArrayList<Interceptor<? extends Message>>(out);
         } else if (ei != null && ei.getBinding() != null) {
             for (BindingOperationInfo boi : ei.getBinding().getOperations()) {
-                EffectivePolicy p = engine.getEffectiveServerRequestPolicy(ei, boi);
+                EffectivePolicy p = engine.getEffectiveServerRequestPolicy(ei, boi, m);
                 if (p == null || p.getPolicy() == null || p.getPolicy().isEmpty()) {
                     continue;
                 }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyDataEngineImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyDataEngineImpl.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyDataEngineImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyDataEngineImpl.java Wed Oct 16 19:14:45 2013
@@ -56,9 +56,9 @@ public class PolicyDataEngineImpl implem
         return this.policyEngine;
     }
 
-    public <T> T getClientEndpointPolicy(EndpointInfo ei, Conduit c,
+    public <T> T getClientEndpointPolicy(Message m, EndpointInfo ei, Conduit c,
                                          PolicyCalculator<T> policyCalculator) {
-        Collection<Assertion> alternative = getPolicyEngine().getClientEndpointPolicy(ei, c)
+        Collection<Assertion> alternative = getPolicyEngine().getClientEndpointPolicy(ei, c, m)
             .getChosenAlternative();
         List<T> filteredPolicies = new ArrayList<T>();
         for (Assertion a : alternative) {
@@ -79,10 +79,10 @@ public class PolicyDataEngineImpl implem
         return getPolicy(policies, intersector);
     }
 
-    public <T> T getServerEndpointPolicy(EndpointInfo ei, Destination d, 
+    public <T> T getServerEndpointPolicy(Message m, EndpointInfo ei, Destination d, 
                                          PolicyCalculator<T> policyCalculator) {
         Collection<Assertion> alternative = getPolicyEngine()
-            .getServerEndpointPolicy(ei, d).getChosenAlternative();
+            .getServerEndpointPolicy(ei, d, m).getChosenAlternative();
         List<T> filteredPolicies = new ArrayList<T>();
         for (Assertion a : alternative) {
             if (policyCalculator.getDataClassName().equals(a.getName())) {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java Wed Oct 16 19:14:45 2013
@@ -22,6 +22,7 @@ package org.apache.cxf.ws.policy;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -56,41 +57,41 @@ public interface PolicyEngine {
     
     // available throughout the outbound path
     
-    EffectivePolicy getEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, Conduit c);
+    EffectivePolicy getEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, Conduit c, Message m);
     
     void setEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, EffectivePolicy ep);
     
     EffectivePolicy getEffectiveServerResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, 
-                                                     Destination d, List<List<Assertion>> incoming);
+                                                     Destination d, List<List<Assertion>> incoming, Message m);
     
     void setEffectiveServerResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, EffectivePolicy ep);
     
     EffectivePolicy getEffectiveServerFaultPolicy(EndpointInfo ei, BindingOperationInfo boi,
-                                                  BindingFaultInfo bfi, Destination d);
+                                                  BindingFaultInfo bfi, Destination d, Message m);
     
     void setEffectiveServerFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi, EffectivePolicy ep); 
     
     // available throughout the inbound path
         
-    EndpointPolicy getClientEndpointPolicy(EndpointInfo ei, Conduit conduit);
-    EndpointPolicy getServerEndpointPolicy(EndpointInfo ei, Destination destination);
+    EndpointPolicy getClientEndpointPolicy(EndpointInfo ei, Conduit conduit, Message msg);
+    EndpointPolicy getServerEndpointPolicy(EndpointInfo ei, Destination destination, Message msg);
     
     void setServerEndpointPolicy(EndpointInfo ei, EndpointPolicy ep);
     void setClientEndpointPolicy(EndpointInfo ei, EndpointPolicy ep);
     
     // only available after message type has been determined
     
-    EffectivePolicy getEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi);
+    EffectivePolicy getEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, Message m);
     
     void setEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, EffectivePolicy ep);
     
-    EffectivePolicy getEffectiveClientResponsePolicy(EndpointInfo ei, BindingOperationInfo boi);
+    EffectivePolicy getEffectiveClientResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, Message m);
     
     void setEffectiveClientResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, EffectivePolicy ep);
     
     EffectivePolicy getEffectiveClientFaultPolicy(EndpointInfo ei, 
                                                   BindingOperationInfo boi,
-                                                  BindingFaultInfo bfi);
+                                                  BindingFaultInfo bfi, Message m);
     
     void setEffectiveClientFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi, EffectivePolicy ep);
     

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Wed Oct 16 19:14:45 2013
@@ -33,6 +33,7 @@ import org.apache.cxf.common.logging.Log
 import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.service.factory.FactoryBeanListener;
 import org.apache.cxf.service.factory.FactoryBeanListenerManager;
 import org.apache.cxf.service.model.BindingFaultInfo;
@@ -192,12 +193,12 @@ public class PolicyEngineImpl implements
     // PolicyEngine interface
 
     public EffectivePolicy getEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, 
-                                                           Conduit c) {
+                                                           Conduit c, Message m) {
         EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_CLIENT);
         if (null == effectivePolicy) {
             EffectivePolicyImpl epi = createOutPolicyInfo();
             Assertor assertor = PolicyUtils.createAsserter(c);
-            epi.initialise(ei, boi, this, assertor, true, true);
+            epi.initialise(ei, boi, this, assertor, true, true, m);
             boi.setProperty(POLICY_INFO_REQUEST_CLIENT, epi);
             effectivePolicy = epi;
         }
@@ -212,7 +213,8 @@ public class PolicyEngineImpl implements
     public EffectivePolicy getEffectiveServerResponsePolicy(EndpointInfo ei,
                                                             BindingOperationInfo boi,
                                                             Destination d,
-                                                            List<List<Assertion>> incoming) {
+                                                            List<List<Assertion>> incoming, 
+                                                            Message m) {
         if (incoming == null) {
             EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_SERVER);
             if (null == effectivePolicy) {
@@ -226,7 +228,7 @@ public class PolicyEngineImpl implements
         }
         EffectivePolicyImpl epi = createOutPolicyInfo();
         Assertor assertor = PolicyUtils.createAsserter(d);
-        epi.initialise(ei, boi, this, assertor, false, false, incoming);
+        epi.initialise(ei, boi, this, assertor, incoming, m);
         return epi;
     }
 
@@ -238,12 +240,13 @@ public class PolicyEngineImpl implements
     public EffectivePolicy getEffectiveServerFaultPolicy(EndpointInfo ei,
                                                          BindingOperationInfo boi,
                                                          BindingFaultInfo bfi, 
-                                                         Destination d) {
+                                                         Destination d,
+                                                         Message m) {
 
         if (bfi == null) {
             EffectivePolicyImpl epi = createOutPolicyInfo();
             Assertor assertor = PolicyUtils.createAsserter(d);
-            epi.initialise(ei, boi, null, this, assertor);
+            epi.initialise(ei, boi, null, this, assertor, m);
             return epi;
         }
         bfi = mapToWrappedBindingFaultInfo(bfi);
@@ -251,7 +254,7 @@ public class PolicyEngineImpl implements
         if (null == effectivePolicy) {
             EffectivePolicyImpl epi = createOutPolicyInfo();
             Assertor assertor = PolicyUtils.createAsserter(d);
-            epi.initialise(ei, boi, bfi, this, assertor);
+            epi.initialise(ei, boi, bfi, this, assertor, m);
             bfi.setProperty(POLICY_INFO_FAULT_SERVER, epi);
             effectivePolicy = epi;
         }
@@ -274,26 +277,27 @@ public class PolicyEngineImpl implements
         bfi.setProperty(POLICY_INFO_FAULT_SERVER, ep);
     }
 
-    public EndpointPolicy getClientEndpointPolicy(EndpointInfo ei, Conduit conduit) {
+    public EndpointPolicy getClientEndpointPolicy(EndpointInfo ei, Conduit conduit, Message m) {
         Assertor assertor = PolicyUtils.createAsserter(conduit);
-        return getEndpointPolicy(ei, true, assertor);
+        return getEndpointPolicy(ei, true, assertor, m);
     }
    
-    public EndpointPolicy getServerEndpointPolicy(EndpointInfo ei, Destination destination) {
+    public EndpointPolicy getServerEndpointPolicy(EndpointInfo ei, Destination destination, Message m) {
         Assertor assertor = PolicyUtils.createAsserter(destination);
-        return getEndpointPolicy(ei, false, assertor);
+        return getEndpointPolicy(ei, false, assertor, m);
     }
 
     private EndpointPolicy getEndpointPolicy(
         EndpointInfo ei, 
         boolean isRequestor,
-        Assertor assertor) {
+        Assertor assertor,
+        Message m) {
         EndpointPolicy ep = (EndpointPolicy)ei.getProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT 
                             : POLICY_INFO_ENDPOINT_SERVER);
         if (null != ep) {
             return ep; 
         }
-        return createEndpointPolicyInfo(ei, isRequestor, assertor);
+        return createEndpointPolicyInfo(ei, isRequestor, assertor, m);
     }
 
     public void setClientEndpointPolicy(EndpointInfo ei, EndpointPolicy ep) {
@@ -305,11 +309,12 @@ public class PolicyEngineImpl implements
     }
 
     public EffectivePolicy getEffectiveServerRequestPolicy(EndpointInfo ei, 
-                                                           BindingOperationInfo boi) {
+                                                           BindingOperationInfo boi, 
+                                                           Message m) {
         EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_SERVER);
         if (null == effectivePolicy) {
             EffectivePolicyImpl epi = createOutPolicyInfo();
-            epi.initialise(ei, boi, this, false, true);
+            epi.initialise(ei, boi, this, false, true, m);
             boi.setProperty(POLICY_INFO_REQUEST_SERVER, epi);
             effectivePolicy = epi;
         }
@@ -321,11 +326,13 @@ public class PolicyEngineImpl implements
         boi.setProperty(POLICY_INFO_REQUEST_SERVER, ep);        
     }
 
-    public EffectivePolicy getEffectiveClientResponsePolicy(EndpointInfo ei, BindingOperationInfo boi) {
+    public EffectivePolicy getEffectiveClientResponsePolicy(EndpointInfo ei,
+                                                            BindingOperationInfo boi,
+                                                            Message m) {
         EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_CLIENT);
         if (null == effectivePolicy) {
             EffectivePolicyImpl epi = createOutPolicyInfo();
-            epi.initialise(ei, boi, this, true, false);        
+            epi.initialise(ei, boi, this, true, false, m);        
             boi.setProperty(POLICY_INFO_RESPONSE_CLIENT, epi);
             effectivePolicy = epi;
         }
@@ -337,15 +344,17 @@ public class PolicyEngineImpl implements
         boi.setProperty(POLICY_INFO_RESPONSE_CLIENT, ep);
     }
 
-    public EffectivePolicy getEffectiveClientFaultPolicy(EndpointInfo ei, BindingOperationInfo boi,
-                                                         BindingFaultInfo bfi) {
+    public EffectivePolicy getEffectiveClientFaultPolicy(EndpointInfo ei,
+                                                         BindingOperationInfo boi,
+                                                         BindingFaultInfo bfi,
+                                                         Message m) {
         EffectivePolicy effectivePolicy = null;
         if (bfi != null) {
             effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_CLIENT);
         }
         if (null == effectivePolicy) {
             EffectivePolicyImpl epi = createOutPolicyInfo();
-            epi.initialisePolicy(ei, boi, bfi, this);
+            epi.initialisePolicy(ei, boi, bfi, this, m);
             if (bfi != null) {
                 bfi.setProperty(POLICY_INFO_FAULT_CLIENT, epi);
             }
@@ -545,9 +554,10 @@ public class PolicyEngineImpl implements
 
     EndpointPolicyImpl createEndpointPolicyInfo(EndpointInfo ei, 
                                                 boolean isRequestor, 
-                                                Assertor assertor) {
+                                                Assertor assertor,
+                                                Message m) {
         EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, this, isRequestor, assertor);
-        epi.initialize();
+        epi.initialize(m);
         ei.setProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER, epi);
         return epi;
     }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java Wed Oct 16 19:14:45 2013
@@ -75,20 +75,19 @@ public class PolicyInInterceptor extends
         if (p != null) {
             EndpointPolicyImpl endpi = new EndpointPolicyImpl(p);
             EffectivePolicyImpl effectivePolicy = new EffectivePolicyImpl();
-            effectivePolicy.initialise(endpi, (PolicyEngineImpl)pe, true);
+            effectivePolicy.initialise(endpi, (PolicyEngineImpl)pe, true, msg);
             msg.put(EffectivePolicy.class, effectivePolicy);
             PolicyUtils.logPolicy(LOG, Level.FINEST, "Using effective policy: ", 
                                   effectivePolicy.getPolicy());
             
             interceptors.addAll(effectivePolicy.getInterceptors());
             assertions.addAll(effectivePolicy.getChosenAlternative());
-            
         } else if (MessageUtils.isRequestor(msg)) {
             // 2. Process client policy
             BindingOperationInfo boi = exchange.get(BindingOperationInfo.class);
             if (boi == null) {
                 Conduit conduit = exchange.getConduit(msg);
-                EndpointPolicy ep = pe.getClientEndpointPolicy(ei, conduit);
+                EndpointPolicy ep = pe.getClientEndpointPolicy(ei, conduit, msg);
                 if (ep != null) {
                     interceptors.addAll(ep.getInterceptors());
                     assertions.addAll(ep.getVocabulary());
@@ -97,7 +96,7 @@ public class PolicyInInterceptor extends
                 // We do not know the underlying message type yet - so we pre-emptively add interceptors 
                 // that can deal with any resposes or faults returned to this client endpoint.
                 
-                EffectivePolicy ep = pe.getEffectiveClientResponsePolicy(ei, boi);
+                EffectivePolicy ep = pe.getEffectiveClientResponsePolicy(ei, boi, msg);
                 if (ep != null) {
                     interceptors.addAll(ep.getInterceptors());
                     // insert assertions of endpoint's vocabulary into message
@@ -114,7 +113,7 @@ public class PolicyInInterceptor extends
             // We do not know the underlying message type yet - so we pre-emptively add interceptors 
             // that can deal with any messages to this endpoint
             
-            EndpointPolicy ep = pe.getServerEndpointPolicy(ei, destination);
+            EndpointPolicy ep = pe.getServerEndpointPolicy(ei, destination, msg);
             if (ep != null) {
                 interceptors.addAll(ep.getInterceptors());
                 assertions.addAll(ep.getVocabulary());

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java Wed Oct 16 19:14:45 2013
@@ -83,7 +83,7 @@ public class PolicyOutInterceptor extend
         if (p != null) {
             EndpointPolicyImpl endpi = new EndpointPolicyImpl(p);
             EffectivePolicyImpl effectivePolicy = new EffectivePolicyImpl();
-            effectivePolicy.initialise(endpi, (PolicyEngineImpl)pe, false);
+            effectivePolicy.initialise(endpi, (PolicyEngineImpl)pe, false, msg);
             msg.put(EffectivePolicy.class, effectivePolicy);
             PolicyUtils.logPolicy(LOG, Level.FINEST, "Using effective policy: ", 
                                   effectivePolicy.getPolicy());
@@ -95,7 +95,7 @@ public class PolicyOutInterceptor extend
             Conduit conduit = exchange.getConduit(msg);
             
             // add the required interceptors
-            EffectivePolicy effectivePolicy = pe.getEffectiveClientRequestPolicy(ei, boi, conduit);
+            EffectivePolicy effectivePolicy = pe.getEffectiveClientRequestPolicy(ei, boi, conduit, msg);
             msg.put(EffectivePolicy.class, effectivePolicy);
             if (effectivePolicy != null) {
                 PolicyUtils.logPolicy(
@@ -110,7 +110,7 @@ public class PolicyOutInterceptor extend
             List<List<Assertion>> incoming 
                 = CastUtils.cast((List<?>)exchange.get("ws-policy.validated.alternatives"));
             EffectivePolicy effectivePolicy 
-                = pe.getEffectiveServerResponsePolicy(ei, boi, destination, incoming);
+                = pe.getEffectiveServerResponsePolicy(ei, boi, destination, incoming, msg);
             msg.put(EffectivePolicy.class, effectivePolicy);
             if (effectivePolicy != null) {
                 PolicyUtils.logPolicy(

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java Wed Oct 16 19:14:45 2013
@@ -97,7 +97,7 @@ public class PolicyVerificationInFaultIn
         }
         getTransportAssertions(message);
         
-        EffectivePolicy effectivePolicy = pe.getEffectiveClientFaultPolicy(ei, boi, bfi);
+        EffectivePolicy effectivePolicy = pe.getEffectiveClientFaultPolicy(ei, boi, bfi, message);
         if (effectivePolicy != null) {
             aim.checkEffectivePolicy(effectivePolicy.getPolicy());
             LOG.fine("Verified policies for inbound message.");

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java Wed Oct 16 19:14:45 2013
@@ -92,9 +92,9 @@ public class PolicyVerificationInInterce
         EffectivePolicy effectivePolicy = message.get(EffectivePolicy.class);
         if (effectivePolicy == null) {
             if (MessageUtils.isRequestor(message)) {
-                effectivePolicy = pe.getEffectiveClientResponsePolicy(ei, boi);
+                effectivePolicy = pe.getEffectiveClientResponsePolicy(ei, boi, message);
             } else {
-                effectivePolicy = pe.getEffectiveServerRequestPolicy(ei, boi);
+                effectivePolicy = pe.getEffectiveServerRequestPolicy(ei, boi, message);
             }
         }
         try {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java Wed Oct 16 19:14:45 2013
@@ -93,7 +93,7 @@ public class ServerPolicyOutFaultInterce
         if (p != null) {
             EndpointPolicyImpl endpi = new EndpointPolicyImpl(p);
             EffectivePolicyImpl effectivePolicy = new EffectivePolicyImpl();
-            effectivePolicy.initialise(endpi, (PolicyEngineImpl)pe, false, true);
+            effectivePolicy.initialise(endpi, (PolicyEngineImpl)pe, false, true, msg);
             PolicyUtils.logPolicy(LOG, Level.FINEST, "Using effective policy: ", 
                                   effectivePolicy.getPolicy());
             
@@ -109,7 +109,7 @@ public class ServerPolicyOutFaultInterce
                 return;
             }
             
-            EffectivePolicy effectivePolicy = pe.getEffectiveServerFaultPolicy(ei, boi, bfi, destination);
+            EffectivePolicy effectivePolicy = pe.getEffectiveServerFaultPolicy(ei, boi, bfi, destination, msg);
             if (effectivePolicy != null) {
                 faultInterceptors.addAll(effectivePolicy.getInterceptors());
                 assertions.addAll(effectivePolicy.getChosenAlternative());            

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java Wed Oct 16 19:14:45 2013
@@ -108,7 +108,7 @@ public class WSPolicyFeature extends Abs
         Policy p = initializeEndpointPolicy(endpoint, bus);
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         EndpointInfo ei = endpoint.getEndpointInfo();
-        EndpointPolicy ep = pe.getClientEndpointPolicy(ei, null);
+        EndpointPolicy ep = pe.getClientEndpointPolicy(ei, null, null);
         pe.setClientEndpointPolicy(ei, ep.updatePolicy(p));
     }
 
@@ -118,7 +118,7 @@ public class WSPolicyFeature extends Abs
         Policy p = initializeEndpointPolicy(endpoint, bus);
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         EndpointInfo ei = endpoint.getEndpointInfo();
-        EndpointPolicy ep = pe.getServerEndpointPolicy(ei, null);
+        EndpointPolicy ep = pe.getServerEndpointPolicy(ei, null, null);
         pe.setServerEndpointPolicy(ei, ep.updatePolicy(p));
 
         // Add policy to the service model (and consequently to the WSDL)

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java Wed Oct 16 19:14:45 2013
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.policy.Assertor;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.neethi.Assertion;
@@ -33,8 +34,11 @@ import org.apache.neethi.Policy;
  */
 public class FirstAlternativeSelector extends BaseAlternativeSelector {
     
-    public Collection<Assertion> selectAlternative(Policy policy, PolicyEngine engine, Assertor assertor,
-                                                   List<List<Assertion>> request) {
+    public Collection<Assertion> selectAlternative(Policy policy,
+                                                   PolicyEngine engine,
+                                                   Assertor assertor,
+                                                   List<List<Assertion>> request,
+                                                   Message msg) {
 
         Iterator<List<Assertion>> alternatives = policy.getAlternatives();
         while (alternatives.hasNext()) {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java Wed Oct 16 19:14:45 2013
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.policy.Assertor;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.neethi.Assertion;
@@ -36,7 +37,8 @@ public class MaximalAlternativeSelector 
     public Collection<Assertion> selectAlternative(
         Policy policy, PolicyEngine engine, 
         Assertor assertor,
-        List<List<Assertion>> request) {
+        List<List<Assertion>> request,
+        Message msg) {
         Collection<Assertion> choice = null;
         Iterator<List<Assertion>> alternatives = policy.getAlternatives();
         while (alternatives.hasNext()) {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java Wed Oct 16 19:14:45 2013
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.policy.Assertor;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.neethi.Assertion;
@@ -36,7 +37,8 @@ public class MinimalAlternativeSelector 
     public Collection<Assertion> selectAlternative(
         Policy policy, PolicyEngine engine,
         Assertor assertor,
-        List<List<Assertion>> request) {
+        List<List<Assertion>> request,
+        Message msg) {
         
         Collection<Assertion> choice = null;
         Iterator<List<Assertion>> alternatives = policy.getAlternatives();

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java Wed Oct 16 19:14:45 2013
@@ -30,6 +30,7 @@ import javax.xml.namespace.QName;
 import org.apache.cxf.Bus;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -40,6 +41,7 @@ import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -102,7 +104,7 @@ public class EffectivePolicyImplTest ext
         effectivePolicy.initialiseInterceptors(pe, false);
         EasyMock.expectLastCall();
         control.replay();
-        effectivePolicy.initialise(endpointPolicy, pe, false);
+        effectivePolicy.initialise(endpointPolicy, pe, false, null);
         control.verify();    
     }
     
@@ -114,9 +116,10 @@ public class EffectivePolicyImplTest ext
                          PolicyEngine.class,
                          boolean.class,
                          boolean.class,
-                         Assertor.class});
+                         Assertor.class,
+                         Message.class});
         Method m2 = EffectivePolicyImpl.class.getDeclaredMethod("chooseAlternative",
-            new Class[] {PolicyEngine.class, Assertor.class});
+            new Class[] {PolicyEngine.class, Assertor.class, Message.class});
         Method m3 = EffectivePolicyImpl.class.getDeclaredMethod("initialiseInterceptors",
                                                           new Class[] {PolicyEngine.class});
         EffectivePolicyImpl effectivePolicy = EasyMock.createMockBuilder(EffectivePolicyImpl.class)
@@ -127,15 +130,15 @@ public class EffectivePolicyImplTest ext
         Assertor a = control.createMock(Assertor.class);
         boolean requestor = true;
        
-        effectivePolicy.initialisePolicy(ei, boi, pe, requestor, requestor, a);
+        effectivePolicy.initialisePolicy(ei, boi, pe, requestor, requestor, a, null);
         EasyMock.expectLastCall().andReturn(a);
-        effectivePolicy.chooseAlternative(pe, a);
+        effectivePolicy.chooseAlternative(pe, a, null);
         EasyMock.expectLastCall();
         effectivePolicy.initialiseInterceptors(pe, false);
         EasyMock.expectLastCall();
         
         control.replay();
-        effectivePolicy.initialise(ei, boi, pe, a, requestor, requestor);
+        effectivePolicy.initialise(ei, boi, pe, a, requestor, requestor, null);
         control.verify();        
     }
     
@@ -143,9 +146,9 @@ public class EffectivePolicyImplTest ext
     public void testInitialiseFault() throws NoSuchMethodException {
         Method m1 = EffectivePolicyImpl.class.getDeclaredMethod("initialisePolicy",
             new Class[] {EndpointInfo.class, BindingOperationInfo.class,
-                         BindingFaultInfo.class, PolicyEngine.class});
+                         BindingFaultInfo.class, PolicyEngine.class, Message.class});
         Method m2 = EffectivePolicyImpl.class.getDeclaredMethod("chooseAlternative",
-            new Class[] {PolicyEngine.class, Assertor.class});
+            new Class[] {PolicyEngine.class, Assertor.class, Message.class});
         Method m3 = EffectivePolicyImpl.class.getDeclaredMethod("initialiseInterceptors",
                                                           new Class[] {PolicyEngine.class});
         EffectivePolicyImpl effectivePolicy = EasyMock.createMockBuilder(EffectivePolicyImpl.class)
@@ -155,15 +158,15 @@ public class EffectivePolicyImplTest ext
         PolicyEngineImpl pe = new PolicyEngineImpl();
         Assertor a = control.createMock(Assertor.class);
        
-        effectivePolicy.initialisePolicy(ei, null, bfi, pe);
+        effectivePolicy.initialisePolicy(ei, null, bfi, pe, null);
         EasyMock.expectLastCall();
-        effectivePolicy.chooseAlternative(pe, a);
+        effectivePolicy.chooseAlternative(pe, a, null);
         EasyMock.expectLastCall();
         effectivePolicy.initialiseInterceptors(pe, false);
         EasyMock.expectLastCall();
         
         control.replay();
-        effectivePolicy.initialise(ei, null, bfi, pe, a);
+        effectivePolicy.initialise(ei, null, bfi, pe, a, null);
         control.verify();        
     }
     
@@ -190,9 +193,9 @@ public class EffectivePolicyImplTest ext
                 
         EndpointPolicy effectivePolicy = control.createMock(EndpointPolicy.class);
         if (requestor) {
-            EasyMock.expect(engine.getClientEndpointPolicy(ei, (Conduit)null)).andReturn(effectivePolicy);
+            EasyMock.expect(engine.getClientEndpointPolicy(ei, (Conduit)null, null)).andReturn(effectivePolicy);
         } else {
-            EasyMock.expect(engine.getServerEndpointPolicy(ei, (Destination)null)).andReturn(effectivePolicy);
+            EasyMock.expect(engine.getServerEndpointPolicy(ei, (Destination)null, null)).andReturn(effectivePolicy);
         }
         Policy ep = control.createMock(Policy.class);
         EasyMock.expect(effectivePolicy.getPolicy()).andReturn(ep);        
@@ -207,13 +210,14 @@ public class EffectivePolicyImplTest ext
         
         control.replay();
         EffectivePolicyImpl epi = new EffectivePolicyImpl();
-        epi.initialisePolicy(ei, boi, engine, requestor, requestor, null);
+        epi.initialisePolicy(ei, boi, engine, requestor, requestor, null, null);
         assertSame(merged, epi.getPolicy());
         control.verify();
     }
     
     @Test
-    public void testInitialiseServerFaultPolicy() {        
+    public void testInitialiseServerFaultPolicy() { 
+        Message m = new MessageImpl();
         EndpointInfo ei = control.createMock(EndpointInfo.class);
         BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
         PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
@@ -221,7 +225,7 @@ public class EffectivePolicyImplTest ext
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
         EasyMock.expect(bfi.getBindingOperation()).andReturn(boi).anyTimes();               
         EndpointPolicy endpointPolicy = control.createMock(EndpointPolicy.class);        
-        EasyMock.expect(engine.getServerEndpointPolicy(ei, (Destination)null)).andReturn(endpointPolicy);
+        EasyMock.expect(engine.getServerEndpointPolicy(ei, (Destination)null, m)).andReturn(endpointPolicy);
         Policy ep = control.createMock(Policy.class);
         EasyMock.expect(endpointPolicy.getPolicy()).andReturn(ep);        
         Policy op = control.createMock(Policy.class);
@@ -235,13 +239,14 @@ public class EffectivePolicyImplTest ext
         
         control.replay();
         EffectivePolicyImpl epi = new EffectivePolicyImpl();
-        epi.initialisePolicy(ei, boi, bfi, engine);
+        epi.initialisePolicy(ei, boi, bfi, engine, m);
         assertSame(merged, epi.getPolicy());
         control.verify();
     }
     
     @Test
     public void testChooseAlternative() {
+        Message m = new MessageImpl();
         EffectivePolicyImpl epi = new EffectivePolicyImpl();        
         Policy policy = new Policy();
         epi.setPolicy(policy);        
@@ -249,11 +254,11 @@ public class EffectivePolicyImplTest ext
         Assertor assertor = control.createMock(Assertor.class);
         AlternativeSelector selector = control.createMock(AlternativeSelector.class);
         EasyMock.expect(engine.getAlternativeSelector()).andReturn(selector);
-        EasyMock.expect(selector.selectAlternative(policy, engine, assertor, null)).andReturn(null);
+        EasyMock.expect(selector.selectAlternative(policy, engine, assertor, null, m)).andReturn(null);
         
         control.replay();
         try {
-            epi.chooseAlternative(engine, assertor);  
+            epi.chooseAlternative(engine, assertor, m);  
             fail("Expected PolicyException not thrown.");
         } catch (PolicyException ex) {
             // expected
@@ -263,9 +268,9 @@ public class EffectivePolicyImplTest ext
         control.reset();        
         EasyMock.expect(engine.getAlternativeSelector()).andReturn(selector);
         Collection<Assertion> alternative = new ArrayList<Assertion>();
-        EasyMock.expect(selector.selectAlternative(policy, engine, assertor, null)).andReturn(alternative);
+        EasyMock.expect(selector.selectAlternative(policy, engine, assertor, null, m)).andReturn(alternative);
         control.replay();        
-        epi.chooseAlternative(engine, assertor);
+        epi.chooseAlternative(engine, assertor, m);
         Collection<Assertion> choice = epi.getChosenAlternative();
         assertSame(choice, alternative);   
         control.verify();
@@ -308,8 +313,8 @@ public class EffectivePolicyImplTest ext
         
         control.reset();
         setupPolicyInterceptorProviderRegistry(engine, reg);
-        List<Interceptor<? extends Message>> m = new ArrayList<Interceptor<? extends Message>>();
-        setupRegistryInterceptors(useIn, fault, reg, null, m);
+        List<Interceptor<? extends Message>> il = new ArrayList<Interceptor<? extends Message>>();
+        setupRegistryInterceptors(useIn, fault, reg, null, il);
         PolicyAssertion a = control.createMock(PolicyAssertion.class);        
         alternative.add(a);
         control.replay();
@@ -321,8 +326,8 @@ public class EffectivePolicyImplTest ext
         setupPolicyInterceptorProviderRegistry(engine, reg);
         QName qn = new QName("http://x.y.z", "a");
         EasyMock.expect(a.getName()).andReturn(qn);
-        m = new ArrayList<Interceptor<? extends Message>>();
-        setupRegistryInterceptors(useIn, fault, reg, qn, m);
+        il = new ArrayList<Interceptor<? extends Message>>();
+        setupRegistryInterceptors(useIn, fault, reg, qn, il);
         control.replay();
         epi.initialiseInterceptors(engine, useIn, fault);
         assertEquals(0, epi.getInterceptors().size());
@@ -332,9 +337,9 @@ public class EffectivePolicyImplTest ext
         setupPolicyInterceptorProviderRegistry(engine, reg);
         EasyMock.expect(a.getName()).andReturn(qn);        
         Interceptor<Message> pi = control.createMock(Interceptor.class);
-        m = new ArrayList<Interceptor<? extends Message>>();
-        m.add(pi);
-        setupRegistryInterceptors(useIn, fault, reg, qn, m);
+        il = new ArrayList<Interceptor<? extends Message>>();
+        il.add(pi);
+        setupRegistryInterceptors(useIn, fault, reg, qn, il);
         control.replay();
         epi.initialiseInterceptors(engine, useIn, fault);
         assertEquals(1, epi.getInterceptors().size());

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java?rev=1532864&r1=1532863&r2=1532864&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java Wed Oct 16 19:14:45 2013
@@ -31,6 +31,7 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.neethi.All;
@@ -41,6 +42,7 @@ import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyOperator;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -59,7 +61,7 @@ public class EndpointPolicyImplTest exte
         }
 
         @Override
-        void finalizeConfig() {
+        void finalizeConfig(Message m) {
         }
     };
 
@@ -107,11 +109,12 @@ public class EndpointPolicyImplTest exte
 
     @Test
     public void testInitialize() throws NoSuchMethodException {
+        Message m = new MessageImpl();
         Method m1 = EndpointPolicyImpl.class.getDeclaredMethod("initializePolicy", new Class[] {});
         Method m2 = EndpointPolicyImpl.class.getDeclaredMethod("checkExactlyOnes", new Class[] {});
-        Method m3 = EndpointPolicyImpl.class.getDeclaredMethod("chooseAlternative", new Class[] {});
-        Method m4 = EndpointPolicyImpl.class.getDeclaredMethod("initializeVocabulary", new Class[] {});
-        Method m5 = EndpointPolicyImpl.class.getDeclaredMethod("initializeInterceptors", new Class[] {});
+        Method m3 = EndpointPolicyImpl.class.getDeclaredMethod("chooseAlternative", new Class[] {Message.class});
+        Method m4 = EndpointPolicyImpl.class.getDeclaredMethod("initializeVocabulary", new Class[] {Message.class});
+        Method m5 = EndpointPolicyImpl.class.getDeclaredMethod("initializeInterceptors", new Class[] {Message.class});
         EndpointPolicyImpl epi = EasyMock.createMockBuilder(EndpointPolicyImpl.class)
             .addMockedMethods(m1, m2, m3, m4, m5).createMock(control);
 
@@ -119,11 +122,11 @@ public class EndpointPolicyImplTest exte
         EasyMock.expectLastCall();
         epi.checkExactlyOnes();
         EasyMock.expectLastCall();
-        epi.chooseAlternative();
+        epi.chooseAlternative(m);
         EasyMock.expectLastCall();
 
         control.replay();
-        epi.initialize();
+        epi.initialize(m);
         control.verify();
     }
 
@@ -156,15 +159,16 @@ public class EndpointPolicyImplTest exte
         Assertor assertor = control.createMock(Assertor.class);
         AlternativeSelector selector = control.createMock(AlternativeSelector.class);
 
+        Message m = new MessageImpl();
         EndpointPolicyImpl epi = new EndpointPolicyImpl(null, engine, true, assertor);
         epi.setPolicy(policy);
 
         EasyMock.expect(engine.getAlternativeSelector()).andReturn(selector);
-        EasyMock.expect(selector.selectAlternative(policy, engine, assertor, null)).andReturn(null);
+        EasyMock.expect(selector.selectAlternative(policy, engine, assertor, null, m)).andReturn(null);
 
         control.replay();
         try {
-            epi.chooseAlternative();
+            epi.chooseAlternative(m);
             fail("Expected PolicyException not thrown.");
         } catch (PolicyException ex) {
             // expected
@@ -174,9 +178,9 @@ public class EndpointPolicyImplTest exte
         control.reset();
         EasyMock.expect(engine.getAlternativeSelector()).andReturn(selector);
         Collection<Assertion> alternative = new ArrayList<Assertion>();
-        EasyMock.expect(selector.selectAlternative(policy, engine, assertor, null)).andReturn(alternative);
+        EasyMock.expect(selector.selectAlternative(policy, engine, assertor, null, m)).andReturn(alternative);
         control.replay();
-        epi.chooseAlternative();
+        epi.chooseAlternative(m);
         Collection<Assertion> choice = epi.getChosenAlternative();
         assertSame(choice, alternative);
         control.verify();
@@ -319,7 +323,8 @@ public class EndpointPolicyImplTest exte
         }
 
         control.replay();
-        epi.initializeInterceptors();
+        Message m = new MessageImpl();
+        epi.initializeInterceptors(m);
         assertEquals(1, epi.getInterceptors().size());
         assertSame(api, epi.getInterceptors().get(0));
         if (requestor) {