cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r479596 - in /incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm: GreeterImpl.java SequenceTest.java twoway-message-loss.xml
Date Mon, 27 Nov 2006 11:43:31 GMT
Author: andreasmyth
Date: Mon Nov 27 03:43:30 2006
New Revision: 479596

URL: http://svn.apache.org/viewvc?view=rev&rev=479596
Log:
[JIRA CXF-140] Test message loss in twoway scenario.

Modified:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/GreeterImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/twoway-message-loss.xml

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/GreeterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/GreeterImpl.java?view=diff&rev=479596&r1=479595&r2=479596
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/GreeterImpl.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/GreeterImpl.java
Mon Nov 27 03:43:30 2006
@@ -43,10 +43,26 @@
 public class GreeterImpl implements Greeter {
 
     private static final Logger LOG = Logger.getLogger(GreeterImpl.class.getName());
-    
+    private long delay;
+     
+    public long getDelay() {
+        return delay;
+    }
+
+    public void setDelay(long d) {
+        delay = d;
+    }
+
     public String greetMe(String arg0) {
         LOG.fine("Executing operation greetMe with parameter: " + arg0);
         String result = arg0.toUpperCase();
+        if (delay > 0) {
+            try {
+                Thread.sleep(delay);
+            } catch (InterruptedException ex) {
+                // ignore
+            }
+        }
         LOG.fine("returning: " + result);
         return result;
     }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java?view=diff&rev=479596&r1=479595&r2=479596
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
Mon Nov 27 03:43:30 2006
@@ -63,7 +63,7 @@
     private OutMessageRecorder outRecorder;
     private InMessageRecorder inRecorder;
 
-    private boolean testAll;
+    private boolean testAll = true;
     private boolean doTestOnewayAnonymousAcks = testAll;
     private boolean doTestOnewayDeferredAnonymousAcks = testAll;
     private boolean doTestOnewayDeferredNonAnonymousAcks = testAll;
@@ -72,7 +72,8 @@
     private boolean doTestTwowayNonAnonymous = testAll;
     private boolean doTestTwowayNonAnonymousDeferred = testAll;
     private boolean doTestTwowayNonAnonymousMaximumSequenceLength2 = testAll;
-    private boolean doTestOnewayMessageLoss = true;
+    private boolean doTestOnewayMessageLoss = testAll;
+    private boolean doTestTwowayMessageLoss = testAll;
 
     public static void main(String[] args) {
         junit.textui.TestRunner.run(SequenceTest.class);
@@ -524,7 +525,7 @@
         // Expected outbound:
         // CreateSequence 
         // + 4 greetMe messages
-        // + at least 2 resends (message maye be resend multiple times depending
+        // + at least 2 resends (message may be resent multiple times depending
         // on the timing of the ACKs)
        
         String[] expectedActions = new String[7];
@@ -547,6 +548,62 @@
                                         null, null, null, null};
         mf.verifyActions(expectedActions, false);
         mf.verifyMessageNumbers(new String[] {null, null, null, null, null}, false);
+        mf.verifyAcknowledgements(new boolean[] {false, true, true, true, true}, false);
+  
+    }
+    
+    public void testTwowayMessageLoss() throws Exception {
+        if (!doTestTwowayMessageLoss) {
+            return;
+        }
+        setupGreeter("org/apache/cxf/systest/ws/rm/twoway-message-loss.xml");
+        
+        greeterBus.getOutInterceptors().add(new MessageLossSimulator());
+        RMManager manager = greeterBus.getExtension(RMManager.class);
+        manager.getRMAssertion().getBaseRetransmissionInterval().setMilliseconds(new BigInteger("2000"));
+
+        greeter.greetMeAsync("one");
+        greeter.greetMeAsync("two");
+        greeter.greetMeAsync("three");
+        greeter.greetMeAsync("four");
+        
+        awaitMessages(7, 10, 10000);
+        
+        MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages());
+
+        // Expected outbound:
+        // CreateSequence 
+        // + 4 greetMe messages
+        // + 2 resends
+       
+        String[] expectedActions = new String[7];
+        expectedActions[0] = RMConstants.getCreateSequenceAction();        
+        for (int i = 1; i < expectedActions.length; i++) {
+            expectedActions[i] = GREETME_ACTION;
+        }
+        mf.verifyActions(expectedActions, true);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", "2", "3", "4", "4"}, true);
+        mf.verifyLastMessage(new boolean[7], true);
+        boolean[] expectedAcks = new boolean[7];
+        for (int i = 2; i < expectedAcks.length; i++) {
+            expectedAcks[i] = true;
+        }
+        mf.verifyAcknowledgements(expectedAcks , true);
+ 
+        // Expected inbound:
+        // createSequenceResponse 
+        // + 4 greetMeResponse actions (to original or resent) 
+        // + 5 partial responses (to CSR & each of the initial greetMe messages)
+        // + at least 2 further partial response (for each of the resends)
+        
+        mf.verifyPartialResponses(5);
+        mf.purgePartialResponses();
+        
+        expectedActions = new String[] {RMConstants.getCreateSequenceResponseAction(),
+                                        GREETME_RESPONSE_ACTION, GREETME_RESPONSE_ACTION,
+                                        GREETME_RESPONSE_ACTION, GREETME_RESPONSE_ACTION};
+        mf.verifyActions(expectedActions, false);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3", "4"}, false);
         mf.verifyAcknowledgements(new boolean[] {false, true, true, true, true}, false);
   
     }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/twoway-message-loss.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/twoway-message-loss.xml?view=diff&rev=479596&r1=479595&r2=479596
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/twoway-message-loss.xml
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/twoway-message-loss.xml
Mon Nov 27 03:43:30 2006
@@ -25,7 +25,6 @@
        xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
     
-    <!--
     <bean name="{http://cxf.apache.org/greeter_control}GreeterPort.http-conduit" abstract="true">
         <property name="client">
             <value>
@@ -33,7 +32,6 @@
             </value>
         </property>
     </bean>
-    -->
     
     <bean id="org.apache.cxf.ws.rm.RMManager" class="org.apache.cxf.ws.rm.RMManager">
         <property name="bus" ref="cxf"/>



Mime
View raw message