Author: bvahdat
Date: Wed Oct 3 05:11:26 2012
New Revision: 1393292
URL: http://svn.apache.org/viewvc?rev=1393292&view=rev
Log:
Merged revisions 1393291 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1393291 | bvahdat | 2012-10-03 07:07:05 +0200 (Mi, 03 Okt 2012) | 1 line
Fixed the test failure with NPE on the CI-Server. The usage of static
variables was the cause of this in case the second test method would be run as
the first one in which case both beforeThreadName & afterThreadName would be
null. Also afterThreadName should be correctly volatile as we set it's value
async but read it inside the main thread.
........
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/ThreadsCorePoolTest.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1393291
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/ThreadsCorePoolTest.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/ThreadsCorePoolTest.java?rev=1393292&r1=1393291&r2=1393292&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/ThreadsCorePoolTest.java
(original)
+++
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/ThreadsCorePoolTest.java
Wed Oct 3 05:11:26 2012
@@ -26,8 +26,8 @@ import org.apache.camel.builder.RouteBui
*/
public class ThreadsCorePoolTest extends ContextTestSupport {
- private static String beforeThreadName;
- private static String afterThreadName;
+ private String beforeThreadName;
+ private volatile String afterThreadName;
public void testThreadsCorePool() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(1);
@@ -36,6 +36,8 @@ public class ThreadsCorePoolTest extends
assertMockEndpointsSatisfied();
+ assertNotNull("The main thread name should be already properly set!",
beforeThreadName);
+ assertNotNull("The camel thread name should be already properly set!",
afterThreadName);
assertFalse("Should use different threads",
beforeThreadName.equalsIgnoreCase(afterThreadName));
}
@@ -46,6 +48,8 @@ public class ThreadsCorePoolTest extends
assertMockEndpointsSatisfied();
+ assertNotNull("The main thread name should be already properly set!",
beforeThreadName);
+ assertNotNull("The camel thread name should be already properly set!",
afterThreadName);
assertFalse("Should use different threads",
beforeThreadName.equalsIgnoreCase(afterThreadName));
}
@@ -74,8 +78,18 @@ public class ThreadsCorePoolTest extends
.to("mock:result");
from("direct:foo")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws
Exception {
+ beforeThreadName =
Thread.currentThread().getName();
+ }
+ })
// using the builder style
.threads().poolSize(5)
+ .process(new Processor() {
+ public void process(Exchange exchange) throws
Exception {
+ afterThreadName = Thread.currentThread().getName();
+ }
+ })
.to("mock:result");
}
};