cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r523385 [2/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/ api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/ api/src/test/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ r...
Date Wed, 28 Mar 2007 16:08:25 GMT
Copied: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java (from r523191, incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/OutPolicyInfoTest.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java?view=diff&rev=523385&p1=incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/OutPolicyInfoTest.java&r1=523191&p2=incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/OutPolicyInfoTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java Wed Mar 28 09:08:23 2007
@@ -28,15 +28,14 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.endpoint.Endpoint;
 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.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
-import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.neethi.All;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.ExactlyOne;
@@ -50,21 +49,22 @@
 /**
  * 
  */
-public class OutPolicyInfoTest extends Assert {
+public class EffectivePolicyImplTest extends Assert {
 
     private IMocksControl control;
     
     @Before
     public void setUp() {
-        control = EasyMock.createNiceControl();        
+        control = EasyMock.createNiceControl();
+        new Integer(4);
     } 
     
     @Test
     public void testAccessors() {
-        OutPolicyInfo opi = new OutPolicyInfo();
-        assertNull(opi.getPolicy());
-        assertNull(opi.getChosenAlternative());
-        assertNull(opi.getInterceptors());
+        EffectivePolicyImpl effectivePolicy = new EffectivePolicyImpl();
+        assertNull(effectivePolicy.getPolicy());
+        assertNull(effectivePolicy.getChosenAlternative());
+        assertNull(effectivePolicy.getInterceptors());
         
         Policy p = control.createMock(Policy.class);
         Assertion a = control.createMock(Assertion.class);
@@ -72,85 +72,86 @@
         Interceptor i = control.createMock(Interceptor.class);
         List<Interceptor> li = Collections.singletonList(i);
         control.replay();
-        opi.setPolicy(p);
-        assertSame(p, opi.getPolicy());
-        opi.setChosenAlternative(la);
-        assertSame(la, opi.getChosenAlternative());
-        opi.setInterceptors(li);
-        assertSame(li, opi.getInterceptors());
+        effectivePolicy.setPolicy(p);
+        assertSame(p, effectivePolicy.getPolicy());
+        effectivePolicy.setChosenAlternative(la);
+        assertSame(la, effectivePolicy.getChosenAlternative());
+        effectivePolicy.setInterceptors(li);
+        assertSame(li, effectivePolicy.getInterceptors());
         control.verify();
     }
     
     @Test
-    public void testInitialiseFromEndpointPolicyInfo() throws NoSuchMethodException {
-        Method m = OutPolicyInfo.class.getDeclaredMethod("initialiseInterceptors",
-                                                          new Class[] {PolicyEngine.class});
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class, new Method[] {m});
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);
+    public void testInitialiseFromEndpointPolicy() throws NoSuchMethodException {
+        Method m = EffectivePolicyImpl.class.getDeclaredMethod("initialiseInterceptors",
+                                                          new Class[] {PolicyEngineImpl.class});
+        EffectivePolicyImpl effectivePolicy = control.createMock(EffectivePolicyImpl.class, new Method[] {m});
+        EndpointPolicyImpl endpointPolicy = control.createMock(EndpointPolicyImpl.class);
         Policy p = control.createMock(Policy.class);
-        EasyMock.expect(epi.getPolicy()).andReturn(p);
+        EasyMock.expect(endpointPolicy.getPolicy()).andReturn(p);
         Collection<Assertion> chosenAlternative = new ArrayList<Assertion>();
-        EasyMock.expect(epi.getChosenAlternative()).andReturn(chosenAlternative);
-        PolicyEngine pe = control.createMock(PolicyEngine.class);
-        opi.initialiseInterceptors(pe);
+        EasyMock.expect(endpointPolicy.getChosenAlternative()).andReturn(chosenAlternative);
+        PolicyEngineImpl pe = control.createMock(PolicyEngineImpl.class);
+        effectivePolicy.initialiseInterceptors(pe);
         EasyMock.expectLastCall();
         control.replay();
-        opi.initialise(epi, pe);
+        effectivePolicy.initialise(endpointPolicy, pe);
         control.verify();    
     }
     
     @Test
     public void testInitialise() throws NoSuchMethodException {
-        Method m1 = OutPolicyInfo.class.getDeclaredMethod("initialisePolicy",
-            new Class[] {Endpoint.class, BindingOperationInfo.class, PolicyEngine.class, boolean.class});
-        Method m2 = OutPolicyInfo.class.getDeclaredMethod("chooseAlternative",
-            new Class[] {PolicyEngine.class, Assertor.class});
-        Method m3 = OutPolicyInfo.class.getDeclaredMethod("initialiseInterceptors",
-                                                          new Class[] {PolicyEngine.class});
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class, new Method[] {m1, m2, m3});
-        
-        Endpoint e = control.createMock(Endpoint.class);
+        Method m1 = EffectivePolicyImpl.class.getDeclaredMethod("initialisePolicy",
+            new Class[] {EndpointInfo.class, BindingOperationInfo.class, PolicyEngineImpl.class, 
+                         boolean.class});
+        Method m2 = EffectivePolicyImpl.class.getDeclaredMethod("chooseAlternative",
+            new Class[] {PolicyEngineImpl.class, Assertor.class});
+        Method m3 = EffectivePolicyImpl.class.getDeclaredMethod("initialiseInterceptors",
+                                                          new Class[] {PolicyEngineImpl.class});
+        EffectivePolicyImpl effectivePolicy = 
+            control.createMock(EffectivePolicyImpl.class, new Method[] {m1, m2, m3});        
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
-        PolicyEngine pe = control.createMock(PolicyEngine.class);
+        PolicyEngineImpl pe = control.createMock(PolicyEngineImpl.class);
         Assertor a = control.createMock(Assertor.class);
         boolean requestor = true;
        
-        opi.initialisePolicy(e, boi, pe, requestor);
+        effectivePolicy.initialisePolicy(ei, boi, pe, requestor);
         EasyMock.expectLastCall();
-        opi.chooseAlternative(pe, a);
+        effectivePolicy.chooseAlternative(pe, a);
         EasyMock.expectLastCall();
-        opi.initialiseInterceptors(pe);
+        effectivePolicy.initialiseInterceptors(pe);
         EasyMock.expectLastCall();
         
         control.replay();
-        opi.initialise(e, boi, pe, a, requestor);
+        effectivePolicy.initialise(ei, boi, pe, a, requestor);
         control.verify();        
     }
     
     @Test
     public void testInitialiseFault() throws NoSuchMethodException {
-        Method m1 = OutPolicyInfo.class.getDeclaredMethod("initialisePolicy",
-            new Class[] {Endpoint.class, BindingFaultInfo.class, PolicyEngine.class});
-        Method m2 = OutPolicyInfo.class.getDeclaredMethod("chooseAlternative",
-            new Class[] {PolicyEngine.class, Assertor.class});
-        Method m3 = OutPolicyInfo.class.getDeclaredMethod("initialiseInterceptors",
-                                                          new Class[] {PolicyEngine.class});
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class, new Method[] {m1, m2, m3});
-        
-        Endpoint e = control.createMock(Endpoint.class);
+        Method m1 = EffectivePolicyImpl.class.getDeclaredMethod("initialisePolicy",
+            new Class[] {EndpointInfo.class, BindingFaultInfo.class, PolicyEngineImpl.class});
+        Method m2 = EffectivePolicyImpl.class.getDeclaredMethod("chooseAlternative",
+            new Class[] {PolicyEngineImpl.class, Assertor.class});
+        Method m3 = EffectivePolicyImpl.class.getDeclaredMethod("initialiseInterceptors",
+                                                          new Class[] {PolicyEngineImpl.class});
+        EffectivePolicyImpl effectivePolicy = 
+            control.createMock(EffectivePolicyImpl.class, new Method[] {m1, m2, m3});        
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
         BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
-        PolicyEngine pe = control.createMock(PolicyEngine.class);
+        PolicyEngineImpl pe = control.createMock(PolicyEngineImpl.class);
         Assertor a = control.createMock(Assertor.class);
        
-        opi.initialisePolicy(e, bfi, pe);
+        effectivePolicy.initialisePolicy(ei, bfi, pe);
         EasyMock.expectLastCall();
-        opi.chooseAlternative(pe, a);
+        effectivePolicy.chooseAlternative(pe, a);
         EasyMock.expectLastCall();
-        opi.initialiseInterceptors(pe);
+        effectivePolicy.initialiseInterceptors(pe);
         EasyMock.expectLastCall();
         
         control.replay();
-        opi.initialise(e, bfi, pe, a);
+        effectivePolicy.initialise(ei, bfi, pe, a);
         control.verify();        
     }
     
@@ -165,9 +166,9 @@
     }
     
     private void doTestInitialisePolicy(boolean requestor) {        
-        Endpoint e = control.createMock(Endpoint.class);
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
-        PolicyEngine engine = control.createMock(PolicyEngine.class);
+        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
         BindingMessageInfo bmi = control.createMock(BindingMessageInfo.class);
         if (requestor) {
             EasyMock.expect(boi.getInput()).andReturn(bmi);
@@ -175,14 +176,14 @@
             EasyMock.expect(boi.getOutput()).andReturn(bmi);
         }
                 
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);
+        EndpointPolicy effectivePolicy = control.createMock(EndpointPolicy.class);
         if (requestor) {
-            EasyMock.expect(engine.getEndpointPolicyInfo(e, (Conduit)null)).andReturn(epi);
+            EasyMock.expect(engine.getClientEndpointPolicy(ei, (Conduit)null)).andReturn(effectivePolicy);
         } else {
-            EasyMock.expect(engine.getEndpointPolicyInfo(e, (Destination)null)).andReturn(epi);
+            EasyMock.expect(engine.getServerEndpointPolicy(ei, (Destination)null)).andReturn(effectivePolicy);
         }
         Policy ep = control.createMock(Policy.class);
