camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject svn commit: r1365018 - in /camel/branches/camel-2.9.x: ./ camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
Date Tue, 24 Jul 2012 12:52:35 GMT
Author: bvahdat
Date: Tue Jul 24 12:52:35 2012
New Revision: 1365018

URL: http://svn.apache.org/viewvc?rev=1365018&view=rev
Log:
Merged revisions 1365016 via svnmerge from 
https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x

................
  r1365016 | bvahdat | 2012-07-24 14:49:06 +0200 (Di, 24 Jul 2012) | 9 lines
  
  Merged revisions 1365013 via svnmerge from 
  https://svn.apache.org/repos/asf/camel/trunk
  
  ........
    r1365013 | bvahdat | 2012-07-24 14:44:56 +0200 (Di, 24 Jul 2012) | 1 line
    
    CAMEL-5460: MockEndpoint.expectedBodiesReceivedInAnyOrder() should allow asserting on
the multiple arrival for the SAME body.
  ........
................

Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
    camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1365013
  Merged /camel/branches/camel-2.10.x:r1365016

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java?rev=1365018&r1=1365017&r2=1365018&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
Tue Jul 24 12:52:35 2012
@@ -22,7 +22,6 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -644,15 +643,13 @@ public class MockEndpoint extends Defaul
 
         expects(new Runnable() {
             public void run() {
-                Set<Object> actualBodyValuesSet = new HashSet<Object>(actualBodyValues);
+                List<Object> actualBodyValuesSet = new ArrayList<Object>(actualBodyValues);
                 for (int i = 0; i < expectedBodyValues.size(); i++) {
                     Exchange exchange = getReceivedExchanges().get(i);
                     assertTrue("No exchange received for counter: " + i, exchange != null);
 
                     Object expectedBody = expectedBodyValues.get(i);
-                    assertTrue("Message with body " + expectedBody
-                            + " was expected but not found in " + actualBodyValuesSet,
-                            actualBodyValuesSet.remove(expectedBody));
+                    assertTrue("Message with body " + expectedBody + " was expected but not
found in " + actualBodyValuesSet, actualBodyValuesSet.remove(expectedBody));
                 }
             }
         });
@@ -1042,7 +1039,7 @@ public class MockEndpoint extends Defaul
             Exchange copy = ExchangeHelper.createCopy(exchange, true);
             performAssertions(exchange, copy);
         } catch (Throwable e) {
-            // must catch java.lang.Throwable as AssertionException extends java.lang.Error
+            // must catch java.lang.Throwable as AssertionError extends java.lang.Error
             failures.add(e);
         } finally {
             // make sure latch is counted down to avoid test hanging forever

Modified: camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java?rev=1365018&r1=1365017&r2=1365018&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
Tue Jul 24 12:52:35 2012
@@ -92,7 +92,16 @@ public class MockEndpointTest extends Co
 
         resultEndpoint.assertIsSatisfied();
     }       
-    
+
+    public void testExpectsBodiesInAnyOrderWithDuplicates() throws Exception {
+        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
+        resultEndpoint.expectedBodiesReceivedInAnyOrder(listOfMessages(11, 15, 12, 12, 13,
14, 15, 15));
+
+        sendMessages(15, 15, 12, 14, 13, 12, 15, 11);
+
+        resultEndpoint.assertIsSatisfied();
+    }
+
     public void testNoDuplicateMessagesPass() throws Exception {
         MockEndpoint resultEndpoint = getMockEndpoint("mock:result"); 
         resultEndpoint.expectsNoDuplicates(header("counter"));



Mime
View raw message