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 2019/05/15 09:03:55 UTC
[camel] 10/11: CAMEL-13522: camel3 - The various Camel exceptions
should favour extending runtime exception
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch 13514
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9394829bdeb1afcb69cc5d2ae6d8cfbc6cbf4a65
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed May 15 09:48:04 2019 +0200
CAMEL-13522: camel3 - The various Camel exceptions should favour extending runtime exception
---
.../org/apache/camel/component/activemq/CamelMessageConsumer.java | 2 --
.../org/apache/camel/component/activemq/CamelMessageProducer.java | 2 --
.../main/java/org/apache/camel/component/ahc/ws/WsConsumer.java | 8 ++++----
.../component/atmosphere/websocket/MemoryWebSocketStore.java | 4 ++--
.../java/org/apache/camel/component/cometd/CometdConsumer.java | 8 ++++----
.../java/org/apache/camel/component/cometd/CometdProducer.java | 7 +++----
.../java/org/apache/camel/component/ehcache/EhcacheManager.java | 4 ++--
.../camel/component/file/remote/FtpConsumerIdempotentRefTest.java | 4 ++--
.../guava/eventbus/GuavaEventBusConsumerConfigurationTest.java | 3 +--
.../camel/component/hazelcast/HazelcastErrorMessagesTest.java | 4 ++--
components/camel-infinispan/pom.xml | 1 -
.../org/apache/camel/component/infinispan/InfinispanManager.java | 8 ++++----
components/camel-infinispan/src/test/resources/log4j.xml | 2 +-
.../camel/component/jms/JmsTestConnectionOnStartupTest.java | 8 +++-----
.../java/org/apache/camel/component/mina2/Mina2EncodingTest.java | 2 +-
.../org/apache/camel/component/quartz2/QuartzPropertiesTest.java | 2 +-
.../camel/component/reactive/streams/BasicPublisherTest.java | 4 ++--
.../camel/component/reactor/engine/ReactorStreamsServiceTest.java | 4 ++--
.../camel/component/rxjava2/engine/RxJavaStreamsServiceTest.java | 4 ++--
.../org/apache/camel/component/xslt/SaxonInvalidXsltFileTest.java | 2 +-
.../org/apache/camel/component/servlet/HttpClientRouteTest.java | 2 +-
.../apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java | 5 +++--
.../camel/component/sjms/producer/NoConnectionFactoryTest.java | 6 +++---
.../camel/component/sjms/tx/TransactedProducerInOutErrorTest.java | 6 +++---
.../camel/component/spring/batch/SpringBatchEndpointTest.java | 8 ++++----
.../camel/spring/boot/SupervisingRouteControllerRestartTest.java | 2 +-
components/readme.adoc | 2 +-
27 files changed, 53 insertions(+), 61 deletions(-)
diff --git a/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/CamelMessageConsumer.java b/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/CamelMessageConsumer.java
index 8fe1c0b..7cb0ebc 100644
--- a/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/CamelMessageConsumer.java
+++ b/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/CamelMessageConsumer.java
@@ -63,8 +63,6 @@ public class CamelMessageConsumer implements MessageConsumer {
if (pollingConsumer != null) {
pollingConsumer.stop();
}
- } catch (JMSException e) {
- throw e;
} catch (Exception e) {
throw JMSExceptionSupport.create(e);
}
diff --git a/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/CamelMessageProducer.java b/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/CamelMessageProducer.java
index 71230cc..a9ed0e8 100644
--- a/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/CamelMessageProducer.java
+++ b/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/CamelMessageProducer.java
@@ -69,8 +69,6 @@ public class CamelMessageProducer extends ActiveMQMessageProducerSupport {
closed = true;
try {
producer.stop();
- } catch (JMSException e) {
- throw e;
} catch (Exception e) {
throw JMSExceptionSupport.create(e);
}
diff --git a/components/camel-ahc-ws/src/main/java/org/apache/camel/component/ahc/ws/WsConsumer.java b/components/camel-ahc-ws/src/main/java/org/apache/camel/component/ahc/ws/WsConsumer.java
index b447f20..5041415 100644
--- a/components/camel-ahc-ws/src/main/java/org/apache/camel/component/ahc/ws/WsConsumer.java
+++ b/components/camel-ahc-ws/src/main/java/org/apache/camel/component/ahc/ws/WsConsumer.java
@@ -31,15 +31,15 @@ public class WsConsumer extends DefaultConsumer {
}
@Override
- public void start() throws Exception {
- super.start();
+ public void doStart() throws Exception {
+ super.doStart();
getEndpoint().connect(this);
}
@Override
- public void stop() throws Exception {
+ public void doStop() throws Exception {
getEndpoint().disconnect(this);
- super.stop();
+ super.doStop();
}
@Override
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java
index b6fca1c..90436cd 100644
--- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java
@@ -42,14 +42,14 @@ public class MemoryWebSocketStore implements WebSocketStore {
* @see org.apache.camel.Service#start()
*/
@Override
- public void start() throws Exception {
+ public void start() {
}
/* (non-Javadoc)
* @see org.apache.camel.Service#stop()
*/
@Override
- public void stop() throws Exception {
+ public void stop() {
values.clear();
keys.clear();
}
diff --git a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
index 4d808f3..335f679 100644
--- a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
+++ b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
@@ -42,8 +42,8 @@ public class CometdConsumer extends DefaultConsumer implements CometdProducerCon
}
@Override
- public void start() throws Exception {
- super.start();
+ public void doStart() throws Exception {
+ super.doStart();
// must connect first
endpoint.connect(this);
// should probably look into synchronization for this.
@@ -53,9 +53,9 @@ public class CometdConsumer extends DefaultConsumer implements CometdProducerCon
}
@Override
- public void stop() throws Exception {
+ public void doStop() throws Exception {
endpoint.disconnect(this);
- super.stop();
+ super.doStop();
}
public void setBayeux(BayeuxServerImpl bayeux) {
diff --git a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdProducer.java b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdProducer.java
index a9feb31..6807df7 100644
--- a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdProducer.java
+++ b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdProducer.java
@@ -43,10 +43,9 @@ public class CometdProducer extends DefaultProducer implements CometdProducerCon
}
@Override
- public void start() throws Exception {
- super.start();
+ public void doStart() throws Exception {
+ super.doStart();
// must connect first
-
endpoint.connect(this);
// should probably look into synchronization for this.
if (service == null) {
@@ -55,7 +54,7 @@ public class CometdProducer extends DefaultProducer implements CometdProducerCon
}
@Override
- public void stop() throws Exception {
+ public void doStop() throws Exception {
super.stop();
endpoint.disconnect(this);
}
diff --git a/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheManager.java b/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheManager.java
index 9d363b7..bcbe578 100644
--- a/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheManager.java
+++ b/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheManager.java
@@ -52,12 +52,12 @@ public class EhcacheManager implements Service {
}
@Override
- public synchronized void start() throws Exception {
+ public synchronized void start() {
refCount.retain();
}
@Override
- public synchronized void stop() throws Exception {
+ public synchronized void stop() {
refCount.release();
userCaches.values().forEach(UserManagedCache::close);
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentRefTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentRefTest.java
index 50eb0b1..bf9ea47 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentRefTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentRefTest.java
@@ -103,10 +103,10 @@ public class FtpConsumerIdempotentRefTest extends FtpServerTestSupport {
return;
}
- public void start() throws Exception {
+ public void start() {
}
- public void stop() throws Exception {
+ public void stop() {
}
}
}
\ No newline at end of file
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 59bf8ea1..4832543 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,7 +18,6 @@ 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.support.SimpleRegistry;
@@ -49,7 +48,7 @@ public class GuavaEventBusConsumerConfigurationTest extends CamelTestSupport {
try {
context.start();
fail("Should throw exception");
- } catch (FailedToCreateRouteException e) {
+ } catch (Exception e) {
IllegalStateException ise = assertIsInstanceOf(IllegalStateException.class, e.getCause());
assertEquals("You cannot set both 'eventClass' and 'listenerInterface' parameters.", ise.getMessage());
}
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastErrorMessagesTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastErrorMessagesTest.java
index 76e2a68..ae810b1 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastErrorMessagesTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastErrorMessagesTest.java
@@ -33,7 +33,7 @@ public class HazelcastErrorMessagesTest extends HazelcastCamelTestSupport {
context.start();
fail("Should have thrown exception");
} catch (Exception e) {
- assertTrue(e.getMessage().contains("You cannot send messages to this endpoint: hazelcast-atomicvalue://foo"));
+ assertTrue(e.getCause().getMessage().contains("You cannot send messages to this endpoint: hazelcast-atomicvalue://foo"));
}
}
@@ -50,7 +50,7 @@ public class HazelcastErrorMessagesTest extends HazelcastCamelTestSupport {
context.start();
fail("Should have thrown exception");
} catch (Exception e) {
- assertTrue(e.getMessage().contains("You cannot send messages to this endpoint: hazelcast-instance://foo"));
+ assertTrue(e.getCause().getMessage().contains("You cannot send messages to this endpoint: hazelcast-instance://foo"));
}
}
diff --git a/components/camel-infinispan/pom.xml b/components/camel-infinispan/pom.xml
index e4b882a..000d925 100644
--- a/components/camel-infinispan/pom.xml
+++ b/components/camel-infinispan/pom.xml
@@ -37,7 +37,6 @@
</properties>
<dependencies>
- <!-- TODO: requires camel-core -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-support</artifactId>
diff --git a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanManager.java b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanManager.java
index 75b5f3a..fa36cf2 100644
--- a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanManager.java
+++ b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanManager.java
@@ -22,7 +22,7 @@ import java.util.Properties;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
-import org.apache.camel.Service;
+import org.apache.camel.support.service.ServiceSupport;
import org.apache.camel.util.ObjectHelper;
import org.infinispan.cache.impl.DecoratedCache;
import org.infinispan.client.hotrod.RemoteCacheManager;
@@ -33,7 +33,7 @@ import org.infinispan.manager.DefaultCacheManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class InfinispanManager implements Service {
+public class InfinispanManager extends ServiceSupport {
private static final transient Logger LOGGER = LoggerFactory.getLogger(InfinispanManager.class);
private final InfinispanConfiguration configuration;
@@ -57,7 +57,7 @@ public class InfinispanManager implements Service {
}
@Override
- public void start() throws Exception {
+ public void doStart() throws Exception {
cacheContainer = configuration.getCacheContainer();
if (cacheContainer == null) {
@@ -129,7 +129,7 @@ public class InfinispanManager implements Service {
}
@Override
- public void stop() throws Exception {
+ public void doStop() throws Exception {
if (isManagedCacheContainer) {
cacheContainer.stop();
}
diff --git a/components/camel-infinispan/src/test/resources/log4j.xml b/components/camel-infinispan/src/test/resources/log4j.xml
index b4b65ac..e4081f2 100644
--- a/components/camel-infinispan/src/test/resources/log4j.xml
+++ b/components/camel-infinispan/src/test/resources/log4j.xml
@@ -82,7 +82,7 @@
<root>
<priority value="INFO" />
- <appender-ref ref="CONSOLE" />
+ <appender-ref ref="FILE" />
</root>
</log4j:configuration>
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTestConnectionOnStartupTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTestConnectionOnStartupTest.java
index 262a12c..db1af79 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTestConnectionOnStartupTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTestConnectionOnStartupTest.java
@@ -20,9 +20,7 @@ import javax.jms.ConnectionFactory;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.camel.CamelContext;
-import org.apache.camel.FailedToCreateConsumerException;
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;
@@ -43,7 +41,7 @@ public class JmsTestConnectionOnStartupTest extends CamelTestSupport {
try {
context.start();
fail("Should have thrown an exception");
- } catch (FailedToCreateConsumerException e) {
+ } catch (Exception e) {
assertEquals("Failed to create Consumer for endpoint: activemq://queue:foo?testConnectionOnStartup=true. "
+ "Reason: Cannot get JMS Connection on startup for destination foo", e.getMessage());
}
@@ -61,8 +59,8 @@ public class JmsTestConnectionOnStartupTest extends CamelTestSupport {
try {
context.start();
fail("Should have thrown an exception");
- } catch (FailedToCreateRouteException ex) {
- FailedToCreateProducerException e = (FailedToCreateProducerException) ex.getCause();
+ } catch (Exception ex) {
+ FailedToCreateProducerException e = assertIsInstanceOf(FailedToCreateProducerException.class, ex.getCause());
assertTrue(e.getMessage().startsWith("Failed to create Producer for endpoint: activemq://queue:foo?testConnectionOnStartup=true."));
assertTrue(e.getMessage().contains("java.net.ConnectException"));
}
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 ace5eac..741ad1f 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
@@ -193,7 +193,7 @@ public class Mina2EncodingTest extends BaseMina2Test {
}
});
fail("Should have thrown a ResolveEndpointFailedException due invalid encoding parameter");
- } catch (FailedToCreateRouteException e) {
+ } catch (Exception e) {
IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertEquals("The encoding: XXX is not supported", iae.getMessage());
}
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzPropertiesTest.java b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzPropertiesTest.java
index 7203ce2..c16b882 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzPropertiesTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzPropertiesTest.java
@@ -60,7 +60,7 @@ public class QuartzPropertiesTest extends BaseQuartzTest {
quartz.start();
fail("Should have thrown exception");
} catch (Exception e) {
- assertEquals("Error loading Quartz properties file: doesnotexist.properties", e.getMessage());
+ assertEquals("Error loading Quartz properties file: doesnotexist.properties", e.getCause().getMessage());
}
}
diff --git a/components/camel-reactive-streams/src/test/java/org/apache/camel/component/reactive/streams/BasicPublisherTest.java b/components/camel-reactive-streams/src/test/java/org/apache/camel/component/reactive/streams/BasicPublisherTest.java
index 9e9cccc..1ea3d6b 100644
--- a/components/camel-reactive-streams/src/test/java/org/apache/camel/component/reactive/streams/BasicPublisherTest.java
+++ b/components/camel-reactive-streams/src/test/java/org/apache/camel/component/reactive/streams/BasicPublisherTest.java
@@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import org.apache.camel.Exchange;
-import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.FailedToStartRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.reactive.streams.api.CamelReactiveStreams;
import org.apache.camel.test.junit4.CamelTestSupport;
@@ -104,7 +104,7 @@ public class BasicPublisherTest extends CamelTestSupport {
disp3.dispose();
}
- @Test(expected = FailedToCreateRouteException.class)
+ @Test(expected = FailedToStartRouteException.class)
public void testOnlyOneCamelProducerPerPublisher() throws Exception {
new RouteBuilder() {
diff --git a/components/camel-reactor/src/test/java/org/apache/camel/component/reactor/engine/ReactorStreamsServiceTest.java b/components/camel-reactor/src/test/java/org/apache/camel/component/reactor/engine/ReactorStreamsServiceTest.java
index abd1614..af56887 100644
--- a/components/camel-reactor/src/test/java/org/apache/camel/component/reactor/engine/ReactorStreamsServiceTest.java
+++ b/components/camel-reactor/src/test/java/org/apache/camel/component/reactor/engine/ReactorStreamsServiceTest.java
@@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import org.apache.camel.Exchange;
-import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.FailedToStartRouteException;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
@@ -394,7 +394,7 @@ public class ReactorStreamsServiceTest extends ReactorStreamsServiceTestSupport
// misc
// ************************************************
- @Test(expected = FailedToCreateRouteException.class)
+ @Test(expected = FailedToStartRouteException.class)
public void testOnlyOneCamelProducerPerPublisher() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
diff --git a/components/camel-rxjava2/src/test/java/org/apache/camel/component/rxjava2/engine/RxJavaStreamsServiceTest.java b/components/camel-rxjava2/src/test/java/org/apache/camel/component/rxjava2/engine/RxJavaStreamsServiceTest.java
index 3d6edf6..c440b4d 100644
--- a/components/camel-rxjava2/src/test/java/org/apache/camel/component/rxjava2/engine/RxJavaStreamsServiceTest.java
+++ b/components/camel-rxjava2/src/test/java/org/apache/camel/component/rxjava2/engine/RxJavaStreamsServiceTest.java
@@ -24,7 +24,7 @@ import java.util.function.Function;
import io.reactivex.Flowable;
import io.reactivex.disposables.Disposable;
import org.apache.camel.Exchange;
-import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.FailedToStartRouteException;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
@@ -386,7 +386,7 @@ public class RxJavaStreamsServiceTest extends RxJavaStreamsServiceTestSupport {
// misc
// ************************************************
- @Test(expected = FailedToCreateRouteException.class)
+ @Test(expected = FailedToStartRouteException.class)
public void testOnlyOneCamelProducerPerPublisher() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
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 f0fe9ef..3658606 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
@@ -37,7 +37,7 @@ public class SaxonInvalidXsltFileTest extends TestSupport {
fail("Should have thrown an exception due XSL compilation error");
} catch (Exception e) {
// expected
- assertIsInstanceOf(TransformerException.class, e.getCause());
+ assertIsInstanceOf(TransformerException.class, e.getCause().getCause());
}
}
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 94e5f2c..e489853 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
@@ -122,7 +122,7 @@ public class HttpClientRouteTest extends ServletCamelRouterTestSupport {
}
});
fail("Excepts exception here");
- } catch (FailedToCreateRouteException ex) {
+ } catch (Exception ex) {
assertTrue("Get a wrong exception.", ex.getCause() instanceof FailedToCreateProducerException);
assertTrue("Get a wrong cause of exception.", ex.getCause().getCause() instanceof UnsupportedOperationException);
}
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 aee1551..a1fba4e 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
@@ -19,6 +19,7 @@ package org.apache.camel.component.sjms.batch;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.camel.CamelContext;
import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.FailedToStartRouteException;
import org.apache.camel.builder.AggregationStrategies;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.sjms.SjmsComponent;
@@ -87,7 +88,7 @@ public class SjmsBatchEndpointTest extends CamelTestSupport {
context.start();
}
- @Test(expected = FailedToCreateRouteException.class)
+ @Test(expected = FailedToStartRouteException.class)
public void testConsumerNegativePollDuration() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
@@ -99,7 +100,7 @@ public class SjmsBatchEndpointTest extends CamelTestSupport {
context.start();
}
- @Test(expected = FailedToCreateRouteException.class)
+ @Test(expected = FailedToStartRouteException.class)
public void testConsumerNegativeConsumerCount() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/NoConnectionFactoryTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/NoConnectionFactoryTest.java
index b66e1af..553fc37 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/NoConnectionFactoryTest.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/NoConnectionFactoryTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.sjms.producer;
import org.apache.camel.CamelContext;
import org.apache.camel.FailedToCreateProducerException;
-import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.FailedToStartRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.junit.Assert;
@@ -69,7 +69,7 @@ public class NoConnectionFactoryTest {
try {
context.start();
} catch (Throwable t) {
- Assert.assertEquals(FailedToCreateRouteException.class, t.getClass());
+ Assert.assertEquals(FailedToStartRouteException.class, t.getClass());
Assert.assertEquals(FailedToCreateProducerException.class, t.getCause().getClass());
Assert.assertEquals(IllegalArgumentException.class, t.getCause().getCause().getClass());
LOG.info("Expected exception was thrown", t);
@@ -85,7 +85,7 @@ public class NoConnectionFactoryTest {
try {
context.start();
} catch (Throwable t) {
- Assert.assertEquals(FailedToCreateRouteException.class, t.getClass());
+ Assert.assertEquals(FailedToStartRouteException.class, t.getClass());
Assert.assertEquals(FailedToCreateProducerException.class, t.getCause().getClass());
Assert.assertEquals(IllegalArgumentException.class, t.getCause().getCause().getClass());
LOG.info("Expected exception was thrown", t);
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedProducerInOutErrorTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedProducerInOutErrorTest.java
index 2d742d3..2a95b15 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedProducerInOutErrorTest.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedProducerInOutErrorTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.sjms.tx;
import org.apache.camel.CamelContext;
import org.apache.camel.FailedToCreateProducerException;
-import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.FailedToStartRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.sjms.CamelJmsTestHelper;
import org.apache.camel.component.sjms.SjmsComponent;
@@ -35,7 +35,7 @@ public class TransactedProducerInOutErrorTest {
private static final Logger LOG = LoggerFactory.getLogger(TransactedProducerInOutErrorTest.class);
- @Test(expected = FailedToCreateRouteException.class)
+ @Test(expected = FailedToStartRouteException.class)
public void test() throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(createRouteBuilder());
@@ -44,7 +44,7 @@ public class TransactedProducerInOutErrorTest {
try {
context.start();
} catch (Throwable t) {
- Assert.assertEquals(FailedToCreateRouteException.class, t.getClass());
+ Assert.assertEquals(FailedToStartRouteException.class, t.getClass());
Assert.assertEquals(FailedToCreateProducerException.class, t.getCause().getClass());
Assert.assertEquals(IllegalArgumentException.class, t.getCause().getCause().getClass());
LOG.info("Exception was thrown as expected", t);
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 c028a63..e4e4ff2 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
@@ -23,7 +23,7 @@ import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.EndpointInject;
-import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.FailedToStartRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultCamelContext;
@@ -193,7 +193,7 @@ public class SpringBatchEndpointTest extends CamelTestSupport {
mockEndpoint.expectedBodiesReceived(jobExecution);
}
- @Test(expected = FailedToCreateRouteException.class)
+ @Test(expected = FailedToStartRouteException.class)
public void shouldThrowExceptionIfUsedAsConsumer() throws Exception {
// When
context().addRoutes(new RouteBuilder() {
@@ -303,7 +303,7 @@ public class SpringBatchEndpointTest extends CamelTestSupport {
assertSame(alternativeJobLauncher, batchEndpointJobLauncher);
}
- @Test(expected = FailedToCreateRouteException.class)
+ @Test(expected = FailedToStartRouteException.class)
public void shouldFailWhenThereIsNoJobLauncher() throws Exception {
// Given
SimpleRegistry registry = new SimpleRegistry();
@@ -320,7 +320,7 @@ public class SpringBatchEndpointTest extends CamelTestSupport {
camelContext.start();
}
- @Test(expected = FailedToCreateRouteException.class)
+ @Test(expected = FailedToStartRouteException.class)
public void shouldFailWhenThereIsMoreThanOneJobLauncher() throws Exception {
// Given
SimpleRegistry registry = new SimpleRegistry();
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/SupervisingRouteControllerRestartTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/SupervisingRouteControllerRestartTest.java
index 381e574..654a007 100644
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/SupervisingRouteControllerRestartTest.java
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/SupervisingRouteControllerRestartTest.java
@@ -84,7 +84,7 @@ public class SupervisingRouteControllerRestartTest {
try {
controller.startRoute("dummy");
} catch (Exception e) {
- Assert.assertEquals("Forced error on restart", e.getMessage());
+ Assert.assertEquals("Forced error on restart", e.getCause().getMessage());
}
Assert.assertTrue(controller.getBackOffContext("dummy").isPresent());
diff --git a/components/readme.adoc b/components/readme.adoc
index b24e55f..927e597 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -463,7 +463,7 @@ Number of Components: 295 in 232 JAR artifacts (0 deprecated)
| link:camel-jing/src/main/docs/jing-component.adoc[Jing] (camel-jing) +
`jing:resourceUri` | 1.1 | Validates the payload of a message using RelaxNG Syntax using Jing library.
-| link:@@@ARTIFACTID@@@/src/main/docs/jms-component.adoc[JMS] (@@@ARTIFACTID@@@) +
+| link:camel-jms/src/main/docs/jms-component.adoc[JMS] (camel-jms) +
`jms:destinationType:destinationName` | 1.0 | The jms component allows messages to be sent to (or consumed from) a JMS Queue or Topic.
| link:camel-jmx/src/main/docs/jmx-component.adoc[JMX] (camel-jmx) +