cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r617250 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/ rt/ws/rm/s...
Date Thu, 31 Jan 2008 21:42:33 GMT
Author: dkulp
Date: Thu Jan 31 13:42:25 2008
New Revision: 617250

URL: http://svn.apache.org/viewvc?rev=617250&view=rev
Log:
[CXF-1409] Patch from Sergey applied.  Thanks!
* Fixes Endpoint polices referenced from WSPolicyFeature can not be applied if EndpointPolicy already exists


Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl2.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/greeter.wsdl   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml   (with props)
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java Thu Jan 31 13:42:25 2008
@@ -35,6 +35,7 @@
 public interface EndpointPolicy {
     
     Policy getPolicy();
+    EndpointPolicy updatePolicy(Policy p);
     
     Collection<Assertion> getChosenAlternative();
     

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java Thu Jan 31 13:42:25 2008
@@ -70,10 +70,10 @@
     // available throughout the inbound path
         
     EndpointPolicy getClientEndpointPolicy(EndpointInfo ei, Conduit conduit);
-    
     EndpointPolicy getServerEndpointPolicy(EndpointInfo ei, Destination destination);
     
-    void setEndpointPolicy(EndpointInfo ei, EndpointPolicy ep);  
+    void setServerEndpointPolicy(EndpointInfo ei, EndpointPolicy ep);
+    void setClientEndpointPolicy(EndpointInfo ei, EndpointPolicy ep);
     
     // only available after message type has been determined
     

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java Thu Jan 31 13:42:25 2008
@@ -35,6 +35,7 @@
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.neethi.Assertion;
+import org.apache.neethi.ExactlyOne;
 import org.apache.neethi.Policy;
 
 /**
@@ -51,10 +52,38 @@
     private List<Interceptor> interceptors;
     private List<Interceptor> faultInterceptors;
     
+    private EndpointInfo ei;
+    private PolicyEngineImpl engine;
+    private boolean requestor;
+    private Assertor assertor;
+        
+    public EndpointPolicyImpl() {
+        
+    }
+    
+    public EndpointPolicyImpl(EndpointInfo ei,
+                              PolicyEngineImpl engine, 
+                              boolean requestor,
+                              Assertor assertor) {
+        this.ei = ei;
+        this.engine = engine;
+        this.requestor = requestor;
+        this.assertor = assertor;
+    }
+        
     public Policy getPolicy() {
         return policy;        
     }
     
+    public EndpointPolicy updatePolicy(Policy p) {
+        EndpointPolicyImpl epi = createEndpointPolicy();
+        Policy np = (Policy)p.normalize(true);
+        epi.setPolicy(getPolicy().merge(np));
+        epi.checkExactlyOnes();
+        epi.finalizeConfig();
+        return epi;
+    }
+    
     public Collection<Assertion> getChosenAlternative() {
         return chosenAlternative;
     }
@@ -75,21 +104,27 @@
         return faultInterceptors;
     }
     
+    void initialize() {
+        initializePolicy();
+        checkExactlyOnes();
+        finalizeConfig();
+    }
     
-    void initialise(EndpointInfo ei, boolean isRequestor, PolicyEngineImpl engine, Assertor assertor) {
-        initialisePolicy(ei, engine);
-        chooseAlternative(engine, assertor);
-        initialiseVocabulary(ei, isRequestor, engine);
-        initialiseInterceptors(ei, isRequestor, engine); 
+    void finalizeConfig() {
+        chooseAlternative();
+        initializeVocabulary();
+        initializeInterceptors(); 
     }
    
-    void initialisePolicy(EndpointInfo ei, PolicyEngineImpl engine) {
+    void initializePolicy() {
         policy = engine.getAggregatedServicePolicy(ei.getService());
         policy = policy.merge(engine.getAggregatedEndpointPolicy(ei));
-        policy = (Policy)policy.normalize(true);
+        if (!policy.isEmpty()) {
+            policy = (Policy)policy.normalize(true);
+        }
     }
 
-    void chooseAlternative(PolicyEngineImpl engine, Assertor assertor) {
+    void chooseAlternative() {
         Collection<Assertion> alternative = engine.getAlternativeSelector()
             .selectAlternative(policy, engine, assertor);
         if (null == alternative) {
@@ -99,7 +134,7 @@
         }
     }
     
-    void initialiseVocabulary(EndpointInfo ei, boolean requestor, PolicyEngineImpl engine) {
+    void initializeVocabulary() {
         vocabulary = new ArrayList<Assertion>();
         if (requestor) {
             faultVocabulary = new ArrayList<Assertion>();
@@ -143,7 +178,7 @@
         }
     }
 
-    void initialiseInterceptors(EndpointInfo ei, boolean requestor, PolicyEngineImpl engine) {
+    void initializeInterceptors() {
         PolicyInterceptorProviderRegistry reg 
             = engine.getBus().getExtension(PolicyInterceptorProviderRegistry.class);
         interceptors = new ArrayList<Interceptor>();
@@ -206,5 +241,37 @@
         faultInterceptors = inFault;
     }
     
-    
+    protected EndpointPolicyImpl createEndpointPolicy() {
+        return new EndpointPolicyImpl(this.ei,
+                                      this.engine,
+                                      this.requestor,
+                                      this.assertor);
+    }
+    
+    void checkExactlyOnes() {
+        // Policy has been normalized and merged by now but unfortunately
+        // ExactlyOnce have not been normalized properly by Neethi, for ex
+        // <Policy>
+        // <ExactlyOne><All><A></All></ExactlyOne>
+        // <ExactlyOne><All><B></All></ExactlyOne>
+        //  </Policy>
+        // this is what we can see after the normalization happens but in fact this
+        // is still unnormalized expression, should be
+        // <Policy>
+        // <ExactlyOne><All><A></All><All><B></All></ExactlyOne>
+        // </Policy>
+                
+        List<?> assertions = policy.getPolicyComponents();
+        if (assertions.size() <= 1) {
+            return;
+        }
+        
+        Policy p = new Policy();
+        ExactlyOne alternatives = new ExactlyOne();
+        p.addPolicyComponent(alternatives);
+        for (Object a : assertions) {
+            alternatives.addPolicyComponents(((ExactlyOne)a).getPolicyComponents());
+        }
+        setPolicy(p);        
+    }
 }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Thu Jan 31 13:42:25 2008
@@ -65,18 +65,13 @@
     private AlternativeSelector alternativeSelector;
     
     private Map<BindingOperation, EffectivePolicy> clientRequestInfo;
-    
     private Map<BindingOperation, EffectivePolicy> clientResponseInfo;
-    
     private Map<BindingFault, EffectivePolicy> clientFaultInfo;
-    
     private Map<BindingOperation, EffectivePolicy> serverRequestInfo;
-    
     private Map<BindingOperation, EffectivePolicy> serverResponseInfo;
-    
     private Map<BindingFault, EffectivePolicy> serverFaultInfo;
-    
-    private Map<EndpointInfo, EndpointPolicy> endpointInfo;
+    private Map<EndpointInfo, EndpointPolicy> serverEndpointInfo;
+    private Map<EndpointInfo, EndpointPolicy> clientEndpointInfo;
 
     public PolicyEngineImpl() { 
         init();
@@ -214,25 +209,30 @@
     }
     
     public EndpointPolicy getClientEndpointPolicy(EndpointInfo ei, Conduit conduit) {
-        EndpointPolicy endpointPolicy = endpointInfo.get(ei);
-        if (null != endpointPolicy) {
-            return endpointPolicy;
-        }
         Assertor assertor = conduit instanceof Assertor ? (Assertor)conduit : null;
-        return createEndpointPolicyInfo(ei, true, assertor);
+        return getEndpointPolicy(ei, clientEndpointInfo.get(ei), true, assertor);
     }
    
     public EndpointPolicy getServerEndpointPolicy(EndpointInfo ei, Destination destination) {
-        EndpointPolicy endpointPolicy = endpointInfo.get(ei);
-        if (null != endpointPolicy) {
-            return endpointPolicy;
-        }
+        
         Assertor assertor = destination instanceof Assertor ? (Assertor)destination : null;
-        return createEndpointPolicyInfo(ei, false, assertor);
+        return getEndpointPolicy(ei, serverEndpointInfo.get(ei), false, assertor);
+    }
+    
+    private EndpointPolicy getEndpointPolicy(
+        EndpointInfo ei, EndpointPolicy ep, boolean isRequestor, Assertor assertor) {
+        if (null != ep) {
+            return ep; 
+        }
+        return createEndpointPolicyInfo(ei, isRequestor, assertor);
     }
     
-    public void setEndpointPolicy(EndpointInfo ei, EndpointPolicy ep) {
-        endpointInfo.put(ei, ep);
+    public void setClientEndpointPolicy(EndpointInfo ei, EndpointPolicy ep) {
+        clientEndpointInfo.put(ei, ep);
+    }
+    
+    public void setServerEndpointPolicy(EndpointInfo ei, EndpointPolicy ep) {
+        serverEndpointInfo.put(ei, ep);
     }
     
     public EffectivePolicy getEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi) {
@@ -303,7 +303,9 @@
         clientFaultInfo 
             = new ConcurrentHashMap<BindingFault, EffectivePolicy>();
     
-        endpointInfo 
+        serverEndpointInfo 
+            = new ConcurrentHashMap<EndpointInfo, EndpointPolicy>();
+        clientEndpointInfo 
             = new ConcurrentHashMap<EndpointInfo, EndpointPolicy>();
     
         serverRequestInfo 
@@ -496,13 +498,16 @@
     } 
     
     EndpointPolicyImpl createEndpointPolicyInfo(EndpointInfo ei, boolean isRequestor, Assertor assertor) {
-        EndpointPolicyImpl epi = createEndpointPolicyInfo();
-        epi.initialise(ei, isRequestor, this, assertor);
-        endpointInfo.put(ei, epi);
+        EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, this, isRequestor, assertor);
+        epi.initialize();
+        
+        Map<EndpointInfo, EndpointPolicy> map = isRequestor ? clientEndpointInfo : serverEndpointInfo;
+        map.put(ei, epi);
 
         return epi;
-    }  
-
+    }
+    
+    
     /**
      * Check if a given list of assertions can potentially be supported by
      * interceptors or by an already installed assertor (a conduit or transport
@@ -530,7 +535,7 @@
 
     public void stopServer(Server server) {
         EndpointInfo ei = server.getEndpoint().getEndpointInfo();
-        endpointInfo.remove(ei);
+        serverEndpointInfo.remove(ei);
     }
     
     /**
@@ -615,7 +620,5 @@
         return new EffectivePolicyImpl();
     }
     
-    EndpointPolicyImpl createEndpointPolicyInfo() {
-        return new EndpointPolicyImpl();
-    }
+    
 }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java Thu Jan 31 13:42:25 2008
@@ -21,7 +21,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.List;
 import java.util.ResourceBundle;
 
 import org.w3c.dom.Element;
@@ -33,7 +32,7 @@
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.AbstractFeature;
-import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.ws.policy.attachment.reference.ReferenceResolver;
 import org.apache.cxf.ws.policy.attachment.reference.RemoteReferenceResolver;
 import org.apache.neethi.Policy;
@@ -104,18 +103,24 @@
     @Override
     public void initialize(Client client, Bus bus) {
         Endpoint endpoint = client.getEndpoint();
-        
-        intializeEndpoint(endpoint, bus);
+        Policy p = initializeEndpointPolicy(endpoint, bus);
+        PolicyEngine pe = bus.getExtension(PolicyEngine.class);
+        EndpointInfo ei = endpoint.getEndpointInfo();
+        EndpointPolicy ep = pe.getClientEndpointPolicy(ei, null);
+        pe.setClientEndpointPolicy(ei, ep.updatePolicy(p));
     }
 
     @Override
     public void initialize(Server server, Bus bus) {
         Endpoint endpoint = server.getEndpoint();
-        
-        intializeEndpoint(endpoint, bus);
+        Policy p = initializeEndpointPolicy(endpoint, bus);
+        PolicyEngine pe = bus.getExtension(PolicyEngine.class);
+        EndpointInfo ei = endpoint.getEndpointInfo();
+        EndpointPolicy ep = pe.getServerEndpointPolicy(ei, null);
+        pe.setServerEndpointPolicy(ei, ep.updatePolicy(p));
     }
 
-    private void intializeEndpoint(Endpoint endpoint, Bus bus) {
+    private Policy initializeEndpointPolicy(Endpoint endpoint, Bus bus) {
         
         initialize(bus);
         
@@ -139,20 +144,21 @@
             }
         } 
         
-        List<ServiceInfo> sis = endpoint.getService().getServiceInfos();
-        for (ServiceInfo si : sis) {
-            if (policies != null) {
-                for (Policy p : policies) {
-                    si.addExtensor(p);
-                }
+        Policy thePolicy = new Policy();
+        
+        if (policies != null) {
+            for (Policy p : policies) {
+                thePolicy = thePolicy.merge(p);
             }
-            
-            if (loadedPolicies != null) {
-                for (Policy p : loadedPolicies) {
-                    si.addExtensor(p);
-                }
+        }
+        
+        if (loadedPolicies != null) {
+            for (Policy p : loadedPolicies) {
+                thePolicy = thePolicy.merge(p);
             }
         }
+        
+        return thePolicy;
     }
     
     public Collection<Policy> getPolicies() {
@@ -210,6 +216,7 @@
         if (null == p) {
             throw new PolicyException(new Message("UNRESOLVED_POLICY_REFERENCE_EXC", BUNDLE, ref.getURI()));
         }
+        
         return p;
     }   
     

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java Thu Jan 31 13:42:25 2008
@@ -29,6 +29,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingInfo;
@@ -36,7 +37,10 @@
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.neethi.All;
 import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+import org.apache.neethi.ExactlyOne;
 import org.apache.neethi.Policy;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
@@ -50,6 +54,15 @@
 public class EndpointPolicyImplTest extends Assert {
 
     private IMocksControl control;
+    final class TestEndpointPolicy extends EndpointPolicyImpl {
+        @Override
+        protected EndpointPolicyImpl createEndpointPolicy() {
+            return new TestEndpointPolicy();
+        }
+        @Override 
+        void finalizeConfig() {
+        }
+    };
     
     @Before
     public void setUp() {
@@ -88,36 +101,36 @@
     }
     
     @Test
-    public void testInitialise() throws NoSuchMethodException {
-        Method m1 = EndpointPolicyImpl.class.getDeclaredMethod("initialisePolicy",
-            new Class[] {EndpointInfo.class, PolicyEngineImpl.class});
-        Method m2 = EndpointPolicyImpl.class.getDeclaredMethod("chooseAlternative",
-            new Class[] {PolicyEngineImpl.class, Assertor.class});
-        Method m3 = EndpointPolicyImpl.class.getDeclaredMethod("initialiseVocabulary",
-            new Class[] {EndpointInfo.class, boolean.class, PolicyEngineImpl.class});
-        Method m4 = EndpointPolicyImpl.class.getDeclaredMethod("initialiseInterceptors",
-            new Class[] {EndpointInfo.class, boolean.class, PolicyEngineImpl.class});
+    public void testInitialize() throws NoSuchMethodException {
+        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[] {});
         EndpointPolicyImpl epi = control.createMock(EndpointPolicyImpl.class, 
-                                                    new Method[] {m1, m2, m3, m4});
-        EndpointInfo ei = control.createMock(EndpointInfo.class);
-        boolean isRequestor = false;
-        PolicyEngineImpl pe = control.createMock(PolicyEngineImpl.class);
-        Assertor a = control.createMock(Assertor.class);
+                                                    new Method[] {m1, m2, m3, m4, m5});
          
-        epi.initialisePolicy(ei, pe);
+        epi.initializePolicy();
         EasyMock.expectLastCall();
-        epi.chooseAlternative(pe, a);
+        epi.checkExactlyOnes();
         EasyMock.expectLastCall();
-        epi.initialiseInterceptors(ei, isRequestor, pe); 
+        epi.chooseAlternative();
+        EasyMock.expectLastCall();
+        epi.initializeInterceptors(); 
         EasyMock.expectLastCall();
         
         control.replay();
-        epi.initialise(ei, isRequestor, pe, a);
+        epi.initialize();
         control.verify();        
     }
     
     @Test
-    public void testInitialisePolicy() {        
+    public void testInitializePolicy() {        
         EndpointInfo ei = control.createMock(EndpointInfo.class);
         PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
         ServiceInfo si = control.createMock(ServiceInfo.class);
@@ -131,26 +144,29 @@
         EasyMock.expect(merged.normalize(true)).andReturn(merged);
         
         control.replay();
-        EndpointPolicyImpl epi = new EndpointPolicyImpl();
-        epi.initialisePolicy(ei, engine);
+        EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, engine, true, null);
+        epi.initializePolicy();
         assertSame(merged, epi.getPolicy());
         control.verify();
     }
        
     @Test
     public void testChooseAlternative() {
-        EndpointPolicyImpl epi = new EndpointPolicyImpl();        
         Policy policy = new Policy();
-        epi.setPolicy(policy);        
+        
         PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
         Assertor assertor = control.createMock(Assertor.class);
         AlternativeSelector selector = control.createMock(AlternativeSelector.class);
+        
+        EndpointPolicyImpl epi = new EndpointPolicyImpl(null, engine, true, assertor);
+        epi.setPolicy(policy);        
+        
         EasyMock.expect(engine.getAlternativeSelector()).andReturn(selector);
         EasyMock.expect(selector.selectAlternative(policy, engine, assertor)).andReturn(null);
         
         control.replay();
         try {
-            epi.chooseAlternative(engine, assertor);  
+            epi.chooseAlternative();  
             fail("Expected PolicyException not thrown.");
         } catch (PolicyException ex) {
             // expected
@@ -162,7 +178,7 @@
         Collection<Assertion> alternative = new ArrayList<Assertion>();
         EasyMock.expect(selector.selectAlternative(policy, engine, assertor)).andReturn(alternative);
         control.replay();        
-        epi.chooseAlternative(engine, assertor);
+        epi.chooseAlternative();
         Collection<Assertion> choice = epi.getChosenAlternative();
         assertSame(choice, alternative);   
         control.verify();
@@ -170,16 +186,20 @@
     
     @Test
     public void testInitialiseVocabularyServer() {
-        dotestInitialiseVocabulary(false);
+        dotestInitializeVocabulary(false);
     }
     
     @Test
     public void testInitialiseVocabularyClient() {
-        dotestInitialiseVocabulary(true);
+        dotestInitializeVocabulary(true);
     }
     
-    private void dotestInitialiseVocabulary(boolean requestor) {
-        EndpointPolicyImpl epi = new EndpointPolicyImpl();   
+    private void dotestInitializeVocabulary(boolean requestor) {
+        
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
+        
+        EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, engine, requestor, null);   
         List<Assertion> alternative = new ArrayList<Assertion>();
         epi.setChosenAlternative(alternative);
         Assertion ea = control.createMock(Assertion.class);        
@@ -189,12 +209,11 @@
         alternative.add(eaOpt);
         EasyMock.expect(eaOpt.isOptional()).andReturn(true);
         
-        EndpointInfo ei = control.createMock(EndpointInfo.class);
         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));
-        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
+        
         Policy op = control.createMock(Policy.class);
         EasyMock.expect(engine.getAggregatedOperationPolicy(boi)).andReturn(op);
         Assertion oa = control.createMock(Assertion.class);
@@ -220,7 +239,7 @@
         }
         
         control.replay();
-        epi.initialiseVocabulary(ei, requestor, engine);
+        epi.initializeVocabulary();
         Collection<Assertion> expected = new ArrayList<Assertion>();
         expected.add(ea);
         expected.add(oa);
@@ -256,32 +275,79 @@
     }
     
     @Test
+    public void testUpdatePolicy() {
+        
+        EndpointPolicyImpl epi = new TestEndpointPolicy();
+        
+        Policy p1 = new Policy();
+        QName aqn1 = new QName("http://x.y.z", "a");
+        p1.addAssertion(mockAssertion(aqn1, 5, true));
+        
+        Policy p2 = new Policy();
+        QName aqn2 = new QName("http://x.y.z", "b");
+        p2.addAssertion(mockAssertion(aqn2, 5, true));
+        control.replay();
+        
+        epi.setPolicy((Policy)p1.normalize(true));
+                
+        Policy ep = epi.updatePolicy(p2).getPolicy();
+        
+        List<ExactlyOne> pops = 
+            CastUtils.cast(ep.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("2 alternatives should be available", 2, alts.size());
+        
+        List<Assertion> assertions1 = 
+            CastUtils.cast(alts.get(0).getAssertions(), Assertion.class);
+        assertEquals("1 assertion should be available", 1, assertions1.size());
+            
+        List<Assertion> assertions2 = 
+                CastUtils.cast(alts.get(1).getAssertions(), Assertion.class);
+        assertEquals("1 assertion should be available", 1, assertions2.size());    
+        
+        QName n1 = assertions1.get(0).getName();
+        QName n2 = assertions2.get(0).getName();
+        assertTrue("Policy was not merged",
+                   n1.equals(aqn1) && n2.equals(aqn2) || n1.equals(aqn2) && n2.equals(aqn1));
+    }
+    
+    private Assertion mockAssertion(QName name, int howMany, boolean normalize) {
+        Assertion a = control.createMock(Assertion.class);        
+        EasyMock.expect(a.getName()).andReturn(name).times(howMany);
+        if (normalize) {
+            EasyMock.expect(a.getType()).andReturn(Constants.TYPE_ASSERTION).times(howMany);
+            EasyMock.expect(a.normalize()).andReturn(a).times(howMany);
+        }
+        return a;
+    }
+    
+    @Test
     public void testInitialiseInterceptorsServer() {
-        doTestInitialiseInterceptors(false);
+        doTestInitializeInterceptors(false);
     }
     
     @Test
     public void testInitialiseInterceptorsClient() {
-        doTestInitialiseInterceptors(true);
+        doTestInitializeInterceptors(true);
     }
     
-    private void doTestInitialiseInterceptors(boolean requestor) {
-        EndpointPolicyImpl epi = new EndpointPolicyImpl();        
+    private void doTestInitializeInterceptors(boolean requestor) {
+        
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
+        
+        EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, engine, requestor, null);        
         Collection<Assertion> v = new ArrayList<Assertion>();
         Collection<Assertion> fv = new ArrayList<Assertion>();
-        Assertion a = control.createMock(Assertion.class);        
-        v.add(a);
         QName aqn = new QName("http://x.y.z", "a");
-        EasyMock.expect(a.getName()).andReturn(aqn).times(requestor ? 2 : 1);
-        Assertion aa = control.createMock(Assertion.class);        
-        v.add(aa);
-        EasyMock.expect(aa.getName()).andReturn(aqn).times(requestor ? 2 : 1);
+        v.add(mockAssertion(aqn, requestor ? 2 : 1, false));
+        v.add(mockAssertion(aqn, requestor ? 2 : 1, false));
         fv.addAll(v);
         epi.setVocabulary(v);
         epi.setFaultVocabulary(fv);
         
-        EndpointInfo ei = control.createMock(EndpointInfo.class);
-        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
         PolicyInterceptorProviderRegistry reg = control.createMock(PolicyInterceptorProviderRegistry.class);
         setupPolicyInterceptorProviderRegistry(engine, reg);
         
@@ -296,7 +362,7 @@
         }
         
         control.replay();
-        epi.initialiseInterceptors(ei, requestor, engine);
+        epi.initializeInterceptors();
         assertEquals(1, epi.getInterceptors().size());
         assertSame(api, epi.getInterceptors().get(0));
         if (requestor) {

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java Thu Jan 31 13:42:25 2008
@@ -91,7 +91,6 @@
         assertTrue(engine.isEnabled()); 
         assertSame(selector, engine.getAlternativeSelector());
         assertNotNull(engine.createOutPolicyInfo());
-        assertNotNull(engine.createEndpointPolicyInfo());
         
     }
     
@@ -306,30 +305,48 @@
     
     @Test
     public void testCreateEndpointPolicyInfo() throws NoSuchMethodException {
-        Method m = PolicyEngineImpl.class.getDeclaredMethod("createEndpointPolicyInfo", new Class[] {});
-        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
+        Method m1 = PolicyEngineImpl.class.getDeclaredMethod("createEndpointPolicyInfo", 
+            new Class[] {EndpointInfo.class, boolean.class, Assertor.class});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m1});
         engine.init();
         EndpointInfo ei = control.createMock(EndpointInfo.class);
         Assertor assertor = control.createMock(Assertor.class);
         EndpointPolicyImpl epi = control.createMock(EndpointPolicyImpl.class);
-        EasyMock.expect(engine.createEndpointPolicyInfo()).andReturn(epi);
-        epi.initialise(ei, false, engine, assertor);
-        EasyMock.expectLastCall();
+        EasyMock.expect(engine.createEndpointPolicyInfo(ei, false, assertor)).andReturn(epi);
         control.replay();
         assertSame(epi, engine.createEndpointPolicyInfo(ei, false, assertor));
         control.verify();
     }
     
     @Test
-    public void testSetEndpointPolicy() {
+    public void testEndpointPolicyWithEqualPolicies() {
         engine = new PolicyEngineImpl();
         EndpointInfo ei = control.createMock(EndpointInfo.class);
+        ServiceInfo si = control.createMock(ServiceInfo.class);
+        ei.getService();
+        EasyMock.expectLastCall().andReturn(si).times(2);
+        si.getExtensor(Policy.class);
+        EasyMock.expectLastCall().andReturn(null).times(2);
         EndpointPolicyImpl epi = control.createMock(EndpointPolicyImpl.class);
-        engine.setEndpointPolicy(ei, epi);
+        control.replay();
+        engine.setServerEndpointPolicy(ei, epi);
+        engine.setClientEndpointPolicy(ei, epi);
+        
         assertSame(epi, engine.getClientEndpointPolicy(ei, (Conduit)null));
-        assertSame(epi, engine.getServerEndpointPolicy(ei, (Destination)null)); 
+        assertSame(epi, engine.getServerEndpointPolicy(ei, (Destination)null));
+        
+        control.reset();
+        ei.getService();
+        EasyMock.expectLastCall().andReturn(si).times(2);
+        Policy p = new Policy();
+        si.getExtensor(Policy.class);
+        EasyMock.expectLastCall().andReturn(p).times(2);
+        epi.getPolicy();
+        EasyMock.expectLastCall().andReturn(p).times(2);
+        control.replay();
+        assertSame(epi, engine.getServerEndpointPolicy(ei, (Destination)null));
     }
-    
+       
     
     @Test
     public void testDontAddBusInterceptors() {        

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java Thu Jan 31 13:42:25 2008
@@ -285,7 +285,11 @@
             .getEndpointInfo(), null) : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(),
                                                                        conduit);
 
-        engine.setEndpointPolicy(ei, ep);
+        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);

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java Thu Jan 31 13:42:25 2008
@@ -287,7 +287,7 @@
         EasyMock.expect(pe.getServerEndpointPolicy(aei, null)).andReturn(epi);
         EasyMock.expect(epi.getChosenAlternative()).andReturn(new ArrayList<Assertion>());
 
-        pe.setEndpointPolicy(ei, epi);
+        pe.setServerEndpointPolicy(ei, epi);
         EasyMock.expectLastCall();
         BindingInfo bi = control.createMock(BindingInfo.class);
         EasyMock.expect(ei.getBinding()).andReturn(bi);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java Thu Jan 31 13:42:25 2008
@@ -28,20 +28,16 @@
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.endpoint.Client;
-import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.greeter_control.BasicGreeterService;
 import org.apache.cxf.greeter_control.Greeter;
 import org.apache.cxf.greeter_control.PingMeFault;
 import org.apache.cxf.interceptor.Interceptor;
-import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.systest.ws.util.ConnectionHelper;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.ServerPolicyInInterceptor;
 import org.apache.cxf.ws.policy.ServerPolicyOutInterceptor;
-import org.apache.neethi.Policy;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -83,7 +79,7 @@
 
     @BeforeClass
     public static void startServers() throws Exception {
-        assertTrue("server did not launch correctly", launchServer(Server.class));
+        assertTrue("server did not launch correctly", launchServer(Server.class, false));
     }
     
     @Test
@@ -103,13 +99,6 @@
 
         ConnectionHelper.setKeepAliveConnection(greeter, true);
 
-        Client client = ClientProxy.getClient(greeter);
-        List<ServiceInfo> sis = client.getEndpoint().getService().getServiceInfos();
-        
-        ServiceInfo si = sis.get(0);
-        Policy p = si.getExtensor(Policy.class);
-        assertNotNull(p);
-        
         testInterceptors(bus);
         
         // oneway

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java Thu Jan 31 13:42:25 2008
@@ -19,19 +19,18 @@
 
 package org.apache.cxf.systest.ws.policy;
 
+import java.util.List;
 import java.util.logging.Logger;
 
-import javax.xml.ws.Endpoint;
-
 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.interceptor.LoggingInInterceptor;
-import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.systest.ws.util.ConnectionHelper;
 import org.apache.cxf.systest.ws.util.InMessageRecorder;
 import org.apache.cxf.systest.ws.util.MessageFlow;
@@ -40,8 +39,12 @@
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.ws.rm.RMConstants;
-
+import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -70,20 +73,30 @@
     
         protected void run()  {            
             SpringBusFactory bf = new SpringBusFactory();
-            Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/rmwsdl.xml");
-            PolicyTestUtils.setPolicyConstants(bus, 
-                                               PolicyConstants.NAMESPACE_W3_200607);
+            Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/rmwsdl_server.xml");
             BusFactory.setDefaultBus(bus);
-            LoggingInInterceptor in = new LoggingInInterceptor();
-            bus.getInInterceptors().add(in);
-            LoggingOutInterceptor out = new LoggingOutInterceptor();
-            bus.getOutInterceptors().add(out);
-            bus.getOutFaultInterceptors().add(out);
             
-            ReliableGreeterImpl implementor = new ReliableGreeterImpl();
-            String address = "http://localhost:9020/SoapContext/GreeterPort";
-            Endpoint.publish(address, implementor);
-            LOG.info("Published greeter endpoint.");
+            ServerRegistry sr = bus.getExtension(ServerRegistry.class);
+            PolicyEngine pe = bus.getExtension(PolicyEngine.class);
+            
+            List<Assertion> assertions1 = getAssertions(pe, sr.getServers().get(0));
+            assertEquals("2 assertions should be available", 2, assertions1.size());
+            List<Assertion> assertions2 = getAssertions(pe, sr.getServers().get(1));
+            assertEquals("1 assertion should be available", 1, assertions2.size());
+            
+            LOG.info("Published greeter endpoints.");
+        }
+        
+        protected List<Assertion> 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(), Assertion.class);
         }
         
         public static void main(String[] args) {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java Thu Jan 31 13:42:25 2008
@@ -27,10 +27,10 @@
  * 
  */
 
-@WebService(serviceName = "ReliableGreeterService",
+@WebService(serviceName = "RerliableGreeterService",
             portName = "GreeterPort",
             endpointInterface = "org.apache.cxf.greeter_control.Greeter",
             targetNamespace = "http://cxf.apache.org/greeter_control",
-            wsdlLocation = "testutils/greeter_control.wsdl")
+            wsdlLocation = "org/apache/cxf/systest/ws/policy/greeter.wsdl")
 public class ReliableGreeterImpl extends AbstractGreeterImpl {
 }

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl2.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl2.java?rev=617250&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl2.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl2.java Thu Jan 31 13:42:25 2008
@@ -0,0 +1,36 @@
+/**
+ * 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 javax.jws.WebService;
+
+import org.apache.cxf.greeter_control.AbstractGreeterImpl;
+
+/**
+ * 
+ */
+
+@WebService(serviceName = "ReliableGreeterService",
+            portName = "GreeterPort2",
+            endpointInterface = "org.apache.cxf.greeter_control.Greeter",
+            targetNamespace = "http://cxf.apache.org/greeter_control",
+            wsdlLocation = "org/apache/cxf/systest/ws/policy/greeter.wsdl")
+public class ReliableGreeterImpl2 extends AbstractGreeterImpl {
+}

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

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

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/greeter.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/greeter.wsdl?rev=617250&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/greeter.wsdl (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/greeter.wsdl Thu Jan 31 13:42:25 2008
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:tns="http://cxf.apache.org/greeter_control"
+    xmlns:x1="http://cxf.apache.org/greeter_control/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://cxf.apache.org/greeter_control" name="HelloWorld">
+    <wsdl:types>
+        <schema targetNamespace="http://cxf.apache.org/greeter_control/types" 
+            xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeOneWay">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="pingMe">
+                <complexType/>
+            </element>
+            <element name="pingMeResponse">
+                <complexType/>
+            </element>
+            <element name="faultDetail">
+                <complexType>
+                    <sequence>
+                        <element name="minor" type="xsd:short"/>
+                        <element name="major" type="xsd:short"/>
+                    </sequence>
+                </complexType>
+            </element>
+            
+            <element name="startGreeter">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="startGreeterResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="xsd:boolean"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="stopGreeter">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="stopGreeterResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="xsd:boolean"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="faultLocation">
+                <complexType>
+                    <sequence>
+                        <element name="phase" type="xsd:string"/>
+                        <element name="before" type="xsd:string"/>
+                        <element name="after" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+        </schema>
+    </wsdl:types>
+
+   
+   <wsdl:message name="sayHiRequest">
+        <wsdl:part element="x1:sayHi" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part element="x1:sayHiResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMeResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeOneWayRequest">
+        <wsdl:part element="x1:greetMeOneWay" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="pingMeRequest">
+    <wsdl:part name="in" element="x1:pingMe"/>
+    </wsdl:message>
+    <wsdl:message name="pingMeResponse">
+        <wsdl:part name="out" element="x1:pingMeResponse"/>
+    </wsdl:message>        
+    <wsdl:message name="pingMeFault">
+        <wsdl:part name="faultDetail" element="x1:faultDetail"/>
+    </wsdl:message> 
+    
+    <wsdl:message name="startGreeterRequest">
+        <wsdl:part element="x1:startGreeter" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="startGreeterResponse">
+        <wsdl:part element="x1:startGreeterResponse" name="out"/>
+    </wsdl:message>    
+    <wsdl:message name="stopGreeterRequest">
+        <wsdl:part element="x1:stopGreeter" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="stopGreeterResponse">
+        <wsdl:part element="x1:stopGreeterResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="setFaultLocationRequest">
+        <wsdl:part element="x1:faultLocation" name="in"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="Greeter">
+        <wsdl:operation name="sayHi">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+            <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+        </wsdl:operation>
+
+        <wsdl:operation name="pingMe">
+            <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/>
+            <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/>
+            <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/>
+        </wsdl:operation> 
+    </wsdl:portType>
+    
+
+    <wsdl:binding name="GreeterSOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="sayHiRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHiResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeOneWayRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+        </wsdl:operation>
+
+            <wsdl:operation name="pingMe">
+            <soap:operation style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+            <wsdl:fault name="pingMeFault">
+                <soap:fault name="pingMeFault" use="literal"/>
+            </wsdl:fault>
+        </wsdl:operation>
+        
+    </wsdl:binding>
+  
+    
+    <wsdl:service name="ReliableGreeterService">
+        <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort">
+            <soap:address location="http://localhost:9020/SoapContext/GreeterPort"/>
+        </wsdl:port> 
+        <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort2">
+            <soap:address location="http://localhost:9020/SoapContext/GreeterPort2"/>
+        </wsdl:port>
+    </wsdl:service>
+   
+
+</wsdl:definitions>
+

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/greeter.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/greeter.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/greeter.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml?rev=617250&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml Thu Jan 31 13:42:25 2008
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<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:wsp="http://www.w3.org/ns/ws-policy"
+  	   xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+	   xmlns:p="http://cxf.apache.org/policy"
+	   xmlns:jaxws="http://cxf.apache.org/jaxws"
+       xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+       xsi:schemaLocation="
+http://www.w3.org/ns/ws-policy	http://www.w3.org/2007/02/ws-policy.xsd
+http://cxf.apache.org/ws/addressing http://cxf.apache.org/schema/ws/addressing.xsd
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
+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">
+
+    <http:conduit name="{http://cxf.apache.org/greeter_control}GreeterPort.http-conduit">
+      <http:client DecoupledEndpoint="http://localhost:9998/decoupled_endpoint"/>
+    </http:conduit>
+
+    
+    <bean id="org.apache.cxf.ws.policy.PolicyEngine" class="org.apache.cxf.ws.policy.spring.InitializingPolicyEngine">
+        <property name="bus" ref="cxf"/>
+        <property name="enabled" value="true"/>
+    </bean>
+    
+    <jaxws:endpoint id="id1"
+        implementor="org.apache.cxf.systest.ws.policy.ReliableGreeterImpl"
+        xmlns:ns="http://cxf.apache.org/greeter_control"
+        serviceName="ns:ReliableGreeterService"
+        endpointName="ns:GreeterPort">
+		<jaxws:features>
+			<bean class="org.apache.cxf.feature.LoggingFeature"/>
+            <p:policies>
+                 <wsp:PolicyReference URI="#AddressingRmPolicy"/>
+            </p:policies>
+		</jaxws:features>
+	</jaxws:endpoint>
+	
+	<jaxws:endpoint id="id2"
+        implementor="org.apache.cxf.systest.ws.policy.ReliableGreeterImpl2"
+        xmlns:ns="http://cxf.apache.org/greeter_control"
+        serviceName="ns:ReliableGreeterService"
+        endpointName="ns:GreeterPort2">
+		<jaxws:features>
+			<bean class="org.apache.cxf.feature.LoggingFeature"/>
+            <p:policies>
+               <wsp:PolicyReference URI="#AddressingPolicy"/>
+            </p:policies>
+		</jaxws:features>
+	</jaxws:endpoint>
+
+    <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:Policy>
+</beans>
\ No newline at end of file

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl_server.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl?rev=617250&r1=617249&r2=617250&view=diff
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl (original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl Thu Jan 31 13:42:25 2008
@@ -279,7 +279,7 @@
             <wswa:UsingAddressing xmlns:wswa="http://www.w3.org/2005/02/addressing/wsdl"/>
         </wsdl:port>
     </wsdl:service>
-   
+    
     <wsdl:service name="ReliableGreeterService">
         <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort">
             <soap:address location="http://localhost:9020/SoapContext/GreeterPort"/>
@@ -291,7 +291,16 @@
                     <wsrmp:BaseRetransmissionInterval Milliseconds="30000"/>
                 </wsrmp:RMAssertion>
             </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">



Mime
View raw message