cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1304487 - in /cxf/branches/2.5.x-fixes: rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/ systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/ systests/ws-specs...
Date Fri, 23 Mar 2012 17:07:56 GMT
Author: dkulp
Date: Fri Mar 23 17:07:56 2012
New Revision: 1304487

URL: http://svn.apache.org/viewvc?rev=1304487&view=rev
Log:
[CXF-4189] Fix problem with ReplyTo=None for req/resp mep
Patch from Andrei Shakirin applied


Conflicts:

	api/src/main/java/org/apache/cxf/ws/addressing/Messages.properties

Modified:
    cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
    cxf/branches/2.5.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
    cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java
    cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java

Modified: cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=1304487&r1=1304486&r2=1304487&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
Fri Mar 23 17:07:56 2012
@@ -518,10 +518,14 @@ public class MAPAggregator extends Abstr
             }
             AddressingPropertiesImpl theMaps = 
                 ContextUtils.retrieveMAPs(message, false, ContextUtils.isOutbound(message));
-            if (null != theMaps && ContextUtils.isRequestor(message)) {         
  
-                assertAddressing(message, 
-                                 theMaps.getReplyTo(),
-                                 theMaps.getFaultTo());
+            if (null != theMaps) {
+                if (ContextUtils.isRequestor(message)) {            
+                    assertAddressing(message, 
+                                     theMaps.getReplyTo(),
+                                     theMaps.getFaultTo());
+                } else {
+                    checkReplyTo(message, theMaps);
+                }
             }
         } else if (!ContextUtils.isRequestor(message)) {
             //responder validates incoming MAPs
@@ -552,10 +556,8 @@ public class MAPAggregator extends Abstr
                                                 message);
                 } 
                 if (!isOneway) {
-                    // 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;
+                        LOG.warning("Detected NONE value in ReplyTo WSA header for request-respone
MEP");
                     } else {
                         // ensure the inbound MAPs are available in both the full & fault
                         // response messages (used to determine relatesTo etc.)
@@ -1265,5 +1267,24 @@ public class MAPAggregator extends Abstr
         
         return valid;
     }
+
+    /**
+     * Check for NONE ReplyTo value in request-response MEP
+     * @param message the current message
+     * @param maps the incoming MAPs
+     */
+    private void checkReplyTo(Message message, AddressingProperties maps) {             

+        // if ReplyTo address is none then 202 response status is expected
+        // However returning a fault is more appropriate for request-response MEP
+        if (!message.getExchange().isOneWay() 
+            && !MessageUtils.isPartialResponse(message)
+            && ContextUtils.isNoneAddress(maps.getReplyTo())) {
+            String reason = MessageFormat.format(BUNDLE.getString("REPLYTO_NOT_SUPPORTED_MSG"),
+                                                 maps.getReplyTo().getAddress().getValue());
+            throw new SoapFault(reason,
+                                new QName(Names.WSA_NAMESPACE_NAME,
+                                          Names.WSA_NONE_ADDRESS));
+        }
+    }
 }
 

Modified: cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties?rev=1304487&r1=1304486&r2=1304487&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
Fri Mar 23 17:07:56 2012
@@ -26,4 +26,6 @@ INVALID_MAP_MSG = Invalid Message Addres
 MAP_REQUIRED_MSG = Message Addressing Property {0} required
 DUPLICATE_MESSAGE_ID_MSG = Duplicate Message ID {0}
 INVALID_ADDRESSING_PROPERTY_MESSAGE = A header representing a Message Addressing Property
is not valid and the message cannot be processed
-MISSING_ACTION_MESSAGE = A required header representing a Message Addressing Property is
not present
\ No newline at end of file
+MISSING_ACTION_MESSAGE = A required header representing a Message Addressing Property is
not present
+UNSUPPORTED_REPLY_TO_VALUE = A value of ReplyTo property {0} is not supported for request-response
MEP
+REPLYTO_NOT_SUPPORTED_MSG = ReplyTo {0} is not supported for request-response MEP

Modified: cxf/branches/2.5.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java?rev=1304487&r1=1304486&r2=1304487&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
Fri Mar 23 17:07:56 2012
@@ -56,12 +56,10 @@ 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.EasyMock;
 import org.easymock.IMocksControl;
-
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -383,10 +381,11 @@ public class MAPAggregatorTest extends A
         verifyMessage(message, true, false, false /*check*/);
     }
     
-    @Test
+    @Test(expected = SoapFault.class)
     public void testTwoWayRequestWithReplyToNone() throws Exception {
         Message message = new MessageImpl();  
         Exchange exchange = new ExchangeImpl();
+        exchange.setOutMessage(message);
         message.setExchange(exchange);
         setUpMessageProperty(message,
                              REQUESTOR_ROLE,
@@ -400,18 +399,13 @@ public class MAPAggregatorTest extends A
         maps.setMessageID(id);
         maps.setAction(ContextUtils.getAttributedURI(""));
         setUpMessageProperty(message,
-                             SERVER_ADDRESSING_PROPERTIES_INBOUND,
+                             SERVER_ADDRESSING_PROPERTIES_OUTBOUND,
                              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
-        }
+        aggregator.mediate(message, false);
     }
     
     @Test

Modified: cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java?rev=1304487&r1=1304486&r2=1304487&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java
(original)
+++ cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java
Fri Mar 23 17:07:56 2012
@@ -53,7 +53,7 @@ public class WSAClientServerTest extends
 
     @BeforeClass
     public static void startServers() throws Exception {
-        assertTrue("server did not launch correctly", launchServer(Server.class));
+        assertTrue("server did not launch correctly", launchServer(Server.class, true));
     }
 
     @Test

Modified: cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java?rev=1304487&r1=1304486&r2=1304487&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java
(original)
+++ cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java
Fri Mar 23 17:07:56 2012
@@ -58,6 +58,9 @@ public class AddressingPolicyTest extend
         public Server(String dir) {
             tmpDir = dir;
         }
+        public Server(String[] args) {
+            tmpDir = args[0];
+        }
         protected void run()  {
             
             System.setProperty("temp.location", tmpDir);
@@ -97,7 +100,7 @@ public class AddressingPolicyTest extend
         System.setProperty("temp.location", TEMPDIR);
 
         assertTrue("server did not launch correctly", launchServer(Server.class, null,
-                                                                   new String[] {TEMPDIR}));
+                                                                   new String[] {TEMPDIR},
true));
     }
          
     @Test
@@ -120,7 +123,7 @@ public class AddressingPolicyTest extend
 
         // oneway
 
-        greeter.greetMeOneWay("CXF");
+        //greeter.greetMeOneWay("CXF");
 
         // two-way
 



Mime
View raw message