cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1242304 - in /cxf/branches/2.4.x-fixes: ./ api/src/main/java/org/apache/cxf/message/ rt/core/src/main/java/org/apache/cxf/interceptor/ systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/ systests/uncategorized/src/test/...
Date Thu, 09 Feb 2012 12:55:28 GMT
Author: ay
Date: Thu Feb  9 12:55:27 2012
New Revision: 1242304

URL: http://svn.apache.org/viewvc?rev=1242304&view=rev
Log:
Merged revisions 1242047 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

........
  r1242047 | ay | 2012-02-08 20:26:46 +0100 (Wed, 08 Feb 2012) | 1 line
  
  [CXF-4091] add a robust in-only processing option for oneway call
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java
    cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
    cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/ControlImpl.java
    cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
    cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/greeter_control/ControlImpl.java
    cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/greeter_control.wsdl

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb  9 12:55:27 2012
@@ -1,2 +1,2 @@
-/cxf/branches/2.5.x-fixes:1242264
+/cxf/branches/2.5.x-fixes:1242047,1242264
 /cxf/trunk:1242263

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

Modified: cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java?rev=1242304&r1=1242303&r2=1242304&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java Thu Feb
 9 12:55:27 2012
@@ -69,7 +69,7 @@ public interface Message extends StringM
     String PARTIAL_RESPONSE_MESSAGE = "org.apache.cxf.partial.response";
     String ONE_WAY_REQUEST = "OnewayRequest";
     
-
+    String ROBUST_ONEWAY = "org.apache.cxf.oneway.robust";
     
     String HTTP_REQUEST_METHOD = "org.apache.cxf.request.method";
     String REQUEST_URI = "org.apache.cxf.request.uri";

Modified: cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java?rev=1242304&r1=1242303&r2=1242304&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
Thu Feb  9 12:55:27 2012
@@ -32,9 +32,11 @@ import org.apache.cxf.io.DelegatingInput
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.workqueue.WorkQueueManager;
 
 
@@ -79,15 +81,13 @@ public class OneWayProcessorInterceptor 
             message.put(OneWayProcessorInterceptor.class, this);
             final InterceptorChain chain = message.getInterceptorChain();
 
-            Object o = message.getContextualProperty(USE_ORIGINAL_THREAD);
-            if (o == null) {
-                o = Boolean.FALSE;
-            } else if (o instanceof String) {
-                o = Boolean.valueOf((String)o);
-            }
+            boolean robust = 
+                MessageUtils.isTrue(message.getContextualProperty(Message.ROBUST_ONEWAY));
 
+            boolean useOriginalThread = 
+                MessageUtils.isTrue(message.getContextualProperty(USE_ORIGINAL_THREAD));
             
-            if (Boolean.FALSE.equals(o)) {
+            if (!useOriginalThread && !robust) {
                 //need to suck in all the data from the input stream as
                 //the transport might discard any data on the stream when this 
                 //thread unwinds or when the empty response is sent back
@@ -96,7 +96,21 @@ public class OneWayProcessorInterceptor 
                     in.cacheInput();
                 }
             }
-
+            
+            if (robust) {
+                // continue to invoke the chain
+                chain.pause();
+                chain.resume();
+                if (message.getContent(Exception.class) != null) {
+                    // return the fault over the response fault channel
+                    MessageObserver faultObserver = chain.getFaultObserver();
+                    if (faultObserver != null) {
+                        message.getExchange().setOneWay(false);
+                        faultObserver.onMessage(message);
+                    } 
+                    return;
+                }
+            }
             
             try {
                 Message partial = createMessage(message.getExchange());
@@ -116,7 +130,7 @@ public class OneWayProcessorInterceptor 
                 //IGNORE
             }
             
-            if (Boolean.FALSE.equals(o)) {
+            if (!useOriginalThread && !robust) {
                 chain.pause();
                 try {
                     final Object lock = new Object();

Modified: cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/ControlImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/ControlImpl.java?rev=1242304&r1=1242303&r2=1242304&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/ControlImpl.java
(original)
+++ cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/ControlImpl.java
Thu Feb  9 12:55:27 2012
@@ -113,4 +113,19 @@ public class ControlImpl implements Cont
         // TODO Auto-generated method stub
         return null;
     }
+
+    public Response<?> setRobustInOnlyModeAsync(boolean in) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Future<?> setRobustInOnlyModeAsync(boolean in, AsyncHandler<?> asyncHandler)
{
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void setRobustInOnlyMode(boolean in) {
+        // TODO Auto-generated method stub
+        
+    }
 }

Modified: cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java?rev=1242304&r1=1242303&r2=1242304&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
(original)
+++ cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
Thu Feb  9 12:55:27 2012
@@ -153,6 +153,15 @@ public class InterceptorFaultTest extend
 
     @Test
     public void testWithoutAddressing() throws Exception {
+        testWithoutAddressing(false);
+    }
+
+    @Test
+    public void testRobustWithoutAddressing() throws Exception {
+        testWithoutAddressing(true);
+    }
+
+    private void testWithoutAddressing(boolean robust) throws Exception {
         
         setupGreeter("org/apache/cxf/systest/interceptor/no-addr.xml", false);
 
@@ -166,14 +175,20 @@ public class InterceptorFaultTest extend
             p = it.next();
             location.setPhase(p.getName());
             if (Phase.PRE_LOGICAL.equals(p.getName())) {
+                continue;
+            } else if (Phase.POST_INVOKE.equals(p.getName())) {
                 break;
-            }             
-            testFail(location);
+            }    
+            testFail(location, false, robust);
         }
     }
     
     @Test
     public void testWithAddressingAnonymousReplies() throws Exception {
+        testWithAddressingAnonymousReplies(false);
+    }
+
+    private void testWithAddressingAnonymousReplies(boolean robust) throws Exception {
         setupGreeter("org/apache/cxf/systest/interceptor/addr.xml", false);
 
         // all interceptors pass
@@ -203,7 +218,7 @@ public class InterceptorFaultTest extend
             if (Phase.PRE_LOGICAL.equals(p.getName())) {
                 break;
             }   
-            testFail(location, true);
+            testFail(location, true, robust);
         }
         
         // test failure occuring after logical addressing interceptor -
