You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2010/09/07 11:56:10 UTC

svn commit: r993305 - in /cxf/branches/2.2.x-fixes: ./ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/

Author: sergeyb
Date: Tue Sep  7 09:56:09 2010
New Revision: 993305

URL: http://svn.apache.org/viewvc?rev=993305&view=rev
Log:
Merged revisions 992686 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r992686 | sergeyb | 2010-09-04 22:37:46 +0100 (Sat, 04 Sep 2010) | 1 line
  
  [CXF-2972] Returning a fault when ReplyTo EPR address is none
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
    cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    cxf/branches/2.2.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep  7 09:56:09 2010
@@ -1 +1 @@
-/cxf/trunk:989123,989434,990386,990593,991324,991416,991797,991893,991923,991925-991927,992000,992464,992681
+/cxf/trunk:989123,989434,990386,990593,991324,991416,991797,991893,991923,991925-991927,992000,992464,992681,992686

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

Modified: cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?rev=993305&r1=993304&r2=993305&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java (original)
+++ cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java Tue Sep  7 09:56:09 2010
@@ -316,6 +316,18 @@ public final class ContextUtils {
                || Names.WSA_ANONYMOUS_ADDRESS.equals(ref.getAddress().getValue())
                || Names.WSA_NONE_ADDRESS.equals(ref.getAddress().getValue());
     }
+    
+    /**
+     * Helper method to determine if an EPR address is none.
+     *
+     * @param ref the EPR under test
+     * @return true if the address is generic
+     */
+    public static boolean isNoneAddress(EndpointReferenceType ref) {
+        return ref != null 
+               && ref.getAddress() != null
+               && Names.WSA_NONE_ADDRESS.equals(ref.getAddress().getValue());
+    }
 
     /**
      * Helper method to determine if an MAPs Action is empty (a null action

Modified: cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=993305&r1=993304&r2=993305&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java (original)
+++ cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java Tue Sep  7 09:56:09 2010
@@ -508,10 +508,16 @@ public class MAPAggregator extends Abstr
                                                 message);
                 } 
                 if (!isOneway) {
-                    // ensure the inbound MAPs are available in both the full & fault
-                    // response messages (used to determine relatesTo etc.)
-                    ContextUtils.propogateReceivedMAPs(maps,
+                    // if ReplyTo address is none then 202 response status is expected
+                    // However returning a fault is more appropriate for request-response MEP
+                    if (ContextUtils.isNoneAddress(maps.getReplyTo())) {
+                        continueProcessing = false;
+                    } else {
+                        // ensure the inbound MAPs are available in both the full & fault
+                        // response messages (used to determine relatesTo etc.)
+                        ContextUtils.propogateReceivedMAPs(maps,
                                                        message.getExchange());
+                    }
                 }
             }
             if (continueProcessing) {

Modified: cxf/branches/2.2.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java?rev=993305&r1=993304&r2=993305&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java Tue Sep  7 09:56:09 2010
@@ -33,16 +33,13 @@ import javax.xml.namespace.QName;
 import javax.xml.ws.RequestWrapper;
 import javax.xml.ws.ResponseWrapper;
 
-//import javax.xml.ws.RequestWrapper;
-//import javax.xml.ws.ResponseWrapper;
-
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.phase.PhaseManager;
@@ -58,16 +55,17 @@ import org.apache.cxf.service.model.Inte
 import org.apache.cxf.service.model.MessageInfo.Type;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
+
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-
 import static org.apache.cxf.binding.soap.Soap11.SOAP_NAMESPACE;
 import static org.apache.cxf.message.Message.REQUESTOR_ROLE;
 import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES;
@@ -319,6 +317,37 @@ public class MAPAggregatorTest extends A
         control.verify();
         verifyMessage(message, true, false, false /*check*/);
     }
+    
+    @Test
+    public void testTwoWayRequestWithReplyToNone() throws Exception {
+        Message message = new MessageImpl();  
+        Exchange exchange = new ExchangeImpl();
+        message.setExchange(exchange);
+        setUpMessageProperty(message,
+                             REQUESTOR_ROLE,
+                             Boolean.FALSE);
+        AddressingPropertiesImpl maps = new AddressingPropertiesImpl();
+        EndpointReferenceType replyTo = new EndpointReferenceType();
+        replyTo.setAddress(ContextUtils.getAttributedURI(Names.WSA_NONE_ADDRESS));
+        maps.setReplyTo(replyTo);
+        AttributedURIType id = 
+            ContextUtils.getAttributedURI("urn:uuid:12345");
+        maps.setMessageID(id);
+        maps.setAction(ContextUtils.getAttributedURI(""));
+        setUpMessageProperty(message,
+                             SERVER_ADDRESSING_PROPERTIES_INBOUND,
+                             maps);
+        setUpMessageProperty(message,
+                             "org.apache.cxf.ws.addressing.map.fault.name",
+                             "NoneAddress");
+        
+        try {
+            aggregator.mediate(message, false);
+            fail("Two way request with ReplyTo address set to none must fail");
+        } catch (SoapFault ex) {
+            // expected
+        }
+    }
 
     
     private Message setUpMessage(boolean requestor,