-        EasyMock.expect(epi.getPolicy()).andReturn(ep);        
+        EasyMock.expect(effectivePolicy.getPolicy()).andReturn(ep);        
         Policy op = control.createMock(Policy.class);
         EasyMock.expect(engine.getAggregatedOperationPolicy(boi)).andReturn(op);
         Policy merged = control.createMock(Policy.class);
@@ -193,24 +194,24 @@
         EasyMock.expect(merged.normalize(true)).andReturn(merged);
         
         control.replay();
-        OutPolicyInfo opi = new OutPolicyInfo();
-        opi.initialisePolicy(e, boi, engine, requestor);
-        assertSame(merged, opi.getPolicy());
+        EffectivePolicyImpl epi = new EffectivePolicyImpl();
+        epi.initialisePolicy(ei, boi, engine, requestor);
+        assertSame(merged, epi.getPolicy());
         control.verify();
     }
     
     @Test
     public void testInitialiseServerFaultPolicy() {        
-        Endpoint e = control.createMock(Endpoint.class);
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
         BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
-        PolicyEngine engine = control.createMock(PolicyEngine.class);
+        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
         
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
         EasyMock.expect(bfi.getBindingOperation()).andReturn(boi);               
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);        
-        EasyMock.expect(engine.getEndpointPolicyInfo(e, (Destination)null)).andReturn(epi);
+        EndpointPolicy endpointPolicy = control.createMock(EndpointPolicy.class);        
+        EasyMock.expect(engine.getServerEndpointPolicy(ei, (Destination)null)).andReturn(endpointPolicy);
         Policy ep = control.createMock(Policy.class);
-        EasyMock.expect(epi.getPolicy()).andReturn(ep);        
+        EasyMock.expect(endpointPolicy.getPolicy()).andReturn(ep);        
         Policy op = control.createMock(Policy.class);
         EasyMock.expect(engine.getAggregatedOperationPolicy(boi)).andReturn(op);
         Policy merged = control.createMock(Policy.class);
@@ -221,18 +222,18 @@
         EasyMock.expect(merged.normalize(true)).andReturn(merged);
         
         control.replay();
-        OutPolicyInfo opi = new OutPolicyInfo();
-        opi.initialisePolicy(e, bfi, engine);
-        assertSame(merged, opi.getPolicy());
+        EffectivePolicyImpl epi = new EffectivePolicyImpl();
+        epi.initialisePolicy(ei, bfi, engine);
+        assertSame(merged, epi.getPolicy());
         control.verify();
     }
     
     @Test
     public void testChooseAlternative() {
-        OutPolicyInfo cpi = new OutPolicyInfo();
+        EffectivePolicyImpl cpi = new EffectivePolicyImpl();
         cpi.setPolicy(new Policy());
         
-        PolicyEngine engine = control.createMock(PolicyEngine.class);
+        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
         Assertor assertor = control.createMock(Assertor.class);
                
         Policy policy = new Policy();
@@ -286,11 +287,11 @@
     
     @Test
     public void testInitialiseOutInterceptors() {
-        OutPolicyInfo cpi = new OutPolicyInfo();        
+        EffectivePolicyImpl cpi = new EffectivePolicyImpl();        
         List<Assertion> alternative = new ArrayList<Assertion>();
         cpi.setChosenAlternative(alternative);
         
-        PolicyEngine engine = control.createMock(PolicyEngine.class);
+        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
         PolicyInterceptorProviderRegistry reg = control.createMock(PolicyInterceptorProviderRegistry.class);
         setupPolicyInterceptorProviderRegistry(engine, reg);
         
@@ -335,99 +336,11 @@
         control.verify();     
     }
     
-    private void setupPolicyInterceptorProviderRegistry(PolicyEngine engine, 
+    private void setupPolicyInterceptorProviderRegistry(PolicyEngineImpl engine, 
                                                         PolicyInterceptorProviderRegistry reg) {
         Bus bus = control.createMock(Bus.class);        
         EasyMock.expect(engine.getBus()).andReturn(bus);
         EasyMock.expect(bus.getExtension(PolicyInterceptorProviderRegistry.class)).andReturn(reg);
     }
     
-    @Test
-    public void testCheckEffectivePolicy() {
-        OutPolicyInfo opi = new OutPolicyInfo();  
-        Policy p = new Policy();
-        QName aqn = new QName("http://x.y.z", "a");
-        Assertion a = new PrimitiveAssertion(aqn);
-        QName bqn = new QName("http://x.y.z", "b");
-        Assertion b = new PrimitiveAssertion(bqn);
-        QName cqn = new QName("http://x.y.z", "c");
-        Assertion c = new PrimitiveAssertion(cqn);
-        All alt1 = new All();
-        alt1.addAssertion(a);
-        alt1.addAssertion(b);
-        All alt2 = new All();
-        alt2.addAssertion(c);
-        ExactlyOne ea = new ExactlyOne();
-        ea.addPolicyComponent(alt1);
-        ea.addPolicyComponent(alt2);
-        p.addPolicyComponent(ea);   
-        AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST, Assertion.class));
-        AssertionInfo ai = new AssertionInfo(a);
-        AssertionInfo bi = new AssertionInfo(b);
-        AssertionInfo ci = new AssertionInfo(c);
-        aim.put(aqn, Collections.singleton(ai));
-        aim.put(bqn, Collections.singleton(bi));
-        aim.put(cqn, Collections.singleton(ci));
-        opi.setPolicy(p);
-        
-        try {
-            opi.checkEffectivePolicy(aim);
-            fail("Expected PolicyException not thrown.");
-        } catch (PolicyException ex) {
-            // expected
-        }
-        
-        ai.setAsserted(true);
-        ci.setAsserted(true);
-        
-        opi.checkEffectivePolicy(aim);
-    }
-    
-    @Test
-    public void testAlternativeSupported() {
-        Assertion a1 = control.createMock(Assertion.class);
-        QName aqn = new QName("http://x.y.z", "a");
-        EasyMock.expect(a1.getName()).andReturn(aqn).anyTimes();
-        Assertion a2 = control.createMock(Assertion.class);
-        EasyMock.expect(a2.getName()).andReturn(aqn).anyTimes();
-        Assertion b = control.createMock(Assertion.class);
-        QName bqn = new QName("http://x.y.z", "b");
-        EasyMock.expect(b.getName()).andReturn(bqn).anyTimes();
-        Assertion c = control.createMock(Assertion.class);
-        QName cqn = new QName("http://x.y.z", "c");
-        EasyMock.expect(c.getName()).andReturn(cqn).anyTimes();
-        AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST, Assertion.class));
-        AssertionInfo ai1 = new AssertionInfo(a1);
-        AssertionInfo ai2 = new AssertionInfo(a2);
-        Collection<AssertionInfo> ais = new ArrayList<AssertionInfo>();
-        AssertionInfo bi = new AssertionInfo(b);
-        AssertionInfo ci = new AssertionInfo(c);
-        ais.add(ai1);
-        ais.add(ai2);
-        aim.put(aqn, ais);
-        aim.put(bqn, Collections.singleton(bi));
-        aim.put(cqn, Collections.singleton(ci));
-        ai2.setAsserted(true);
-        bi.setAsserted(true);
-        ci.setAsserted(true);
-        EasyMock.expect(a1.equal(a1)).andReturn(true).anyTimes();
-        EasyMock.expect(a2.equal(a2)).andReturn(true).anyTimes();
-        EasyMock.expect(b.equal(b)).andReturn(true).anyTimes();
-        EasyMock.expect(c.equal(c)).andReturn(true).anyTimes();
-        
-        
-        List<Assertion> alt1 = new ArrayList<Assertion>();
-        alt1.add(a1);
-        alt1.add(b);
-        
-        List<Assertion> alt2 = new ArrayList<Assertion>();
-        alt2.add(a2);
-        alt2.add(c);
-                
-        OutPolicyInfo opi = new OutPolicyInfo();
-        control.replay();
-        assertTrue(!opi.alternativeSupported(alt1, aim));
-        assertTrue(opi.alternativeSupported(alt2, aim));
-        control.verify();     
-    }  
 }

