cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1531410 - in /cxf/trunk/rt/ws: policy/src/main/java/org/apache/cxf/ws/policy/ policy/src/test/java/org/apache/cxf/ws/policy/ rm/src/main/java/org/apache/cxf/ws/rm/ rm/src/test/java/org/apache/cxf/ws/rm/
Date Fri, 11 Oct 2013 20:27:27 GMT
Author: dkulp
Date: Fri Oct 11 20:27:27 2013
New Revision: 1531410

URL: http://svn.apache.org/r1531410
Log:
Use the interface when possible

Modified:
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java?rev=1531410&r1=1531409&r2=1531410&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
Fri Oct 11 20:27:27 2013
@@ -69,11 +69,11 @@ public class EffectivePolicyImpl impleme
         return chosenAlternative;
     }
     
-    public void initialise(EndpointPolicyImpl epi, PolicyEngineImpl engine, boolean inbound)
{
+    public void initialise(EndpointPolicy epi, PolicyEngine engine, boolean inbound) {
         initialise(epi, engine, inbound, false);
     }
 
-    public void initialise(EndpointPolicyImpl epi, PolicyEngineImpl engine, boolean inbound,
boolean fault) {
+    public void initialise(EndpointPolicy epi, PolicyEngine engine, boolean inbound, boolean
fault) {
         policy = epi.getPolicy();
         chosenAlternative = epi.getChosenAlternative();
         if (chosenAlternative == null) {
@@ -84,7 +84,7 @@ public class EffectivePolicyImpl impleme
     
     public void initialise(EndpointInfo ei, 
                     BindingOperationInfo boi, 
-                    PolicyEngineImpl engine, 
+                    PolicyEngine engine, 
                     Assertor assertor,
                     boolean requestor,
                     boolean request) {
@@ -95,7 +95,7 @@ public class EffectivePolicyImpl impleme
     
     public void initialise(EndpointInfo ei, 
                     BindingOperationInfo boi, 
-                    PolicyEngineImpl engine, 
+                    PolicyEngine engine, 
                     Assertor assertor,
                     boolean requestor,
                     boolean request,
@@ -107,7 +107,7 @@ public class EffectivePolicyImpl impleme
     
     public void initialise(EndpointInfo ei, 
                     BindingOperationInfo boi, 
-                    PolicyEngineImpl engine, 
+                    PolicyEngine engine, 
                     boolean requestor, boolean request) {
         Assertor assertor = initialisePolicy(ei, boi, engine, requestor, request, null);
         if (requestor || !request) {
@@ -115,7 +115,7 @@ public class EffectivePolicyImpl impleme
             initialiseInterceptors(engine, requestor);
         } else {
             //incoming server should not choose an alternative, need to include all the policies
-            Collection<Assertion> alternative = engine.getAssertions(this.policy, true);
+            Collection<Assertion> alternative = ((PolicyEngineImpl)engine).getAssertions(this.policy,
true);
             this.setChosenAlternative(alternative);
         }
     }
@@ -123,7 +123,7 @@ public class EffectivePolicyImpl impleme
     public void initialise(EndpointInfo ei, 
                     BindingOperationInfo boi, 
                     BindingFaultInfo bfi, 
-                    PolicyEngineImpl engine, 
+                    PolicyEngine engine, 
                     Assertor assertor) {
         initialisePolicy(ei, boi, bfi, engine);
         chooseAlternative(engine, assertor);
@@ -143,7 +143,7 @@ public class EffectivePolicyImpl impleme
     }
     Assertor initialisePolicy(EndpointInfo ei,
                           BindingOperationInfo boi,  
-                          PolicyEngineImpl engine, 
+                          PolicyEngine engine, 
                           boolean requestor, boolean request,
                           Assertor assertor) {
         
@@ -163,28 +163,28 @@ public class EffectivePolicyImpl impleme
             assertor = ((EndpointPolicyImpl)ep).getAssertor();
         }
         
-        policy = policy.merge(engine.getAggregatedOperationPolicy(boi));
+        policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedOperationPolicy(boi));
         if (null != bmi) {
-            policy = policy.merge(engine.getAggregatedMessagePolicy(bmi));
+            policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedMessagePolicy(bmi));
         }
         policy = policy.normalize(engine.getRegistry(), true);
         return assertor;
     }
     
     void initialisePolicy(EndpointInfo ei, BindingOperationInfo boi,
-                          BindingFaultInfo bfi, PolicyEngineImpl engine) {
+                          BindingFaultInfo bfi, PolicyEngine engine) {
         policy = engine.getServerEndpointPolicy(ei, (Destination)null).getPolicy();     
   
-        policy = policy.merge(engine.getAggregatedOperationPolicy(boi));
+        policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedOperationPolicy(boi));
         if (bfi != null) {
-            policy = policy.merge(engine.getAggregatedFaultPolicy(bfi));
+            policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedFaultPolicy(bfi));
         }
         policy = policy.normalize(engine.getRegistry(), true);
     }
 
-    void chooseAlternative(PolicyEngineImpl engine, Assertor assertor) {
+    void chooseAlternative(PolicyEngine engine, Assertor assertor) {
         chooseAlternative(engine, assertor, null);
     }
-    void chooseAlternative(PolicyEngineImpl engine, Assertor assertor, List<List<Assertion>>
incoming) {
+    void chooseAlternative(PolicyEngine engine, Assertor assertor, List<List<Assertion>>
incoming) {
         Collection<Assertion> alternative = engine.getAlternativeSelector()
             .selectAlternative(policy, engine, assertor, incoming);
         if (null == alternative) {
@@ -195,18 +195,18 @@ public class EffectivePolicyImpl impleme
         }   
     }
 
-    void initialiseInterceptors(PolicyEngineImpl engine) {
+    void initialiseInterceptors(PolicyEngine engine) {
         initialiseInterceptors(engine, false);
     }
     
-    void initialiseInterceptors(PolicyEngineImpl engine, boolean useIn) {
+    void initialiseInterceptors(PolicyEngine engine, boolean useIn) {
         initialiseInterceptors(engine, useIn, false);
     }
 
-    void initialiseInterceptors(PolicyEngineImpl engine, boolean useIn, boolean fault) {
-        if (engine.getBus() != null) {
+    void initialiseInterceptors(PolicyEngine engine, boolean useIn, boolean fault) {
+        if (((PolicyEngineImpl)engine).getBus() != null) {
             PolicyInterceptorProviderRegistry reg 
-                = engine.getBus().getExtension(PolicyInterceptorProviderRegistry.class);
+                = ((PolicyEngineImpl)engine).getBus().getExtension(PolicyInterceptorProviderRegistry.class);
             Set<Interceptor<? extends org.apache.cxf.message.Message>> out 
                 = new LinkedHashSet<Interceptor<? extends org.apache.cxf.message.Message>>();
             for (Assertion a : getChosenAlternative()) {
@@ -217,7 +217,7 @@ public class EffectivePolicyImpl impleme
     }
     
     
-    protected Collection<Assertion> getSupportedAlternatives(PolicyEngineImpl engine,
+    protected Collection<Assertion> getSupportedAlternatives(PolicyEngine engine,
                                                                    Policy p) {
         Collection<Assertion> alternatives = new ArrayList<Assertion>();
 
@@ -230,7 +230,7 @@ public class EffectivePolicyImpl impleme
         return alternatives;
     }
 
-    void initialiseInterceptors(PolicyInterceptorProviderRegistry reg, PolicyEngineImpl engine,
+    void initialiseInterceptors(PolicyInterceptorProviderRegistry reg, PolicyEngine engine,
                                 Set<Interceptor<? extends org.apache.cxf.message.Message>>
out, Assertion a,
                                 boolean useIn, boolean fault) {
         QName qn = a.getName();

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java?rev=1531410&r1=1531409&r2=1531410&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
(original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
Fri Oct 11 20:27:27 2013
@@ -90,7 +90,7 @@ public class EffectivePolicyImplTest ext
     @Test
     public void testInitialiseFromEndpointPolicy() throws NoSuchMethodException {
         Method m = EffectivePolicyImpl.class.getDeclaredMethod("initialiseInterceptors",
-                                                          new Class[] {PolicyEngineImpl.class});
+                                                          new Class[] {PolicyEngine.class});
         EffectivePolicyImpl effectivePolicy = EasyMock.createMockBuilder(EffectivePolicyImpl.class)
             .addMockedMethod(m).createMock(control);
         EndpointPolicyImpl endpointPolicy = control.createMock(EndpointPolicyImpl.class);
@@ -111,14 +111,14 @@ public class EffectivePolicyImplTest ext
         Method m1 = EffectivePolicyImpl.class.getDeclaredMethod("initialisePolicy",
             new Class[] {EndpointInfo.class, 
                          BindingOperationInfo.class, 
-                         PolicyEngineImpl.class,
+                         PolicyEngine.class,
                          boolean.class,
                          boolean.class,
                          Assertor.class});
         Method m2 = EffectivePolicyImpl.class.getDeclaredMethod("chooseAlternative",
-            new Class[] {PolicyEngineImpl.class, Assertor.class});
+            new Class[] {PolicyEngine.class, Assertor.class});
         Method m3 = EffectivePolicyImpl.class.getDeclaredMethod("initialiseInterceptors",
-                                                          new Class[] {PolicyEngineImpl.class});
+                                                          new Class[] {PolicyEngine.class});
         EffectivePolicyImpl effectivePolicy = EasyMock.createMockBuilder(EffectivePolicyImpl.class)
             .addMockedMethods(m1, m2, m3).createMock(control);        
         EndpointInfo ei = control.createMock(EndpointInfo.class);
@@ -143,11 +143,11 @@ public class EffectivePolicyImplTest ext
     public void testInitialiseFault() throws NoSuchMethodException {
         Method m1 = EffectivePolicyImpl.class.getDeclaredMethod("initialisePolicy",
             new Class[] {EndpointInfo.class, BindingOperationInfo.class,
-                         BindingFaultInfo.class, PolicyEngineImpl.class});
+                         BindingFaultInfo.class, PolicyEngine.class});
         Method m2 = EffectivePolicyImpl.class.getDeclaredMethod("chooseAlternative",
-            new Class[] {PolicyEngineImpl.class, Assertor.class});
+            new Class[] {PolicyEngine.class, Assertor.class});
         Method m3 = EffectivePolicyImpl.class.getDeclaredMethod("initialiseInterceptors",
-                                                          new Class[] {PolicyEngineImpl.class});
+                                                          new Class[] {PolicyEngine.class});
         EffectivePolicyImpl effectivePolicy = EasyMock.createMockBuilder(EffectivePolicyImpl.class)
             .addMockedMethods(m1, m2, m3).createMock(control);        
         EndpointInfo ei = control.createMock(EndpointInfo.class);

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java?rev=1531410&r1=1531409&r2=1531410&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java Fri Oct 11 20:27:27
2013
@@ -70,8 +70,8 @@ import org.apache.cxf.ws.addressing.JAXW
 import org.apache.cxf.ws.addressing.MAPAggregator;
 import org.apache.cxf.ws.addressing.Names;
 import org.apache.cxf.ws.policy.EffectivePolicyImpl;
-import org.apache.cxf.ws.policy.EndpointPolicyImpl;
-import org.apache.cxf.ws.policy.PolicyEngineImpl;
+import org.apache.cxf.ws.policy.EndpointPolicy;
+import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.ws.rm.manager.SequenceTerminationPolicyType;
 import org.apache.cxf.ws.rm.manager.SourcePolicyType;
 import org.apache.cxf.ws.rm.v200702.CloseSequenceResponseType;
@@ -443,16 +443,16 @@ public class RMEndpoint {
 
     void setPolicies() {
         // use same WS-policies as for application endpoint
-        PolicyEngineImpl engine = manager.getBus().getExtension(PolicyEngineImpl.class);
+        PolicyEngine engine = manager.getBus().getExtension(PolicyEngine.class);
         if (null == engine || !engine.isEnabled()) {
             return;
         }
 
         for (Endpoint endpoint : endpoints.values()) {
             EndpointInfo ei = endpoint.getEndpointInfo();
-            EndpointPolicyImpl epi = (EndpointPolicyImpl)(null == conduit
+            EndpointPolicy epi = null == conduit
                 ? engine.getServerEndpointPolicy(applicationEndpoint.getEndpointInfo(), null)
-                    : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(),
conduit));
+                    : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(),
conduit);
             
             if (conduit != null) {
                 engine.setClientEndpointPolicy(ei, epi);

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java?rev=1531410&r1=1531409&r2=1531410&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java Fri Oct 11 20:27:27
2013
@@ -42,6 +42,7 @@ import org.apache.cxf.service.model.Serv
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.addressing.Names;
+import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.ws.policy.PolicyEngineImpl;
 import org.apache.cxf.ws.rm.v200702.Identifier;
 import org.easymock.EasyMock;
@@ -248,7 +249,7 @@ public class RMEndpointTest extends Asse
     public void testSetPoliciesNoEngine() {
         Bus bus = control.createMock(Bus.class);
         EasyMock.expect(manager.getBus()).andReturn(bus);
-        EasyMock.expect(bus.getExtension(PolicyEngineImpl.class)).andReturn(null);
+        EasyMock.expect(bus.getExtension(PolicyEngine.class)).andReturn(null);
         control.replay();
         rme.setPolicies();
     }
@@ -258,7 +259,7 @@ public class RMEndpointTest extends Asse
         Bus bus = control.createMock(Bus.class);
         EasyMock.expect(manager.getBus()).andReturn(bus);
         PolicyEngineImpl pe = control.createMock(PolicyEngineImpl.class);
-        EasyMock.expect(bus.getExtension(PolicyEngineImpl.class)).andReturn(pe);
+        EasyMock.expect(bus.getExtension(PolicyEngine.class)).andReturn(pe);
         EasyMock.expect(pe.isEnabled()).andReturn(false);
         control.replay();
         rme.setPolicies();



Mime
View raw message