Author: davsclaus
Date: Tue Nov 3 05:58:26 2009
New Revision: 832307
URL: http://svn.apache.org/viewvc?rev=832307&view=rev
Log:
Fixed unit test.
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSuspendAndResumeTest.java
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSuspendTest.java
camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedSuspendedServiceTest.java
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSuspendAndResumeTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSuspendAndResumeTest.java?rev=832307&r1=832306&r2=832307&view=diff
==============================================================================
---
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSuspendAndResumeTest.java
(original)
+++
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSuspendAndResumeTest.java
Tue Nov 3 05:58:26 2009
@@ -79,14 +79,18 @@
private class MyPolicy extends RoutePolicySupport {
+ private int counter;
private Consumer consumer;
public void onExchangeDone(Route route, Exchange exchange) {
this.consumer = route.getConsumer();
- try {
- super.stopConsumer(consumer);
- } catch (Exception e) {
- handleException(e);
+ // only stop it at first run
+ if (counter++ == 0) {
+ try {
+ super.stopConsumer(consumer);
+ } catch (Exception e) {
+ handleException(e);
+ }
}
}
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSuspendTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSuspendTest.java?rev=832307&r1=832306&r2=832307&view=diff
==============================================================================
---
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSuspendTest.java
(original)
+++
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSuspendTest.java
Tue Nov 3 05:58:26 2009
@@ -63,11 +63,16 @@
private class MyPolicy extends RoutePolicySupport {
+ private int counter;
+
public void onExchangeDone(Route route, Exchange exchange) {
- try {
- super.stopConsumer(route.getConsumer());
- } catch (Exception e) {
- handleException(e);
+ // only stop it at first run
+ if (counter++ == 0) {
+ try {
+ super.stopConsumer(route.getConsumer());
+ } catch (Exception e) {
+ handleException(e);
+ }
}
}
}
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedSuspendedServiceTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedSuspendedServiceTest.java?rev=832307&r1=832306&r2=832307&view=diff
==============================================================================
---
camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedSuspendedServiceTest.java
(original)
+++
camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedSuspendedServiceTest.java
Tue Nov 3 05:58:26 2009
@@ -102,11 +102,16 @@
private class MyPolicy extends RoutePolicySupport {
+ private int counter;
+
public void onExchangeDone(Route route, Exchange exchange) {
- try {
- super.stopConsumer(route.getConsumer());
- } catch (Exception e) {
- handleException(e);
+ // only stop it at first run
+ if (counter++ == 0) {
+ try {
+ super.stopConsumer(route.getConsumer());
+ } catch (Exception e) {
+ handleException(e);
+ }
}
}