Author: dsosnoski
Date: Mon Aug 1 04:59:35 2011
New Revision: 1152690
URL: http://svn.apache.org/viewvc?rev=1152690&view=rev
Log:
Fix RMOutInterceptor to expose correct version of WS-RM and WS-A in messages
being sent.
Modified:
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
Modified:
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java?rev=1152690&r1=1152689&r2=1152690&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
(original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
Mon Aug 1 04:59:35 2011
@@ -60,9 +60,10 @@ public class RMOutInterceptor extends Ab
LogUtils.log(LOG, Level.WARNING, "MAPS_RETRIEVAL_FAILURE_MSG");
return;
}
- maps.exposeAs(getManager().getRMAddressingNamespace());
Source source = getManager().getSource(msg);
+ ProtocolVariation protocol =
source.getReliableEndpoint().getProtocol();
+ maps.exposeAs(protocol.getWSANamespace());
Destination destination = getManager().getDestination(msg);
String action = null;
@@ -76,8 +77,8 @@ public class RMOutInterceptor extends Ab
boolean isApplicationMessage =
!RMContextUtils.isRMProtocolMessage(action);
boolean isPartialResponse = MessageUtils.isPartialResponse(msg);
- boolean isLastMessage =
RM10Constants.CLOSE_SEQUENCE_ACTION.equals(action)
- || RM11Constants.CLOSE_SEQUENCE_ACTION.equals(action);
+ RMConstants constants = protocol.getConstants();
+ boolean isLastMessage =
constants.getCloseSequenceAction().equals(action);
if (isApplicationMessage && !isPartialResponse) {
RetransmissionInterceptor ri = new RetransmissionInterceptor();
@@ -96,22 +97,7 @@ public class RMOutInterceptor extends Ab
RMProperties rmpsOut = RMContextUtils.retrieveRMProperties(msg, true);
if (null == rmpsOut) {
rmpsOut = new RMProperties();
- String uri = null;
- if (RMContextUtils.isServerSide(msg)) {
- RMProperties rmpsIn = RMContextUtils
- .retrieveRMProperties(msg.getExchange().getInMessage(),
false);
- uri = rmpsIn.getNamespaceURI();
- } else {
- uri =
(String)msg.getContextualProperty(RMManager.WSRM_VERSION_PROPERTY);
- }
- if (uri != null && RMUtils.getConstants(uri) == null) {
- LogUtils.log(LOG, Level.WARNING, "Ignoring unknown WS-RM
namespace: " + uri);
- uri = null;
- }
- if (uri == null) {
- uri = getManager().getRMNamespace();
- }
- rmpsOut.exposeAs(uri);
+ rmpsOut.exposeAs(protocol.getWSRMNamespace());
RMContextUtils.storeRMProperties(msg, rmpsOut, true);
}
@@ -160,35 +146,25 @@ public class RMOutInterceptor extends Ab
source.setCurrent(null);
}
}
- } else {
- if (!MessageUtils.isRequestor(msg)) {
- if (RM10Constants.CREATE_SEQUENCE_ACTION.equals(action)) {
-
maps.getAction().setValue(RM10Constants.CREATE_SEQUENCE_RESPONSE_ACTION);
- } else if
(RM11Constants.CREATE_SEQUENCE_ACTION.equals(action)) {
-
maps.getAction().setValue(RM11Constants.CREATE_SEQUENCE_RESPONSE_ACTION);
- }
- }
+ } else if (!MessageUtils.isRequestor(msg) &&
constants.getCreateSequenceAction().equals(action)) {
+
maps.getAction().setValue(constants.getCreateSequenceResponseAction());
}
// add Acknowledgements (to application messages or explicitly
// created Acknowledgement messages only)
- if (isApplicationMessage ||
RM10Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION.equals(action)
- || RM11Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION.equals(action)) {
+ if (isApplicationMessage ||
constants.getSequenceAckAction().equals(action)) {
AttributedURIType to = maps.getTo();
assert null != to;
addAcknowledgements(destination, rmpsOut, inSeqId, to);
if (isPartialResponse && rmpsOut.getAcks() != null &&
rmpsOut.getAcks().size() > 0) {
AttributedURIType actionURI = new AttributedURIType();
-
actionURI.setValue(RMUtils.getConstants(rmpsOut.getNamespaceURI())
- .getSequenceAckAction());
+ actionURI.setValue(constants.getSequenceAckAction());
maps.setAction(actionURI);
}
}
- if (RM10Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION.equals(action)
- || RM11Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION.equals(action)
- || RM10Constants.TERMINATE_SEQUENCE_ACTION.equals(action)
- || RM11Constants.TERMINATE_SEQUENCE_ACTION.equals(action)) {
+ if (constants.getSequenceAckAction().equals(action)
+ || constants.getTerminateSequenceAction().equals(action)) {
maps.setReplyTo(RMUtils.createNoneReference());
}
Modified:
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java?rev=1152690&r1=1152689&r2=1152690&view=diff
==============================================================================
---
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
(original)
+++
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
Mon Aug 1 04:59:35 2011
@@ -133,7 +133,10 @@ public class RMOutInterceptorTest extend
queue.start();
EasyMock.expectLastCall();
+ RMEndpoint rme = control.createMock(RMEndpoint.class);
+
EasyMock.expect(rme.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
Source source = control.createMock(Source.class);
+
EasyMock.expect(source.getReliableEndpoint()).andReturn(rme).anyTimes();
EasyMock.expect(manager.getSource(message)).andReturn(source).anyTimes();
Destination destination = control.createMock(Destination.class);
EasyMock.expect(manager.getDestination(message)).andReturn(destination).anyTimes();