cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r764052 - in /cxf/branches/2.1.x-fixes: ./ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/ rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/
Date Fri, 10 Apr 2009 20:58:00 GMT
Author: dkulp
Date: Fri Apr 10 20:58:00 2009
New Revision: 764052

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

........
  r763931 | eglynn | 2009-04-10 09:36:22 -0400 (Fri, 10 Apr 2009) | 2 lines
  
  Commited patch for CXF-2167 on behalf of Andrew Dinn. Added unit test coverage also.
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
    cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
    cxf/branches/2.1.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr 10 20:58:00 2009
@@ -1 +1 @@
-/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854
+/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931

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

Modified: cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java?rev=764052&r1=764051&r2=764052&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
Fri Apr 10 20:58:00 2009
@@ -425,7 +425,7 @@
             QName exposedRelationshipType = exposed.getRelationshipType();
             if (exposedRelationshipType != null) {
                 String internalRelationshipType = 
-                    Names.WSA_REPLY_NAME.equals(
+                    Names.WSA_REPLY_NAME.equalsIgnoreCase(
                                       exposedRelationshipType.getLocalPart())
                     ? Names.WSA_RELATIONSHIP_REPLY
                     : exposedRelationshipType.toString();

Modified: cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?rev=764052&r1=764051&r2=764052&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
Fri Apr 10 20:58:00 2009
@@ -726,7 +726,9 @@
      * @param maps the addressing properties
      */
     private void restoreExchange(SoapMessage message, AddressingProperties maps) {
-        if (maps != null && maps.getRelatesTo() != null) {
+        if (maps != null
+            && maps.getRelatesTo() != null
+            && isRelationshipReply(maps.getRelatesTo())) { 
             Exchange correlatedExchange =
                 uncorrelatedExchanges.remove(maps.getRelatesTo().getValue());
             if (correlatedExchange != null) {
@@ -756,6 +758,14 @@
         
     }
 
+    /** 
+     * @param relatesTo the current RelatesTo
+     * @return true iff the relationship type is reply
+     */
+    private boolean isRelationshipReply(RelatesToType relatesTo) {
+        return Names.WSA_RELATIONSHIP_REPLY.equals(relatesTo.getRelationshipType());
+    }
+ 
     /**
      * Marks a message as partial response
      * 

Modified: cxf/branches/2.1.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java?rev=764052&r1=764051&r2=764052&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
Fri Apr 10 20:58:00 2009
@@ -79,7 +79,9 @@
     private Map<String, List<String>> mimeHeaders;
     private Exchange correlatedExchange;
     private boolean expectRelatesTo;
-
+    private String nonReplyRelationship;
+    private boolean expectFaultTo;
+    
     @Before
     public void setUp() {
         codec = new MAPCodec();
@@ -96,6 +98,7 @@
         mimeHeaders = null;
         correlatedExchange = null;
         ContextUtils.setJAXBContext(null);
+        nonReplyRelationship = null;
     }
 
     @Test
@@ -243,6 +246,25 @@
         verifyMessage(message, true, false, false);
     }
 
+    @Test
+    public void testRequestorInboundNonReply() throws Exception {
+        nonReplyRelationship = "wsat:correlatedOneway";
+        SoapMessage message = setUpMessage(true, false);
+        codec.handleMessage(message);
+        control.verify();
+        verifyMessage(message, true, false, true);
+    }
+
+    @Test
+    public void testRequestorInboundNonNativeNonReply() throws Exception {
+        nonReplyRelationship = "wsat:correlatedOneway";
+        String uri = VersionTransformer.Names200408.WSA_NAMESPACE_NAME;
+        SoapMessage message = setUpMessage(true, false, false, false, uri);
+        codec.handleMessage(message);
+        control.verify();
+        verifyMessage(message, true, false, false);
+    }
+
     private SoapMessage setUpMessage(boolean requestor, boolean outbound) throws Exception
{
         return setUpMessage(requestor, outbound, false);
     }
@@ -423,8 +445,12 @@
             relatesTo = new RelatesToType();
             relatesTo.setValue(correlationID);
             maps.setRelatesTo(relatesTo);
-            correlatedExchange = new ExchangeImpl();
-            codec.uncorrelatedExchanges.put(correlationID, correlatedExchange);
+            if (nonReplyRelationship == null) {
+                correlatedExchange = new ExchangeImpl();
+                codec.uncorrelatedExchanges.put(correlationID, correlatedExchange);
+            } else {
+                relatesTo.setRelationshipType(nonReplyRelationship);
+            }
         }
         AttributedURIType action = ContextUtils.getAttributedURI("http://foo/bar/SEI/opRequest");
         maps.setAction(action);
@@ -614,18 +640,27 @@
                                boolean exposedAsNative) {
         if (requestor) {
             if (outbound) {
-                String id = expectedValues[0] instanceof AttributedURIType
-                    ? ((AttributedURIType)expectedValues[0]).getValue()
-                    : expectedValues[0] instanceof AttributedURI ? ((AttributedURI)expectedValues[0])
-                        .getValue() : ((org.apache.cxf.ws.addressing.v200403.AttributedURI)expectedValues[0])
-                        .getValue();
-                // assertTrue("expected correlationID : " + id + " in map: " +
-                // codec.uncorrelatedExchanges,
-                // codec.uncorrelatedExchanges.containsKey(id));
-                assertSame("unexpected correlated exchange", codec.uncorrelatedExchanges.get(id),
message
-                    .getExchange());
+                String id = expectedValues[1] instanceof AttributedURIType
+                    ? ((AttributedURIType)expectedValues[1]).getValue()
+                    : expectedValues[0] instanceof AttributedURI 
+                      ? ((AttributedURI)expectedValues[1]).getValue() 
+                      : ((org.apache.cxf.ws.addressing.v200403.AttributedURI)expectedValues[1]).getValue();
+                assertSame("unexpected correlated exchange", 
+                           codec.uncorrelatedExchanges.get(id), 
+                           message.getExchange());
             } else {
-                assertSame("unexpected correlated exchange", correlatedExchange, message.getExchange());
+                if (isReply(exposedAsNative)) {
+                    assertSame("unexpected correlated exchange", 
+                               correlatedExchange, 
+                               message.getExchange());
+                } else {
+                    assertNotSame("unexpected correlated exchange",
+                                  correlatedExchange,
+                                  message.getExchange());
+                }
+                assertEquals("expected empty uncorrelated exchange cache",
+                             0, 
+                             codec.uncorrelatedExchanges.size());
             }
         }
         if (outbound) {
@@ -638,6 +673,24 @@
             }
         }
         assertTrue("unexpected MAPs", verifyMAPs(message.get(getMAPProperty(requestor, outbound))));
+    }
+
+    private boolean isReply(boolean exposedAsNative) {
+        boolean isReply = false;
+        if (exposedAsNative) {
+            isReply = 
+                Names.WSA_RELATIONSHIP_REPLY.equals(
+                    ((RelatesToType)expectedValues[4]).getRelationshipType());
+        } else {
+            QName relationship = 
+                expectedValues[4] instanceof Relationship
+                ? ((Relationship)expectedValues[4]).getRelationshipType()
+                : ((org.apache.cxf.ws.addressing.v200403.Relationship)expectedValues[4])
+                      .getRelationshipType();
+            isReply = relationship == null 
+                      || Names.WSA_REPLY_NAME.equalsIgnoreCase(relationship.getLocalPart());
+        } 
 
+        return isReply;
     }
 }



Mime
View raw message