cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1169682 - in /cxf/trunk: rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
Date Mon, 12 Sep 2011 10:46:32 GMT
Author: ay
Date: Mon Sep 12 10:46:32 2011
New Revision: 1169682

URL: http://svn.apache.org/viewvc?rev=1169682&view=rev
Log:
[CXF-374] request context property for WS-RM sequence demarcation

Modified:
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?rev=1169682&r1=1169681&r2=1169682&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java Mon Sep 12 10:46:32
2011
@@ -90,6 +90,18 @@ public class RMManager {
      */
     public static final String WSRM_WSA_VERSION_PROPERTY = "org.apache.cxf.ws.rm.wsa-namespace";
 
+    /**
+     * Message contextual property giving the last message.
+     */
+    public static final String WSRM_LAST_MESSAGE_PROPERTY = 
+        "org.apache.cxf.ws.rm.last-message";
+
+    /**
+     * Message contextual property for setting the replyTo header
+     */
+    public static final String WSRM_REPLY_TO_PROPERTY = 
+        "org.apache.cxf.ws.rm.reply-to";
+    
     private static final Logger LOG = LogUtils.getL7dLogger(RMManager.class);
 
 

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=1169682&r1=1169681&r2=1169682&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 Sep 12
10:46:32 2011
@@ -136,6 +136,11 @@ public class RMOutInterceptor extends Ab
                 // context
                 seq.nextMessageNumber(inSeqId, inMessageNumber, isLastMessage);
                 
+                if (Boolean.TRUE.equals(msg.getContextualProperty(RMManager.WSRM_LAST_MESSAGE_PROPERTY)))
{
+                    // mark the message as the last one
+                    seq.setLastMessage(true);
+                }
+                
                 rmpsOut.setSequence(seq);
 
                 // if this was the last message in the sequence, reset the

Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java?rev=1169682&r1=1169681&r2=1169682&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
Mon Sep 12 10:46:32 2011
@@ -331,8 +331,7 @@ public class SequenceTest extends Abstra
                                                  RM10Constants.TERMINATE_SEQUENCE_ACTION};
         mf.verifyActions(expectedActions, true);
         mf.verifyMessageNumbers(new String[] {null, "1", null, null, "1", null}, true);
-        // TODO: temporarily commented-out until WS-RM last message support added back in
-//        mf.verifyLastMessage(new boolean[] {false, true, false, false, true, false}, true);
+        mf.verifyLastMessage(new boolean[] {false, true, false, false, true, false}, true);
 
         // createSequenceResponse message plus partial responses to
         // greetMeOneWay and terminateSequence ||: 2
@@ -348,6 +347,55 @@ public class SequenceTest extends Abstra
         mf.verifyLastMessage(new boolean[] {false, false, false, false}, false);
         mf.verifyAcknowledgements(new boolean[] {false, true, false, true}, false);
     }
+
+    @Test
+    public void testOnewayAnonymousAcksClientSequenceDemarcation() throws Exception {
+        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml");
+        greeter.greetMeOneWay("once");
+
+        ((BindingProvider)greeter).getRequestContext().
+            put(RMManager.WSRM_LAST_MESSAGE_PROPERTY, Boolean.TRUE);
+        greeter.greetMeOneWay("twice");
+
+        ((BindingProvider)greeter).getRequestContext().
+            remove(RMManager.WSRM_LAST_MESSAGE_PROPERTY);
+        greeter.greetMeOneWay("thrice");
+
+        // three application messages plus two createSequence plus one
+        // terminateSequence
+
+        awaitMessages(6, 5);
+        
+        MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(),
+            inRecorder.getInboundMessages(), Names200408.WSA_NAMESPACE_NAME, RM10Constants.NAMESPACE_URI);
+        
+        mf.verifyMessages(6, true);
+        String[] expectedActions = new String[] {RM10Constants.CREATE_SEQUENCE_ACTION, 
+                                                 GREETMEONEWAY_ACTION,
+                                                 GREETMEONEWAY_ACTION,
+                                                 RM10Constants.TERMINATE_SEQUENCE_ACTION,
+                                                 RM10Constants.CREATE_SEQUENCE_ACTION, 
+                                                 GREETMEONEWAY_ACTION};
+
+        mf.verifyActions(expectedActions, true);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", null, null, "1"}, true);
+        mf.verifyLastMessage(new boolean[] {false, false, true, false, false, false}, true);
+
+        // createSequenceResponse message plus partial responses to
+        // greetMeOneWay and terminateSequence ||: 2
+
+        mf.verifyMessages(5, false);
+
+        expectedActions = new String[] {RM10Constants.CREATE_SEQUENCE_RESPONSE_ACTION, 
+                                        RM10Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION, 
+                                        RM10Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION, 
+                                        RM10Constants.CREATE_SEQUENCE_RESPONSE_ACTION, 
+                                        RM10Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION};
+        mf.verifyActions(expectedActions, false);
+        mf.verifyMessageNumbers(new String[] {null, null, null, null, null}, false);
+        mf.verifyLastMessage(new boolean[] {false, false, false, false, false}, false);
+        mf.verifyAcknowledgements(new boolean[] {false, true, true, false, true}, false);
+    }
    
     @Test
     public void testOnewayAnonymousAcksSuppressed() throws Exception {



Mime
View raw message