Copied: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java (from r523191, incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyInfoTest.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java?view=diff&rev=523385&p1=incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyInfoTest.java&r1=523191&p2=incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyInfoTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java Wed Mar 28 09:08:23 2007
@@ -50,7 +50,7 @@
 /**
  * 
  */
-public class EndpointPolicyInfoTest extends Assert {
+public class EndpointPolicyImplTest extends Assert {
 
     private IMocksControl control;
     
@@ -61,11 +61,11 @@
     
     @Test
     public void testAccessors() {
-        EndpointPolicyInfo epi = new EndpointPolicyInfo();
+        EndpointPolicyImpl epi = new EndpointPolicyImpl();
         assertNull(epi.getPolicy());
         assertNull(epi.getChosenAlternative());
-        assertNull(epi.getInInterceptors());
-        assertNull(epi.getInFaultInterceptors());
+        assertNull(epi.getInterceptors());
+        assertNull(epi.getFaultInterceptors());
         assertNull(epi.getVocabulary());
         assertNull(epi.getFaultVocabulary());
         
@@ -79,10 +79,10 @@
         assertSame(p, epi.getPolicy());
         epi.setChosenAlternative(la);
         assertSame(la, epi.getChosenAlternative());
-        epi.setInInterceptors(li);
-        assertSame(li, epi.getInInterceptors());
-        epi.setInFaultInterceptors(li);
-        assertSame(li, epi.getInFaultInterceptors());
+        epi.setInterceptors(li);
+        assertSame(li, epi.getInterceptors());
+        epi.setFaultInterceptors(li);
+        assertSame(li, epi.getFaultInterceptors());
         epi.setVocabulary(la);
         assertSame(la, epi.getVocabulary());
         epi.setFaultVocabulary(la);
@@ -92,19 +92,19 @@
     
     @Test
     public void testInitialise() throws NoSuchMethodException {
-        Method m1 = EndpointPolicyInfo.class.getDeclaredMethod("initialisePolicy",
-            new Class[] {EndpointInfo.class, PolicyEngine.class});
-        Method m2 = EndpointPolicyInfo.class.getDeclaredMethod("chooseAlternative",
-            new Class[] {PolicyEngine.class, Assertor.class});
-        Method m3 = EndpointPolicyInfo.class.getDeclaredMethod("initialiseVocabulary",
-            new Class[] {EndpointInfo.class, boolean.class, PolicyEngine.class});
-        Method m4 = EndpointPolicyInfo.class.getDeclaredMethod("initialiseInterceptors",
-            new Class[] {EndpointInfo.class, boolean.class, PolicyEngine.class});
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class, 
+        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});
+        EndpointPolicyImpl epi = control.createMock(EndpointPolicyImpl.class, 
                                                     new Method[] {m1, m2, m3, m4});
         EndpointInfo ei = control.createMock(EndpointInfo.class);
         boolean isServer = true;
-        PolicyEngine pe = control.createMock(PolicyEngine.class);
+        PolicyEngineImpl pe = control.createMock(PolicyEngineImpl.class);
         Assertor a = control.createMock(Assertor.class);
          
         epi.initialisePolicy(ei, pe);
@@ -122,7 +122,7 @@
     @Test
     public void testInitialisePolicy() {        
         EndpointInfo ei = control.createMock(EndpointInfo.class);
-        PolicyEngine engine = control.createMock(PolicyEngine.class);
+        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
         ServiceInfo si = control.createMock(ServiceInfo.class);
         EasyMock.expect(ei.getService()).andReturn(si);
         Policy sp = control.createMock(Policy.class);
@@ -134,7 +134,7 @@
         EasyMock.expect(merged.normalize(true)).andReturn(merged);
         
         control.replay();
-        EndpointPolicyInfo epi = new EndpointPolicyInfo();
+        EndpointPolicyImpl epi = new EndpointPolicyImpl();
         epi.initialisePolicy(ei, engine);
         assertSame(merged, epi.getPolicy());
         control.verify();
@@ -142,10 +142,10 @@
        
     @Test
     public void testChooseAlternative() {
-        EndpointPolicyInfo cpi = new EndpointPolicyInfo();
+        EndpointPolicyImpl cpi = new EndpointPolicyImpl();
         cpi.setPolicy(new Policy());
         
-        PolicyEngine engine = control.createMock(PolicyEngine.class);
+        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
         Assertor assertor = control.createMock(Assertor.class);
                
         Policy policy = new Policy();
@@ -208,7 +208,7 @@
     }
     
     private void dotestInitialiseVocabulary(boolean requestor) {
-        EndpointPolicyInfo epi = new EndpointPolicyInfo();   
+        EndpointPolicyImpl epi = new EndpointPolicyImpl();   
         List<Assertion> alternative = new ArrayList<Assertion>();
         epi.setChosenAlternative(alternative);
         Assertion ea = control.createMock(Assertion.class);        
@@ -223,7 +223,7 @@
         EasyMock.expect(ei.getBinding()).andReturn(bi);
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
         EasyMock.expect(bi.getOperations()).andReturn(Collections.singletonList(boi));
-        PolicyEngine engine = control.createMock(PolicyEngine.class);
+        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);
@@ -295,7 +295,7 @@
     }
     
     private void doTestInitialiseInterceptors(boolean requestor) {
-        EndpointPolicyInfo epi = new EndpointPolicyInfo();        
+        EndpointPolicyImpl epi = new EndpointPolicyImpl();        
         Collection<Assertion> v = new ArrayList<Assertion>();
         Collection<Assertion> fv = new ArrayList<Assertion>();
         Assertion a = control.createMock(Assertion.class);        
@@ -310,7 +310,7 @@
         epi.setFaultVocabulary(fv);
         
         EndpointInfo ei = control.createMock(EndpointInfo.class);
-        PolicyEngine engine = control.createMock(PolicyEngine.class);
+        PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
         PolicyInterceptorProviderRegistry reg = control.createMock(PolicyInterceptorProviderRegistry.class);
         setupPolicyInterceptorProviderRegistry(engine, reg);
         
@@ -326,18 +326,18 @@
         
         control.replay();
         epi.initialiseInterceptors(ei, requestor, engine);
-        assertEquals(1, epi.getInInterceptors().size());
-        assertSame(api, epi.getInInterceptors().get(0));
+        assertEquals(1, epi.getInterceptors().size());
+        assertSame(api, epi.getInterceptors().get(0));
         if (requestor) {
-            assertEquals(1, epi.getInFaultInterceptors().size());
-            assertSame(api, epi.getInFaultInterceptors().get(0));
+            assertEquals(1, epi.getFaultInterceptors().size());
+            assertSame(api, epi.getFaultInterceptors().get(0));
         } else {
-            assertNull(epi.getInFaultInterceptors());
+            assertNull(epi.getFaultInterceptors());
         }
         control.verify();          
     }
     
-    private void setupPolicyInterceptorProviderRegistry(PolicyEngine engine, 
+    private void setupPolicyInterceptorProviderRegistry(PolicyEngineImpl engine, 
                                                         PolicyInterceptorProviderRegistry reg) {
         Bus bus = control.createMock(Bus.class);        
         EasyMock.expect(engine.getBus()).andReturn(bus);

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?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- 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 Wed Mar 28 09:08:23 2007
@@ -30,7 +30,6 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.phase.PhaseInterceptor;
@@ -60,7 +59,7 @@
 public class PolicyEngineTest extends Assert {
 
     private IMocksControl control;
-    private PolicyEngine engine;
+    private PolicyEngineImpl engine;
     
     @Before
     public void setUp() {
@@ -69,7 +68,7 @@
     
     @Test
     public void testAccessors() {
-        engine = new PolicyEngine();
+        engine = new PolicyEngineImpl();
         assertNotNull(engine.getRegistry());
         assertNull(engine.getBus());
         assertNull(engine.getPolicyProviders()); 
@@ -84,14 +83,237 @@
         assertSame(bus, engine.getBus());
         assertSame(providers, engine.getPolicyProviders());
         assertSame(reg, engine.getRegistry());
-        assertTrue(engine.getRegisterInterceptors());
-        
+        assertTrue(engine.getRegisterInterceptors());        
         assertNotNull(engine.createOutPolicyInfo());
         assertNotNull(engine.createEndpointPolicyInfo());
         
     }
     
     @Test
+    public void testGetEffectiveClientRequestPolicy() throws NoSuchMethodException {
+        Method m = PolicyEngineImpl.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
+        engine.init();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); 
+        AssertingConduit conduit = control.createMock(AssertingConduit.class);
+        EffectivePolicyImpl epi = control.createMock(EffectivePolicyImpl.class);
+        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(epi);
+        epi.initialise(ei, boi, engine, conduit, true);
+        EasyMock.expectLastCall();
+        control.replay();
+        assertSame(epi, engine.getEffectiveClientRequestPolicy(ei, boi, conduit));
+        assertSame(epi, engine.getEffectiveClientRequestPolicy(ei, boi, conduit));
+        control.verify();
+    }
+    
+    @Test 
+    public void testSetEffectiveClientRequestPolicy() {
+        engine = new PolicyEngineImpl();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
+        EffectivePolicy effectivePolicy = control.createMock(EffectivePolicy.class);
+        engine.setEffectiveClientRequestPolicy(ei, boi, effectivePolicy);
+        assertSame(effectivePolicy, 
+                   engine.getEffectiveClientRequestPolicy(ei, boi, (Conduit)null));        
+    }
+    
+    @Test
+    public void testGetEffectiveServerResponsePolicy() throws NoSuchMethodException {
+        Method m = PolicyEngineImpl.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
+        engine.init();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); 
+        AssertingDestination destination = control.createMock(AssertingDestination.class);
+        EffectivePolicyImpl epi = control.createMock(EffectivePolicyImpl.class);
+        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(epi);
+        epi.initialise(ei, boi, engine, destination, false);
+        EasyMock.expectLastCall();
+        control.replay();
+        assertSame(epi, engine.getEffectiveServerResponsePolicy(ei, boi, destination));
+        assertSame(epi, engine.getEffectiveServerResponsePolicy(ei, boi, destination));
+        control.verify();
+    }
+    
+    @Test
+    public void testSetEffectiveServerResponsePolicy() {
+        engine = new PolicyEngineImpl();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
+        EffectivePolicy effectivePolicy = control.createMock(EffectivePolicy.class);
+        engine.setEffectiveServerResponsePolicy(ei, boi, effectivePolicy);
+        assertSame(effectivePolicy, 
+                   engine.getEffectiveServerResponsePolicy(ei, boi, (Destination)null));   
+    }
+   
+    @Test
+    public void testGetEffectiveServerFaultPolicy() throws NoSuchMethodException {
+        Method m = PolicyEngineImpl.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
+        engine.init();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class); 
+        AssertingDestination destination = control.createMock(AssertingDestination.class);
+        EffectivePolicyImpl epi = control.createMock(EffectivePolicyImpl.class);
+        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(epi);
+        epi.initialise(ei, bfi, engine, destination);
+        EasyMock.expectLastCall();
+        control.replay();
+        assertSame(epi, engine.getEffectiveServerFaultPolicy(ei, bfi, destination));
+        assertSame(epi, engine.getEffectiveServerFaultPolicy(ei, bfi, destination));
+        control.verify();
+    }
+    
+    @Test
+    public void testSetEffectiveServerFaultPolicy() {
+        engine = new PolicyEngineImpl();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
+        EffectivePolicy epi = control.createMock(EffectivePolicy.class);
+        engine.setEffectiveServerFaultPolicy(ei, bfi, epi);
+        assertSame(epi, engine.getEffectiveServerFaultPolicy(ei, bfi, (Destination)null));   
+    }
+       
+    @Test
+    public void testGetEffectiveServerRequestPolicyInfo() throws NoSuchMethodException {
+        Method m = PolicyEngineImpl.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
+        engine.init();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); 
+        EffectivePolicyImpl epi = control.createMock(EffectivePolicyImpl.class);
+        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(epi);
+        epi.initialisePolicy(ei, boi, engine, false);
+        EasyMock.expectLastCall();
+        control.replay();
+        assertSame(epi, engine.getEffectiveServerRequestPolicy(ei, boi));
+        assertSame(epi, engine.getEffectiveServerRequestPolicy(ei, boi));
+        control.verify();
+    }
+    
+    @Test 
+    public void testSetEffectiveServerRequestPolicy() {
+        engine = new PolicyEngineImpl();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
+        EffectivePolicy effectivePolicy = control.createMock(EffectivePolicy.class);
+        engine.setEffectiveServerRequestPolicy(ei, boi, effectivePolicy);
+        assertSame(effectivePolicy, engine.getEffectiveServerRequestPolicy(ei, boi));        
+    }
+    
+    @Test
+    public void testGetEffectiveClientResponsePolicy() throws NoSuchMethodException {
+        Method m = PolicyEngineImpl.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
+        engine.init();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); 
+        EffectivePolicyImpl epi = control.createMock(EffectivePolicyImpl.class);
+        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(epi);
+        epi.initialisePolicy(ei, boi, engine, true);
+        EasyMock.expectLastCall();
+        control.replay();
+        assertSame(epi, engine.getEffectiveClientResponsePolicy(ei, boi));
+        assertSame(epi, engine.getEffectiveClientResponsePolicy(ei, boi));
+        control.verify();
+    }
+    
+    @Test 
+    public void testSetEffectiveClientResponsePolicy() {
+        engine = new PolicyEngineImpl();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
+        EffectivePolicy epi = control.createMock(EffectivePolicy.class);
+        engine.setEffectiveClientResponsePolicy(ei, boi, epi);
+        assertSame(epi, engine.getEffectiveClientResponsePolicy(ei, boi));        
+    }
+    
+    @Test
+    public void testGetEffectiveClientFaultPolicy() throws NoSuchMethodException {
+        Method m = PolicyEngineImpl.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
+        engine.init();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class); 
+        EffectivePolicyImpl epi = control.createMock(EffectivePolicyImpl.class);
+        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(epi);
+        epi.initialisePolicy(ei, bfi, engine);
+        EasyMock.expectLastCall();
+        control.replay();
+        assertSame(epi, engine.getEffectiveClientFaultPolicy(ei, bfi));
+        assertSame(epi, engine.getEffectiveClientFaultPolicy(ei, bfi));
+        control.verify();
+    }
+    
+    @Test 
+    public void testSetEffectiveClientFaultPolicy() {
+        engine = new PolicyEngineImpl();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
+        EffectivePolicy epi = control.createMock(EffectivePolicy.class);
+        engine.setEffectiveClientFaultPolicy(ei, bfi, epi);
+        assertSame(epi, engine.getEffectiveClientFaultPolicy(ei, bfi));        
+    }
+    
+    @Test
+    public void testGetEndpointPolicyClientSide() throws NoSuchMethodException {
+        Method m = PolicyEngineImpl.class.getDeclaredMethod("createEndpointPolicyInfo", 
+            new Class[] {EndpointInfo.class, boolean.class, Assertor.class});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
+        engine.init();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        AssertingConduit conduit = control.createMock(AssertingConduit.class);
+        EndpointPolicyImpl epi = control.createMock(EndpointPolicyImpl.class);
+        EasyMock.expect(engine.createEndpointPolicyInfo(ei, false, conduit)).andReturn(epi);
+        control.replay();
+        assertSame(epi, engine.getClientEndpointPolicy(ei, conduit));
+        control.verify();        
+    }
+    
+    @Test
+    public void testGetEndpointPolicyServerSide() throws NoSuchMethodException {
+        Method m = PolicyEngineImpl.class.getDeclaredMethod("createEndpointPolicyInfo", 
+            new Class[] {EndpointInfo.class, boolean.class, Assertor.class});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
+        engine.init();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        AssertingDestination destination = control.createMock(AssertingDestination.class);
+        EndpointPolicyImpl epi = control.createMock(EndpointPolicyImpl.class);
+        EasyMock.expect(engine.createEndpointPolicyInfo(ei, true, destination)).andReturn(epi);
+        control.replay();
+        assertSame(epi, engine.getServerEndpointPolicy(ei, destination));
+        control.verify();        
+    }
+    
+    @Test
+    public void testCreateEndpointPolicyInfo() throws NoSuchMethodException {
+        Method m = PolicyEngineImpl.class.getDeclaredMethod("createEndpointPolicyInfo", new Class[] {});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
+        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();
+        control.replay();
+        assertSame(epi, engine.createEndpointPolicyInfo(ei, false, assertor));
+        control.verify();
+    }
+    
+    @Test
+    public void testSetEndpointPolicy() {
+        engine = new PolicyEngineImpl();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        EndpointPolicyImpl epi = control.createMock(EndpointPolicyImpl.class);
+        engine.setEndpointPolicy(ei, epi);
+        assertSame(epi, engine.getClientEndpointPolicy(ei, (Conduit)null));
+        assertSame(epi, engine.getServerEndpointPolicy(ei, (Destination)null)); 
+    }
+    
+    
+    @Test
     public void testDontAddBusInterceptors() {        
         doTestAddBusInterceptors(false);
     }
@@ -102,7 +324,7 @@
     }
     
     private void doTestAddBusInterceptors(boolean add) {        
-        engine = new PolicyEngine();
+        engine = new PolicyEngineImpl();
         engine.setRegisterInterceptors(add);
     
         Bus bus = control.createMock(Bus.class);
@@ -152,7 +374,7 @@
     
     @Test
     public void testGetAggregatedServicePolicy() {
-        engine = new PolicyEngine();
+        engine = new PolicyEngineImpl();
         List<PolicyProvider> providers = new ArrayList<PolicyProvider>();
         engine.setPolicyProviders(providers);
         ServiceInfo si = control.createMock(ServiceInfo.class);
@@ -188,7 +410,7 @@
     
     @Test
     public void testGetAggregatedEndpointPolicy() {
-        engine = new PolicyEngine();
+        engine = new PolicyEngineImpl();
         List<PolicyProvider> providers = new ArrayList<PolicyProvider>();
         engine.setPolicyProviders(providers);
         EndpointInfo ei = control.createMock(EndpointInfo.class);
@@ -224,7 +446,7 @@
     
     @Test
     public void testGetAggregatedOperationPolicy() {
-        engine = new PolicyEngine();
+        engine = new PolicyEngineImpl();
         List<PolicyProvider> providers = new ArrayList<PolicyProvider>();
         engine.setPolicyProviders(providers);
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
@@ -260,7 +482,7 @@
     
     @Test
     public void testGetAggregatedMessagePolicy() {
-        engine = new PolicyEngine();
+        engine = new PolicyEngineImpl();
         List<PolicyProvider> providers = new ArrayList<PolicyProvider>();
         engine.setPolicyProviders(providers);
         BindingMessageInfo bmi = control.createMock(BindingMessageInfo.class);
@@ -296,7 +518,7 @@
     
     @Test
     public void testGetAggregatedFaultPolicy() {
-        engine = new PolicyEngine();
+        engine = new PolicyEngineImpl();
         List<PolicyProvider> providers = new ArrayList<PolicyProvider>();
         engine.setPolicyProviders(providers);
         BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
@@ -332,9 +554,9 @@
     
     @Test
     public void testGetAssertions() throws NoSuchMethodException {
-        Method m = PolicyEngine.class.getDeclaredMethod("addAssertions",
+        Method m = PolicyEngineImpl.class.getDeclaredMethod("addAssertions",
             new Class[] {PolicyComponent.class, boolean.class, Collection.class});
-        engine = control.createMock(PolicyEngine.class, new Method[] {m});
+        engine = control.createMock(PolicyEngineImpl.class, new Method[] {m});
         Assertion a = control.createMock(Assertion.class);
         EasyMock.expect(a.getType()).andReturn(Constants.TYPE_ASSERTION);
         EasyMock.expect(a.isOptional()).andReturn(true);
@@ -367,7 +589,7 @@
     
     @Test
     public void testAddAssertions() {
-        engine = new PolicyEngine();
+        engine = new PolicyEngineImpl();
         Collection<Assertion> assertions = new ArrayList<Assertion>();
         
         Assertion a = control.createMock(Assertion.class);
@@ -402,249 +624,28 @@
     
     @Test
     public void testKeys() {
-        engine = new PolicyEngine();
-        Endpoint endpoint = control.createMock(Endpoint.class);
+        engine = new PolicyEngineImpl();
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);      
         BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);  
         control.replay();
         
-        PolicyEngine.BindingOperation bo = engine.new BindingOperation(endpoint, boi); 
+        PolicyEngineImpl.BindingOperation bo = engine.new BindingOperation(ei, boi); 
         assertNotNull(bo);
-        PolicyEngine.BindingOperation bo2 = engine.new BindingOperation(endpoint, boi);
+        PolicyEngineImpl.BindingOperation bo2 = engine.new BindingOperation(ei, boi);
         assertEquals(bo, bo2);
         assertEquals(bo.hashCode(), bo2.hashCode());
                   
-        PolicyEngine.BindingFault bf = engine.new BindingFault(endpoint, bfi);
+        PolicyEngineImpl.BindingFault bf = engine.new BindingFault(ei, bfi);
         assertNotNull(bf);
-        PolicyEngine.BindingFault bf2 = engine.new BindingFault(endpoint, bfi);
+        PolicyEngineImpl.BindingFault bf2 = engine.new BindingFault(ei, bfi);
         assertEquals(bf, bf2);
         assertEquals(bf.hashCode(), bf2.hashCode());
               
         control.verify();
     }
     
-    @Test
-    public void testGetClientRequestPolicyInfo() throws NoSuchMethodException {
-        Method m = PolicyEngine.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
-        engine = control.createMock(PolicyEngine.class, new Method[] {m});
-        engine.init();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); 
-        AssertingConduit conduit = control.createMock(AssertingConduit.class);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(opi);
-        opi.initialise(endpoint, boi, engine, conduit, true);
-        EasyMock.expectLastCall();
-        control.replay();
-        assertSame(opi, engine.getClientRequestPolicyInfo(endpoint, boi, conduit));
-        assertSame(opi, engine.getClientRequestPolicyInfo(endpoint, boi, conduit));
-        control.verify();
-    }
-    
-    @Test 
-    public void testSetClientRequestPolicyInfo() {
-        engine = new PolicyEngine();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        engine.setClientRequestPolicyInfo(endpoint, boi, opi);
-        assertSame(opi, engine.getClientRequestPolicyInfo(endpoint, boi, (Conduit)null));        
-    }
-    
-    @Test
-    public void testGetServerRequestPolicyInfo() throws NoSuchMethodException {
-        Method m = PolicyEngine.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
-        engine = control.createMock(PolicyEngine.class, new Method[] {m});
-        engine.init();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); 
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(opi);
-        opi.initialisePolicy(endpoint, boi, engine, false);
-        EasyMock.expectLastCall();
-        control.replay();
-        assertSame(opi, engine.getServerRequestPolicyInfo(endpoint, boi));
-        assertSame(opi, engine.getServerRequestPolicyInfo(endpoint, boi));
-        control.verify();
-    }
-    
-    @Test 
-    public void testSetServerRequestPolicyInfo() {
-        engine = new PolicyEngine();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        engine.setServerRequestPolicyInfo(endpoint, boi, opi);
-        assertSame(opi, engine.getServerRequestPolicyInfo(endpoint, boi));        
-    }
-    
-    @Test
-    public void testGetClientResponsePolicyInfo() throws NoSuchMethodException {
-        Method m = PolicyEngine.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
-        engine = control.createMock(PolicyEngine.class, new Method[] {m});
-        engine.init();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); 
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(opi);
-        opi.initialisePolicy(endpoint, boi, engine, true);
-        EasyMock.expectLastCall();
-        control.replay();
-        assertSame(opi, engine.getClientResponsePolicyInfo(endpoint, boi));
-        assertSame(opi, engine.getClientResponsePolicyInfo(endpoint, boi));
-        control.verify();
-    }
-    
-    @Test 
-    public void testSetClientResponsePolicyInfo() {
-        engine = new PolicyEngine();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        engine.setClientResponsePolicyInfo(endpoint, boi, opi);
-        assertSame(opi, engine.getClientResponsePolicyInfo(endpoint, boi));        
-    }
-    
-    @Test
-    public void testGetClientFaultPolicyInfo() throws NoSuchMethodException {
-        Method m = PolicyEngine.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
-        engine = control.createMock(PolicyEngine.class, new Method[] {m});
-        engine.init();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class); 
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(opi);
-        opi.initialisePolicy(endpoint, bfi, engine);
-        EasyMock.expectLastCall();
-        control.replay();
-        assertSame(opi, engine.getClientFaultPolicyInfo(endpoint, bfi));
-        assertSame(opi, engine.getClientFaultPolicyInfo(endpoint, bfi));
-        control.verify();
-    }
-    
-    @Test 
-    public void testSetClientFaultPolicyInfo() {
-        engine = new PolicyEngine();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        engine.setClientFaultPolicyInfo(endpoint, bfi, opi);
-        assertSame(opi, engine.getClientFaultPolicyInfo(endpoint, bfi));        
-    }
-    
-    @Test
-    public void testGetEndpointPolicyInfoClientSide() throws NoSuchMethodException {
-        Method m = PolicyEngine.class.getDeclaredMethod("createEndpointPolicyInfo", 
-            new Class[] {Endpoint.class, boolean.class, Assertor.class});
-        engine = control.createMock(PolicyEngine.class, new Method[] {m});
-        engine.init();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        AssertingConduit conduit = control.createMock(AssertingConduit.class);
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);
-        EasyMock.expect(engine.createEndpointPolicyInfo(endpoint, false, conduit)).andReturn(epi);
-        control.replay();
-        assertSame(epi, engine.getEndpointPolicyInfo(endpoint, conduit));
-        control.verify();        
-    }
-    
-    @Test
-    public void testGetEndpointPolicyInfoServerSide() throws NoSuchMethodException {
-        Method m = PolicyEngine.class.getDeclaredMethod("createEndpointPolicyInfo", 
-            new Class[] {Endpoint.class, boolean.class, Assertor.class});
-        engine = control.createMock(PolicyEngine.class, new Method[] {m});
-        engine.init();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        AssertingDestination destination = control.createMock(AssertingDestination.class);
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);
-        EasyMock.expect(engine.createEndpointPolicyInfo(endpoint, true, destination)).andReturn(epi);
-        control.replay();
-        assertSame(epi, engine.getEndpointPolicyInfo(endpoint, destination));
-        control.verify();        
-    }
-    
-    @Test
-    public void testCreateEndpointPolicyInfo() throws NoSuchMethodException {
-        Method m = PolicyEngine.class.getDeclaredMethod("createEndpointPolicyInfo", new Class[] {});
-        engine = control.createMock(PolicyEngine.class, new Method[] {m});
-        engine.init();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        EndpointInfo ei = control.createMock(EndpointInfo.class);
-        EasyMock.expect(endpoint.getEndpointInfo()).andReturn(ei);
-        Assertor assertor = control.createMock(Assertor.class);
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);
-        EasyMock.expect(engine.createEndpointPolicyInfo()).andReturn(epi);
-        epi.initialise(ei, false, engine, assertor);
-        EasyMock.expectLastCall();
-        control.replay();
-        assertSame(epi, engine.createEndpointPolicyInfo(endpoint, false, assertor));
-        control.verify();
-    }
-    
-    @Test
-    public void testSetEndpointPolicyInfo() {
-        engine = new PolicyEngine();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);
-        engine.setEndpointPolicyInfo(endpoint, epi);
-        assertSame(epi, engine.getEndpointPolicyInfo(endpoint, (Conduit)null));
-        assertSame(epi, engine.getEndpointPolicyInfo(endpoint, (Destination)null)); 
-    }
-    
-    @Test
-    public void testGetServerResponsePolicyInfo() throws NoSuchMethodException {
-        Method m = PolicyEngine.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
-        engine = control.createMock(PolicyEngine.class, new Method[] {m});
-        engine.init();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); 
-        AssertingDestination destination = control.createMock(AssertingDestination.class);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(opi);
-        opi.initialise(endpoint, boi, engine, destination, false);
-        EasyMock.expectLastCall();
-        control.replay();
-        assertSame(opi, engine.getServerResponsePolicyInfo(endpoint, boi, destination));
-        assertSame(opi, engine.getServerResponsePolicyInfo(endpoint, boi, destination));
-        control.verify();
-    }
     
