You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/01/21 18:25:55 UTC
svn commit: r613943 - in /incubator/cxf/branches/2.0.x-fixes: ./
distribution/bundle/
rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/
systests/src/test/java/org/apache/cxf/systest/jms/
Author: dkulp
Date: Mon Jan 21 09:25:54 2008
New Revision: 613943
URL: http://svn.apache.org/viewvc?rev=613943&view=rev
Log:
Merged revisions 613937 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r613937 | dkulp | 2008-01-21 12:09:01 -0500 (Mon, 21 Jan 2008) | 3 lines
[CXF-1399] Fix issue with JMS transport ignoring the PROTOCOL_HEADERS
Also update to now-released 1.0-beta-1 version of shade plugin to make the bundle jar usable
........
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/distribution/bundle/pom.xml
incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: incubator/cxf/branches/2.0.x-fixes/distribution/bundle/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/bundle/pom.xml?rev=613943&r1=613942&r2=613943&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/distribution/bundle/pom.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/distribution/bundle/pom.xml Mon Jan 21 09:25:54 2008
@@ -259,7 +259,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
- <version>1.0-alpha-15</version>
+ <version>1.0-beta-1</version>
<executions>
<execution>
<phase>package</phase>
Modified: incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=613943&r1=613942&r2=613943&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java Mon Jan 21 09:25:54 2008
@@ -24,6 +24,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,6 +40,7 @@
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.configuration.Configurable;
import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.io.CachedOutputStream;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.Message;
@@ -310,8 +313,10 @@
ttl = getClientConfig().getMessageTimeToLive();
}
- base.setMessageProperties(headers, jmsMessage);
-
+ base.setMessageProperties(headers, jmsMessage);
+ Map<String, List<String>> protHeaders =
+ CastUtils.cast((Map<?, ?>)outMessage.get(Message.PROTOCOL_HEADERS));
+ base.addProtocolHeaders(jmsMessage, protHeaders);
if (!isOneWay) {
String id = pooledSession.getCorrelationID();
Modified: incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=613943&r1=613942&r2=613943&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java Mon Jan 21 09:25:54 2008
@@ -26,6 +26,8 @@
import java.io.OutputStream;
import java.util.Calendar;
import java.util.GregorianCalendar;
+import java.util.List;
+import java.util.Map;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
import java.util.concurrent.Executor;
@@ -45,6 +47,7 @@
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.configuration.Configurable;
import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.io.CachedOutputStream;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageImpl;
@@ -372,7 +375,7 @@
message.put(JMSConstants.JMS_REQUEST_MESSAGE,
inMessage.get(JMSConstants.JMS_REQUEST_MESSAGE));
message.setContent(OutputStream.class,
- new JMSOutputStream(inMessage));
+ new JMSOutputStream(inMessage, message));
}
protected Logger getLogger() {
@@ -383,14 +386,16 @@
private class JMSOutputStream extends CachedOutputStream {
private Message inMessage;
+ private Message outMessage;
private javax.jms.Message reply;
private Queue replyTo;
private QueueSender sender;
// setup the ByteArrayStream
- public JMSOutputStream(Message m) {
+ public JMSOutputStream(Message m, Message o) {
super();
inMessage = m;
+ outMessage = o;
}
//to prepear the message and get the send out message
@@ -441,6 +446,9 @@
setReplyCorrelationID(request, reply);
base.setMessageProperties(headers, reply);
+ Map<String, List<String>> protHeaders =
+ CastUtils.cast((Map<?, ?>)outMessage.get(Message.PROTOCOL_HEADERS));
+ base.addProtocolHeaders(reply, protHeaders);
sendResponse();
Modified: incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java?rev=613943&r1=613942&r2=613943&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java Mon Jan 21 09:25:54 2008
@@ -19,8 +19,11 @@
package org.apache.cxf.transport.jms;
+import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.jms.BytesMessage;
import javax.jms.Destination;
@@ -146,6 +149,7 @@
headers.setJMSTimeStamp(new Long(message.getJMSTimestamp()));
headers.setJMSType(message.getJMSType());
+ Map<String, List<String>> protHeaders = new HashMap<String, List<String>>();
List<JMSPropertyType> props = headers.getProperty();
Enumeration enm = message.getPropertyNames();
while (enm.hasMoreElements()) {
@@ -155,8 +159,10 @@
prop.setName(name);
prop.setValue(val);
props.add(prop);
+
+ protHeaders.put(name, Collections.singletonList(val));
}
-
+ inMessage.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, protHeaders);
return headers;
}
@@ -194,6 +200,25 @@
return correlationId;
}
+ protected void addProtocolHeaders(Message message, Map<String, List<String>> headers)
+ throws JMSException {
+ if (headers == null) {
+ return;
+ }
+ StringBuilder value = new StringBuilder(256);
+ for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
+ value.setLength(0);
+ boolean first = true;
+ for (String s : entry.getValue()) {
+ if (!first) {
+ value.append("; ");
+ }
+ value.append(s);
+ first = false;
+ }
+ message.setStringProperty(entry.getKey(), value.toString());
+ }
+ }
protected void setMessageProperties(JMSMessageHeadersType headers, Message message)
throws JMSException {
Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java?rev=613943&r1=613942&r2=613943&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java Mon Jan 21 09:25:54 2008
@@ -348,8 +348,15 @@
"JMS_SAMPLE_CORRELATION_ID".equals(responseHdr.getJMSCorrelationID()));
assertTrue("response Headers must conain the app property set in request context.",
responseHdr.getProperty() != null);
- assertEquals("response Headers must match the app property set in request context.",
- testReturnPropertyName, responseHdr.getProperty().iterator().next().getName());
+
+ boolean found = false;
+ for (JMSPropertyType p : responseHdr.getProperty()) {
+ if (testReturnPropertyName.equals(p.getName())) {
+ found = true;
+ }
+ }
+ assertTrue("response Headers must match the app property set in request context.",
+ found);
}
} catch (UndeclaredThrowableException ex) {
throw (Exception)ex.getCause();
Re: svn commit: r613943 - in /incubator/cxf/branches/2.0.x-fixes: ./
distribution/bundle/
rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/
systests/src/test/java/org/apache/cxf/systest/jms/
Posted by Glen Mazza <gl...@verizon.net>.
Am Montag, den 21.01.2008, 17:25 +0000 schrieb dkulp@apache.org:
> Author: dkulp
> Date: Mon Jan 21 09:25:54 2008
> New Revision: 613943
>
> Modified:
> incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=613943&r1=613942&r2=613943&view=diff
> ==============================================================================
> --- incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java (original)
> +++ incubator/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java Mon Jan 21 09:25:54 2008
> @@ -26,6 +26,8 @@
> import java.io.OutputStream;
> import java.util.Calendar;
> import java.util.GregorianCalendar;
> +import java.util.List;
> +import java.util.Map;
> import java.util.SimpleTimeZone;
> import java.util.TimeZone;
> import java.util.concurrent.Executor;
> @@ -45,6 +47,7 @@
> import org.apache.cxf.common.logging.LogUtils;
> import org.apache.cxf.configuration.Configurable;
> import org.apache.cxf.configuration.Configurer;
> +import org.apache.cxf.helpers.CastUtils;
> import org.apache.cxf.io.CachedOutputStream;
> import org.apache.cxf.message.Message;
> import org.apache.cxf.message.MessageImpl;
> @@ -372,7 +375,7 @@
> message.put(JMSConstants.JMS_REQUEST_MESSAGE,
> inMessage.get(JMSConstants.JMS_REQUEST_MESSAGE));
> message.setContent(OutputStream.class,
> - new JMSOutputStream(inMessage));
> + new JMSOutputStream(inMessage, message));
> }
>
> protected Logger getLogger() {
> @@ -383,14 +386,16 @@
> private class JMSOutputStream extends CachedOutputStream {
>
> private Message inMessage;
> + private Message outMessage;
> private javax.jms.Message reply;
> private Queue replyTo;
> private QueueSender sender;
>
> // setup the ByteArrayStream
> - public JMSOutputStream(Message m) {
> + public JMSOutputStream(Message m, Message o) {
I think it would be nice for our JavaDoc if you spelled out "m" and "o"
here.
> Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java?rev=613943&r1=613942&r2=613943&view=diff
> ==============================================================================
> --- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java (original)
> +++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java Mon Jan 21 09:25:54 2008
> @@ -348,8 +348,15 @@
> "JMS_SAMPLE_CORRELATION_ID".equals(responseHdr.getJMSCorrelationID()));
> assertTrue("response Headers must conain the app property set in request context.",
> responseHdr.getProperty() != null);
> - assertEquals("response Headers must match the app property set in request context.",
> - testReturnPropertyName, responseHdr.getProperty().iterator().next().getName());
> +
> + boolean found = false;
> + for (JMSPropertyType p : responseHdr.getProperty()) {
> + if (testReturnPropertyName.equals(p.getName())) {
> + found = true;
shouldn't "break;" be added here ?
Regards,
Glen
> + }
> + }
> + assertTrue("response Headers must match the app property set in request context.",
> + found);
> }
> } catch (UndeclaredThrowableException ex) {
> throw (Exception)ex.getCause();
>
>