cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsosno...@apache.org
Subject svn commit: r1531258 - in /cxf/trunk/rt: ./ ws/rm/ ws/rm/src/main/java/org/apache/cxf/ws/rm/ ws/rm/src/test/java/org/apache/cxf/ws/rm/
Date Fri, 11 Oct 2013 11:30:54 GMT
Author: dsosnoski
Date: Fri Oct 11 11:30:53 2013
New Revision: 1531258

URL: http://svn.apache.org/r1531258
Log:
CXF-5105 - basic support for using WS-RM over WS-SecureConversation

Modified:
    cxf/trunk/rt/pom.xml
    cxf/trunk/rt/ws/rm/pom.xml
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java

Modified: cxf/trunk/rt/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/pom.xml?rev=1531258&r1=1531257&r2=1531258&view=diff
==============================================================================
--- cxf/trunk/rt/pom.xml (original)
+++ cxf/trunk/rt/pom.xml Fri Oct 11 11:30:53 2013
@@ -53,8 +53,8 @@
         <module>transports/udp</module>
         <module>ws/policy</module>
         <module>ws/addr</module>
-        <module>ws/rm</module>
         <module>ws/security</module>
+        <module>ws/rm</module>
         <module>ws/mex</module>
         <module>ws/eventing</module>
         <module>rs/client</module>