-    @Test
-    public void testSetServerResponsePolicyInfo() {
-        engine = new PolicyEngine();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        engine.setServerResponsePolicyInfo(endpoint, boi, opi);
-        assertSame(opi, engine.getServerResponsePolicyInfo(endpoint, boi, (Destination)null));   
-    }
-   
-    @Test
-    public void testGetServerFaultPolicyInfo() throws NoSuchMethodException {
-        Method m = PolicyEngine.class.getDeclaredMethod("createOutPolicyInfo", new Class[] {});
-        engine = control.createMock(PolicyEngine.class, new Method[] {m});
-        engine.init();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class); 
-        AssertingDestination destination = control.createMock(AssertingDestination.class);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        EasyMock.expect(engine.createOutPolicyInfo()).andReturn(opi);
-        opi.initialise(endpoint, bfi, engine, destination);
-        EasyMock.expectLastCall();
-        control.replay();
-        assertSame(opi, engine.getServerFaultPolicyInfo(endpoint, bfi, destination));
-        assertSame(opi, engine.getServerFaultPolicyInfo(endpoint, bfi, destination));
-        control.verify();
-    }
-    
-    @Test
-    public void testSetServerFaultPolicyInfo() {
-        engine = new PolicyEngine();
-        Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        engine.setServerFaultPolicyInfo(endpoint, bfi, opi);
-        assertSame(opi, engine.getServerFaultPolicyInfo(endpoint, bfi, (Destination)null));   
-    }
     
     private Set<String> getInterceptorIds(List<Interceptor> interceptors) {
         Set<String> ids = new HashSet<String>();

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java Wed Mar 28 09:08:23 2007
@@ -77,8 +77,9 @@
             deb = debr.get(UNKNOWN);
             assertNull(deb);
             
-            PolicyEngine engine = bus.getExtension(PolicyEngine.class);
-            assertNotNull(engine);            
+            PolicyEngine pe = bus.getExtension(PolicyEngine.class);
+            assertNotNull(pe);
+            PolicyEngineImpl engine = (PolicyEngineImpl)pe; 
             assertNotNull(engine.getPolicyProviders());
             assertNotNull(engine.getRegistry());
             

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java Wed Mar 28 09:08:23 2007
@@ -32,6 +32,7 @@
 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;
 import org.apache.cxf.service.model.FaultInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
@@ -52,6 +53,7 @@
     private Exchange exchange;
     private BindingOperationInfo boi;
     private Endpoint endpoint;
+    private EndpointInfo ei;
     private Bus bus;
     private PolicyEngine pe;
     private Conduit conduit;
@@ -80,17 +82,18 @@
         
         control.reset();
         setupMessage(true, true, true, true, true, true);        
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        EasyMock.expect(pe.getClientRequestPolicyInfo(endpoint, boi, conduit)).andReturn(opi);
+        EffectivePolicy effectivePolicy = control.createMock(EffectivePolicy.class);
+        EasyMock.expect(pe.getEffectiveClientRequestPolicy(ei, boi, conduit))
+            .andReturn(effectivePolicy);
         Interceptor i = control.createMock(Interceptor.class);
-        EasyMock.expect(opi.getInterceptors())
+        EasyMock.expect(effectivePolicy.getInterceptors())
             .andReturn(CastUtils.cast(Collections.singletonList(i), Interceptor.class));
         InterceptorChain ic = control.createMock(InterceptorChain.class);
         EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
         ic.add(i);
         EasyMock.expectLastCall();
         Collection<Assertion> assertions = CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
-        EasyMock.expect(opi.getChosenAlternative()).andReturn(assertions);
+        EasyMock.expect(effectivePolicy.getChosenAlternative()).andReturn(assertions);
         message.put(EasyMock.eq(AssertionInfoMap.class), EasyMock.isA(AssertionInfoMap.class));
         EasyMock.expectLastCall();
         control.replay();
@@ -107,17 +110,17 @@
         
         control.reset();
         setupMessage(true, true, false, false, true, true);        
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);
-        EasyMock.expect(pe.getEndpointPolicyInfo(endpoint, conduit)).andReturn(epi);
+        EndpointPolicy endpointPolicy = control.createMock(EndpointPolicy.class);
+        EasyMock.expect(pe.getClientEndpointPolicy(ei, conduit)).andReturn(endpointPolicy);
         Interceptor i = control.createMock(Interceptor.class);
