cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1126929 - in /cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws: rm/MessageLossSimulator.java rm/ServerPersistenceTest.java util/InMessageRecorder.java util/OutMessageRecorder.java
Date Tue, 24 May 2011 08:38:05 GMT
Author: ay
Date: Tue May 24 08:38:04 2011
New Revision: 1126929

URL: http://svn.apache.org/viewvc?rev=1126929&view=rev
Log:
[CXF-3179] ServerPersistenceTest to use synchronized variables to avoid occasional test errors

Modified:
    cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/MessageLossSimulator.java
    cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
    cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/InMessageRecorder.java
    cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/OutMessageRecorder.java

Modified: cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/MessageLossSimulator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/MessageLossSimulator.java?rev=1126929&r1=1126928&r2=1126929&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/MessageLossSimulator.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/MessageLossSimulator.java
Tue May 24 08:38:04 2011
@@ -67,9 +67,11 @@ public class MessageLossSimulator extend
         if (MessageUtils.isPartialResponse(message)) {
             return;
         }
-        appMessageCount++;
-        if (0 != (appMessageCount % 2)) {
-            return;
+        synchronized (this) {
+            appMessageCount++;
+            if (0 != (appMessageCount % 2)) {
+                return;
+            }
         }
         
         InterceptorChain chain = message.getInterceptorChain();

Modified: cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java?rev=1126929&r1=1126928&r2=1126929&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
Tue May 24 08:38:04 2011
@@ -144,7 +144,7 @@ public class ServerPersistenceTest exten
         verifyMissingResponse(responses);
         control.stopGreeter(SERVER_LOSS_CFG);
         LOG.fine("Stopped greeter server");
-       
+        
         out.getOutboundMessages().clear();
         in.getInboundMessages().clear();
         
@@ -153,13 +153,13 @@ public class ServerPersistenceTest exten
         LOG.fine("Restarted greeter server" + nl + nl);
         
         verifyServerRecovery(responses);
-        
-        out.getOutboundMessages().clear();
-        in.getInboundMessages().clear();
-            
         responses[3] = greeter.greetMeAsync("four");
+        
         verifyRetransmissionQueue();
         
+        out.getOutboundMessages().clear();
+        in.getInboundMessages().clear();
+
         greeterBus.shutdown(true);
         
         control.stopGreeter(CFG);
@@ -167,10 +167,8 @@ public class ServerPersistenceTest exten
     }
     
     void verifyMissingResponse(Response<GreetMeResponse> responses[]) throws Exception
{
-        awaitMessages(5, 8, 60000);
-
-        // wait another while to prove that response to second request is indeed lost
-        Thread.sleep(4000);
+        awaitMessages(5, 7, 10000);
+        
         int nDone = 0;
         for (int i = 0; i < 3; i++) {
             if (responses[i].isDone()) {
@@ -190,6 +188,7 @@ public class ServerPersistenceTest exten
         // mf.verifyMessageNumbers(new String[] {null, "1", "2", "3"}, true);
         // mf.verifyAcknowledgements(new boolean[] {false, false, true, false}, true);
         
+        Thread.sleep(5000);
         mf.verifyPartialResponses(5);
         mf.purgePartialResponses();
         expectedActions = new String[] {RMConstants.getCreateSequenceResponseAction(),
@@ -239,7 +238,7 @@ public class ServerPersistenceTest exten
   
     
     void verifyRetransmissionQueue() throws Exception {
-        awaitMessages(3, 5, 60000);
+        awaitMessages(2, 5, 60000);
         
         boolean empty = greeterBus.getExtension(RMManager.class).getRetransmissionQueue().isEmpty();
         assertTrue("Retransmission Queue is not empty", empty);

Modified: cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/InMessageRecorder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/InMessageRecorder.java?rev=1126929&r1=1126928&r2=1126929&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/InMessageRecorder.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/InMessageRecorder.java
Tue May 24 08:38:04 2011
@@ -56,7 +56,9 @@ public class InMessageRecorder extends A
             is.close();
             bos.close();
             byte bytes[] = bos.toByteArray();
-            inbound.add(bytes);
+            synchronized (inbound) {
+                inbound.add(bytes);    
+            }
             if (LOG.isLoggable(Level.FINE)) {
                 LOG.fine("inbound: " + bos.toString());
             }

Modified: cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/OutMessageRecorder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/OutMessageRecorder.java?rev=1126929&r1=1126928&r2=1126929&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/OutMessageRecorder.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/OutMessageRecorder.java
Tue May 24 08:38:04 2011
@@ -81,7 +81,9 @@ public class OutMessageRecorder extends 
                 if (LOG.isLoggable(Level.FINE)) {
                     LOG.fine("outbound: " + bytes);
                 }
-                outbound.add(bytes);
+                synchronized (outbound) {
+                    outbound.add(bytes);    
+                }
             } catch (Exception e) {
                 LOG.fine("Can't record message from output stream class: "
                          + cos.getOut().getClass().getName());



Mime
View raw message