cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject git commit: [CXF-5709] WSRM 1.1 TerminateSequence should not overwrite default replyTo to none
Date Wed, 23 Apr 2014 16:47:07 GMT
Repository: cxf
Updated Branches:
  refs/heads/master a3505225e -> 5e8329447


[CXF-5709] WSRM 1.1 TerminateSequence should not overwrite default replyTo to none


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

Branch: refs/heads/master
Commit: 5e832944780870f3bf0539b1ee40f62fec493807
Parents: a350522
Author: Akitoshi Yoshida <ay@apache.org>
Authored: Wed Apr 23 18:46:52 2014 +0200
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Wed Apr 23 18:46:52 2014 +0200

----------------------------------------------------------------------
 .../org/apache/cxf/ws/rm/RMOutInterceptor.java  |  3 +-
 .../apache/cxf/ws/rm/RMOutInterceptorTest.java  | 47 ++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5e832944/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
index e18c319..344bb21 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
@@ -106,7 +106,8 @@ public class RMOutInterceptor extends AbstractRMInterceptor<Message>
 {
             }
         } 
         if (constants.getSequenceAckAction().equals(action)
-            || constants.getTerminateSequenceAction().equals(action)) {
+            || (constants.getTerminateSequenceAction().equals(action)
+                && RM10Constants.NAMESPACE_URI.equals(rmNamespace))) {
             maps.setReplyTo(RMUtils.createNoneReference());
         }
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/5e832944/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
index 5f596f5..bb65576 100644
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
@@ -29,6 +29,7 @@ import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.Names;
 import org.apache.cxf.ws.addressing.VersionTransformer.Names200408;
 import org.apache.cxf.ws.rm.v200702.Identifier;
 import org.easymock.EasyMock;
@@ -163,8 +164,54 @@ public class RMOutInterceptorTest extends Assert {
         control.verify();
     }
     
+    @Test
+    public void testRM11TerminateSequence() throws RMException, SequenceFault {
+        testRMTerminateSequence(RM11Constants.NAMESPACE_URI, Names.WSA_NAMESPACE_NAME,
+                                RM11Constants.TERMINATE_SEQUENCE_ACTION,
+                                org.apache.cxf.ws.addressing.Names.WSA_ANONYMOUS_ADDRESS,
+                                org.apache.cxf.ws.addressing.Names.WSA_ANONYMOUS_ADDRESS);
+    }
+
+    @Test
+    public void testRM10TerminateSequence() throws RMException, SequenceFault {
+        testRMTerminateSequence(RM10Constants.NAMESPACE_URI, Names.WSA_NAMESPACE_NAME,
+                                RM10Constants.TERMINATE_SEQUENCE_ACTION,
+                                org.apache.cxf.ws.addressing.Names.WSA_ANONYMOUS_ADDRESS,
+                                org.apache.cxf.ws.addressing.Names.WSA_NONE_ADDRESS);
+    }
+
+    private void testRMTerminateSequence(String wsrmnsuri, String wsansuri,
+                                         String action, String breplyto, String areplyto)

+        throws RMException, SequenceFault {
+        AddressingProperties maps = createMAPs(action, "localhost:9000/GreeterPort", breplyto);

+
+        Message message = control.createMock(Message.class);
+        Exchange exchange = control.createMock(Exchange.class);
+        EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes();
+        EasyMock.expect(exchange.getOutMessage()).andReturn(message).anyTimes();
+        EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(Boolean.TRUE).anyTimes();
+        EasyMock.expect(message.get(JAXWSAConstants.ADDRESSING_PROPERTIES_OUTBOUND))
+            .andReturn(maps).anyTimes();
+        RMManager manager = control.createMock(RMManager.class);
+        RMConfiguration config = new RMConfiguration();
+        config.setRMNamespace(wsrmnsuri);
+        config.setRM10AddressingNamespace(wsansuri);
+        EasyMock.expect(manager.getEffectiveConfiguration(message)).andReturn(config).anyTimes();
+        control.replay();
+        RMOutInterceptor rmi = new RMOutInterceptor();
+        rmi.setManager(manager);
+        rmi.handle(message);
+
+        assertEquals(areplyto,
+                     maps.getReplyTo().getAddress().getValue());
+        control.verify();
+    }
+
     private AddressingProperties createMAPs(String action, String to, String replyTo) {
         AddressingProperties maps = new AddressingProperties();
+        AttributedURIType actionuri =  new AttributedURIType();
+        actionuri.setValue(action);
+        maps.setAction(actionuri);
         maps.setTo(RMUtils.createReference(to));
         EndpointReferenceType epr = RMUtils.createReference(replyTo);
         maps.setReplyTo(epr);


Mime
View raw message