cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r476139 - in /incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm: MessageFlow.java SequenceTest.java
Date Fri, 17 Nov 2006 13:43:08 GMT
Author: andreasmyth
Date: Fri Nov 17 05:43:07 2006
New Revision: 476139

URL: http://svn.apache.org/viewvc?view=rev&rev=476139
Log:
Account for unpredictable order in which partial and full responses are processed at client
side in SequenceTest.

Modified:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/MessageFlow.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/MessageFlow.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/MessageFlow.java?view=diff&rev=476139&r1=476138&r2=476139
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/MessageFlow.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/MessageFlow.java
Fri Nov 17 05:43:07 2006
@@ -99,6 +99,25 @@
             }
         }
     }
+
+    public void verifyActionsIgnoringPartialResponses(String[] expectedActions) throws Exception
{
+        int j = 0;
+        for (int i = 0; i < inboundMessages.size() && j < expectedActions.length;
i++) {
+            String action = getAction(inboundMessages.get(i));
+            if (null == action && emptyBody(inboundMessages.get(i))) {
+                continue;
+            }
+            if (null == expectedActions[j]) {
+                assertNull("Inbound message " + i + " has unexpected action: " + action,
action);
+            } else {
+                assertEquals("Inbound message " + i + " has unexpected action: ", expectedActions[j],
action);
+            }
+            j++;
+        }
+        if (j < expectedActions.length) {
+            fail("Inbound messages do not contain all expected actions.");
+        }
+    }
     
     public boolean checkActions(String[] expectedActions, boolean outbound) throws Exception
{
 
@@ -392,9 +411,21 @@
     }
     
     public void verifyPartialResponses(int nExpected) throws Exception {
+        verifyPartialResponses(nExpected, null);
+    }
+
+    public void verifyPartialResponses(int nExpected, boolean[] piggybackedAcks) throws Exception
{
         int npr = 0;
         for (int i =  0; i < inboundMessages.size(); i++) {
             if (isPartialResponse(inboundMessages.get(i))) {
+                if (piggybackedAcks != null) {
+                    Element ack = getAcknowledgment(inboundMessages.get(i));
+                    if (piggybackedAcks[npr]) {
+                        assertNotNull("Partial response " + npr + " does not include acknowledgement.",
ack);
+                    } else {
+                        assertNull("Partial response " + npr + " has unexpected acknowledgement.",
ack);
+                    }
+                }
                 npr++;   
             }
         }
@@ -403,7 +434,7 @@
     }
     
     public boolean isPartialResponse(Document d) throws Exception {
-        return false;
+        return null == getAction(d) && emptyBody(d);
     }
     
     public boolean emptyBody(Document d) throws Exception {

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=476139&r1=476138&r2=476139
==============================================================================
--- 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
Fri Nov 17 05:43:07 2006
@@ -203,7 +203,8 @@
         mf.verifyMessages(4, false);
         expectedActions = new String[] {null, RMConstants.getCreateSequenceResponseAction(),

                                         null, null};
-        mf.verifyActions(expectedActions, false);
+        expectedActions = new String[] {RMConstants.getCreateSequenceResponseAction()};
+        mf.verifyActionsIgnoringPartialResponses(expectedActions);
         mf.verifyMessageNumbers(new String[4], false);
         mf.verifyAcknowledgements(new boolean[4], false);
 
@@ -221,6 +222,7 @@
 
         mf.verifyMessages(0, true);
         mf.verifyMessages(1, false);
+        mf.verifyAcknowledgements(new boolean[] {true}, false);
 
     }
     
@@ -296,16 +298,21 @@
 
         // createSequenceResponse plus 3 greetMeResponse messages plus
         // one partial response for each of the four messages
+        // the first partial response should no include an acknowledgement, the other three
should
 
         mf.verifyMessages(8, false);
-        expectedActions = new String[] {null, RMConstants.getCreateSequenceResponseAction(),

-                                        null, GREETME_RESPONSE_ACTION, 
-                                        null, GREETME_RESPONSE_ACTION, 
-                                        null, GREETME_RESPONSE_ACTION};
+        mf.verifyPartialResponses(4, new boolean[4]);
+
+        mf.purgePartialResponses();
+
+        expectedActions = new String[] {RMConstants.getCreateSequenceResponseAction(), 
+                                        GREETME_RESPONSE_ACTION, 
+                                        GREETME_RESPONSE_ACTION, 
+                                        GREETME_RESPONSE_ACTION};
         mf.verifyActions(expectedActions, false);
-        mf.verifyMessageNumbers(new String[] {null, null, null, "1", null, "2", null, "3"},
false);
-        mf.verifyLastMessage(new boolean[8], false);
-        mf.verifyAcknowledgements(new boolean[] {false, false, false, true, false, true,
false, true}, false);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3"}, false);
+        mf.verifyLastMessage(new boolean[4], false);
+        mf.verifyAcknowledgements(new boolean[] {false, true, true, true}, false);
     }
 
 



Mime
View raw message