-        EasyMock.expect(epi.getInInterceptors())
+        EasyMock.expect(endpointPolicy.getInterceptors())
             .andReturn(CastUtils.cast(Collections.singletonList(i), Interceptor.class));
         InterceptorChain ic = control.createMock(InterceptorChain.class);
         EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
         ic.add(i);
         EasyMock.expectLastCall();
         Collection<Assertion> assertions = CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
-        EasyMock.expect(epi.getVocabulary()).andReturn(assertions);
+        EasyMock.expect(endpointPolicy.getVocabulary()).andReturn(assertions);
         message.put(EasyMock.eq(AssertionInfoMap.class), EasyMock.isA(AssertionInfoMap.class));
         EasyMock.expectLastCall();
         control.replay();
@@ -134,17 +137,17 @@
         
         control.reset();
         setupMessage(true, true, false, false, true, true);
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);
-        EasyMock.expect(pe.getEndpointPolicyInfo(endpoint, conduit)).andReturn(epi);
+        EndpointPolicy endpointPolicy = control.createMock(EndpointPolicy.class);
+        EasyMock.expect(pe.getClientEndpointPolicy(ei, conduit)).andReturn(endpointPolicy);
         Interceptor i = control.createMock(Interceptor.class);
-        EasyMock.expect(epi.getInFaultInterceptors())
+        EasyMock.expect(endpointPolicy.getFaultInterceptors())
             .andReturn(CastUtils.cast(Collections.singletonList(i), Interceptor.class));
         InterceptorChain ic = control.createMock(InterceptorChain.class);
         EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
         ic.add(i);
         EasyMock.expectLastCall();
         Collection<Assertion> assertions = CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
