You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ni...@apache.org on 2012/11/07 05:48:10 UTC
svn commit: r1406462 - in /servicemix/smx4/features/branches/features-4.4.x:
./
cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/
cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/
Author: ningjiang
Date: Wed Nov 7 04:48:10 2012
New Revision: 1406462
URL: http://svn.apache.org/viewvc?rev=1406462&view=rev
Log:
Merged revisions 1406451 via svnmerge from
https://svn.apache.org/repos/asf/servicemix/smx4/features/trunk
........
r1406451 | ningjiang | 2012-11-07 12:20:24 +0800 (Wed, 07 Nov 2012) | 1 line
SMX4-1273 cxf-nmr trasport should copy the message header which value is String as the Protocol Header
........
Modified:
servicemix/smx4/features/branches/features-4.4.x/ (props changed)
servicemix/smx4/features/branches/features-4.4.x/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java
servicemix/smx4/features/branches/features-4.4.x/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationTest.java
Propchange: servicemix/smx4/features/branches/features-4.4.x/
------------------------------------------------------------------------------
Merged /servicemix/smx4/features/trunk:r1406451
Propchange: servicemix/smx4/features/branches/features-4.4.x/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Nov 7 04:48:10 2012
@@ -1 +1 @@
-/servicemix/smx4/features/trunk:1-1215210,1232811,1239315,1244513,1298713,1299584,1302577,1307720,1347872,1358015,1372709,1372733
+/servicemix/smx4/features/trunk:1-1215210,1232811,1239315,1244513,1298713,1299584,1302577,1307720,1347872,1358015,1372709,1372733,1406451
Modified: servicemix/smx4/features/branches/features-4.4.x/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/branches/features-4.4.x/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java?rev=1406462&r1=1406461&r2=1406462&view=diff
==============================================================================
--- servicemix/smx4/features/branches/features-4.4.x/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java (original)
+++ servicemix/smx4/features/branches/features-4.4.x/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java Wed Nov 7 04:48:10 2012
@@ -25,7 +25,9 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -144,11 +146,19 @@ public class NMRDestination extends Abst
}
inMessage.setAttachments(cxfAttachmentList);
- //copy properties
+ //copy properties and setup the cxf protocol header
+ Map<String, List<String>> protocolHeaders = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
+ inMessage.put(Message.PROTOCOL_HEADERS, protocolHeaders);
+
for (Map.Entry<String, Object> ent : nm.getHeaders().entrySet()) {
if (!ent.getKey().equals(Message.REQUESTOR_ROLE)) {
inMessage.put(ent.getKey(), ent.getValue());
}
+ if (ent.getValue() instanceof String) {
+ List<String> value = new ArrayList<String>();
+ value.add((String)ent.getValue());
+ protocolHeaders.put(ent.getKey(), value);
+ }
}
//copy securitySubject
Modified: servicemix/smx4/features/branches/features-4.4.x/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/branches/features-4.4.x/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationTest.java?rev=1406462&r1=1406461&r2=1406462&view=diff
==============================================================================
--- servicemix/smx4/features/branches/features-4.4.x/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationTest.java (original)
+++ servicemix/smx4/features/branches/features-4.4.x/cxf/cxf-transport-nmr/src/test/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationTest.java Wed Nov 7 04:48:10 2012
@@ -22,6 +22,8 @@ package org.apache.servicemix.cxf.transp
import java.io.ByteArrayInputStream;
import java.security.AccessController;
import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.logging.Logger;
import javax.security.auth.Subject;
@@ -129,7 +131,9 @@ public class NMRDestinationTest extends
EasyMock.expect(xchg.getStatus()).andReturn(Status.Active);
EasyMock.expect(xchg.getIn()).andReturn(inMsg);
EasyMock.expect(inMsg.getAttachments()).andReturn(new HashMap<String, Object>());
- EasyMock.expect(inMsg.getHeaders()).andReturn(new HashMap<String, Object>());
+ Map<String, Object> nmrHeaders = new HashMap<String, Object>();
+ nmrHeaders.put("hello", "world");
+ EasyMock.expect(inMsg.getHeaders()).andReturn(nmrHeaders);
Source source = new StreamSource(new ByteArrayInputStream(
"<message>TestHelloWorld</message>".getBytes()));
EasyMock.expect(inMsg.getBody(Source.class)).andReturn(source);
@@ -145,6 +149,9 @@ public class NMRDestinationTest extends
destination.setMessageObserver(observer);
destination.process(xchg);
assertNotNull(inMessage);
+ @SuppressWarnings("unchecked")
+ Map<String, List<String>> protocolHeaders = (Map<String, List<String>>)inMessage.get(Message.PROTOCOL_HEADERS);
+ assertEquals("We should get a right protocol headers", "world", protocolHeaders.get("hello").get(0));
}
@Test