cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject git commit: [CXF-5741]:The properties in the requestContext are not copied into RMClient
Date Wed, 14 May 2014 01:36:47 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 54b617b84 -> 266ad768f


[CXF-5741]:The properties in the requestContext are not copied into RMClient


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/266ad768
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/266ad768
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/266ad768

Branch: refs/heads/master
Commit: 266ad768fbc09feb2fe257b14e29e1c07653829a
Parents: 54b617b
Author: Jim Ma <ema@apache.org>
Authored: Wed May 14 09:26:50 2014 +0800
Committer: Jim Ma <ema@apache.org>
Committed: Wed May 14 09:30:27 2014 +0800

----------------------------------------------------------------------
 rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java | 11 +++++++----
 .../src/main/java/org/apache/cxf/ws/rm/RMManager.java  | 11 ++++++++++-
 .../src/test/java/org/apache/cxf/ws/rm/ProxyTest.java  | 13 +++++++++----
 .../test/java/org/apache/cxf/ws/rm/RMManagerTest.java  |  4 +++-
 4 files changed, 29 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/266ad768/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
index 7646c54..977ac55 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
@@ -129,8 +129,8 @@ public class Proxy {
     }
 
     public CreateSequenceResponseType createSequence(EndpointReferenceType defaultAcksTo,
RelatesToType relatesTo, 
-             boolean isServer, final ProtocolVariation protocol, final Exchange exchange)
throws RMException {
-        
+             boolean isServer, final ProtocolVariation protocol, final Exchange exchange,
Map<String, Object> context) 
+        throws RMException {
         SourcePolicyType sp = reliableEndpoint.getManager().getSourcePolicy();
         CreateSequenceType create = new CreateSequenceType();        
 
@@ -196,7 +196,7 @@ public class Proxy {
         }
         
         
-        Object resp = invoke(oi, protocol, new Object[] {send}, null, exchange);
+        Object resp = invoke(oi, protocol, new Object[] {send}, context, exchange);
         return codec.convertReceivedCreateSequenceResponse(resp);
     }
     
@@ -307,6 +307,9 @@ public class Proxy {
         
         BindingOperationInfo boi = bi.getOperation(oi);
         try {
+            if (context != null) {
+                client.getRequestContext().putAll(context);
+            }
             Object[] result = client.invoke(boi, params, context, exchange);
             if (result != null && result.length > 0) {
                 return result[0];
@@ -376,4 +379,4 @@ public class Proxy {
     void setReliableEndpoint(RMEndpoint rme) {
         reliableEndpoint = rme;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/266ad768/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
index 37a2460..4442ec5 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
@@ -22,6 +22,7 @@ package org.apache.cxf.ws.rm;
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Timer;
 import java.util.concurrent.ConcurrentHashMap;
@@ -460,8 +461,16 @@ public class RMManager {
             Proxy proxy = source.getReliableEndpoint().getProxy();
             ProtocolVariation protocol = config.getProtocolVariation();
             Exchange exchange = new ExchangeImpl();
+            Map<String, Object> context = new HashMap<String, Object>(16);
+            for (String key : message.getContextualPropertyKeys()) {
+                //copy other properties?
+                if (key.startsWith("ws-security")) {
+                    context.put(key, message.getContextualProperty(key));               
  
+                }
+            }
+            
             CreateSequenceResponseType createResponse = 
-                proxy.createSequence(acksTo, relatesTo, isServer, protocol, exchange);
+                proxy.createSequence(acksTo, relatesTo, isServer, protocol, exchange, context);
             if (!isServer) {
                 Servant servant = source.getReliableEndpoint().getServant();
                 servant.createSequenceResponse(createResponse, protocol);

http://git-wip-us.apache.org/repos/asf/cxf/blob/266ad768/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
index fe3e087..b567dc3 100644
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
@@ -50,6 +50,7 @@ import org.apache.cxf.ws.rm.v200702.Identifier;
 import org.apache.cxf.ws.rm.v200702.OfferType;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
+
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -270,12 +271,15 @@ public class ProxyTest extends Assert {
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
         EasyMock.expect(bi.getOperation(oi)).andReturn(boi).anyTimes();
         Client client = control.createMock(Client.class);
+        EasyMock.expect(client.getRequestContext()).andReturn(new HashMap<String, Object>()).anyTimes();
+        
         EasyMock.expect(proxy.createClient(bus, endpoint, ProtocolVariation.RM10WSA200408,
conduit, replyTo))
             .andReturn(client).anyTimes();  
         Object[] args = new Object[] {};
         Map<String, Object> context = new HashMap<String, Object>();
         Object[] results = new Object[] {"a", "b", "c"};
         Exchange exchange = control.createMock(Exchange.class);
+        
         EasyMock.expect(client.invoke(boi, args, context, exchange)).andReturn(results).anyTimes();
         
         control.replay();
@@ -354,22 +358,23 @@ public class ProxyTest extends Assert {
             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(Object[].class), EasyMock.isA(Map.class),
              EasyMock.isA(Exchange.class))).andReturn(csr).anyTimes();
-        
         EndpointReferenceType defaultAcksTo = control.createMock(EndpointReferenceType.class);
         AttributedURIType aut = control.createMock(AttributedURIType.class);
         EasyMock.expect(aut.getValue()).andReturn("here").anyTimes();
         EasyMock.expect(defaultAcksTo.getAddress()).andReturn(aut).anyTimes();
         RelatesToType relatesTo = control.createMock(RelatesToType.class);
         control.replay();
+        Map<String, Object> context = new HashMap<String, Object>();
         if (isServer) {
             assertNull(proxy.createSequence(defaultAcksTo, relatesTo, isServer, 
-                                            ProtocolVariation.RM10WSA200408, exchange));
+                                            ProtocolVariation.RM10WSA200408, exchange, context));
         } else {
             assertNotNull(proxy.createSequence(defaultAcksTo, relatesTo, isServer, 
-                                               ProtocolVariation.RM10WSA200408, exchange));
+                                               ProtocolVariation.RM10WSA200408, exchange,
context));
         }
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/266ad768/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
index ba01bd2..8e7304a 100644
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.TimerTask;
 
@@ -391,6 +392,7 @@ public class RMManagerTest extends Assert {
         manager = control.createMock(RMManager.class, new Method[] {m});
         Message message = control.createMock(Message.class);
         Exchange exchange = control.createMock(Exchange.class);
+        EasyMock.expect(message.getContextualPropertyKeys()).andReturn(new HashSet<String>()).anyTimes();
         EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes();
         EasyMock.expect(exchange.getOutMessage()).andReturn(message).anyTimes();
         EasyMock.expect(exchange.getInMessage()).andReturn(null).anyTimes();
@@ -416,7 +418,7 @@ public class RMManagerTest extends Assert {
                              (RelatesToType)EasyMock.isNull(),
                              EasyMock.eq(false),
                              EasyMock.isA(ProtocolVariation.class),
-                             EasyMock.isA(Exchange.class));
+                             EasyMock.isA(Exchange.class), EasyMock.isA(HashMap.class));
         EasyMock.expectLastCall().andReturn(createResponse);
         Servant servant = control.createMock(Servant.class);
         EasyMock.expect(rme.getServant()).andReturn(servant);


Mime
View raw message