-        EasyMock.expect(epi.getFaultVocabulary()).andReturn(assertions);
+        EasyMock.expect(endpointPolicy.getFaultVocabulary()).andReturn(assertions);
         message.put(EasyMock.eq(AssertionInfoMap.class), EasyMock.isA(AssertionInfoMap.class));
         EasyMock.expectLastCall();
         control.replay();
@@ -161,17 +164,17 @@
 
         control.reset();
         setupMessage(false, false, false, false, true, true);
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);
-        EasyMock.expect(pe.getEndpointPolicyInfo(endpoint, destination)).andReturn(epi);
+        EndpointPolicy endpointPolicy = control.createMock(EndpointPolicyImpl.class);
+        EasyMock.expect(pe.getServerEndpointPolicy(ei, destination)).andReturn(endpointPolicy);
         Interceptor i = control.createMock(Interceptor.class);
-        EasyMock.expect(epi.getInInterceptors())
+        EasyMock.expect(endpointPolicy.getInterceptors())
             .andReturn(CastUtils.cast(Collections.singletonList(i), Interceptor.class));
         InterceptorChain ic = control.createMock(InterceptorChain.class);
         EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
         ic.add(i);
         EasyMock.expectLastCall();
         Collection<Assertion> assertions = CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
-        EasyMock.expect(epi.getVocabulary()).andReturn(assertions);
+        EasyMock.expect(endpointPolicy.getVocabulary()).andReturn(assertions);
         message.put(EasyMock.eq(AssertionInfoMap.class), EasyMock.isA(AssertionInfoMap.class));
         EasyMock.expectLastCall();
         control.replay();
