cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1347040 - /cxf/branches/2.5.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
Date Wed, 06 Jun 2012 18:33:02 GMT
Author: dkulp
Date: Wed Jun  6 18:33:01 2012
New Revision: 1347040

URL: http://svn.apache.org/viewvc?rev=1347040&view=rev
Log:
Merged revisions 1346488 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1346488 | ay | 2012-06-05 13:39:05 -0400 (Tue, 05 Jun 2012) | 2 lines

  fixed ManagedEndpointsTest for its execution order issue

........

Modified:
    cxf/branches/2.5.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java

Modified: cxf/branches/2.5.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java?rev=1347040&r1=1347039&r2=1347040&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
(original)
+++ cxf/branches/2.5.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
Wed Jun  6 18:33:01 2012
@@ -104,16 +104,6 @@ public class ManagedEndpointsTest extend
     }
     
     @Test
-    public void runTests() throws Exception {
-        //There is a problem if testSuspendAndResumeSourceSequence is run first
-        //Need to get Aki to look at it.  For now, just force them into 
-        //an order that works
-        testManagedEndpointsOneway();
-        stopBus();
-        testSuspendAndResumeSourceSequence();
-    }
-    
-    //@Test
     public void testManagedEndpointsOneway() throws Exception {
         checkServerReady(30000);
         
@@ -146,10 +136,10 @@ public class ManagedEndpointsTest extend
         greeter.greetMeOneWay("one"); // sent
 
         o = mbs.invoke(clientManagerName, "getEndpointIdentifiers", null, null);
-        verifyArray("Expected endpoint identifier", o, new String[]{epId});
+        verifyArray("Expected endpoint identifier", o, new String[]{epId}, true);
 
         o = mbs.invoke(serverManagerName, "getEndpointIdentifiers", null, null);
-        verifyArray("Expected endpoint identifier", o, new String[]{epId});
+        verifyArray("Expected endpoint identifier", o, new String[]{epId}, true);
         
         ObjectName clientEndpointName = RMUtils.getManagedObjectName(clientManager, ep);
         ObjectName serverEndpointName = RMUtils.getManagedObjectName(serverManager, ep);
@@ -163,7 +153,7 @@ public class ManagedEndpointsTest extend
         assertTrue("Expected sequence identifier", o instanceof String && sseqId.equals(o));
         
         o = mbs.invoke(serverEndpointName, "getDestinationSequenceIds", null, null);
-        verifyArray("Expected sequence identifier", o, new String[]{sseqId}); 
+        verifyArray("Expected sequence identifier", o, new String[]{sseqId}, false); 
         
         o = mbs.invoke(clientEndpointName, "getDestinationSequenceIds", null, null);
         assertTrue("One sequence expected", o instanceof String[] && 1 == ((String[])o).length);
@@ -171,7 +161,7 @@ public class ManagedEndpointsTest extend
 
         o = mbs.invoke(serverEndpointName, "getSourceSequenceIds", 
                        new Object[]{true}, new String[]{"boolean"});
-        verifyArray("Expected sequence identifier", o, new String[]{dseqId}); 
+        verifyArray("Expected sequence identifier", o, new String[]{dseqId}, false); 
         
         o = mbs.invoke(clientEndpointName, "getQueuedMessageTotalCount", null, null);
         assertTrue("No queued message", o instanceof Integer && 0 == ((Integer)o).intValue());
@@ -190,7 +180,7 @@ public class ManagedEndpointsTest extend
 
         o = mbs.invoke(clientEndpointName, "getSourceSequenceAcknowledgedRange", 
                        new Object[]{sseqId}, new String[]{"java.lang.String"});
-        verifyArray("Expected range", o, new Long[]{1L, 1L});
+        verifyArray("Expected range", o, new Long[]{1L, 1L}, true);
         
         o = mbs.invoke(clientEndpointName, "getUnAcknowledgedMessageIdentifiers", 
                        new Object[]{sseqId}, new String[]{"java.lang.String"});
@@ -204,7 +194,7 @@ public class ManagedEndpointsTest extend
 
         o = mbs.invoke(clientEndpointName, "getSourceSequenceAcknowledgedRange", 
                        new Object[]{sseqId}, new String[]{"java.lang.String"});
-        verifyArray("Expected range", o, new Long[]{1L, 1L, 3L, 3L});
+        verifyArray("Expected range", o, new Long[]{1L, 1L, 3L, 3L}, true);
         
         o = mbs.invoke(clientEndpointName, "getUnAcknowledgedMessageIdentifiers", 
                        new Object[]{sseqId}, new String[]{"java.lang.String"});
@@ -216,7 +206,7 @@ public class ManagedEndpointsTest extend
 
         o = mbs.invoke(serverEndpointName, "getDestinationSequenceAcknowledgedRange", 
                        new Object[]{sseqId}, new String[]{"java.lang.String"});
-        verifyArray("Expected range", o, new Long[]{1L, 1L, 3L, 3L});
+        verifyArray("Expected range", o, new Long[]{1L, 1L, 3L, 3L}, true);
 
         // 7 sec retry interval + 5 sec
         LOG.info("waiting for 12 secs for the retry to complete ...");
@@ -227,11 +217,11 @@ public class ManagedEndpointsTest extend
 
         o = mbs.invoke(clientEndpointName, "getSourceSequenceAcknowledgedRange", 
                        new Object[]{sseqId}, new String[]{"java.lang.String"});
-        verifyArray("Expected range", o, new Long[]{1L, 3L});
+        verifyArray("Expected range", o, new Long[]{1L, 3L}, true);
         
         o = mbs.invoke(serverEndpointName, "getDestinationSequenceAcknowledgedRange", 
                        new Object[]{sseqId}, new String[]{"java.lang.String"});
-        verifyArray("Expected range", o, new Long[]{1L, 3L});
+        verifyArray("Expected range", o, new Long[]{1L, 3L}, true);
 
         o = mbs.invoke(clientEndpointName, "getUnAcknowledgedMessageIdentifiers", 
                        new Object[]{sseqId}, new String[]{"java.lang.String"});
@@ -239,7 +229,7 @@ public class ManagedEndpointsTest extend
 
     }
     
-    //@Test
+    @Test
     public void testSuspendAndResumeSourceSequence() throws Exception {
         checkServerReady(30000);
         
@@ -321,12 +311,26 @@ public class ManagedEndpointsTest extend
         fail("server not ready");
     }
 
-    private <T> void verifyArray(String desc, Object value, T[] target) {
+    private <T> void verifyArray(String desc, Object value, T[] target, boolean exact)
{
         assertTrue(desc, target.getClass().isInstance(value));
         @SuppressWarnings("unchecked")
         T[] values = (T[])value;
+        if (exact) {
+            // exact-match
+            assertEquals(desc + " length", target.length, values.length);
+        } else {
+            // partial-match (the values must contain the target) 
+            assertTrue(desc + " length", target.length <= values.length);
+        }
+        int d = 0;
         for (int i = 0; i < target.length; i++) {
-            assertEquals(desc, target[i], values[i]);
+            while (!target[i].equals(values[i + d])) {
+                if (d >= values.length - target.length) {
+                    break;
+                }
+                d++;
+            }
+            assertEquals(desc, target[i], values[i + d]);
         }
     }
 



Mime
View raw message