@@ -217,24 +232,22 @@ public class InterceptorFaultTest extend
                 //been returned.  The server has accepted the message
                 break;
             }             
-            testFail(location, true);
+            testFail(location, true, robust);
             p = it.hasNext() ? it.next() : null;
         } while (null != p);
     }
     
-    private void testFail(FaultLocation location) throws PingMeFault {
-        testFail(location, false);
-    }
    
-    private void testFail(FaultLocation location, boolean usingAddressing) throws PingMeFault
{
+    private void testFail(FaultLocation location, boolean usingAddressing, boolean robust)

+        throws PingMeFault {
         // System.out.print("Test interceptor failing in phase: " + location.getPhase());

         
         control.setFaultLocation(location);       
-       
+        control.setRobustInOnlyMode(robust);
 
         // oneway reports a plain fault (although server sends a soap fault)
 
-        boolean expectOnewayFault = !usingAddressing 
+        boolean expectOnewayFault = robust 
             || comparator.compare(preLogicalPhase, getPhase(location.getPhase())) > 0;
         
         try {

Modified: cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/greeter_control/ControlImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/greeter_control/ControlImpl.java?rev=1242304&r1=1242303&r2=1242304&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/greeter_control/ControlImpl.java
(original)
+++ cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/greeter_control/ControlImpl.java
Thu Feb  9 12:55:27 2012
@@ -170,7 +170,21 @@ public class ControlImpl implements Cont
     public Future<?> setFaultLocationAsync(FaultLocation in, AsyncHandler<?>
asyncHandler) {
         // TODO Auto-generated method stub
         return null;
-    } 
-    
+    }
+
+    public Response<?> setRobustInOnlyModeAsync(boolean in) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Future<?> setRobustInOnlyModeAsync(boolean in, AsyncHandler<?> asyncHandler)
{
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void setRobustInOnlyMode(boolean in) {
+        endpoint.getProperties().put(Message.ROBUST_ONEWAY, in);        
+    }
+
 }
 

Modified: cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/greeter_control.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/greeter_control.wsdl?rev=1242304&r1=1242303&r2=1242304&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/greeter_control.wsdl (original)
+++ cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/greeter_control.wsdl Thu Feb
 9 12:55:27 2012
@@ -110,7 +110,7 @@
                     </sequence>
                 </complexType>
             </element>
-
+            <element name="robustInOnlyMode" type="xsd:boolean"/>
         </schema>
     </wsdl:types>
 
@@ -157,6 +157,11 @@
     </wsdl:message>
     <wsdl:message name="setFaultLocationResponse">
     </wsdl:message>
+    <wsdl:message name="setRobustInOnlyModeRequest">
+        <wsdl:part element="x1:robustInOnlyMode" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="setRobustInOnlyModeResponse">
+    </wsdl:message>
     
     <wsdl:portType name="Greeter">
         <wsdl:operation name="sayHi">
@@ -195,6 +200,11 @@
             <wsdl:input message="tns:setFaultLocationRequest" name="setFaultLocationRequest"/>
             <wsdl:output message="tns:setFaultLocationResponse" name="setFaultLocationResponse"/>
         </wsdl:operation>
+
+        <wsdl:operation name="setRobustInOnlyMode">
+            <wsdl:input message="tns:setRobustInOnlyModeRequest" name="setRobustInOnlyModeRequest"/>
+            <wsdl:output message="tns:setRobustInOnlyModeResponse" name="setRobustInOnlyModeResponse"/>
+        </wsdl:operation>
     </wsdl:portType>
 
     <wsdl:binding name="GreeterSOAPBinding" type="tns:Greeter">
@@ -271,6 +281,15 @@
                 <soap:body use="literal"/>
             </wsdl:output>
         </wsdl:operation>
+        <wsdl:operation name="setRobustInOnlyMode">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="setRobustInOnlyModeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="setRobustInOnlyModeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
     </wsdl:binding>
 
     <wsdl:service name="ControlService">



Mime
View raw message