@@ -188,17 +191,18 @@
         
         control.reset();
         setupMessage(false, false, true, true, true, true);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        EasyMock.expect(pe.getServerResponsePolicyInfo(endpoint, boi, destination)).andReturn(opi);
+        EffectivePolicy effectivePolicy = control.createMock(EffectivePolicy.class);
+        EasyMock.expect(pe.getEffectiveServerResponsePolicy(ei, boi, destination))
+            .andReturn(effectivePolicy);
         Interceptor i = control.createMock(Interceptor.class);        
-        EasyMock.expect(opi.getInterceptors())
+        EasyMock.expect(effectivePolicy.getInterceptors())
             .andReturn(CastUtils.cast(Collections.singletonList(i), Interceptor.class));
         InterceptorChain ic = control.createMock(InterceptorChain.class);
         EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
         ic.add(i);
         EasyMock.expectLastCall();
         Collection<Assertion> assertions = CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
-        EasyMock.expect(opi.getChosenAlternative()).andReturn(assertions);
+        EasyMock.expect(effectivePolicy.getChosenAlternative()).andReturn(assertions);
         message.put(EasyMock.eq(AssertionInfoMap.class), EasyMock.isA(AssertionInfoMap.class));
         EasyMock.expectLastCall();
         control.replay();
@@ -232,17 +236,18 @@
         EasyMock.expect(exchange.get(Exception.class)).andReturn(ex);
         BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
         EasyMock.expect(interceptor.getBindingFaultInfo(message, ex, boi)).andReturn(bfi);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
-        EasyMock.expect(pe.getServerFaultPolicyInfo(endpoint, bfi, destination)).andReturn(opi);
+        EffectivePolicy effectivePolicy = control.createMock(EffectivePolicyImpl.class);
+        EasyMock.expect(pe.getEffectiveServerFaultPolicy(ei, bfi, destination))
+            .andReturn(effectivePolicy);
         Interceptor i = control.createMock(Interceptor.class);
-        EasyMock.expect(opi.getInterceptors())
+        EasyMock.expect(effectivePolicy.getInterceptors())
             .andReturn(CastUtils.cast(Collections.singletonList(i), Interceptor.class));
         InterceptorChain ic = control.createMock(InterceptorChain.class);
         EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
         ic.add(i);
         EasyMock.expectLastCall();
         Collection<Assertion> assertions = CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
-        EasyMock.expect(opi.getChosenAlternative()).andReturn(assertions);
+        EasyMock.expect(effectivePolicy.getChosenAlternative()).andReturn(assertions);
         message.put(EasyMock.eq(AssertionInfoMap.class), EasyMock.isA(AssertionInfoMap.class));
         EasyMock.expectLastCall();
         control.replay();
@@ -335,6 +340,10 @@
         if (!setupEndpoint) {
             return;
         }
+        if (null == ei) {
+            ei = control.createMock(EndpointInfo.class);
+        }
+        EasyMock.expect(endpoint.getEndpointInfo()).andReturn(ei);
         
         if (null == pe && setupEngine) {
             pe = control.createMock(PolicyEngine.class);

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptorTest.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptorTest.java Wed Mar 28 09:08:23 2007
@@ -24,6 +24,8 @@
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.neethi.Policy;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 import org.junit.Assert;
@@ -41,6 +43,7 @@
     private Exchange exchange;
     private BindingFaultInfo bfi;
     private Endpoint endpoint;
+    private EndpointInfo ei;
     private PolicyEngine engine;
     private AssertionInfoMap aim;
     
@@ -87,9 +90,11 @@
         
         control.reset();
         setupMessage(true, true, true, true, true);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);        
-        EasyMock.expect(engine.getClientFaultPolicyInfo(endpoint, bfi)).andReturn(opi);
-        opi.checkEffectivePolicy(aim);
+        EffectivePolicyImpl effectivePolicy = control.createMock(EffectivePolicyImpl.class);        
+        EasyMock.expect(engine.getEffectiveClientFaultPolicy(ei, bfi)).andReturn(effectivePolicy);
+        Policy policy = control.createMock(Policy.class);
+        EasyMock.expect(effectivePolicy.getPolicy()).andReturn(policy);
+        aim.checkEffectivePolicy(policy);
         EasyMock.expectLastCall();
         control.replay();
         interceptor.handleMessage(message);
@@ -128,6 +133,10 @@
         if (!setupEndpoint) {
             return;
         }
+        if (null == ei) {
+            ei = control.createMock(EndpointInfo.class);
+        }
+        EasyMock.expect(endpoint.getEndpointInfo()).andReturn(ei);
         
         if (setupPolicyEngine && null == engine) {
             engine = control.createMock(PolicyEngine.class);

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptorTest.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptorTest.java Wed Mar 28 09:08:23 2007
@@ -24,6 +24,8 @@
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.neethi.Policy;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 import org.junit.Assert;
@@ -41,6 +43,7 @@
     private Exchange exchange;
     private BindingOperationInfo boi;
     private Endpoint endpoint;
+    private EndpointInfo ei;
     private PolicyEngine engine;
     private AssertionInfoMap aim;
     
@@ -80,9 +83,11 @@
         control.reset();
         setupMessage(true, true, true, true);
         EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(Boolean.FALSE);
-        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);        
-        EasyMock.expect(engine.getServerRequestPolicyInfo(endpoint, boi)).andReturn(opi);
-        opi.checkEffectivePolicy(aim);
+        EffectivePolicyImpl effectivePolicy = control.createMock(EffectivePolicyImpl.class);        
+        EasyMock.expect(engine.getEffectiveServerRequestPolicy(ei, boi)).andReturn(effectivePolicy);
+        Policy policy = control.createMock(Policy.class);
+        EasyMock.expect(effectivePolicy.getPolicy()).andReturn(policy);
+        aim.checkEffectivePolicy(policy);
         EasyMock.expectLastCall();
         control.replay();
         interceptor.handleMessage(message);
@@ -99,8 +104,10 @@
         setupMessage(true, true, true, true);
         EasyMock.expect(message.get(Message.PARTIAL_RESPONSE_MESSAGE)).andReturn(null);
         EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(Boolean.TRUE);  
-        EasyMock.expect(engine.getClientResponsePolicyInfo(endpoint, boi)).andReturn(opi);
-        opi.checkEffectivePolicy(aim);
+        EasyMock.expect(engine.getEffectiveClientResponsePolicy(ei, boi)).andReturn(effectivePolicy);
+        EasyMock.expect(effectivePolicy.getPolicy()).andReturn(policy);
+        aim.checkEffectivePolicy(policy);
+        EasyMock.expectLastCall();
         EasyMock.expectLastCall();
         control.replay();
         interceptor.handleMessage(message);
@@ -133,6 +140,8 @@
         if (!setupEndpoint) {
             return;
         }
