You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2012/07/12 14:40:18 UTC
svn commit: r1360659 - in /camel/branches/camel-2.10.x: ./
camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
Author: ningjiang
Date: Thu Jul 12 12:40:18 2012
New Revision: 1360659
URL: http://svn.apache.org/viewvc?rev=1360659&view=rev
Log:
Merged revisions 1360581 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1360581 | ningjiang | 2012-07-12 16:49:14 +0800 (Thu, 12 Jul 2012) | 1 line
CAMEL-5440 Fixed the issue of mock endpoint expectedHeaderReceived
........
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1360581
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jul 12 12:40:18 2012
@@ -1 +1 @@
-/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527
+/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581
Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java?rev=1360659&r1=1360658&r2=1360659&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java Thu Jul 12 12:40:18 2012
@@ -481,32 +481,32 @@ public class MockEndpoint extends Defaul
public void expectedHeaderReceived(final String name, final Object value) {
if (expectedHeaderValues == null) {
expectedHeaderValues = new CaseInsensitiveMap();
- }
- expectedHeaderValues.put(name, value);
+ // we just wants to expects to be called once
+ expects(new Runnable() {
+ public void run() {
+ for (int i = 0; i < getReceivedExchanges().size(); i++) {
+ Exchange exchange = getReceivedExchange(i);
+ for (Map.Entry<String, Object> entry : expectedHeaderValues.entrySet()) {
+ String key = entry.getKey();
+ Object expectedValue = entry.getValue();
+
+ // we accept that an expectedValue of null also means that the header may be absent
+ if (expectedValue != null) {
+ assertTrue("Exchange " + i + " has no headers", exchange.getIn().hasHeaders());
+ boolean hasKey = exchange.getIn().getHeaders().containsKey(key);
+ assertTrue("No header with name " + key + " found for message: " + i, hasKey);
+ }
- expects(new Runnable() {
- public void run() {
- for (int i = 0; i < getReceivedExchanges().size(); i++) {
- Exchange exchange = getReceivedExchange(i);
- for (Map.Entry<String, Object> entry : expectedHeaderValues.entrySet()) {
- String key = entry.getKey();
- Object expectedValue = entry.getValue();
+ Object actualValue = exchange.getIn().getHeader(key);
+ actualValue = extractActualValue(exchange, actualValue, expectedValue);
- // we accept that an expectedValue of null also means that the header may be absent
- if (expectedValue != null) {
- assertTrue("Exchange " + i + " has no headers", exchange.getIn().hasHeaders());
- boolean hasKey = exchange.getIn().getHeaders().containsKey(key);
- assertTrue("No header with name " + key + " found for message: " + i, hasKey);
+ assertEquals("Header with name " + key + " for message: " + i, expectedValue, actualValue);
}
-
- Object actualValue = exchange.getIn().getHeader(key);
- actualValue = extractActualValue(exchange, actualValue, expectedValue);
-
- assertEquals("Header with name " + key + " for message: " + i, expectedValue, actualValue);
}
}
- }
- });
+ });
+ }
+ expectedHeaderValues.put(name, value);
}
/**