You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/04/07 09:39:51 UTC
[01/10] camel git commit: CAMEL-9827: Downgrade the embed mongodb as
it does not work.
Repository: camel
Updated Branches:
refs/heads/camel-2.17.x 9d3895759 -> 046dc3fba
refs/heads/master cbc64df48 -> d5d659eb4
CAMEL-9827: Downgrade the embed mongodb as it does not work.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/046dc3fb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/046dc3fb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/046dc3fb
Branch: refs/heads/camel-2.17.x
Commit: 046dc3fbaad4148c6d88a7ed39d7644c8344f0ec
Parents: 9d38957
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Apr 7 09:06:40 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 09:06:40 2016 +0200
----------------------------------------------------------------------
components/camel-mongodb/src/test/resources/log4j.properties | 3 +--
parent/pom.xml | 3 ++-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/046dc3fb/components/camel-mongodb/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-mongodb/src/test/resources/log4j.properties b/components/camel-mongodb/src/test/resources/log4j.properties
index cb64298..2aff1e4 100644
--- a/components/camel-mongodb/src/test/resources/log4j.properties
+++ b/components/camel-mongodb/src/test/resources/log4j.properties
@@ -17,8 +17,7 @@
log4j.rootLogger=INFO, file
# change the logging level of this category to increase verbosity of the MongoDB component
-log4j.category.org.apache.camel.component.mongodb=INFO, file
-log4j.additivity.org.apache.camel.component.mongodb=false
+#log4j.category.org.apache.camel.component.mongodb=INFO
# uncomment the following line to turn on Camel debugging
#log4j.logger.org.apache.camel=DEBUG
http://git-wip-us.apache.org/repos/asf/camel/blob/046dc3fb/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index ec39e9d..71fb56b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -157,7 +157,8 @@
<elasticsearch-cluster-runner-version>2.2.0.0</elasticsearch-cluster-runner-version>
<elsql-version>1.2</elsql-version>
<el-api-1.0-version>1.0.1</el-api-1.0-version>
- <embedmongo-version>1.50.2</embedmongo-version>
+ <!-- embedmongo 1.50.2 do not work -->
+ <embedmongo-version>1.50.1</embedmongo-version>
<etcd4j-version>2.10.0</etcd4j-version>
<exec-maven-plugin-version>1.4.0</exec-maven-plugin-version>
<ezmorph-bundle-version>1.0.6_1</ezmorph-bundle-version>
[02/10] camel git commit: CAMEL-9827: Downgrade the embed mongodb as
it does not work.
Posted by da...@apache.org.
CAMEL-9827: Downgrade the embed mongodb as it does not work.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6a4b8ce1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6a4b8ce1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6a4b8ce1
Branch: refs/heads/master
Commit: 6a4b8ce1ff8a092b5371d21f5a51007c3eb7087a
Parents: 171faa0
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Apr 7 09:06:40 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 09:39:40 2016 +0200
----------------------------------------------------------------------
components/camel-mongodb/src/test/resources/log4j.properties | 3 +--
parent/pom.xml | 3 ++-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6a4b8ce1/components/camel-mongodb/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-mongodb/src/test/resources/log4j.properties b/components/camel-mongodb/src/test/resources/log4j.properties
index cb64298..2aff1e4 100644
--- a/components/camel-mongodb/src/test/resources/log4j.properties
+++ b/components/camel-mongodb/src/test/resources/log4j.properties
@@ -17,8 +17,7 @@
log4j.rootLogger=INFO, file
# change the logging level of this category to increase verbosity of the MongoDB component
-log4j.category.org.apache.camel.component.mongodb=INFO, file
-log4j.additivity.org.apache.camel.component.mongodb=false
+#log4j.category.org.apache.camel.component.mongodb=INFO
# uncomment the following line to turn on Camel debugging
#log4j.logger.org.apache.camel=DEBUG
http://git-wip-us.apache.org/repos/asf/camel/blob/6a4b8ce1/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index d38a1dc..999aa9e 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -158,7 +158,8 @@
<elasticsearch-cluster-runner-version>2.2.0.0</elasticsearch-cluster-runner-version>
<elsql-version>1.2</elsql-version>
<el-api-1.0-version>1.0.1</el-api-1.0-version>
- <embedmongo-version>1.50.2</embedmongo-version>
+ <!-- embedmongo 1.50.2 do not work -->
+ <embedmongo-version>1.50.1</embedmongo-version>
<etcd4j-version>2.10.0</etcd4j-version>
<exec-maven-plugin-version>1.4.0</exec-maven-plugin-version>
<ezmorph-bundle-version>1.0.6_1</ezmorph-bundle-version>
[06/10] camel git commit: Fixed test
Posted by da...@apache.org.
Fixed test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d81e4eef
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d81e4eef
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d81e4eef
Branch: refs/heads/master
Commit: d81e4eef6d67e4b37fe3d31b556c38ad86f9bda2
Parents: 5352d80
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 6 16:19:15 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 09:39:40 2016 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/component/stream/StreamFileTest.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d81e4eef/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamFileTest.java
----------------------------------------------------------------------
diff --git a/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamFileTest.java b/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamFileTest.java
index e5cee4e..16b6491 100644
--- a/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamFileTest.java
+++ b/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamFileTest.java
@@ -58,6 +58,8 @@ public class StreamFileTest extends CamelTestSupport {
@Test
public void testFile() throws Exception {
+ context.start();
+
try {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello");
[08/10] camel git commit: CAMEL-9789: Avoid starting services to soon
during CamelContext startup,
that can trigger circular dependencies issue with Spring and similar IoC
frameworks.
Posted by da...@apache.org.
CAMEL-9789: Avoid starting services to soon during CamelContext startup, that can trigger circular dependencies issue with Spring and similar IoC frameworks.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bd137a2e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bd137a2e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bd137a2e
Branch: refs/heads/master
Commit: bd137a2ede93e603fc4e28d85e45d88ea060798e
Parents: d81e4ee
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 6 16:52:20 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 09:39:40 2016 +0200
----------------------------------------------------------------------
.../GuavaEventBusConsumerConfigurationTest.java | 22 +++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/bd137a2e/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java b/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java
index 69e0b6b..7b091d4 100644
--- a/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java
+++ b/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java
@@ -18,15 +18,22 @@ package org.apache.camel.component.guava.eventbus;
import com.google.common.eventbus.EventBus;
import org.apache.camel.CamelContext;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.SimpleRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
-public class GuavaEventBusConsumerConfigurationTest {
+public class GuavaEventBusConsumerConfigurationTest extends CamelTestSupport {
- @Test(expected = IllegalStateException.class)
- public void shouldForwardMessageToCamel() throws Exception {
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void invalidConfiguration() throws Exception {
// Given
SimpleRegistry registry = new SimpleRegistry();
registry.put("eventBus", new EventBus());
@@ -39,8 +46,13 @@ public class GuavaEventBusConsumerConfigurationTest {
}
});
- // When
- context.start();
+ try {
+ context.start();
+ fail("Should throw exception");
+ } catch (FailedToCreateRouteException e) {
+ IllegalStateException ise = assertIsInstanceOf(IllegalStateException.class, e.getCause());
+ assertEquals("You cannot set both 'eventClass' and 'listenerInterface' parameters.", ise.getMessage());
+ }
}
}
[04/10] camel git commit: CAMEL-9789: Avoid starting services to soon
during CamelContext startup,
that can trigger circular dependencies issue with Spring and similar IoC
frameworks.
Posted by da...@apache.org.
CAMEL-9789: Avoid starting services to soon during CamelContext startup, that can trigger circular dependencies issue with Spring and similar IoC frameworks.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/596d1a13
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/596d1a13
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/596d1a13
Branch: refs/heads/master
Commit: 596d1a13fb60d3c739bda443953b09ca4d41a61b
Parents: cbc64df
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 1 13:47:25 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 09:39:40 2016 +0200
----------------------------------------------------------------------
.../apache/camel/component/ref/RefEndpoint.java | 4 +-
.../apache/camel/impl/DefaultCamelContext.java | 114 +++++++++++--------
.../camel/impl/DeferServiceStartupListener.java | 32 +++++-
.../org/apache/camel/impl/RouteService.java | 12 +-
.../component/dataset/DataSetConsumerTest.java | 2 -
...edaQueueMultipleConsumersDifferenceTest.java | 6 +-
.../validator/ValidatorIllegalImportTest.java | 5 +-
.../component/xslt/InvalidXsltFileTest.java | 4 +-
.../component/xslt/XsltFileNotFoundTest.java | 5 +-
.../xslt/XsltReferenceParameterTest.java | 4 +-
.../camel/component/xslt/XsltSaxonTest.java | 3 +-
.../camel/impl/DefaultCamelContextTest.java | 1 +
...ducerTemplateWithCustomCacheMaxSizeTest.java | 3 +
...EventDrivenPollingConsumerQueueSizeTest.java | 3 +
...tartupListenerComponentFromRegistryTest.java | 10 +-
.../impl/StartupListenerComponentTest.java | 10 +-
.../apache/camel/impl/StartupListenerTest.java | 15 ++-
.../ManagedRouteLoadstatisticsTest.java | 34 ++++--
.../processor/FileIdempotentTrunkStoreTest.java | 30 +++--
.../WeightedRandomLoadBalanceTest.java | 6 +-
.../WeightedRoundRobinLoadBalanceTest.java | 6 +-
21 files changed, 208 insertions(+), 101 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/main/java/org/apache/camel/component/ref/RefEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/ref/RefEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/ref/RefEndpoint.java
index d1ca0b6..5400ad6 100644
--- a/camel-core/src/main/java/org/apache/camel/component/ref/RefEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/ref/RefEndpoint.java
@@ -77,8 +77,8 @@ public class RefEndpoint extends DefaultEndpoint implements DelegateEndpoint {
@Override
protected void doStart() throws Exception {
endpoint = CamelContextHelper.mandatoryLookup(getCamelContext(), name, Endpoint.class);
- // add the endpoint as a service so Camel can manage the endpoint and enlist the endpoint in JMX etc.
- getCamelContext().addService(endpoint);
+ // add the endpoint to the endpoint registry
+ getCamelContext().addEndpoint(endpoint.getEndpointUri(), endpoint);
super.doStart();
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 65deba6..7e7dce1 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -157,6 +157,7 @@ import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.JsonSchemaHelper;
import org.apache.camel.util.LoadPropertiesException;
import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.OrderedComparator;
import org.apache.camel.util.ServiceHelper;
import org.apache.camel.util.StopWatch;
import org.apache.camel.util.StringHelper;
@@ -185,7 +186,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
private final Map<String, Component> components = new HashMap<String, Component>();
private final Set<Route> routes = new LinkedHashSet<Route>();
private final List<Service> servicesToStop = new CopyOnWriteArrayList<Service>();
- private final Set<StartupListener> startupListeners = new LinkedHashSet<StartupListener>();
+ private final List<StartupListener> startupListeners = new CopyOnWriteArrayList<StartupListener>();
private final DeferServiceStartupListener deferStartupListener = new DeferServiceStartupListener();
private TypeConverter typeConverter;
private TypeConverterRegistry typeConverterRegistry;
@@ -276,7 +277,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
// create endpoint registry at first since end users may access endpoints before CamelContext is started
this.endpoints = new DefaultEndpointRegistry(this);
- // add the derfer service startup listener
+ // add the defer service startup listener
this.startupListeners.add(deferStartupListener);
// use WebSphere specific resolver if running on WebSphere
@@ -1221,6 +1222,11 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
}
private void doAddService(Object object, boolean stopOnShutdown) throws Exception {
+ doAddService(object, stopOnShutdown, false);
+ }
+
+ private void doAddService(Object object, boolean stopOnShutdown, boolean forceStart) throws Exception {
+
// inject CamelContext
if (object instanceof CamelContextAware) {
CamelContextAware aware = (CamelContextAware) object;
@@ -1239,27 +1245,26 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
}
}
- // only add to services to close if its a singleton
- // otherwise we could for example end up with a lot of prototype scope endpoints
- boolean singleton = true; // assume singleton by default
- if (service instanceof IsSingleton) {
- singleton = ((IsSingleton) service).isSingleton();
- }
- // do not add endpoints as they have their own list
- if (singleton && !(service instanceof Endpoint)) {
- // only add to list of services to stop if its not already there
- if (stopOnShutdown && !hasService(service)) {
- servicesToStop.add(service);
+ if (!forceStart) {
+ // now start the service (and defer starting if CamelContext is starting up itself)
+ deferStartService(object, stopOnShutdown);
+ } else {
+ // only add to services to close if its a singleton
+ // otherwise we could for example end up with a lot of prototype scope endpoints
+ boolean singleton = true; // assume singleton by default
+ if (object instanceof IsSingleton) {
+ singleton = ((IsSingleton) service).isSingleton();
}
+ // do not add endpoints as they have their own list
+ if (singleton && !(service instanceof Endpoint)) {
+ // only add to list of services to stop if its not already there
+ if (stopOnShutdown && !hasService(service)) {
+ servicesToStop.add(service);
+ }
+ }
+ ServiceHelper.startService(service);
}
}
-
- // and then ensure service is started (as stated in the javadoc)
- if (object instanceof Service) {
- startService((Service)object);
- } else if (object instanceof Collection<?>) {
- startServices((Collection<?>)object);
- }
}
public boolean removeService(Object object) throws Exception {
@@ -2338,8 +2343,8 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
// of the camel context (its the container)
typeConverter = createTypeConverter();
try {
- // must add service eager
- addService(typeConverter);
+ // must add service eager and force start it
+ doAddService(typeConverter, true, true);
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
@@ -2352,7 +2357,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
this.typeConverter = typeConverter;
try {
// must add service eager
- addService(typeConverter);
+ doAddService(typeConverter, true, true);
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
@@ -2995,23 +3000,24 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
// re-create endpoint registry as the cache size limit may be set after the constructor of this instance was called.
// and we needed to create endpoints up-front as it may be accessed before this context is started
endpoints = new DefaultEndpointRegistry(this, endpoints);
- addService(endpoints);
+ // add this as service and force pre-start them
+ doAddService(endpoints, true, true);
// special for executorServiceManager as want to stop it manually
- doAddService(executorServiceManager, false);
- addService(producerServicePool);
- addService(pollingConsumerServicePool);
- addService(inflightRepository);
- addService(asyncProcessorAwaitManager);
- addService(shutdownStrategy);
- addService(packageScanClassResolver);
- addService(restRegistry);
- addService(messageHistoryFactory);
+ doAddService(executorServiceManager, false, true);
+ doAddService(producerServicePool, true, true);
+ doAddService(pollingConsumerServicePool, true, true);
+ doAddService(inflightRepository, true, true);
+ doAddService(asyncProcessorAwaitManager, true, true);
+ doAddService(shutdownStrategy, true, true);
+ doAddService(packageScanClassResolver, true, true);
+ doAddService(restRegistry, true, true);
+ doAddService(messageHistoryFactory, true, true);
if (runtimeEndpointRegistry != null) {
if (runtimeEndpointRegistry instanceof EventNotifier) {
getManagementStrategy().addEventNotifier((EventNotifier) runtimeEndpointRegistry);
}
- addService(runtimeEndpointRegistry);
+ doAddService(runtimeEndpointRegistry, true, true);
}
// eager lookup any configured properties component to avoid subsequent lookup attempts which may impact performance
@@ -3053,7 +3059,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
if (streamCachingInUse) {
// stream caching is in use so enable the strategy
getStreamCachingStrategy().setEnabled(true);
- addService(getStreamCachingStrategy());
+ doAddService(getStreamCachingStrategy(), true, true);
} else {
// log if stream caching is not in use as this can help people to enable it if they use streams
log.info("StreamCaching is not in use. If using streams then its recommended to enable stream caching."
@@ -3207,20 +3213,9 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
}
}
- if (!filtered.isEmpty()) {
- // the context is now considered started (i.e. isStarted() == true))
- // starting routes is done after, not during context startup
- safelyStartRouteServices(checkClash, startConsumer, resumeConsumer, addingRoutes, filtered.values());
- }
-
- // we are finished starting routes, so remove flag before we emit the startup listeners below
- isStartingRoutes.remove();
+ // the context is in last phase of staring, so lets start the routes
+ safelyStartRouteServices(checkClash, startConsumer, resumeConsumer, addingRoutes, filtered.values());
- // now notify any startup aware listeners as all the routes etc has been started,
- // allowing the listeners to do custom work after routes has been started
- for (StartupListener startup : startupListeners) {
- startup.onCamelContextStarted(this, isStarted());
- }
} finally {
isStartingRoutes.remove();
}
@@ -3435,6 +3430,19 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
// warm up routes before we start them
doWarmUpRoutes(inputs, startConsumer);
+ // sort the startup listeners so they are started in the right order
+ Collections.sort(startupListeners, new OrderedComparator());
+ // now call the startup listeners where the routes has been warmed up
+ // (only the actual route consumer has not yet been started)
+ for (StartupListener startup : startupListeners) {
+ startup.onCamelContextStarted(this, isStarted());
+ }
+ // because the consumers may also register startup listeners we need to reset
+ // the already started listeners
+ List<StartupListener> backup = new ArrayList<>(startupListeners);
+ startupListeners.clear();
+
+ // now start the consumers
if (startConsumer) {
if (resumeConsumer) {
// and now resume the routes
@@ -3446,6 +3454,16 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
}
}
+ // sort the startup listeners so they are started in the right order
+ Collections.sort(startupListeners, new OrderedComparator());
+ // now the consumers that was just started may also add new StartupListeners (such as timer)
+ // so we need to ensure they get started as well
+ for (StartupListener startup : startupListeners) {
+ startup.onCamelContextStarted(this, isStarted());
+ }
+ // and add the previous started startup listeners to the list so we have them all
+ startupListeners.addAll(0, backup);
+
// inputs no longer needed
inputs.clear();
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/main/java/org/apache/camel/impl/DeferServiceStartupListener.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DeferServiceStartupListener.java b/camel-core/src/main/java/org/apache/camel/impl/DeferServiceStartupListener.java
index a78bdd8..5a533db 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DeferServiceStartupListener.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DeferServiceStartupListener.java
@@ -20,14 +20,18 @@ import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Ordered;
+import org.apache.camel.ResolveEndpointFailedException;
import org.apache.camel.Service;
import org.apache.camel.StartupListener;
import org.apache.camel.util.ServiceHelper;
/**
- * A {@link org.apache.camel.StartupListener} that defers starting {@link Service}s.
+ * A {@link org.apache.camel.StartupListener} that defers starting {@link Service}s, until as late as possible during
+ * the startup process of {@link CamelContext}.
*/
-public class DeferServiceStartupListener implements StartupListener {
+public class DeferServiceStartupListener implements StartupListener, Ordered {
private final Set<Service> services = new CopyOnWriteArraySet<Service>();
@@ -37,9 +41,27 @@ public class DeferServiceStartupListener implements StartupListener {
@Override
public void onCamelContextStarted(CamelContext context, boolean alreadyStarted) throws Exception {
- for (Service service : services) {
- ServiceHelper.startService(service);
+ // new services may be added while starting a service
+ // so use a while loop to get the newly added services as well
+ while (!services.isEmpty()) {
+ Service service = services.iterator().next();
+ try {
+ ServiceHelper.startService(service);
+ } catch (Exception e) {
+ if (service instanceof Endpoint) {
+ Endpoint endpoint = (Endpoint) service;
+ throw new ResolveEndpointFailedException(endpoint.getEndpointUri(), e);
+ } else {
+ throw e;
+ }
+ } finally {
+ services.remove(service);
+ }
}
- services.clear();
+ }
+
+ public int getOrder() {
+ // we want to be last, so the other startup listeners run first
+ return Ordered.LOWEST;
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/RouteService.java b/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
index 2139d5c..d0ff6d0 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
@@ -30,6 +30,7 @@ import org.apache.camel.Channel;
import org.apache.camel.Consumer;
import org.apache.camel.Endpoint;
import org.apache.camel.EndpointAware;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.Processor;
import org.apache.camel.Route;
import org.apache.camel.RouteAware;
@@ -135,7 +136,15 @@ public class RouteService extends ChildServiceSupport {
this.removingRoutes = removingRoutes;
}
- public synchronized void warmUp() throws Exception {
+ public void warmUp() throws Exception {
+ try {
+ doWarmUp();
+ } catch (Exception e) {
+ throw new FailedToCreateRouteException(routeDefinition.getId(), routeDefinition.toString(), e);
+ }
+ }
+
+ protected synchronized void doWarmUp() throws Exception {
if (endpointDone.compareAndSet(false, true)) {
// endpoints should only be started once as they can be reused on other routes
// and whatnot, thus their lifecycle is to start once, and only to stop when Camel shutdown
@@ -196,7 +205,6 @@ public class RouteService extends ChildServiceSupport {
}
protected void doStart() throws Exception {
- // ensure we are warmed up before starting the route
warmUp();
for (Route route : routes) {
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/component/dataset/DataSetConsumerTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/dataset/DataSetConsumerTest.java b/camel-core/src/test/java/org/apache/camel/component/dataset/DataSetConsumerTest.java
index c98acc8..5311330 100644
--- a/camel-core/src/test/java/org/apache/camel/component/dataset/DataSetConsumerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/dataset/DataSetConsumerTest.java
@@ -166,7 +166,5 @@ public class DataSetConsumerTest extends ContextTestSupport {
Thread.sleep(100);
assertMockEndpointsSatisfied();
-
- System.out.println("Place for Breakpoint");
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/component/seda/SameSedaQueueMultipleConsumersDifferenceTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/seda/SameSedaQueueMultipleConsumersDifferenceTest.java b/camel-core/src/test/java/org/apache/camel/component/seda/SameSedaQueueMultipleConsumersDifferenceTest.java
index 9f39d15..19baaf6 100644
--- a/camel-core/src/test/java/org/apache/camel/component/seda/SameSedaQueueMultipleConsumersDifferenceTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/seda/SameSedaQueueMultipleConsumersDifferenceTest.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.seda;
import org.apache.camel.ContextTestSupport;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.builder.RouteBuilder;
/**
@@ -51,8 +52,9 @@ public class SameSedaQueueMultipleConsumersDifferenceTest extends ContextTestSup
}
});
fail("Should have thrown exception");
- } catch (IllegalArgumentException e) {
- assertEquals("Cannot use existing queue seda://foo as the existing queue multiple consumers true does not match given multiple consumers false", e.getMessage());
+ } catch (FailedToCreateRouteException e) {
+ assertEquals("fail", e.getRouteId());
+ assertEquals("Cannot use existing queue seda://foo as the existing queue multiple consumers true does not match given multiple consumers false", e.getCause().getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIllegalImportTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIllegalImportTest.java b/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIllegalImportTest.java
index e6b2085..f71d857 100644
--- a/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIllegalImportTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIllegalImportTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.validator;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.FailedToCreateProducerException;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.builder.RouteBuilder;
/**
@@ -79,8 +80,8 @@ public class ValidatorIllegalImportTest extends ContextTestSupport {
try {
context.start();
fail("Should have thrown exception");
- } catch (FailedToCreateProducerException e) {
- IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ } catch (FailedToCreateRouteException e) {
+ IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause().getCause());
assertTrue(iae.getMessage().startsWith("Resource: org/apache/camel/component/validator/BroadcastMonitor.xsd refers an invalid resource without SystemId."));
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/component/xslt/InvalidXsltFileTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/xslt/InvalidXsltFileTest.java b/camel-core/src/test/java/org/apache/camel/component/xslt/InvalidXsltFileTest.java
index b6cf791..226fa9d 100644
--- a/camel-core/src/test/java/org/apache/camel/component/xslt/InvalidXsltFileTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/xslt/InvalidXsltFileTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.component.xslt;
+import javax.xml.transform.TransformerConfigurationException;
+
import org.apache.camel.CamelContext;
import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.ResolveEndpointFailedException;
@@ -38,7 +40,7 @@ public class InvalidXsltFileTest extends TestSupport {
fail("Should have thrown an exception due XSL compilation error");
} catch (FailedToCreateRouteException e) {
// expected
- assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
+ assertIsInstanceOf(TransformerConfigurationException.class, e.getCause());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/component/xslt/XsltFileNotFoundTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltFileNotFoundTest.java b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltFileNotFoundTest.java
index 4d04905..5e0d476 100644
--- a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltFileNotFoundTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltFileNotFoundTest.java
@@ -40,9 +40,8 @@ public class XsltFileNotFoundTest extends TestSupport {
fail("Should have thrown an exception due XSLT file not found");
} catch (FailedToCreateRouteException e) {
- assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
- assertIsInstanceOf(TransformerException.class, e.getCause().getCause());
- assertIsInstanceOf(FileNotFoundException.class, e.getCause().getCause().getCause());
+ assertIsInstanceOf(TransformerException.class, e.getCause());
+ assertIsInstanceOf(FileNotFoundException.class, e.getCause().getCause());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/component/xslt/XsltReferenceParameterTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltReferenceParameterTest.java b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltReferenceParameterTest.java
index fd7b7f8..a8b3311 100644
--- a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltReferenceParameterTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltReferenceParameterTest.java
@@ -54,10 +54,10 @@ public class XsltReferenceParameterTest extends TestSupport {
ProcessorEndpoint pep1 = context.getEndpoint(TEST_URI_1, ProcessorEndpoint.class);
- builder1 = (XsltBuilder)pep1.getProcessor();
-
context.addRoutes(builder);
context.start();
+
+ builder1 = (XsltBuilder)pep1.getProcessor();
}
public void testConverterReference() {
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/component/xslt/XsltSaxonTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltSaxonTest.java b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltSaxonTest.java
index 3225b45..f1f7c43 100644
--- a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltSaxonTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltSaxonTest.java
@@ -37,8 +37,7 @@ public class XsltSaxonTest extends TestSupport {
fail("Should have thrown an exception due XSLT saxon not on classpath");
} catch (FailedToCreateRouteException e) {
- assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
- assertIsInstanceOf(ClassNotFoundException.class, e.getCause().getCause());
+ assertIsInstanceOf(ClassNotFoundException.class, e.getCause());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java b/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
index 42327e0..b0fc1c4 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
@@ -351,6 +351,7 @@ public class DefaultCamelContextTest extends TestSupport {
DefaultCamelContext ctx = new DefaultCamelContext();
ctx.addService(my);
+ ctx.start();
assertEquals(ctx, my.getCamelContext());
assertEquals("Started", my.getStatus().name());
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateWithCustomCacheMaxSizeTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateWithCustomCacheMaxSizeTest.java b/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateWithCustomCacheMaxSizeTest.java
index 3c717fa..0d89c65 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateWithCustomCacheMaxSizeTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateWithCustomCacheMaxSizeTest.java
@@ -45,6 +45,9 @@ public class DefaultProducerTemplateWithCustomCacheMaxSizeTest extends ContextTe
template.sendBody(e, "Hello");
}
+ // the eviction is async so force cleanup
+ template.cleanUp();
+
assertEquals("Size should be 200", 200, template.getCurrentCacheSize());
template.stop();
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/impl/EventDrivenPollingConsumerQueueSizeTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/EventDrivenPollingConsumerQueueSizeTest.java b/camel-core/src/test/java/org/apache/camel/impl/EventDrivenPollingConsumerQueueSizeTest.java
index 06649a2..d687678 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/EventDrivenPollingConsumerQueueSizeTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/EventDrivenPollingConsumerQueueSizeTest.java
@@ -40,6 +40,9 @@ public class EventDrivenPollingConsumerQueueSizeTest extends ContextTestSupport
}
public void testQueueSize() throws Exception {
+ // must start context as we do not use route builder that auto-start
+ context.start();
+
PollingConsumer consumer = context.getEndpoint(uri).createPollingConsumer();
consumer.start();
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/impl/StartupListenerComponentFromRegistryTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/StartupListenerComponentFromRegistryTest.java b/camel-core/src/test/java/org/apache/camel/impl/StartupListenerComponentFromRegistryTest.java
index 70b2897..0d6c41c 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/StartupListenerComponentFromRegistryTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/StartupListenerComponentFromRegistryTest.java
@@ -39,6 +39,10 @@ public class StartupListenerComponentFromRegistryTest extends ContextTestSupport
}
public void testStartupListenerComponent() throws Exception {
+ // and now the routes are started
+ assertTrue(context.getRouteStatus("foo").isStarted());
+ assertTrue(context.getRouteStatus("bar").isStarted());
+
getMockEndpoint("mock:result").expectedMessageCount(1);
template.sendBody("direct:foo", "Hello World");
@@ -55,9 +59,9 @@ public class StartupListenerComponentFromRegistryTest extends ContextTestSupport
public void onCamelContextStarted(CamelContext context, boolean alreadyStarted) throws Exception {
invoked++;
- // the routes should have been started
- assertTrue(context.getRouteStatus("foo").isStarted());
- assertTrue(context.getRouteStatus("bar").isStarted());
+ // the routes should not have been started as they start afterwards
+ assertTrue(context.getRouteStatus("foo").isStopped());
+ assertTrue(context.getRouteStatus("bar").isStopped());
}
public int getInvoked() {
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/impl/StartupListenerComponentTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/StartupListenerComponentTest.java b/camel-core/src/test/java/org/apache/camel/impl/StartupListenerComponentTest.java
index 15c0e11..d32b2e6 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/StartupListenerComponentTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/StartupListenerComponentTest.java
@@ -30,6 +30,10 @@ public class StartupListenerComponentTest extends ContextTestSupport {
private MyComponent my;
public void testStartupListenerComponent() throws Exception {
+ // and now the routes are started
+ assertTrue(context.getRouteStatus("foo").isStarted());
+ assertTrue(context.getRouteStatus("bar").isStarted());
+
getMockEndpoint("mock:result").expectedMessageCount(1);
template.sendBody("direct:foo", "Hello World");
@@ -46,9 +50,9 @@ public class StartupListenerComponentTest extends ContextTestSupport {
public void onCamelContextStarted(CamelContext context, boolean alreadyStarted) throws Exception {
invoked++;
- // the routes should have been started
- assertTrue(context.getRouteStatus("foo").isStarted());
- assertTrue(context.getRouteStatus("bar").isStarted());
+ // the routes should not have been started as they start afterwards
+ assertTrue(context.getRouteStatus("foo").isStopped());
+ assertTrue(context.getRouteStatus("bar").isStopped());
}
public int getInvoked() {
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/impl/StartupListenerTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/StartupListenerTest.java b/camel-core/src/test/java/org/apache/camel/impl/StartupListenerTest.java
index 9372725..ed291bd 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/StartupListenerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/StartupListenerTest.java
@@ -44,8 +44,13 @@ public class StartupListenerTest extends ContextTestSupport {
invoked++;
this.alreadyStarted = alreadyStarted;
- // the route should have been started
- assertTrue(context.getRouteStatus("foo").isStarted());
+ if (alreadyStarted) {
+ // the routes should already been started as we add the listener afterwards
+ assertTrue(context.getRouteStatus("foo").isStarted());
+ } else {
+ // the routes should not have been started as they start afterwards
+ assertTrue(context.getRouteStatus("foo").isStopped());
+ }
}
public int getInvoked() {
@@ -58,6 +63,9 @@ public class StartupListenerTest extends ContextTestSupport {
}
public void testStartupListenerComponent() throws Exception {
+ // and now the routes are started
+ assertTrue(context.getRouteStatus("foo").isStarted());
+
getMockEndpoint("mock:result").expectedMessageCount(1);
template.sendBody("direct:foo", "Hello World");
@@ -69,6 +77,9 @@ public class StartupListenerTest extends ContextTestSupport {
}
public void testStartupListenerComponentAlreadyStarted() throws Exception {
+ // and now the routes are started
+ assertTrue(context.getRouteStatus("foo").isStarted());
+
MyStartupListener other = new MyStartupListener();
context.addStartupListener(other);
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/management/ManagedRouteLoadstatisticsTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedRouteLoadstatisticsTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedRouteLoadstatisticsTest.java
index 6d1d9a3..5c39897 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedRouteLoadstatisticsTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedRouteLoadstatisticsTest.java
@@ -26,12 +26,25 @@ import org.apache.camel.builder.RouteBuilder;
*/
public class ManagedRouteLoadstatisticsTest extends ManagementTestSupport {
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
public void testLoadStatisticsAreDisabledByDefault() throws Exception {
// JMX tests dont work well on AIX CI servers (hangs them)
if (isPlatform("aix")) {
return;
}
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").to("log:foo").delay(2000).to("mock:result");
+ }
+ });
+ context.start();
+
boolean load = context.getManagementStrategy().getManagementAgent().getLoadStatisticsEnabled() != null
&& context.getManagementStrategy().getManagementAgent().getLoadStatisticsEnabled();
assertFalse(load);
@@ -57,9 +70,17 @@ public class ManagedRouteLoadstatisticsTest extends ManagementTestSupport {
if (isPlatform("aix")) {
return;
}
+
context.getManagementStrategy().getManagementAgent().setLoadStatisticsEnabled(true);
- context.stop();
+
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").to("log:foo").delay(2000).to("mock:result");
+ }
+ });
context.start();
+
// get the stats for the route
MBeanServer mbeanServer = getMBeanServer();
ObjectName on = ObjectName.getInstance("org.apache.camel:context=camel-1,type=routes,name=\"route1\"");
@@ -69,6 +90,7 @@ public class ManagedRouteLoadstatisticsTest extends ManagementTestSupport {
template.asyncSendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
+
Thread.sleep(2000);
String load01 = (String)mbeanServer.getAttribute(on, "Load01");
String load05 = (String)mbeanServer.getAttribute(on, "Load05");
@@ -81,14 +103,4 @@ public class ManagedRouteLoadstatisticsTest extends ManagementTestSupport {
assertTrue(Double.parseDouble(load15.replace(',', '.')) >= 0);
}
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").to("log:foo").delay(2000).to("mock:result");
- }
- };
- }
-
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/processor/FileIdempotentTrunkStoreTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/FileIdempotentTrunkStoreTest.java b/camel-core/src/test/java/org/apache/camel/processor/FileIdempotentTrunkStoreTest.java
index f0807a2..f6cb148 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/FileIdempotentTrunkStoreTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/FileIdempotentTrunkStoreTest.java
@@ -58,18 +58,34 @@ public class FileIdempotentTrunkStoreTest extends ContextTestSupport {
// load in new store and verify we only have the last 5 elements
IdempotentRepository<String> repo2 = FileIdempotentRepository.fileIdempotentRepository(store);
repo2.start();
- assertFalse(repo2.contains("AAAAAAAAAA"));
- assertTrue(repo2.contains("BBBBBBBBBB"));
- assertTrue(repo2.contains("CCCCCCCCCC"));
- assertTrue(repo2.contains("DDDDDDDDDD"));
- assertTrue(repo2.contains("EEEEEEEEEE"));
- assertTrue(repo2.contains("ZZZZZZZZZZ"));
+
+ // should be 5
+ int size = 0;
+ if (repo2.contains("AAAAAAAAAA")) {
+ size++;
+ }
+ if (repo2.contains("BBBBBBBBBB")) {
+ size++;
+ }
+ if (repo2.contains("CCCCCCCCCC")) {
+ size++;
+ }
+ if (repo2.contains("DDDDDDDDDD")) {
+ size++;
+ }
+ if (repo2.contains("EEEEEEEEEE")) {
+ size++;
+ }
+ if (repo2.contains("ZZZZZZZZZZ")) {
+ size++;
+ }
+ assertEquals(5, size);
// should trunk the file store
sendMessage("XXXXXXXXXX", "X");
resultEndpoint.assertIsSatisfied();
- assertFalse(repo.contains("BBBBBBBBBB"));
+
assertTrue(repo.contains("XXXXXXXXXX"));
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/processor/WeightedRandomLoadBalanceTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/WeightedRandomLoadBalanceTest.java b/camel-core/src/test/java/org/apache/camel/processor/WeightedRandomLoadBalanceTest.java
index e66cffd..2ebe50a 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/WeightedRandomLoadBalanceTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/WeightedRandomLoadBalanceTest.java
@@ -17,6 +17,7 @@
package org.apache.camel.processor;
import org.apache.camel.ContextTestSupport;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
@@ -117,8 +118,9 @@ public class WeightedRandomLoadBalanceTest extends ContextTestSupport {
});
context.start();
fail("Should have thrown exception");
- } catch (IllegalArgumentException e) {
- assertEquals("Loadbalacing with 3 should match number of distributions 2", e.getMessage());
+ } catch (FailedToCreateRouteException e) {
+ IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ assertEquals("Loadbalacing with 3 should match number of distributions 2", iae.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/596d1a13/camel-core/src/test/java/org/apache/camel/processor/WeightedRoundRobinLoadBalanceTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/WeightedRoundRobinLoadBalanceTest.java b/camel-core/src/test/java/org/apache/camel/processor/WeightedRoundRobinLoadBalanceTest.java
index 655446f..a3b8cec 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/WeightedRoundRobinLoadBalanceTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/WeightedRoundRobinLoadBalanceTest.java
@@ -17,6 +17,7 @@
package org.apache.camel.processor;
import org.apache.camel.ContextTestSupport;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
@@ -123,8 +124,9 @@ public class WeightedRoundRobinLoadBalanceTest extends ContextTestSupport {
});
context.start();
fail("Should have thrown exception");
- } catch (IllegalArgumentException e) {
- assertEquals("Loadbalacing with 3 should match number of distributions 2", e.getMessage());
+ } catch (FailedToCreateRouteException e) {
+ IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ assertEquals("Loadbalacing with 3 should match number of distributions 2", iae.getMessage());
}
}
[05/10] camel git commit: CAMEL-9789: Avoid starting services to soon
during CamelContext startup,
that can trigger circular dependencies issue with Spring and similar IoC
frameworks.
Posted by da...@apache.org.
CAMEL-9789: Avoid starting services to soon during CamelContext startup, that can trigger circular dependencies issue with Spring and similar IoC frameworks.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cda77f81
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cda77f81
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cda77f81
Branch: refs/heads/master
Commit: cda77f81624467a658a31dd83476bcac7e14b475
Parents: 596d1a1
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 6 15:24:08 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 09:39:40 2016 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/CamelContext.java | 22 ++++++++++-
.../apache/camel/impl/DefaultCamelContext.java | 39 ++++++++++----------
2 files changed, 41 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/cda77f81/camel-core/src/main/java/org/apache/camel/CamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/CamelContext.java b/camel-core/src/main/java/org/apache/camel/CamelContext.java
index c7d212f..9ace5a7 100644
--- a/camel-core/src/main/java/org/apache/camel/CamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/CamelContext.java
@@ -29,6 +29,7 @@ import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
import org.apache.camel.api.management.mbean.ManagedProcessorMBean;
import org.apache.camel.api.management.mbean.ManagedRouteMBean;
import org.apache.camel.builder.ErrorHandlerBuilder;
+import org.apache.camel.impl.DeferServiceStartupListener;
import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.RouteDefinition;
@@ -231,6 +232,25 @@ public interface CamelContext extends SuspendableService, RuntimeConfiguration {
void addService(Object object, boolean stopOnShutdown) throws Exception;
/**
+ * Adds a service to this context.
+ * <p/>
+ * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}.
+ * The service will also be enlisted in JMX for management (if JMX is enabled).
+ * The service will be started, if its not already started.
+ * <p/>
+ * If the option <tt>closeOnShutdown</tt> is <tt>true</tt> then this context will control the lifecycle, ensuring
+ * the service is stopped when the context stops.
+ * If the option <tt>closeOnShutdown</tt> is <tt>false</tt> then this context will not stop the service when the context stops.
+ *
+ * @param object the service
+ * @param stopOnShutdown whether to stop the service when this CamelContext shutdown.
+ * @param forceStart whether to force starting the service right now, as otherwise the service may be deferred being started
+ * to later using {@link #deferStartService(Object, boolean)}
+ * @throws Exception can be thrown when starting the service
+ */
+ void addService(Object object, boolean stopOnShutdown, boolean forceStart) throws Exception;
+
+ /**
* Removes a service from this context.
* <p/>
* The service is assumed to have been previously added using {@link #addService(Object)} method.
@@ -259,7 +279,7 @@ public interface CamelContext extends SuspendableService, RuntimeConfiguration {
<T> T hasService(Class<T> type);
/**
- * Defers starting the service until {@link CamelContext} is started and has initialized all its prior services and routes.
+ * Defers starting the service until {@link CamelContext} is (almost started) or started and has initialized all its prior services and routes.
* <p/>
* If {@link CamelContext} is already started then the service is started immediately.
*
http://git-wip-us.apache.org/repos/asf/camel/blob/cda77f81/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 7e7dce1..a8ff760 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -1218,11 +1218,12 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
}
public void addService(Object object, boolean stopOnShutdown) throws Exception {
- doAddService(object, stopOnShutdown);
+ doAddService(object, stopOnShutdown, false);
}
- private void doAddService(Object object, boolean stopOnShutdown) throws Exception {
- doAddService(object, stopOnShutdown, false);
+ @Override
+ public void addService(Object object, boolean stopOnShutdown, boolean forceStart) throws Exception {
+ doAddService(object, stopOnShutdown, forceStart);
}
private void doAddService(Object object, boolean stopOnShutdown, boolean forceStart) throws Exception {
@@ -2344,7 +2345,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
typeConverter = createTypeConverter();
try {
// must add service eager and force start it
- doAddService(typeConverter, true, true);
+ addService(typeConverter, true, true);
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
@@ -2356,8 +2357,8 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
public void setTypeConverter(TypeConverter typeConverter) {
this.typeConverter = typeConverter;
try {
- // must add service eager
- doAddService(typeConverter, true, true);
+ // must add service eager and force start it
+ addService(typeConverter, true, true);
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
@@ -3001,23 +3002,23 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
// and we needed to create endpoints up-front as it may be accessed before this context is started
endpoints = new DefaultEndpointRegistry(this, endpoints);
// add this as service and force pre-start them
- doAddService(endpoints, true, true);
- // special for executorServiceManager as want to stop it manually
- doAddService(executorServiceManager, false, true);
- doAddService(producerServicePool, true, true);
- doAddService(pollingConsumerServicePool, true, true);
- doAddService(inflightRepository, true, true);
- doAddService(asyncProcessorAwaitManager, true, true);
- doAddService(shutdownStrategy, true, true);
- doAddService(packageScanClassResolver, true, true);
- doAddService(restRegistry, true, true);
- doAddService(messageHistoryFactory, true, true);
+ addService(endpoints, true, true);
+ // special for executorServiceManager as want to stop it manually so false in stopOnShutdown
+ addService(executorServiceManager, false, true);
+ addService(producerServicePool, true, true);
+ addService(pollingConsumerServicePool, true, true);
+ addService(inflightRepository, true, true);
+ addService(asyncProcessorAwaitManager, true, true);
+ addService(shutdownStrategy, true, true);
+ addService(packageScanClassResolver, true, true);
+ addService(restRegistry, true, true);
+ addService(messageHistoryFactory, true, true);
if (runtimeEndpointRegistry != null) {
if (runtimeEndpointRegistry instanceof EventNotifier) {
getManagementStrategy().addEventNotifier((EventNotifier) runtimeEndpointRegistry);
}
- doAddService(runtimeEndpointRegistry, true, true);
+ addService(runtimeEndpointRegistry, true, true);
}
// eager lookup any configured properties component to avoid subsequent lookup attempts which may impact performance
@@ -3059,7 +3060,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
if (streamCachingInUse) {
// stream caching is in use so enable the strategy
getStreamCachingStrategy().setEnabled(true);
- doAddService(getStreamCachingStrategy(), true, true);
+ addService(getStreamCachingStrategy(), true, true);
} else {
// log if stream caching is not in use as this can help people to enable it if they use streams
log.info("StreamCaching is not in use. If using streams then its recommended to enable stream caching."
[09/10] camel git commit: CAMEL-9827: Downgrade the embed mongodb as
it does not work.
Posted by da...@apache.org.
CAMEL-9827: Downgrade the embed mongodb as it does not work.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d5d659eb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d5d659eb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d5d659eb
Branch: refs/heads/master
Commit: d5d659eb4c4ce897738644e1d41793330d50c0f4
Parents: 6a4b8ce
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Apr 7 09:12:27 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 09:39:40 2016 +0200
----------------------------------------------------------------------
.../mongodb/MongoDbTailingProcess.java | 47 +++++++++-----------
1 file changed, 20 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d5d659eb/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
----------------------------------------------------------------------
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
index 916f222..2eaf6e1 100644
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
+++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
@@ -38,8 +38,8 @@ public class MongoDbTailingProcess implements Runnable {
private static final String CAPPED_KEY = "capped";
public volatile boolean keepRunning = true;
- private final CountDownLatch latch = new CountDownLatch(1);
-
+ public volatile boolean stopped; // = false
+
private final DBCollection dbCol;
private final MongoDbEndpoint endpoint;
private final MongoDbTailableCursorConsumer consumer;
@@ -98,30 +98,28 @@ public class MongoDbTailingProcess implements Runnable {
*/
@Override
public void run() {
- try {
- while (keepRunning) {
- doRun();
- // if the previous call didn't return because we have stopped running, then regenerate the cursor
- if (keepRunning) {
- cursor.close();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Regenerating cursor with lastVal: {}, waiting {}ms first", tailTracking.lastVal, cursorRegenerationDelay);
- }
+ while (keepRunning) {
+ doRun();
+ // if the previous call didn't return because we have stopped running, then regenerate the cursor
+ if (keepRunning) {
+ cursor.close();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Regenerating cursor with lastVal: {}, waiting {}ms first", tailTracking.lastVal, cursorRegenerationDelay);
+ }
- if (cursorRegenerationDelayEnabled) {
- try {
- Thread.sleep(cursorRegenerationDelay);
- } catch (InterruptedException e) {
- // ignore
- }
+ if (cursorRegenerationDelayEnabled) {
+ try {
+ Thread.sleep(cursorRegenerationDelay);
+ } catch (InterruptedException e) {
+ // ignore
}
-
- cursor = initializeCursor();
}
+
+ cursor = initializeCursor();
}
- } finally {
- latch.countDown();
}
+
+ stopped = true;
}
protected void stop() throws Exception {
@@ -134,15 +132,10 @@ public class MongoDbTailingProcess implements Runnable {
cursor.close();
}
// wait until the main loop acknowledges the stop
- // TODO: yikes this is not good with a endless while loop
- // wait for stop latch
- boolean zero = latch.await(30, TimeUnit.SECONDS);
+ while (!stopped) { }
if (LOG.isInfoEnabled()) {
LOG.info("Stopped MongoDB Tailable Cursor consumer, bound to collection: {}", "db: " + dbCol.getDB() + ", col: " + dbCol.getName());
}
- if (!zero) {
- LOG.warn("Waited 30 seconds for MongoDB Tailable Cursor consumer to stop cleanly. Will now force stop.");
- }
}
/**
[03/10] camel git commit: CAMEL-9789: Avoid starting services to soon
during CamelContext startup,
that can trigger circular dependencies issue with Spring and similar IoC
frameworks.
Posted by da...@apache.org.
CAMEL-9789: Avoid starting services to soon during CamelContext startup, that can trigger circular dependencies issue with Spring and similar IoC frameworks.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5352d804
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5352d804
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5352d804
Branch: refs/heads/master
Commit: 5352d804500ee77f18d65c26da6de391691dac84
Parents: 1b71233
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 6 15:51:55 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 09:39:40 2016 +0200
----------------------------------------------------------------------
.../apache/camel/component/servlet/HttpClientRouteTest.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5352d804/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
index aff55c1..3fa1e7c 100644
--- a/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
+++ b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
@@ -28,6 +28,7 @@ import com.meterware.httpunit.WebResponse;
import com.meterware.servletunit.ServletUnitClient;
import org.apache.camel.Exchange;
import org.apache.camel.FailedToCreateProducerException;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.junit.Test;
@@ -121,9 +122,9 @@ public class HttpClientRouteTest extends ServletCamelRouterTestSupport {
}
});
fail("Excepts exception here");
- } catch (Exception ex) {
- assertTrue("Get a wrong exception.", ex instanceof FailedToCreateProducerException);
- assertTrue("Get a wrong cause of exception.", ex.getCause() instanceof UnsupportedOperationException);
+ } catch (FailedToCreateRouteException ex) {
+ assertTrue("Get a wrong exception.", ex.getCause() instanceof FailedToCreateProducerException);
+ assertTrue("Get a wrong cause of exception.", ex.getCause().getCause() instanceof UnsupportedOperationException);
}
}
[10/10] camel git commit: CAMEL-9789: Avoid starting services to soon
during CamelContext startup,
that can trigger circular dependencies issue with Spring and similar IoC
frameworks.
Posted by da...@apache.org.
CAMEL-9789: Avoid starting services to soon during CamelContext startup, that can trigger circular dependencies issue with Spring and similar IoC frameworks.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/171faa0e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/171faa0e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/171faa0e
Branch: refs/heads/master
Commit: 171faa0e9e3c40314c0a214484c9611697e31ab8
Parents: bd137a2
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 6 19:31:52 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 09:39:40 2016 +0200
----------------------------------------------------------------------
.../ibatis/IBatisUnknownStatementTypeTest.java | 8 +--
.../component/jgroups/JGroupsComponentTest.java | 8 +--
.../src/test/resources/log4j.properties | 4 +-
.../metrics/routepolicy/MetricsRoutePolicy.java | 8 +++
.../component/mina/MinaSendToProcessorTest.java | 3 +-
.../component/mina2/Mina2EncodingTest.java | 6 ++-
.../mina2/Mina2SendToProcessorTest.java | 3 +-
.../mongodb/MongoDbTailableCursorConsumer.java | 2 +-
.../mongodb/MongoDbTailingProcess.java | 52 ++++++++++++--------
.../mongodb/MongoDbOutputTypeTest.java | 8 +--
.../MyBatisUnknownStatementTypeTest.java | 7 ++-
.../xslt/SaxonInvalidXsltFileTest.java | 10 ++--
.../sjms/batch/SjmsBatchEndpointTest.java | 5 +-
.../component/snmp/UriConfigurationTest.java | 6 +++
.../spring/batch/SpringBatchEndpointTest.java | 2 +-
.../component/xmlrpc/XmlRpcEndpointTest.java | 4 ++
16 files changed, 79 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
index ff35335..f7dc044 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.camel.component.ibatis;
-import org.apache.camel.FailedToCreateProducerException;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
@@ -39,9 +39,9 @@ public class IBatisUnknownStatementTypeTest extends CamelTestSupport {
try {
context.start();
fail("Should have thrown exception");
- } catch (FailedToCreateProducerException e) {
- assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
- assertEquals("statementType must be specified on: Endpoint[ibatis://selectAllAccounts]", e.getCause().getMessage());
+ } catch (FailedToCreateRouteException e) {
+ assertIsInstanceOf(IllegalArgumentException.class, e.getCause().getCause());
+ assertEquals("statementType must be specified on: Endpoint[ibatis://selectAllAccounts]", e.getCause().getCause().getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/JGroupsComponentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/JGroupsComponentTest.java b/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/JGroupsComponentTest.java
index 8e423ec..c10008d 100644
--- a/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/JGroupsComponentTest.java
+++ b/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/JGroupsComponentTest.java
@@ -47,13 +47,13 @@ public class JGroupsComponentTest extends CamelTestSupport {
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
- JGroupsComponent defaultComponent = new JGroupsComponent();
- defaultComponent.setChannel(defaultComponentChannel);
- context().addComponent("my-default-jgroups", defaultComponent);
-
return new RouteBuilder() {
@Override
public void configure() throws Exception {
+ JGroupsComponent defaultComponent = new JGroupsComponent();
+ defaultComponent.setChannel(defaultComponentChannel);
+ context().addComponent("my-default-jgroups", defaultComponent);
+
from("my-default-jgroups:" + CLUSTER_NAME).to("mock:default");
from(CONFIGURED_ENDPOINT_URI).to("mock:configured");
}
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-jgroups/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-jgroups/src/test/resources/log4j.properties b/components/camel-jgroups/src/test/resources/log4j.properties
index 5109305..1a5fe15 100644
--- a/components/camel-jgroups/src/test/resources/log4j.properties
+++ b/components/camel-jgroups/src/test/resources/log4j.properties
@@ -20,7 +20,7 @@
#
log4j.rootLogger=INFO, file
-#log4j.logger.org.apache.camel.component.rcode=DEBUG
+#log4j.logger.org.apache.camel.component.jgroups=DEBUG
# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
@@ -31,5 +31,5 @@ log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} -
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.file.file=target/camel-rcode-test.log
+log4j.appender.file.file=target/camel-jgroups-test.log
log4j.appender.file.append=true
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java
----------------------------------------------------------------------
diff --git a/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java b/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java
index bb6c1e9..f39b33d 100644
--- a/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java
+++ b/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java
@@ -26,6 +26,7 @@ import org.apache.camel.NonManagedService;
import org.apache.camel.Route;
import org.apache.camel.support.RoutePolicySupport;
import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.ServiceHelper;
/**
* A {@link org.apache.camel.spi.RoutePolicy} which gathers statistics and reports them using {@link com.codahale.metrics.MetricRegistry}.
@@ -150,6 +151,13 @@ public class MetricsRoutePolicy extends RoutePolicySupport implements NonManaged
throw ObjectHelper.wrapRuntimeCamelException(e);
}
+ // ensure registry service is started
+ try {
+ ServiceHelper.startService(registryService);
+ } catch (Exception e) {
+ throw ObjectHelper.wrapRuntimeCamelException(e);
+ }
+
// create statistics holder
// for know we record only all the timings of a complete exchange (responses)
// we have in-flight / total statistics already from camel-core
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaSendToProcessorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaSendToProcessorTest.java b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaSendToProcessorTest.java
index a0fdd74..0d248c4 100644
--- a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaSendToProcessorTest.java
+++ b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaSendToProcessorTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.mina;
-import org.apache.camel.FailedToCreateProducerException;
import org.apache.camel.builder.RouteBuilder;
import org.junit.Test;
@@ -34,7 +33,7 @@ public class MinaSendToProcessorTest extends BaseMinaTest {
try {
context.start();
fail("Should have thrown an exception");
- } catch (FailedToCreateProducerException e) {
+ } catch (Exception e) {
// expected
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2EncodingTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2EncodingTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2EncodingTest.java
index f6130c1..63328d5 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2EncodingTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2EncodingTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.mina2;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
@@ -194,8 +195,9 @@ public class Mina2EncodingTest extends BaseMina2Test {
}
});
fail("Should have thrown a ResolveEndpointFailedException due invalid encoding parameter");
- } catch (IllegalArgumentException e) {
- // We were suppose to get here.
+ } catch (FailedToCreateRouteException e) {
+ IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ assertEquals("The encoding: XXX is not supported", iae.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SendToProcessorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SendToProcessorTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SendToProcessorTest.java
index 0ce99df..5dddd85 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SendToProcessorTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SendToProcessorTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.mina2;
-import org.apache.camel.FailedToCreateProducerException;
import org.apache.camel.builder.RouteBuilder;
import org.junit.Test;
@@ -35,7 +34,7 @@ public class Mina2SendToProcessorTest extends BaseMina2Test {
try {
context.start();
fail("Should have thrown an exception");
- } catch (FailedToCreateProducerException e) {
+ } catch (Exception e) {
// expected
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumer.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumer.java
index ca72bfc..212a720 100644
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumer.java
+++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumer.java
@@ -41,7 +41,7 @@ public class MongoDbTailableCursorConsumer extends DefaultConsumer {
tailingProcess.stop();
}
if (executor != null) {
- executor.shutdown();
+ endpoint.getCamelContext().getExecutorServiceManager().shutdown(executor);
executor = null;
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
----------------------------------------------------------------------
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
index 25f44d4..916f222 100644
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
+++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
@@ -17,6 +17,9 @@
package org.apache.camel.component.mongodb;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
import com.mongodb.BasicDBObject;
import com.mongodb.Bytes;
import com.mongodb.DBCollection;
@@ -35,7 +38,7 @@ public class MongoDbTailingProcess implements Runnable {
private static final String CAPPED_KEY = "capped";
public volatile boolean keepRunning = true;
- public volatile boolean stopped; // = false
+ private final CountDownLatch latch = new CountDownLatch(1);
private final DBCollection dbCol;
private final MongoDbEndpoint endpoint;
@@ -81,7 +84,7 @@ public class MongoDbTailingProcess implements Runnable {
tailTracking.recoverFromStore();
cursor = initializeCursor();
} catch (Exception e) {
- throw new CamelMongoDbException("Exception ocurred while initializing tailable cursor", e);
+ throw new CamelMongoDbException("Exception occurred while initializing tailable cursor", e);
}
if (cursor == null) {
@@ -95,28 +98,30 @@ public class MongoDbTailingProcess implements Runnable {
*/
@Override
public void run() {
- while (keepRunning) {
- doRun();
- // if the previous call didn't return because we have stopped running, then regenerate the cursor
- if (keepRunning) {
- cursor.close();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Regenerating cursor with lastVal: {}, waiting {}ms first", tailTracking.lastVal, cursorRegenerationDelay);
- }
-
- if (cursorRegenerationDelayEnabled) {
- try {
- Thread.sleep(cursorRegenerationDelay);
- } catch (InterruptedException e) {
- LOG.error("Thread was interrupted", e);
+ try {
+ while (keepRunning) {
+ doRun();
+ // if the previous call didn't return because we have stopped running, then regenerate the cursor
+ if (keepRunning) {
+ cursor.close();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Regenerating cursor with lastVal: {}, waiting {}ms first", tailTracking.lastVal, cursorRegenerationDelay);
}
+
+ if (cursorRegenerationDelayEnabled) {
+ try {
+ Thread.sleep(cursorRegenerationDelay);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+
+ cursor = initializeCursor();
}
-
- cursor = initializeCursor();
}
+ } finally {
+ latch.countDown();
}
-
- stopped = true;
}
protected void stop() throws Exception {
@@ -129,10 +134,15 @@ public class MongoDbTailingProcess implements Runnable {
cursor.close();
}
// wait until the main loop acknowledges the stop
- while (!stopped) { }
+ // TODO: yikes this is not good with a endless while loop
+ // wait for stop latch
+ boolean zero = latch.await(30, TimeUnit.SECONDS);
if (LOG.isInfoEnabled()) {
LOG.info("Stopped MongoDB Tailable Cursor consumer, bound to collection: {}", "db: " + dbCol.getDB() + ", col: " + dbCol.getName());
}
+ if (!zero) {
+ LOG.warn("Waited 30 seconds for MongoDB Tailable Cursor consumer to stop cleanly. Will now force stop.");
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java
index 50c1eba..f7576bb 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java
@@ -93,9 +93,7 @@ public class MongoDbOutputTypeTest extends AbstractMongoDbTest {
template.getCamelContext().addRoutes(taillableRouteBuilder);
fail("Endpoint should not be initialized with a non compatible outputType");
} catch (Exception exception) {
- log.debug("Exception raised during initialization", exception);
- exception.printStackTrace();
- assertTrue("Exception is not of type IllegalArgumentException", exception instanceof IllegalArgumentException);
+ assertTrue("Exception is not of type IllegalArgumentException", exception.getCause() instanceof IllegalArgumentException);
}
}
@@ -114,9 +112,7 @@ public class MongoDbOutputTypeTest extends AbstractMongoDbTest {
template.getCamelContext().addRoutes(taillableRouteBuilder);
fail("Endpoint should not be initialized with a non compatible outputType");
} catch (Exception exception) {
- log.debug("Exception raised during initialization", exception);
- exception.printStackTrace();
- assertTrue("Exception is not of type IllegalArgumentException", exception instanceof IllegalArgumentException);
+ assertTrue("Exception is not of type IllegalArgumentException", exception.getCause() instanceof IllegalArgumentException);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisUnknownStatementTypeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisUnknownStatementTypeTest.java b/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisUnknownStatementTypeTest.java
index b70c22b..8af60c3 100644
--- a/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisUnknownStatementTypeTest.java
+++ b/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisUnknownStatementTypeTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.mybatis;
-import org.apache.camel.FailedToCreateProducerException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
@@ -39,9 +38,9 @@ public class MyBatisUnknownStatementTypeTest extends CamelTestSupport {
try {
context.start();
fail("Should have thrown exception");
- } catch (FailedToCreateProducerException e) {
- assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
- assertEquals("statementType must be specified on: Endpoint[mybatis://selectAllAccounts]", e.getCause().getMessage());
+ } catch (Exception e) {
+ assertIsInstanceOf(IllegalArgumentException.class, e.getCause().getCause());
+ assertEquals("statementType must be specified on: Endpoint[mybatis://selectAllAccounts]", e.getCause().getCause().getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonInvalidXsltFileTest.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonInvalidXsltFileTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonInvalidXsltFileTest.java
index e8d1dce..fe1b203 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonInvalidXsltFileTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonInvalidXsltFileTest.java
@@ -16,9 +16,9 @@
*/
package org.apache.camel.component.xslt;
+import javax.xml.transform.TransformerException;
+
import org.apache.camel.CamelContext;
-import org.apache.camel.FailedToCreateRouteException;
-import org.apache.camel.ResolveEndpointFailedException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.test.junit4.TestSupport;
@@ -35,16 +35,16 @@ public class SaxonInvalidXsltFileTest extends TestSupport {
context.start();
fail("Should have thrown an exception due XSL compilation error");
- } catch (FailedToCreateRouteException e) {
+ } catch (Exception e) {
// expected
- assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
+ assertIsInstanceOf(TransformerException.class, e.getCause());
}
}
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("seda:a").to("xslt:org/apache/camel/component/xslt/invalid.xsl?transformerFactoryClass=net.sf.saxon.TransformerFactoryImpl");
+ from("seda:a").to("xslt:org/apache/camel/component/xslt/notfound.xsl?transformerFactoryClass=net.sf.saxon.TransformerFactoryImpl");
}
};
}
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java
index c20ba85..7a96012 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.sjms.batch;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.camel.CamelContext;
-import org.apache.camel.FailedToCreateProducerException;
import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.sjms.SjmsComponent;
@@ -88,7 +87,7 @@ public class SjmsBatchEndpointTest extends CamelTestSupport {
context.start();
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = FailedToCreateRouteException.class)
public void testConsumerNegativePollDuration() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
@@ -100,7 +99,7 @@ public class SjmsBatchEndpointTest extends CamelTestSupport {
context.start();
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = FailedToCreateRouteException.class)
public void testConsumerNegativeConsumerCount() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-snmp/src/test/java/org/apache/camel/component/snmp/UriConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-snmp/src/test/java/org/apache/camel/component/snmp/UriConfigurationTest.java b/components/camel-snmp/src/test/java/org/apache/camel/component/snmp/UriConfigurationTest.java
index e13893c..20ccfec 100644
--- a/components/camel-snmp/src/test/java/org/apache/camel/component/snmp/UriConfigurationTest.java
+++ b/components/camel-snmp/src/test/java/org/apache/camel/component/snmp/UriConfigurationTest.java
@@ -27,6 +27,8 @@ public class UriConfigurationTest extends Assert {
@Test
public void testTrapReceiverConfiguration() throws Exception {
+ context.start();
+
Endpoint endpoint = context.getEndpoint("snmp:0.0.0.0:1662?protocol=udp&type=TRAP&oids=1.3.6.1.2.1.7.5.1");
assertTrue("Endpoint not an SnmpEndpoint: " + endpoint, endpoint instanceof SnmpEndpoint);
SnmpEndpoint snmpEndpoint = (SnmpEndpoint) endpoint;
@@ -38,6 +40,8 @@ public class UriConfigurationTest extends Assert {
@Test
public void testTrapReceiverWithoutPortConfiguration() throws Exception {
+ context.start();
+
Endpoint endpoint = context.getEndpoint("snmp:0.0.0.0?protocol=udp&type=TRAP&oids=1.3.6.1.2.1.7.5.1");
assertTrue("Endpoint not an SnmpEndpoint: " + endpoint, endpoint instanceof SnmpEndpoint);
SnmpEndpoint snmpEndpoint = (SnmpEndpoint) endpoint;
@@ -49,6 +53,8 @@ public class UriConfigurationTest extends Assert {
@Test
public void testOidPollerConfiguration() throws Exception {
+ context.start();
+
Endpoint endpoint = context.getEndpoint("snmp:127.0.0.1:1662?protocol=udp&type=POLL&oids=1.3.6.1.2.1.7.5.1");
assertTrue("Endpoint not an SnmpEndpoint: " + endpoint, endpoint instanceof SnmpEndpoint);
SnmpEndpoint snmpEndpoint = (SnmpEndpoint) endpoint;
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchEndpointTest.java b/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchEndpointTest.java
index 54868ff..cb962ab 100644
--- a/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchEndpointTest.java
+++ b/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchEndpointTest.java
@@ -110,7 +110,7 @@ public class SpringBatchEndpointTest extends CamelTestSupport {
mockEndpoint.expectedBodiesReceived(jobExecution);
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test(expected = FailedToCreateRouteException.class)
public void shouldThrowExceptionIfUsedAsConsumer() throws Exception {
// When
context().addRoutes(new RouteBuilder() {
http://git-wip-us.apache.org/repos/asf/camel/blob/171faa0e/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/XmlRpcEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/XmlRpcEndpointTest.java b/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/XmlRpcEndpointTest.java
index efee676..4eed832 100644
--- a/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/XmlRpcEndpointTest.java
+++ b/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/XmlRpcEndpointTest.java
@@ -39,6 +39,8 @@ public class XmlRpcEndpointTest extends Assert {
// create the endpoint with parameters
@Test
public void testEndpointSetting() throws Exception {
+ camelContext.start();
+
XmlRpcEndpoint endpoint = (XmlRpcEndpoint)camelContext.getEndpoint("xmlrpc:http://www.example.com?userAgent=myAgent&gzipCompressing=true&connectionTimeout=30&defaultMethodName=echo");
XmlRpcClientConfigImpl clientConfig = endpoint.getClientConfig();
assertEquals("Get a wrong userAgent", "myAgent", clientConfig.getUserAgent());
@@ -50,6 +52,8 @@ public class XmlRpcEndpointTest extends Assert {
@Test
public void testClientConfigurer() throws Exception {
+ camelContext.start();
+
XmlRpcEndpoint endpoint = (XmlRpcEndpoint)camelContext.getEndpoint("xmlrpc:http://www.example.com?clientConfigurer=#myClientConfigurer");
XmlRpcClient client = endpoint.createClient();
assertEquals("Get a worng maxThreads", 10, client.getMaxThreads());
[07/10] camel git commit: Fixed tests
Posted by da...@apache.org.
Fixed tests
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1b712331
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1b712331
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1b712331
Branch: refs/heads/master
Commit: 1b7123319bc6cafa445c780faa2180dd64843a62
Parents: cda77f8
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 6 15:45:49 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 09:39:40 2016 +0200
----------------------------------------------------------------------
.../camel/component/jms/ConsumerTemplateJmsSelectorTest.java | 3 +++
.../org/apache/camel/component/jms/JmsConsumeTemplateTest.java | 3 +++
.../apache/camel/component/jms/JmsProducerDisableReplyToTest.java | 3 +++
.../camel/component/jms/JmsRequestReplyReplyToOverrideTest.java | 3 +++
4 files changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1b712331/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumerTemplateJmsSelectorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumerTemplateJmsSelectorTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumerTemplateJmsSelectorTest.java
index 2577232..9fd5d23 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumerTemplateJmsSelectorTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumerTemplateJmsSelectorTest.java
@@ -31,6 +31,9 @@ public class ConsumerTemplateJmsSelectorTest extends CamelTestSupport {
@Test
public void testJmsSelector() throws Exception {
+ // must start CamelContext because use route builder is false
+ context.start();
+
template.sendBodyAndHeader("activemq:foo", "Hello World", "foo", "123");
template.sendBodyAndHeader("activemq:foo", "Bye World", "foo", "456");
http://git-wip-us.apache.org/repos/asf/camel/blob/1b712331/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsConsumeTemplateTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsConsumeTemplateTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsConsumeTemplateTest.java
index 33acb90..4987aba 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsConsumeTemplateTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsConsumeTemplateTest.java
@@ -31,6 +31,9 @@ public class JmsConsumeTemplateTest extends CamelTestSupport {
@Test
public void testConsumeTemplate() throws Exception {
+ // must start CamelContext because use route builder is false
+ context.start();
+
String url = "activemq:queue:foo";
template.sendBody(url, "Hello World");
http://git-wip-us.apache.org/repos/asf/camel/blob/1b712331/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerDisableReplyToTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerDisableReplyToTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerDisableReplyToTest.java
index 4da984a..8e638ca 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerDisableReplyToTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerDisableReplyToTest.java
@@ -31,6 +31,9 @@ public class JmsProducerDisableReplyToTest extends CamelTestSupport {
@Test
public void testProducerDisableReplyTo() throws Exception {
+ // must start CamelContext because use route builder is false
+ context.start();
+
String url = "activemq:queue:foo?disableReplyTo=true";
template.requestBody(url, "Hello World");
http://git-wip-us.apache.org/repos/asf/camel/blob/1b712331/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyReplyToOverrideTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyReplyToOverrideTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyReplyToOverrideTest.java
index 2c8d042..1539932 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyReplyToOverrideTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyReplyToOverrideTest.java
@@ -46,6 +46,9 @@ public class JmsRequestReplyReplyToOverrideTest extends CamelTestSupport {
@Test
public void testJmsRequestReplyReplyToAndReplyToHeader() throws Exception {
+ // must start CamelContext because use route builder is false
+ context.start();
+
// send request to foo, set replyTo to bar, but actually expect reply at baz
Thread sender = new Thread(new Responder());
sender.start();