+        ei = control.createMock(EndpointInfo.class);
+        EasyMock.expect(endpoint.getEndpointInfo()).andReturn(ei);
         
         if (setupPolicyEngine && null == engine) {
             engine = control.createMock(PolicyEngine.class);

Modified: incubator/cxf/trunk/rt/ws/rm/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/pom.xml?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/pom.xml (original)
+++ incubator/cxf/trunk/rt/ws/rm/pom.xml Wed Mar 28 09:08:23 2007
@@ -58,11 +58,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-ws-policy</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-common-utilities</artifactId>
             <version>${project.version}</version>
         </dependency>

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?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- 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 Wed Mar 28 09:08:23 2007
@@ -30,6 +30,7 @@
 import org.apache.cxf.binding.soap.model.SoapOperationInfo;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.ServiceConstructionException;
@@ -43,9 +44,12 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.ws.addressing.Names;
-import org.apache.cxf.ws.policy.EndpointPolicyInfo;
-import org.apache.cxf.ws.policy.OutPolicyInfo;
+import org.apache.cxf.ws.policy.EffectivePolicy;
+import org.apache.cxf.ws.policy.EndpointPolicy;
 import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
 
 public class RMEndpoint {
     
@@ -240,27 +244,31 @@
     
     void setPolicies() {
         
-        Endpoint e = getEndpoint();
+        EndpointInfo ei = getEndpoint().getEndpointInfo();
         
         // use same WS-policies as for application endpoint
         
         PolicyEngine engine = manager.getBus().getExtension(PolicyEngine.class);
+        PolicyInterceptorProviderRegistry reg = 
+            manager.getBus().getExtension(PolicyInterceptorProviderRegistry.class);
+        EndpointPolicy ep = null == conduit
+            ? engine.getServerEndpointPolicy(applicationEndpoint.getEndpointInfo(), null)
+            : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(), conduit);
         
-        EndpointPolicyInfo epi = engine.getEndpointPolicyInfo(applicationEndpoint, conduit);
-        OutPolicyInfo opi = new OutPolicyInfo();
-        opi.initialise(epi, engine);
-        
-        engine.setEndpointPolicyInfo(e, epi);
-       
-        BindingInfo bi = e.getEndpointInfo().getBinding();
+        engine.setEndpointPolicy(ei, ep);
+        
+        EffectivePolicy effectiveOutbound = new EffectivePolicyImpl(ep, reg, true, false);
+        EffectivePolicy effectiveInbound = new EffectivePolicyImpl(ep, reg, false, false);
+        
+        BindingInfo bi = ei.getBinding();
         Collection<BindingOperationInfo> bois = bi.getOperations();
         
         for (BindingOperationInfo boi : bois) {
-            engine.setServerRequestPolicyInfo(e, boi, opi);
-            engine.setServerResponsePolicyInfo(e, boi, opi);
+            engine.setEffectiveServerRequestPolicy(ei, boi, effectiveInbound);
+            engine.setEffectiveServerResponsePolicy(ei, boi, effectiveOutbound);
 
-            engine.setClientRequestPolicyInfo(e, boi, opi);
-            engine.setClientResponsePolicyInfo(e, boi, opi);            
+            engine.setEffectiveClientRequestPolicy(ei, boi, effectiveOutbound);
+            engine.setEffectiveClientResponsePolicy(ei, boi, effectiveInbound);            
         }
         
         // TODO: FaultPolicy (SequenceFault)
@@ -437,5 +445,29 @@
     
     void setManager(RMManager m) {
         manager = m;
+    }
+    
+    class EffectivePolicyImpl implements EffectivePolicy {
+        
+        private EndpointPolicy endpointPolicy;
+        private List<Interceptor> interceptors;
+
+        EffectivePolicyImpl(EndpointPolicy ep, PolicyInterceptorProviderRegistry reg, 
+                            boolean outbound, boolean fault) {
+            endpointPolicy = ep;
+            interceptors = reg.getInterceptors(endpointPolicy.getChosenAlternative(), outbound, fault);
+        }
+        
+        public Collection<Assertion> getChosenAlternative() {
+            return endpointPolicy.getChosenAlternative();
+        }
+
+        public List<Interceptor> getInterceptors() {
+            return interceptors;
+        }
+
+        public Policy getPolicy() {
+            return endpointPolicy.getPolicy();
+        }
     }
 }

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?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- 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 Wed Mar 28 09:08:23 2007
@@ -35,12 +35,11 @@
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.ws.policy.EndpointPolicyInfo;
-import org.apache.cxf.ws.policy.OutPolicyInfo;
+import org.apache.cxf.ws.policy.EffectivePolicy;
+import org.apache.cxf.ws.policy.EndpointPolicy;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry;
 import org.apache.neethi.Assertion;
-import org.apache.neethi.Policy;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 import org.junit.After;
@@ -205,37 +204,37 @@
         rme.setManager(manager);
         Endpoint e = control.createMock(Endpoint.class);
         EasyMock.expect(rme.getEndpoint()).andReturn(e);
+        EndpointInfo ei = control.createMock(EndpointInfo.class);
+        EasyMock.expect(e.getEndpointInfo()).andReturn(ei);
         Bus bus = control.createMock(Bus.class);
-        EasyMock.expect(manager.getBus()).andReturn(bus);
+        EasyMock.expect(manager.getBus()).andReturn(bus).times(2);
         PolicyEngine pe = control.createMock(PolicyEngine.class);
         EasyMock.expect(bus.getExtension(PolicyEngine.class)).andReturn(pe);
-        EndpointPolicyInfo epi = control.createMock(EndpointPolicyInfo.class);
-        EasyMock.expect(pe.getEndpointPolicyInfo(ae, (Conduit)null)).andReturn(epi);
-        Policy policy = new Policy();
-        EasyMock.expect(epi.getPolicy()).andReturn(policy);
-        EasyMock.expect(epi.getChosenAlternative()).andReturn(new ArrayList<Assertion>());
-        EasyMock.expect(pe.getBus()).andReturn(bus);
         PolicyInterceptorProviderRegistry reg = control.createMock(PolicyInterceptorProviderRegistry.class);
         EasyMock.expect(bus.getExtension(PolicyInterceptorProviderRegistry.class)).andReturn(reg);
-        pe.setEndpointPolicyInfo(e, epi);
+        EndpointInfo aei = control.createMock(EndpointInfo.class);
+        EasyMock.expect(ae.getEndpointInfo()).andReturn(aei);
+        EndpointPolicy epi = control.createMock(EndpointPolicy.class);
+        EasyMock.expect(pe.getServerEndpointPolicy(aei, null)).andReturn(epi);
+        EasyMock.expect(epi.getChosenAlternative()).andReturn(new ArrayList<Assertion>());
+        
+        pe.setEndpointPolicy(ei, epi);
         EasyMock.expectLastCall();
-        EndpointInfo ei = control.createMock(EndpointInfo.class);
-        EasyMock.expect(e.getEndpointInfo()).andReturn(ei);
         BindingInfo bi = control.createMock(BindingInfo.class);
         EasyMock.expect(ei.getBinding()).andReturn(bi);
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
         EasyMock.expect(bi.getOperations()).andReturn(Collections.singletonList(boi));
-        pe.setServerRequestPolicyInfo(EasyMock.eq(e), EasyMock.eq(boi), 
-                                      EasyMock.isA(OutPolicyInfo.class));
+        pe.setEffectiveServerRequestPolicy(EasyMock.eq(ei), EasyMock.eq(boi), 
+                                      EasyMock.isA(EffectivePolicy.class));
         EasyMock.expectLastCall();
-        pe.setServerResponsePolicyInfo(EasyMock.eq(e), EasyMock.eq(boi), 
-                                      EasyMock.isA(OutPolicyInfo.class));
+        pe.setEffectiveServerResponsePolicy(EasyMock.eq(ei), EasyMock.eq(boi), 
+                                      EasyMock.isA(EffectivePolicy.class));
         EasyMock.expectLastCall();
-        pe.setClientRequestPolicyInfo(EasyMock.eq(e), EasyMock.eq(boi), 
-                                      EasyMock.isA(OutPolicyInfo.class));
+        pe.setEffectiveClientRequestPolicy(EasyMock.eq(ei), EasyMock.eq(boi), 
+                                      EasyMock.isA(EffectivePolicy.class));
         EasyMock.expectLastCall();
-        pe.setClientResponsePolicyInfo(EasyMock.eq(e), EasyMock.eq(boi), 
-                                      EasyMock.isA(OutPolicyInfo.class));
+        pe.setEffectiveClientResponsePolicy(EasyMock.eq(ei), EasyMock.eq(boi), 
+                                      EasyMock.isA(EffectivePolicy.class));
         EasyMock.expectLastCall();
         control.replay();
         rme.setPolicies();



Mime
View raw message