cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1456942 - in /cxf/branches/2.7.x-fixes: ./ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/ rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/
Date Fri, 15 Mar 2013 13:11:27 GMT
Author: ay
Date: Fri Mar 15 13:11:27 2013
New Revision: 1456942

URL: http://svn.apache.org/r1456942
Log:
Merged revisions 1451375 via  svn merge from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1451375 | ay | 2013-02-28 22:53:07 +0100 (Thu, 28 Feb 2013) | 1 line
  
  [CXF-4863] TerminateSequenceResponse must be returned to WS-RM 1.1 TermianteSequence
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java
    cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10AImpl.java
    cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10Impl.java
    cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java
    cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
    cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM11Constants.java
    cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
    cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java
    cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
    cxf/branches/2.7.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java
    cxf/branches/2.7.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java

Propchange: cxf/branches/2.7.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java
Fri Mar 15 13:11:27 2013
@@ -82,6 +82,13 @@ public interface EncoderDecoder {
     Class<?> getTerminateSequenceType();
     
     /**
+     * Get the class used for the TerminateSequenceResponseType.
+     * 
+     * @return class
+     */
+    Class<?> getTerminateSequenceResponseType();
+    
+    /**
      * Builds an element containing WS-RM headers. This adds the appropriate WS-RM and WS-A
namespace
      * declarations to the element, and then adds any WS-RM headers set in the supplied properties
as child
      * elements.

Modified: cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10AImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10AImpl.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10AImpl.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10AImpl.java
Fri Mar 15 13:11:27 2013
@@ -86,6 +86,10 @@ public final class EncoderDecoder10AImpl
         return org.apache.cxf.ws.rm.v200502wsa15.TerminateSequenceType.class;
     }
 
+    public Class<?> getTerminateSequenceResponseType() {
+        return null;
+    }
+
     private static JAXBContext getContext() throws JAXBException {
         synchronized (EncoderDecoder10AImpl.class) {
             if (jaxbContext == null) {

Modified: cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10Impl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10Impl.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10Impl.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10Impl.java
Fri Mar 15 13:11:27 2013
@@ -86,6 +86,10 @@ public final class EncoderDecoder10Impl 
         return org.apache.cxf.ws.rm.v200502.TerminateSequenceType.class;
     }
 
+    public Class<?> getTerminateSequenceResponseType() {
+        return null;
+    }
+
     private static JAXBContext getContext() throws JAXBException {
         synchronized (EncoderDecoder10Impl.class) {
             if (jaxbContext == null) {

Modified: cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java
Fri Mar 15 13:11:27 2013
@@ -87,6 +87,10 @@ public final class EncoderDecoder11Impl 
         return org.apache.cxf.ws.rm.v200702.TerminateSequenceType.class;
     }
 
+    public Class<?> getTerminateSequenceResponseType() {
+        return org.apache.cxf.ws.rm.v200702.TerminateSequenceResponseType.class;
+    }
+
     private static JAXBContext getContext() throws JAXBException {
         synchronized (EncoderDecoder11Impl.class) {
             if (jaxbContext == null) {

Modified: cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java Fri Mar
15 13:11:27 2013
@@ -95,6 +95,7 @@ public class Proxy {
         
         TerminateSequenceType ts = new TerminateSequenceType();
         ts.setIdentifier(ss.getIdentifier());
+        ts.setLastMsgNumber(ss.getCurrentMessageNr());
         EncoderDecoder codec = protocol.getCodec();
         invoke(oi, protocol, new Object[] {codec.convertToSend(ts)}, null);
     }

Modified: cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM11Constants.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM11Constants.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM11Constants.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM11Constants.java
Fri Mar 15 13:11:27 2013
@@ -64,6 +64,9 @@ public final class RM11Constants extends
     public static final QName TERMINATE_SEQUENCE_QNAME =
         new QName(NAMESPACE_URI, "TerminateSequence");
     
+    public static final QName TERMINATE_SEQUENCE_RESPONSE_QNAME =
+        new QName(NAMESPACE_URI, "TerminateSequenceResponse");
+    
     public static final QName TERMINATE_SEQUENCE_ANONYMOUS_QNAME =
         new QName(NAMESPACE_URI, "TerminateSequenceAnonymous");
     
@@ -181,6 +184,10 @@ public final class RM11Constants extends
         return TERMINATE_SEQUENCE_ACTION;
     }
     
+    public String getTerminateSequenceResponseAction() {
+        return TERMINATE_SEQUENCE_RESPONSE_ACTION;
+    }
+    
     public String getCloseSequenceAction() {
         return CLOSE_SEQUENCE_ACTION;
     }
@@ -223,6 +230,10 @@ public final class RM11Constants extends
         return TERMINATE_SEQUENCE_QNAME;
     }
     
+    public QName getTerminateSequenceResponseOperationName() {
+        return TERMINATE_SEQUENCE_RESPONSE_QNAME;
+    }
+    
     public QName getTerminateSequenceAnonymousOperationName() {
         return TERMINATE_SEQUENCE_ANONYMOUS_QNAME;
     }

Modified: cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java Fri
Mar 15 13:11:27 2013
@@ -83,6 +83,7 @@ public class RMEndpoint {
     private static final String CREATE_PART_NAME = "create";
     private static final String CREATE_RESPONSE_PART_NAME = "createResponse";
     private static final String TERMINATE_PART_NAME = "terminate";
+    private static final String TERMINATE_RESPONSE_PART_NAME = "terminateResponse";
     
     private static Schema rmSchema;
 
@@ -481,6 +482,7 @@ public class RMEndpoint {
 
         RMConstants consts = protocol.getConstants();
         operationInfo = ii.addOperation(consts.getTerminateSequenceOperationName());
+
         messageInfo = operationInfo.createMessage(consts.getTerminateSequenceOperationName(),
                                                   MessageInfo.Type.INPUT);
         operationInfo.setInput(messageInfo.getName().getLocalPart(), messageInfo);
@@ -488,6 +490,17 @@ public class RMEndpoint {
         partInfo.setElementQName(consts.getTerminateSequenceOperationName());
         partInfo.setElement(true);
         partInfo.setTypeClass(protocol.getCodec().getTerminateSequenceType());
+        if (RM11Constants.NAMESPACE_URI.equals(protocol.getWSRMNamespace())) {
+            messageInfo = operationInfo.createMessage(
+                RM11Constants.INSTANCE.getTerminateSequenceResponseOperationName(),
+                MessageInfo.Type.OUTPUT);
+            operationInfo.setOutput(messageInfo.getName().getLocalPart(), messageInfo);
+            partInfo = messageInfo.addMessagePart(TERMINATE_RESPONSE_PART_NAME);
+            partInfo.setElementQName(RM11Constants.INSTANCE.getTerminateSequenceResponseOperationName());
+            partInfo.setElement(true);
+            partInfo.setTypeClass(protocol.getCodec().getTerminateSequenceResponseType());
+            partInfo.setIndex(0);
+        }
         
         // for the TerminateSequence operation to an anonymous endpoint
         operationInfo = ii.addOperation(consts.getTerminateSequenceAnonymousOperationName());
@@ -560,7 +573,13 @@ public class RMEndpoint {
 
             boi = bi.buildOperation(consts.getTerminateSequenceOperationName(),
                                     consts.getTerminateSequenceOperationName().getLocalPart(),
null);
-            addAction(boi, consts.getTerminateSequenceAction());
+
+            if (RM11Constants.NAMESPACE_URI.equals(protocol.getWSRMNamespace())) {
+                addAction(boi, consts.getTerminateSequenceAction(), 
+                          RM11Constants.INSTANCE.getTerminateSequenceResponseAction());
+            } else {
+                addAction(boi, consts.getTerminateSequenceAction());
+            }
             bi.addOperation(boi);
 
             boi = bi.buildOperation(consts.getTerminateSequenceAnonymousOperationName(),

Modified: cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java Fri
Mar 15 13:11:27 2013
@@ -34,6 +34,7 @@ import org.apache.cxf.message.Message;
 import org.apache.cxf.service.invoker.Invoker;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.ContextUtils;
 import org.apache.cxf.ws.rm.manager.DestinationPolicyType;
 import org.apache.cxf.ws.rm.v200702.AcceptType;
 import org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType;
@@ -41,6 +42,7 @@ import org.apache.cxf.ws.rm.v200702.Crea
 import org.apache.cxf.ws.rm.v200702.Expires;
 import org.apache.cxf.ws.rm.v200702.Identifier;
 import org.apache.cxf.ws.rm.v200702.OfferType;
+import org.apache.cxf.ws.rm.v200702.TerminateSequenceResponseType;
 import org.apache.cxf.ws.rm.v200702.TerminateSequenceType;
 
 /**
@@ -84,7 +86,10 @@ public class Servant implements Invoker 
             createSequenceResponse(createResponse, protocol);
         } else if (RM10Constants.INSTANCE.getTerminateSequenceOperationName().equals(oi.getName())
             || RM11Constants.INSTANCE.getTerminateSequenceOperationName().equals(oi.getName()))
{
-            terminateSequence(exchange.getInMessage());
+            Object tsr = terminateSequence(exchange.getInMessage());
+            if (tsr != null) {
+                return Collections.singletonList(tsr);
+            }
         }
         
         return null;
@@ -196,7 +201,7 @@ public class Servant implements Invoker 
         }
     }
 
-    public void terminateSequence(Message message) {
+    public Object terminateSequence(Message message) {
         LOG.fine("Terminating sequence");
         final ProtocolVariation protocol = RMContextUtils.getProtocolVariation(message);
         
@@ -212,7 +217,7 @@ public class Servant implements Invoker 
         if (null == terminatedSeq) {
             //  TODO
             LOG.severe("No such sequence.");
-            return;
+            return null;
         } 
 
         destination.removeSequence(terminatedSeq);
@@ -246,7 +251,23 @@ public class Servant implements Invoker 
                 break;
             }
         }
-        
+        TerminateSequenceResponseType terminateResponse = null;
+        if (RM11Constants.NAMESPACE_URI.equals(protocol.getWSRMNamespace())) {
+            AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false);
       
+            Message outMessage = message.getExchange().getOutMessage();
+
+            if (null == outMessage) {
+                // outMessage may be null e.g. if ReplyTo is not set for TS 
+                outMessage = ContextUtils.createMessage(message.getExchange());
+                message.getExchange().setOutMessage(outMessage);
+            }
+            if (null != outMessage) {
+                RMContextUtils.storeMAPs(maps, outMessage, false, false);
+            }
+            terminateResponse = new TerminateSequenceResponseType();        
+            terminateResponse.setIdentifier(sid);
+        }
+        return terminateResponse;
     }
 
     Object getParameter(Message message) {

Modified: cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
Fri Mar 15 13:11:27 2013
@@ -412,6 +412,10 @@ public class RMSoapInterceptor extends A
             boi = bi.getOperation(consts.getSequenceAckOperationName()); 
         } else if (consts.getTerminateSequenceAction().equals(action)) {
             boi = bi.getOperation(consts.getTerminateSequenceOperationName()); 
+        } else if (RM11Constants.INSTANCE.getTerminateSequenceResponseAction().equals(action))
{
+            //TODO add server-side TSR handling
+            boi = bi.getOperation(RM11Constants.INSTANCE.getTerminateSequenceOperationName());
+            isOneway = false;
         } else if (consts.getCloseSequenceAction().equals(action)) {
             boi = bi.getOperation(consts.getCloseSequenceOperationName()); 
         }
@@ -427,7 +431,8 @@ public class RMSoapInterceptor extends A
         // server originated oneway RM protocol messages.        
         // 
         
-        if (!consts.getCreateSequenceResponseAction().equals(action)) {
+        if (!consts.getCreateSequenceResponseAction().equals(action)
+            && !RM11Constants.INSTANCE.getTerminateSequenceResponseAction().equals(action))
{
             LOG.fine("Changing requestor role from " + message.get(Message.REQUESTOR_ROLE)
                      + " to false");
             Object originalRequestorRole = message.get(Message.REQUESTOR_ROLE);

Modified: cxf/branches/2.7.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java
Fri Mar 15 13:11:27 2013
@@ -38,7 +38,10 @@ import org.apache.cxf.ws.rm.manager.Dest
 import org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType;
 import org.apache.cxf.ws.rm.v200502.CreateSequenceType;
 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.TerminateSequenceResponseType;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
 
@@ -213,4 +216,91 @@ public class ServantTest extends Assert 
         
         return message;
     }
+
+    @Test
+    public void testTerminateSequence() throws SequenceFault {
+        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();
+        
+        control.replay();
+        
+        Servant servant = new Servant(rme);
+
+        destination.addSequence(seq, false);        
+        verifyTerminateSequenceDefault(servant, manager, "123", ProtocolVariation.RM10WSA200408);
+        
+        destination.addSequence(seq, false);
+        verifyTerminateSequenceDefault(servant, manager, "123", ProtocolVariation.RM11WSA200508);
+    }
+    
+    private static Message createTestTerminateSequenceMessage(String sidstr, ProtocolVariation
protocol) {
+        Message message = new MessageImpl();
+        Exchange exchange = new ExchangeImpl();
+        exchange.setInMessage(message);
+
+        message.put(Message.REQUESTOR_ROLE, Boolean.FALSE);
+        
+        AddressingPropertiesImpl maps = new AddressingPropertiesImpl();
+        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.SERVER_ADDRESSING_PROPERTIES_INBOUND, maps);
+
+        TerminateSequenceType ts = new TerminateSequenceType();
+        Identifier sid = new Identifier();
+        sid.setValue(sidstr);
+        ts.setIdentifier(sid);
+        Object tst = ProtocolVariation.RM10WSA200408.getWSRMNamespace().equals(protocol.getWSRMNamespace())

+            ? ts : ProtocolVariation.RM10WSA200408.getCodec().convertReceivedTerminateSequence(ts);
+        MessageContentsList contents = new MessageContentsList();
+        contents.add(tst);
+        message.setContent(List.class, contents);
+
+        RMContextUtils.setProtocolVariation(message, protocol);
+        
+        return message;
+    }
+
+    private void verifyTerminateSequenceDefault(Servant servant, RMManager manager, 
+                                                String sidstr, ProtocolVariation protocol)
throws SequenceFault {
+        DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
+        AcksPolicyType ap = RMMANGER_FACTORY.createAcksPolicyType();
+        dp.setAcksPolicy(ap);
+        
+        manager.setDestinationPolicy(dp);
+        
+        Message message = createTestTerminateSequenceMessage(sidstr, protocol);
+
+        Object tsr = servant.terminateSequence(message);
+        
+        if (ProtocolVariation.RM10WSA200408.getWSRMNamespace().equals(protocol.getWSRMNamespace()))
{
+            // rm 1.0
+            assertNull(tsr);
+        } else {
+            // rm 1.1
+            assertTrue(tsr instanceof TerminateSequenceResponseType);
+            org.apache.cxf.ws.rm.v200702.Identifier sid = ((TerminateSequenceResponseType)tsr).getIdentifier();
+            assertNotNull(sid);
+            assertEquals(sidstr, sid.getValue());
+        }
+        
+    }
+
+
 }

Modified: cxf/branches/2.7.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java?rev=1456942&r1=1456941&r2=1456942&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java
Fri Mar 15 13:11:27 2013
@@ -74,6 +74,8 @@ public class ProtocolVariationsTest exte
         = "http://cxf.apache.org/greeter_control/Greeter/greetMeRequest";
     private static final String GREETME_RESPONSE_ACTION
         = "http://cxf.apache.org/greeter_control/Greeter/greetMeResponse";
+    private static final String GREETME_ONEWAY_ACTION
+        = "http://cxf.apache.org/greeter_control/Greeter/greetMeOneWayRequest";
 
     private static String decoupledEndpoint;
     private static int decoupledCount = 1;
@@ -381,6 +383,81 @@ public class ProtocolVariationsTest exte
         verifyTwowayNonAnonymous(Names.WSA_NAMESPACE_NAME, RM11Constants.INSTANCE);
     }
 
+    @Test
+    public void testTerminateSequenceDefault() throws Exception {
+        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false);
+
+        RMManager manager = greeterBus.getExtension(RMManager.class);
+        manager.getSourcePolicy().getSequenceTerminationPolicy().setMaxLength(1);
+
+        greeter.greetMeOneWay("one");
+        
+        verifyTerminateSequence(Names200408.WSA_NAMESPACE_NAME, RM10Constants.INSTANCE);
+    }
+
+    @Test
+    public void testTerminateSequenceRM11() throws Exception {
+        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false);
+
+        RMManager manager = greeterBus.getExtension(RMManager.class);
+        manager.getSourcePolicy().getSequenceTerminationPolicy().setMaxLength(1);
+
+        // WS-RM 1.1 and WS-A 1.0
+        Client client = ClientProxy.getClient(greeter);
+        client.getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM11Constants.NAMESPACE_URI);
+        client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names.WSA_NAMESPACE_NAME);
+
+        greeter.greetMeOneWay("one");
+        
+        verifyTerminateSequence(Names.WSA_NAMESPACE_NAME, RM11Constants.INSTANCE);
+    }
+    
+
+    private void verifyTerminateSequence(String wsaUri, RMConstants consts) throws Exception
{
+        if (RM11Constants.NAMESPACE_URI.equals(consts.getWSRMNamespace())) {
+            awaitMessages(3, 3);
+        } else {
+            awaitMessages(3, 2);
+        }
+        
+        MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(),
+            inRecorder.getInboundMessages(), wsaUri, consts.getWSRMNamespace());
+        
+        mf.verifyMessages(3, true);
+        String[] expectedActions = new String[] {consts.getCreateSequenceAction(), 
+                                                 GREETME_ONEWAY_ACTION,
+                                                 consts.getTerminateSequenceAction()};
+        mf.verifyActions(expectedActions, true);
+        mf.verifyMessageNumbers(new String[] {null, "1", null}, true);
+        if (RM11Constants.NAMESPACE_URI.equals(consts.getWSRMNamespace())) {
+            // no LastMessage
+            mf.verifyLastMessage(new boolean[] {false, false, false}, true);
+        } else {
+            // uses LastMessage
+            mf.verifyLastMessage(new boolean[] {false, true, false}, true);
+        }
+
+        if (RM11Constants.NAMESPACE_URI.equals(consts.getWSRMNamespace())) {
+            // CSR, ACK, TSR
+            mf.verifyMessages(3, false);
+            expectedActions = new String[] {consts.getCreateSequenceResponseAction(), 
+                                            consts.getSequenceAckAction(),
+                                            RM11Constants.INSTANCE.getTerminateSequenceResponseAction()};
+            mf.verifyActions(expectedActions, false);
+            mf.verifyAcknowledgements(new boolean[] {false, true, false}, false);
+
+        } else {
+            // CSR, ACK, PR
+            mf.verifyMessages(2, false);
+            expectedActions = new String[] {consts.getCreateSequenceResponseAction(), 
+                                            consts.getSequenceAckAction()};
+            mf.verifyActions(expectedActions, false);
+            mf.verifyAcknowledgements(new boolean[] {false, true}, false);
+        }
+    }
+
+
+
     private void verifyTwowayNonAnonymous(String wsaUri, RMConstants consts) throws Exception
{
     
         // CreateSequence and three greetMe messages



Mime
View raw message