You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ay...@apache.org on 2015/08/06 19:04:14 UTC
cxf git commit: [CXF-6519] clean up the code and add a test for 3.0.x
Repository: cxf
Updated Branches:
refs/heads/3.0.x-fixes 77ff2fdfe -> fc8878539
[CXF-6519] clean up the code and add a test for 3.0.x
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/fc887853
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/fc887853
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/fc887853
Branch: refs/heads/3.0.x-fixes
Commit: fc8878539430e8bb10c1ae6bd96ad593bcfe5934
Parents: 77ff2fd
Author: Akitoshi Yoshida <ay...@apache.org>
Authored: Thu Aug 6 15:29:18 2015 +0200
Committer: Akitoshi Yoshida <ay...@apache.org>
Committed: Thu Aug 6 19:03:49 2015 +0200
----------------------------------------------------------------------
.../org/apache/cxf/ws/rm/RMInInterceptor.java | 4 +-
.../org/apache/cxf/ws/rm/SourceSequence.java | 1 +
.../java/org/apache/cxf/ws/rm/ServantTest.java | 74 ++++++++++++++++++++
3 files changed, 77 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/fc887853/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
index 4d44acb..5b516e4 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
@@ -168,8 +168,8 @@ public class RMInInterceptor extends AbstractRMInterceptor<Message> {
if (RM10Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION.equals(action)
|| RM11Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION.equals(action)) {
processAcknowledgments(rme, rmps, protocol);
- } else if (RM10Constants.CLOSE_SEQUENCE_ACTION.equals(action)
- || RM11Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION.equals(action)) {
+ } else if (RM10Constants.CLOSE_SEQUENCE_ACTION.equals(action)) {
+ // RM10 out-of-band CloseSequence/lastMessage is a special case; RM11 needs no special handling
processSequence(destination, message);
} else if ((RM10Constants.CREATE_SEQUENCE_ACTION.equals(action)
|| RM11Constants.CREATE_SEQUENCE_ACTION.equals(action)) && !isServer) {
http://git-wip-us.apache.org/repos/asf/cxf/blob/fc887853/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java
index 9224465..cc3e491 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java
@@ -172,6 +172,7 @@ public class SourceSequence extends AbstractSequence {
} else {
RMEndpoint rme = source.getReliableEndpoint();
Proxy proxy = rme.getProxy();
+ // REVIST for rm 1.1, provide an option to how the close and terminate messages are sent
proxy.terminate(this);
source.removeSequence(this);
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/fc887853/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java
index b56ff0f..2e977d8 100755
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java
@@ -29,6 +29,7 @@ import org.apache.cxf.message.ExchangeImpl;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageContentsList;
import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.OperationInfo;
import org.apache.cxf.ws.addressing.AddressingProperties;
import org.apache.cxf.ws.addressing.AttributedURIType;
import org.apache.cxf.ws.addressing.ContextUtils;
@@ -41,6 +42,7 @@ import org.apache.cxf.ws.rm.v200502.Expires;
import org.apache.cxf.ws.rm.v200502.Identifier;
import org.apache.cxf.ws.rm.v200502.OfferType;
import org.apache.cxf.ws.rm.v200502.TerminateSequenceType;
+import org.apache.cxf.ws.rm.v200702.CloseSequenceType;
import org.apache.cxf.ws.rm.v200702.TerminateSequenceResponseType;
import org.easymock.EasyMock;
import org.easymock.IMocksControl;
@@ -277,6 +279,38 @@ public class ServantTest extends Assert {
return message;
}
+ private static Message createTestCloseSequenceMessage(String sidstr) {
+ Message message = new MessageImpl();
+ Exchange exchange = new ExchangeImpl();
+ exchange.setInMessage(message);
+
+ message.put(Message.REQUESTOR_ROLE, Boolean.FALSE);
+
+ AddressingProperties maps = new AddressingProperties();
+ String msgId = "urn:uuid:12345-" + Math.random();
+ AttributedURIType id = ContextUtils.getAttributedURI(msgId);
+ maps.setMessageID(id);
+
+ maps.setAction(ContextUtils.getAttributedURI(RM10Constants.INSTANCE.getTerminateSequenceAction()));
+ maps.setTo(ContextUtils.getAttributedURI(SERVICE_URL));
+
+ maps.setReplyTo(RMUtils.createReference(DECOUPLED_URL));
+
+ message.put(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND, maps);
+
+ CloseSequenceType cs = new CloseSequenceType();
+ org.apache.cxf.ws.rm.v200702.Identifier sid = new org.apache.cxf.ws.rm.v200702.Identifier();
+ sid.setValue(sidstr);
+ cs.setIdentifier(sid);
+ MessageContentsList contents = new MessageContentsList();
+ contents.add(cs);
+ message.setContent(List.class, contents);
+
+ RMContextUtils.setProtocolVariation(message, ProtocolVariation.RM11WSA200508);
+
+ return message;
+ }
+
private void verifyTerminateSequenceDefault(Servant servant, RMManager manager,
String sidstr, ProtocolVariation protocol) throws SequenceFault {
DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
@@ -302,5 +336,45 @@ public class ServantTest extends Assert {
}
+ @Test
+ public void testInvokeForCloseSequence() {
+ RMEndpoint rme = control.createMock(RMEndpoint.class);
+ RMManager manager = new RMManager();
+ Destination destination = new Destination(rme);
+ Source source = new Source(rme);
+ DestinationSequence seq = control.createMock(DestinationSequence.class);
+ org.apache.cxf.ws.rm.v200702.Identifier sid = new org.apache.cxf.ws.rm.v200702.Identifier();
+ sid.setValue("123");
+ EasyMock.expect(seq.getIdentifier()).andReturn(sid).anyTimes();
+
+ EasyMock.expect(rme.getDestination()).andReturn(destination).anyTimes();
+ EasyMock.expect(rme.getManager()).andReturn(manager).anyTimes();
+ EasyMock.expect(rme.getSource()).andReturn(source).anyTimes();
+ Message message = createTestCloseSequenceMessage(sid.getValue());
+
+ OperationInfo oi = control.createMock(OperationInfo.class);
+ EasyMock.expect(oi.getName()).andReturn(RM11Constants.INSTANCE.getCloseSequenceOperationName()).anyTimes();
+ message.getExchange().put(OperationInfo.class, oi);
+
+ control.replay();
+
+ TestServant servant = new TestServant(rme);
+
+ servant.invoke(message.getExchange(), message.getContent(List.class).get(0));
+ assertTrue(servant.called);
+ }
+
+ private static class TestServant extends Servant {
+ boolean called;
+
+ TestServant(RMEndpoint rme) {
+ super(rme);
+ }
+ @Override
+ public Object closeSequence(Message message) {
+ called = true;
+ return null;
+ }
+ }
}