Modified: cxf/trunk/rt/ws/rm/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/pom.xml?rev=1531258&r1=1531257&r2=1531258&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/pom.xml (original)
+++ cxf/trunk/rt/ws/rm/pom.xml Fri Oct 11 11:30:53 2013
@@ -83,6 +83,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-security</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-management</artifactId>
             <version>${project.version}</version>
         </dependency>

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java?rev=1531258&r1=1531257&r2=1531258&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java Fri Oct 11 11:30:53 2013
@@ -35,6 +35,8 @@ import org.apache.cxf.endpoint.ClientImp
 import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.DeferredConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -85,7 +87,7 @@ public class Proxy {
         RMConstants constants = protocol.getConstants();
         OperationInfo oi = reliableEndpoint.getEndpoint(protocol).getEndpointInfo()
             .getService().getInterface().getOperation(constants.getSequenceAckOperationName());
-        invoke(oi, protocol, new Object[] {ds}, null);
+        invoke(oi, protocol, new Object[] {ds});
     }
     
     void terminate(SourceSequence ss) throws RMException {
@@ -98,7 +100,7 @@ public class Proxy {
         ts.setIdentifier(ss.getIdentifier());
         ts.setLastMsgNumber(ss.getCurrentMessageNr());
         EncoderDecoder codec = protocol.getCodec();
-        invoke(oi, protocol, new Object[] {codec.convertToSend(ts)}, null);
+        invoke(oi, protocol, new Object[] {codec.convertToSend(ts)});
     }
     
     void terminate(DestinationSequence ds) throws RMException {
@@ -111,7 +113,7 @@ public class Proxy {
         ts.setIdentifier(ds.getIdentifier());
         ts.setLastMsgNumber(ds.getLastMessageNumber());
         EncoderDecoder codec = protocol.getCodec();
-        invoke(oi, protocol, new Object[] {codec.convertToSend(ts)}, null);
+        invoke(oi, protocol, new Object[] {codec.convertToSend(ts)});
     }
     
     void createSequenceResponse(final Object createResponse, ProtocolVariation protocol)
throws RMException {
@@ -122,14 +124,12 @@ public class Proxy {
         
         // TODO: need to set relatesTo
 
-        invoke(oi, protocol, new Object[] {createResponse}, null);
+        invoke(oi, protocol, new Object[] {createResponse});
        
     }
 
-    public CreateSequenceResponseType createSequence(
-                        EndpointReferenceType defaultAcksTo,
-                        RelatesToType relatesTo,
-                        boolean isServer, final ProtocolVariation protocol) throws RMException
{
+    public CreateSequenceResponseType createSequence(EndpointReferenceType defaultAcksTo,
RelatesToType relatesTo, 
+             boolean isServer, final ProtocolVariation protocol, final Exchange exchange)
throws RMException {
         
         SourcePolicyType sp = reliableEndpoint.getManager().getSourcePolicy();
         CreateSequenceType create = new CreateSequenceType();        
@@ -181,7 +181,7 @@ public class Proxy {
             Runnable r = new Runnable() {
                 public void run() {
                     try {
-                        invoke(oi, protocol, new Object[] {send}, null);
+                        invoke(oi, protocol, new Object[] {send}, null, exchange);
                     } catch (RMException ex) {
                         // already logged
                     }
@@ -196,7 +196,7 @@ public class Proxy {
         }
         
         
-        Object resp = invoke(oi, protocol, new Object[] {send}, null);
+        Object resp = invoke(oi, protocol, new Object[] {send}, null, exchange);
         return codec.convertReceivedCreateSequenceResponse(resp);
     }
     
@@ -264,7 +264,7 @@ public class Proxy {
         RMConstants constants = protocol.getConstants();
         OperationInfo oi = reliableEndpoint.getEndpoint(protocol).getEndpointInfo().getService()
             .getInterface().getOperation(constants.getAckRequestedOperationName());
-        invoke(oi, protocol, new Object[] {}, null);
+        invoke(oi, protocol, new Object[] {});
     }
         
     Identifier getOfferedIdentifier() {
@@ -278,7 +278,7 @@ public class Proxy {
     }
        
     Object invoke(OperationInfo oi, ProtocolVariation protocol, 
-                  Object[] params, Map<String, Object> context) throws RMException
{
+                  Object[] params, Map<String, Object> context, Exchange exchange)
throws RMException {
         
         if (LOG.isLoggable(Level.INFO)) {
             LOG.log(Level.INFO, "Sending out-of-band RM protocol message {0}.", 
@@ -307,7 +307,7 @@ public class Proxy {
         
         BindingOperationInfo boi = bi.getOperation(oi);
         try {
-            Object[] result = client.invoke(boi, params, context);
+            Object[] result = client.invoke(boi, params, context, exchange);
             if (result != null && result.length > 0) {
                 return result[0];
             }
@@ -322,6 +322,15 @@ public class Proxy {
         return null;
     }
     
+    Object invoke(OperationInfo oi, ProtocolVariation protocol, Object[] params, Map<String,
Object> context)
+        throws RMException {
+        return invoke(oi, protocol, params, context, new ExchangeImpl());
+    }
+    
+    Object invoke(OperationInfo oi, ProtocolVariation protocol, Object[] params) throws RMException
{
+        return invoke(oi, protocol, params, null);
+    }
+    
     protected Client createClient(Bus bus, Endpoint endpoint, final ProtocolVariation protocol,

                                   Conduit conduit, final EndpointReferenceType address) {
         ConduitSelector cs = new DeferredConduitSelector(conduit) {

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=1531258&r1=1531257&r2=1531258&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 11:30:53
2013
@@ -51,11 +51,9 @@ import org.apache.cxf.common.logging.Log
 import org.apache.cxf.common.util.PackageUtils;
 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.management.InstrumentationManager;
 import org.apache.cxf.management.jmx.export.runtime.ModelMBeanAssembler;
-import org.apache.cxf.message.Message;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.BindingInfo;
@@ -71,16 +69,14 @@ import org.apache.cxf.ws.addressing.Endp
 import org.apache.cxf.ws.addressing.JAXWSAConstants;
 import org.apache.cxf.ws.addressing.MAPAggregator;
 import org.apache.cxf.ws.addressing.Names;
-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.cxf.ws.policy.EffectivePolicyImpl;
+import org.apache.cxf.ws.policy.EndpointPolicyImpl;
+import org.apache.cxf.ws.policy.PolicyEngineImpl;
 import org.apache.cxf.ws.rm.manager.SequenceTerminationPolicyType;
 import org.apache.cxf.ws.rm.manager.SourcePolicyType;
 import org.apache.cxf.ws.rm.v200702.CloseSequenceResponseType;
 import org.apache.cxf.ws.rm.v200702.CloseSequenceType;
-import org.apache.neethi.Assertion;
-import org.apache.neethi.Policy;
+import org.apache.cxf.ws.security.SecurityConstants;
 
 public class RMEndpoint {
 
@@ -107,6 +103,7 @@ public class RMEndpoint {
     private Destination destination;
     private Map<ProtocolVariation, WrappedService> services;
     private Map<ProtocolVariation, Endpoint> endpoints;
+    private Object tokenStore;
     private Proxy proxy;
     private Servant servant;
     private long lastApplicationMessage;
@@ -138,6 +135,7 @@ public class RMEndpoint {
         applicationMessageCount = new AtomicInteger();
         controlMessageCount = new AtomicInteger();
         acknowledgementSequence = new AtomicInteger();
+        tokenStore = ae.getEndpointInfo().getProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE);
     }
 
     /**
@@ -435,35 +433,36 @@ public class RMEndpoint {
             ei.addExtensor(ua);
         }
         si.addEndpoint(ei);
-
+        ei.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, tokenStore);
+        
         Endpoint endpoint = new WrappedEndpoint(applicationEndpoint, ei, service);
+        
         service.setEndpoint(endpoint);
         endpoints.put(protocol, endpoint);
     }
 
     void setPolicies() {
         // use same WS-policies as for application endpoint
-        PolicyEngine engine = manager.getBus().getExtension(PolicyEngine.class);
+        PolicyEngineImpl engine = manager.getBus().getExtension(PolicyEngineImpl.class);
         if (null == engine || !engine.isEnabled()) {
             return;
         }
 
         for (Endpoint endpoint : endpoints.values()) {
             EndpointInfo ei = endpoint.getEndpointInfo();
-            PolicyInterceptorProviderRegistry reg = manager.getBus()
-                .getExtension(PolicyInterceptorProviderRegistry.class);
-            EndpointPolicy ep = null == conduit ? engine.getServerEndpointPolicy(applicationEndpoint
-                .getEndpointInfo(), null) : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(),
-                    conduit);
+            EndpointPolicyImpl epi = (EndpointPolicyImpl)(null == conduit
+                ? engine.getServerEndpointPolicy(applicationEndpoint.getEndpointInfo(), null)
+                    : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(),
conduit));
             
             if (conduit != null) {
-                engine.setClientEndpointPolicy(ei, ep);
+                engine.setClientEndpointPolicy(ei, epi);
             } else {
-                engine.setServerEndpointPolicy(ei, ep);
+                engine.setServerEndpointPolicy(ei, epi);
             }
-            
-            EffectivePolicy effectiveOutbound = new EffectivePolicyImpl(ep, reg, true, false);
-            EffectivePolicy effectiveInbound = new EffectivePolicyImpl(ep, reg, false, false);
+            EffectivePolicyImpl effectiveOutbound = new EffectivePolicyImpl();
+            effectiveOutbound.initialise(epi, engine, false, false);
+            EffectivePolicyImpl effectiveInbound = new EffectivePolicyImpl();
+            effectiveInbound.initialise(epi, engine, true, false);
             
             BindingInfo bi = ei.getBinding();
             Collection<BindingOperationInfo> bois = bi.getOperations();
@@ -827,29 +826,4 @@ public class RMEndpoint {
     int getCompletedDestinationSequenceCount() {
         return destination != null ? destination.getCompletedSequenceCount() : 0;
     }
-
-    class EffectivePolicyImpl implements EffectivePolicy {
-
-        private EndpointPolicy endpointPolicy;
-        private List<Interceptor<? extends Message>> interceptors;
-
-        EffectivePolicyImpl(EndpointPolicy ep, PolicyInterceptorProviderRegistry reg, boolean
outbound,
-                            boolean fault) {
-            endpointPolicy = ep;
-            interceptors = reg.getInterceptorsForAlternative(endpointPolicy.getChosenAlternative(),
-                                                             outbound, fault);
-        }
-
-        public Collection<Assertion> getChosenAlternative() {
-            return endpointPolicy.getChosenAlternative();
-        }
-
-        public List<Interceptor<? extends Message>> getInterceptors() {
-            return interceptors;
-        }
-
-        public Policy getPolicy() {
-            return endpointPolicy.getPolicy();
-        }
-    }
 }

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java?rev=1531258&r1=1531257&r2=1531258&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java Fri Oct 11
11:30:53 2013
@@ -32,6 +32,7 @@ import org.apache.cxf.ws.addressing.Cont
 import org.apache.cxf.ws.addressing.MAPAggregator;
 import org.apache.cxf.ws.rm.v200702.Identifier;
 import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement;
+import org.apache.cxf.ws.security.trust.STSUtils;
 
 /**
  * 
@@ -112,6 +113,12 @@ public class RMInInterceptor extends Abs
             LOG.fine("Action: " + action);
         }
         
+        // RM does not apply to WS-Trust messages, as used by WS-SecureConversation
+        if (action != null && action.contains("/RST/SCT")
+            && (action.startsWith(STSUtils.WST_NS_05_02) || action.startsWith(STSUtils.WST_NS_05_12)))
{
+            return;
+        }
+        
         Object originalRequestor = message.get(RMMessageConstants.ORIGINAL_REQUESTOR_ROLE);
         if (null != originalRequestor) {
             LOG.fine("Restoring original requestor role to: " + originalRequestor);

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?rev=1531258&r1=1531257&r2=1531258&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java Fri Oct 11 11:30:53
2013
@@ -74,6 +74,7 @@ import org.apache.cxf.ws.rm.v200702.Clos
 import org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType;
 import org.apache.cxf.ws.rm.v200702.Identifier;
 import org.apache.cxf.ws.rm.v200702.SequenceType;
+import org.apache.cxf.ws.security.SecurityConstants;
 
 /**
  * 
@@ -447,11 +448,19 @@ public class RMManager {
             }
             Proxy proxy = source.getReliableEndpoint().getProxy();
             ProtocolVariation protocol = config.getProtocolVariation();
+            Exchange exchange = new ExchangeImpl();
             CreateSequenceResponseType createResponse = 
-                proxy.createSequence(acksTo, relatesTo, isServer, protocol);
+                proxy.createSequence(acksTo, relatesTo, isServer, protocol, exchange);
             if (!isServer) {
                 Servant servant = source.getReliableEndpoint().getServant();
                 servant.createSequenceResponse(createResponse, protocol);
+                
+                // propagate security properties to application endpoint, in case we're using
WS-SecureConversation
+                Exchange appex = message.getExchange();
+                if (appex.get(SecurityConstants.TOKEN) == null) {
+                    appex.put(SecurityConstants.TOKEN, exchange.get(SecurityConstants.TOKEN));
+                    appex.put(SecurityConstants.TOKEN_ID, exchange.get(SecurityConstants.TOKEN_ID));
+                }
             }
 
             seq = source.awaitCurrent(inSeqId);

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java?rev=1531258&r1=1531257&r2=1531258&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java Fri Oct 11 11:30:53
2013
@@ -30,6 +30,8 @@ import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.jaxb.DatatypeFactory;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -273,10 +275,11 @@ public class ProxyTest extends Assert {
         Object[] args = new Object[] {};
         Map<String, Object> context = new HashMap<String, Object>();
         Object[] results = new Object[] {"a", "b", "c"};
-        EasyMock.expect(client.invoke(boi, args, context)).andReturn(results).anyTimes();
       
+        Exchange exchange = control.createMock(Exchange.class);
+        EasyMock.expect(client.invoke(boi, args, context, exchange)).andReturn(results).anyTimes();
         
         control.replay();
-        assertEquals("a", proxy.invoke(oi, ProtocolVariation.RM10WSA200408, args, context));
+        assertEquals("a", proxy.invoke(oi, ProtocolVariation.RM10WSA200408, args, context,
exchange));
     }
     
     @Test 
@@ -306,9 +309,10 @@ public class ProxyTest extends Assert {
     
     
     
+    @SuppressWarnings("unchecked")
     private void testCreateSequence(boolean isServer) throws NoSuchMethodException, RMException
{
         Method m = Proxy.class.getDeclaredMethod("invoke", 
-            new Class[] {OperationInfo.class, ProtocolVariation.class, Object[].class, Map.class});
+            new Class[] {OperationInfo.class, ProtocolVariation.class, Object[].class, Map.class,
Exchange.class});
         Proxy proxy = EasyMock.createMockBuilder(Proxy.class)
             .addMockedMethod(m).createMock(control);
         proxy.setReliableEndpoint(rme);
@@ -337,19 +341,22 @@ public class ProxyTest extends Assert {
         InterfaceInfo ii = control.createMock(InterfaceInfo.class);
         EasyMock.expect(si.getInterface()).andReturn(ii).anyTimes();
         OperationInfo oi = control.createMock(OperationInfo.class);
+        org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType csr = null;
         if (isServer) {
             EasyMock.expect(ii.getOperation(RM10Constants.CREATE_SEQUENCE_ONEWAY_QNAME))
                 .andReturn(oi).anyTimes();
             Endpoint ae = control.createMock(Endpoint.class);
             EasyMock.expect(rme.getApplicationEndpoint()).andReturn(ae).anyTimes();
             EasyMock.expect(ae.getExecutor()).andReturn(SynchronousExecutor.getInstance()).anyTimes();
-            expectInvoke(proxy, oi, null);
         } else {
             EasyMock.expect(ii.getOperation(RM10Constants.CREATE_SEQUENCE_QNAME)).andReturn(oi).anyTimes();
-            org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType csr =
-                new org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType();
-            expectInvoke(proxy, oi, csr);
+            
+            csr = new org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType();
         }
+        ExchangeImpl exchange = new ExchangeImpl();
+        EasyMock.expect(proxy.invoke(EasyMock.same(oi), EasyMock.isA(ProtocolVariation.class),

+             EasyMock.isA(Object[].class), (Map<String, Object>)EasyMock.isNull(),
+             EasyMock.isA(Exchange.class))).andReturn(csr).anyTimes();
         
         EndpointReferenceType defaultAcksTo = control.createMock(EndpointReferenceType.class);
         AttributedURIType aut = control.createMock(AttributedURIType.class);
@@ -359,17 +366,17 @@ public class ProxyTest extends Assert {
         control.replay();
         if (isServer) {
             assertNull(proxy.createSequence(defaultAcksTo, relatesTo, isServer, 
-                                            ProtocolVariation.RM10WSA200408));
+                                            ProtocolVariation.RM10WSA200408, exchange));
         } else {
             assertNotNull(proxy.createSequence(defaultAcksTo, relatesTo, isServer, 
-                                               ProtocolVariation.RM10WSA200408));
+                                               ProtocolVariation.RM10WSA200408, exchange));
         }
     }
     
     @SuppressWarnings("unchecked")
     private void expectInvoke(Proxy proxy, OperationInfo oi, Object expectedReturn) throws
RMException {
         EasyMock.expect(proxy.invoke(EasyMock.same(oi), EasyMock.isA(ProtocolVariation.class),

-                                     EasyMock.isA(Object[].class), 
+            EasyMock.isA(Object[].class),
             (Map<String, Object>)EasyMock.isNull())).andReturn(expectedReturn).anyTimes();
     }
     
@@ -377,7 +384,7 @@ public class ProxyTest extends Assert {
     private void expectInvokeWithContext(Proxy proxy, OperationInfo oi, Object expectedReturn)

         throws RMException {
         EasyMock.expect(proxy.invoke(EasyMock.same(oi), EasyMock.isA(ProtocolVariation.class),
-                                     EasyMock.isA(Object[].class), 
+            EasyMock.isA(Object[].class),
             EasyMock.isA(Map.class))).andReturn(expectedReturn).anyTimes();
     }
 }

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=1531258&r1=1531257&r2=1531258&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 11:30:53
2013
@@ -21,7 +21,6 @@ package org.apache.cxf.ws.rm;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
 import javax.wsdl.extensions.ExtensibilityElement;
@@ -32,8 +31,8 @@ import org.apache.cxf.binding.soap.Soap1
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
 import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.interceptor.Interceptor;
-import org.apache.cxf.message.Message;
+import org.apache.cxf.endpoint.EndpointException;
+import org.apache.cxf.endpoint.EndpointImpl;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -43,13 +42,8 @@ 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.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.cxf.ws.policy.PolicyEngineImpl;
 import org.apache.cxf.ws.rm.v200702.Identifier;
-import org.apache.neethi.Assertion;
-import org.apache.neethi.Policy;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
 
@@ -70,7 +64,10 @@ public class RMEndpointTest extends Asse
         control = EasyMock.createNiceControl();
         manager = control.createMock(RMManager.class);
         ae = control.createMock(Endpoint.class);
+        EasyMock.expect(ae.getEndpointInfo()).andReturn(new EndpointInfo()).anyTimes();
+        control.replay();
         rme = new RMEndpoint(manager, ae);
+        control.reset();
     }
 
     @After
@@ -168,25 +165,24 @@ public class RMEndpointTest extends Asse
     }
 
     @Test
-    public void testCreateEndpoint() throws NoSuchMethodException {
+    public void testCreateEndpoint() throws NoSuchMethodException, EndpointException {
         Method m = RMEndpoint.class.getDeclaredMethod("getUsingAddressing", new Class[] {EndpointInfo.class});
+        Service as = control.createMock(Service.class);
+        EndpointInfo aei = new EndpointInfo();
+        ae = new EndpointImpl(null, as, aei);
         rme = EasyMock.createMockBuilder(RMEndpoint.class).withConstructor(manager, ae)
             .addMockedMethod(m).createMock(control);
         rme.setAplicationEndpoint(ae);
         rme.setManager(manager);
-        Service as = control.createMock(Service.class);
-        EasyMock.expect(ae.getService()).andReturn(as);
-        EndpointInfo aei = control.createMock(EndpointInfo.class);
-        EasyMock.expect(ae.getEndpointInfo()).andReturn(aei).anyTimes();
         SoapBindingInfo bi = control.createMock(SoapBindingInfo.class);
-        EasyMock.expect(aei.getBinding()).andReturn(bi).anyTimes(); 
+        aei.setBinding(bi);
         SoapVersion sv = Soap11.getInstance();
         EasyMock.expect(bi.getSoapVersion()).andReturn(sv);
         String ns = "http://schemas.xmlsoap.org/wsdl/soap/";
         EasyMock.expect(bi.getBindingId()).andReturn(ns);
-        EasyMock.expect(aei.getTransportId()).andReturn(ns);
+        aei.setTransportId(ns);
         String addr = "addr";
-        EasyMock.expect(aei.getAddress()).andReturn(addr);
+        aei.setAddress(addr);
         Object ua = new Object();
         EasyMock.expect(rme.getUsingAddressing(aei)).andReturn(ua);
         control.replay();
@@ -252,7 +248,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(PolicyEngine.class)).andReturn(null);
+        EasyMock.expect(bus.getExtension(PolicyEngineImpl.class)).andReturn(null);
         control.replay();
         rme.setPolicies();
     }
@@ -261,8 +257,8 @@ public class RMEndpointTest extends Asse
     public void testSetPoliciesEngineDisabled() {
         Bus bus = control.createMock(Bus.class);
         EasyMock.expect(manager.getBus()).andReturn(bus);
-        PolicyEngine pe = control.createMock(PolicyEngine.class);
-        EasyMock.expect(bus.getExtension(PolicyEngine.class)).andReturn(pe);
+        PolicyEngineImpl pe = control.createMock(PolicyEngineImpl.class);
+        EasyMock.expect(bus.getExtension(PolicyEngineImpl.class)).andReturn(pe);
         EasyMock.expect(pe.isEnabled()).andReturn(false);
         control.replay();
         rme.setPolicies();
@@ -296,23 +292,6 @@ public class RMEndpointTest extends Asse
         rme.shutdown();
     }
 
-    @Test
-    public void testEffectivePolicyImpl() {
-        EndpointPolicy ep = control.createMock(EndpointPolicy.class);
-        Collection<Assertion> alt = new ArrayList<Assertion>();
-        EasyMock.expect(ep.getChosenAlternative()).andReturn(alt).times(2);
-        PolicyInterceptorProviderRegistry reg = control.createMock(PolicyInterceptorProviderRegistry.class);
-        List<Interceptor<? extends Message>> li = new ArrayList<Interceptor<?
extends Message>>();
-        EasyMock.expect(reg.getInterceptorsForAlternative(alt, true, false)).andReturn(li);
-        Policy p = control.createMock(Policy.class);
-        EasyMock.expect(ep.getPolicy()).andReturn(p);
-        control.replay();
-        EffectivePolicy effective = rme.new EffectivePolicyImpl(ep, reg, true, false);
-        assertSame(alt, effective.getChosenAlternative());
-        assertSame(li, effective.getInterceptors());
-        assertSame(p, effective.getPolicy());
-    }
-
     private void verifyService() {
         Service service = rme.getService(ProtocolVariation.RM10WSA200408);
         ServiceInfo si = service.getServiceInfos().get(0);

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java?rev=1531258&r1=1531257&r2=1531258&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java Fri Oct 11 11:30:53
2013
@@ -406,7 +406,8 @@ public class RMManagerTest extends Asser
         proxy.createSequence(EasyMock.isA(EndpointReferenceType.class),
                              (RelatesToType)EasyMock.isNull(),
                              EasyMock.eq(false),
-                             EasyMock.isA(ProtocolVariation.class));
+                             EasyMock.isA(ProtocolVariation.class),
+                             EasyMock.isA(Exchange.class));
         EasyMock.expectLastCall().andReturn(createResponse);
         Servant servant = control.createMock(Servant.class);
         EasyMock.expect(rme.getServant()).andReturn(servant);



Mime
View raw message