You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/02/04 07:38:05 UTC

[camel] branch master updated: CAMEL-13149: camel-jms should not use activemq-camel during testing but use plain jms and jms client apis. Work in progress. (#2744)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 4e8379a  CAMEL-13149: camel-jms should not use activemq-camel during testing but use plain jms and jms client apis. Work in progress. (#2744)
4e8379a is described below

commit 4e8379ab95cccb1b3bbf37bb06e599be3f501246
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Feb 4 08:37:58 2019 +0100

    CAMEL-13149: camel-jms should not use activemq-camel during testing but use plain jms and jms client apis. Work in progress. (#2744)
---
 components/camel-jms/pom.xml                       |  12 -
 .../camel/component/ActiveMQComponent.java         | 259 ---------------------
 .../component/jms/JmsRouteRequestReplyTest.java    |  86 +++----
 .../camel/component/jms/issues/JmsHammerTest.java  |  86 -------
 .../camel/component/jms/temp/JmsProviderTest.java  |  19 +-
 .../jms/JmsSpringLoadBalanceFailoverTest.xml       |   2 +-
 .../issues/JmsSpringResequencerTest-context.xml    |  64 -----
 7 files changed, 50 insertions(+), 478 deletions(-)

diff --git a/components/camel-jms/pom.xml b/components/camel-jms/pom.xml
index 31b0bfb..392dc18 100644
--- a/components/camel-jms/pom.xml
+++ b/components/camel-jms/pom.xml
@@ -115,18 +115,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.activemq</groupId>
-      <artifactId>activemq-camel</artifactId>
-      <scope>test</scope>
-      <!-- break the cyclic dependency to camel-jms which otherwise would baffle the maven eclipse plugin -->
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.camel</groupId>
-          <artifactId>camel-jms</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.activemq</groupId>
       <artifactId>activemq-pool</artifactId>
       <scope>test</scope>
       <!-- lets use JMS 2.0 api but camel-jms still works with ActiveMQ 5.x that is JMS 1.1 only -->
diff --git a/components/camel-jms/src/test/java/org/apache/activemq/camel/component/ActiveMQComponent.java b/components/camel-jms/src/test/java/org/apache/activemq/camel/component/ActiveMQComponent.java
deleted file mode 100644
index d6f0bc6..0000000
--- a/components/camel-jms/src/test/java/org/apache/activemq/camel/component/ActiveMQComponent.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.camel.component;
-
-import java.net.URISyntaxException;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.jms.Connection;
-
-import org.apache.activemq.EnhancedConnection;
-import org.apache.activemq.Service;
-import org.apache.activemq.advisory.DestinationSource;
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.jms.JmsComponent;
-import org.apache.camel.component.jms.JmsConfiguration;
-import org.apache.camel.support.IntrospectionSupport;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.URISupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.jms.connection.SingleConnectionFactory;
-import org.springframework.jms.core.JmsTemplate;
-
-/**
- * This class is used only temporary to align with the new Camel 3 API
- */
-public class ActiveMQComponent extends JmsComponent {
-
-    private static final transient Logger LOG = LoggerFactory.getLogger(ActiveMQComponent.class);
-    DestinationSource source;
-    
-    private EnhancedConnection connection;
-    private final CopyOnWriteArrayList<SingleConnectionFactory> singleConnectionFactoryList = new CopyOnWriteArrayList<SingleConnectionFactory>();
-    private final CopyOnWriteArrayList<Service> pooledConnectionFactoryServiceList = new CopyOnWriteArrayList<Service>();
-
-    private boolean exposeAllQueues;
-    private CamelEndpointLoader endpointLoader;
-
-    public ActiveMQComponent() {
-    }
-
-    public ActiveMQComponent(CamelContext context) {
-        super(context);
-    }
-
-    public ActiveMQComponent(ActiveMQConfiguration configuration) {
-        super();
-        setConfiguration(configuration);
-    }
-    
-    /**
-     * Creates an <a href="http://camel.apache.org/activemq.html">ActiveMQ
-     * Component</a>
-     *
-     * @return the created component
-     */
-    public static ActiveMQComponent activeMQComponent() {
-        return new ActiveMQComponent();
-    }
-    
-    /**
-     * Creates an <a href="http://camel.apache.org/activemq.html">ActiveMQ
-     * Component</a> connecting to the given
-     * <a href="http://activemq.apache.org/configuring-transports.html">broker
-     * URL</a>
-     *
-     * @param brokerURL the URL to connect to
-     * @return the created component
-     */
-    public static ActiveMQComponent activeMQComponent(String brokerURL) {
-        ActiveMQComponent answer = new ActiveMQComponent();
-        if (answer.getConfiguration() instanceof ActiveMQConfiguration) {
-            ((ActiveMQConfiguration)answer.getConfiguration()).setBrokerURL(brokerURL);
-        }
-
-        return answer;
-    }
-
-    /**
-     * Sets the broker URL to use to connect to ActiveMQ using the
-     * <a href="http://activemq.apache.org/configuring-transports.html">ActiveMQ
-     * URI format</a>
-     */
-    public void setBrokerURL(String brokerURL) {
-        if (getConfiguration() instanceof ActiveMQConfiguration) {
-            ((ActiveMQConfiguration)getConfiguration()).setBrokerURL(brokerURL);
-        }
-    }
-
-    public void setTrustAllPackages(boolean trustAllPackages) {
-        if (getConfiguration() instanceof ActiveMQConfiguration) {
-            ((ActiveMQConfiguration)getConfiguration()).setTrustAllPackages(trustAllPackages);
-        }
-    }
-
-    public boolean isExposeAllQueues() {
-        return exposeAllQueues;
-    }
-
-    /**
-     * If enabled this will cause all Queues in the ActiveMQ broker to be
-     * eagerly populated into the CamelContext so that they can be easily
-     * browsed by any Camel tooling. This option is disabled by default.
-     */
-    public void setExposeAllQueues(boolean exposeAllQueues) {
-        this.exposeAllQueues = exposeAllQueues;
-    }
-
-    /**
-     * Enables or disables whether a PooledConnectionFactory will be used so
-     * that when messages are sent to ActiveMQ from outside of a message
-     * consuming thread, pooling will be used rather than the default with the
-     * Spring {@link JmsTemplate} which will create a new connection, session,
-     * producer for each message then close them all down again.
-     * <p/>
-     * The default value is true. Note that this requires an extra dependency on
-     * commons-pool2.
-     */
-    public void setUsePooledConnection(boolean usePooledConnection) {
-        if (getConfiguration() instanceof ActiveMQConfiguration) {
-            ((ActiveMQConfiguration)getConfiguration()).setUsePooledConnection(usePooledConnection);
-        }
-    }
-
-    /**
-     * Enables or disables whether a Spring {@link SingleConnectionFactory} will
-     * be used so that when messages are sent to ActiveMQ from outside of a
-     * message consuming thread, pooling will be used rather than the default
-     * with the Spring {@link JmsTemplate} which will create a new connection,
-     * session, producer for each message then close them all down again.
-     * <p/>
-     * The default value is false and a pooled connection is used by default.
-     */
-    public void setUseSingleConnection(boolean useSingleConnection) {
-        if (getConfiguration() instanceof ActiveMQConfiguration) {
-            ((ActiveMQConfiguration)getConfiguration()).setUseSingleConnection(useSingleConnection);
-        }
-    }
-
-    protected void addPooledConnectionFactoryService(Service pooledConnectionFactoryService) {
-        pooledConnectionFactoryServiceList.add(pooledConnectionFactoryService);
-    }
-
-    protected void addSingleConnectionFactory(SingleConnectionFactory singleConnectionFactory) {
-        singleConnectionFactoryList.add(singleConnectionFactory);
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    protected String convertPathToActualDestination(String path, Map<String, Object> parameters) {
-        // support ActiveMQ destination options using the destination. prefix
-        // http://activemq.apache.org/destination-options.html
-        Map options = IntrospectionSupport.extractProperties(parameters, "destination.");
-
-        String query;
-        try {
-            query = URISupport.createQueryString(options);
-        } catch (URISyntaxException e) {
-            throw ObjectHelper.wrapRuntimeCamelException(e);
-        }
-
-        // if we have destination options then append them to the destination
-        // name
-        if (ObjectHelper.isNotEmpty(query)) {
-            return path + "?" + query;
-        } else {
-            return path;
-        }
-    }
-
-    @Override
-    protected void doStart() throws Exception {
-        super.doStart();
-
-        if (isExposeAllQueues()) {
-            createDestinationSource();
-            endpointLoader = new CamelEndpointLoader(getCamelContext(), source);
-            endpointLoader.afterPropertiesSet();
-        }
-
-        // use OriginalDestinationPropagateStrategy by default if no custom
-        // stategy has
-        // been set
-        if (getMessageCreatedStrategy() == null) {
-            setMessageCreatedStrategy(new OriginalDestinationPropagateStrategy());
-        }
-    }
-
-    protected void createDestinationSource() {
-        try {
-            if (source == null) {
-                if (connection == null) {
-                    Connection value = getConfiguration().getConnectionFactory().createConnection();
-                    if (value instanceof EnhancedConnection) {
-                        connection = (EnhancedConnection)value;
-                    } else {
-                        throw new IllegalArgumentException("Created JMS Connection is not an EnhancedConnection: " + value);
-                    }
-                    connection.start();
-                }
-                source = connection.getDestinationSource();
-            }
-        } catch (Throwable t) {
-            LOG.info("Can't get destination source, endpoint completer will not work", t);
-        }
-    }
-
-    @Override
-    protected void doStop() throws Exception {
-        if (source != null) {
-            source.stop();
-            source = null;
-        }
-        if (connection != null) {
-            connection.close();
-            connection = null;
-        }
-        for (Service s : pooledConnectionFactoryServiceList) {
-            s.stop();
-        }
-        pooledConnectionFactoryServiceList.clear();
-        for (SingleConnectionFactory s : singleConnectionFactoryList) {
-            s.destroy();
-        }
-        singleConnectionFactoryList.clear();
-        super.doStop();
-    }
-
-    @Override
-    public void setConfiguration(JmsConfiguration configuration) {
-        if (configuration instanceof ActiveMQConfiguration) {
-            ((ActiveMQConfiguration)configuration).setActiveMQComponent(this);
-        }
-        super.setConfiguration(configuration);
-    }
-
-    @Override
-    protected JmsConfiguration createConfiguration() {
-        ActiveMQConfiguration answer = new ActiveMQConfiguration();
-        answer.setActiveMQComponent(this);
-        return answer;
-    }
-
-}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java
index 00d5f46..102747b 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java
@@ -29,7 +29,6 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.jms.ConnectionFactory;
 
-import org.apache.activemq.camel.component.ActiveMQComponent;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
@@ -42,6 +41,7 @@ import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
+import org.springframework.jms.core.JmsTemplate;
 
 import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge;
 
@@ -153,41 +153,35 @@ public class JmsRouteRequestReplyTest extends CamelTestSupport {
 
             ContextBuilder contextBuilderCorrelationID = new ContextBuilder() {
                 public CamelContext buildContext(CamelContext context) throws Exception {
-                    ConnectionFactory connectionFactory =
-                        CamelJmsTestHelper.createConnectionFactory();
-                    ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
-                    jmsComponent.setConnectionFactory(connectionFactory);
-                    jmsComponent.setUseMessageIDAsCorrelationID(false);
-                    jmsComponent.setConcurrentConsumers(maxServerTasks);
-                    context.addComponent(componentName, jmsComponent);
+                    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+                    JmsComponent jms = jmsComponentAutoAcknowledge(connectionFactory);
+                    jms.setUseMessageIDAsCorrelationID(false);
+                    jms.setConcurrentConsumers(maxServerTasks);
+                    context.addComponent(componentName, jms);
                     return context;
                 }
             };
 
             ContextBuilder contextBuilderMessageIDNamedReplyToSelector = new ContextBuilder() {
                 public CamelContext buildContext(CamelContext context) throws Exception {
-                    ConnectionFactory connectionFactory =
-                        CamelJmsTestHelper.createConnectionFactory();
-                    ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
-                    jmsComponent.setConnectionFactory(connectionFactory);
-                    jmsComponent.setUseMessageIDAsCorrelationID(true);
-                    jmsComponent.setConcurrentConsumers(maxServerTasks);
-                    jmsComponent.getConfiguration().setReplyToDestinationSelectorName(REPLY_TO_DESTINATION_SELECTOR_NAME);
-                    context.addComponent(componentName, jmsComponent);
+                    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+                    JmsComponent jms = jmsComponentAutoAcknowledge(connectionFactory);
+                    jms.getConfiguration().setReplyToDestinationSelectorName(REPLY_TO_DESTINATION_SELECTOR_NAME);
+                    jms.setUseMessageIDAsCorrelationID(true);
+                    jms.setConcurrentConsumers(maxServerTasks);
+                    context.addComponent(componentName, jms);
                     return context;
                 }
             };
 
             ContextBuilder contextBuilderCorrelationIDNamedReplyToSelector = new ContextBuilder() {
                 public CamelContext buildContext(CamelContext context) throws Exception {
-                    ConnectionFactory connectionFactory =
-                        CamelJmsTestHelper.createConnectionFactory();
-                    ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
-                    jmsComponent.setConnectionFactory(connectionFactory);
-                    jmsComponent.setUseMessageIDAsCorrelationID(false);
-                    jmsComponent.setConcurrentConsumers(maxServerTasks);
-                    jmsComponent.getConfiguration().setReplyToDestinationSelectorName(REPLY_TO_DESTINATION_SELECTOR_NAME);
-                    context.addComponent(componentName, jmsComponent);
+                    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+                    JmsComponent jms = jmsComponentAutoAcknowledge(connectionFactory);
+                    jms.getConfiguration().setReplyToDestinationSelectorName(REPLY_TO_DESTINATION_SELECTOR_NAME);
+                    jms.setUseMessageIDAsCorrelationID(false);
+                    jms.setConcurrentConsumers(maxServerTasks);
+                    context.addComponent(componentName, jms);
                     return context;
                 }
             };
@@ -195,37 +189,31 @@ public class JmsRouteRequestReplyTest extends CamelTestSupport {
 
             ContextBuilder contextBuilderCorrelationIDDiffComp = new ContextBuilder() {
                 public CamelContext buildContext(CamelContext context) throws Exception {
-                    ConnectionFactory connectionFactory =
-                        CamelJmsTestHelper.createConnectionFactory();
-                    ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
-                    jmsComponent.setConnectionFactory(connectionFactory);
-                    jmsComponent.setConcurrentConsumers(maxServerTasks);
-                    context.addComponent(componentName, jmsComponent);
-
-                    ActiveMQComponent jmsComponent1 = ActiveMQComponent.activeMQComponent();
-                    jmsComponent1.setConnectionFactory(connectionFactory);
-                    jmsComponent1.setUseMessageIDAsCorrelationID(false);
-                    jmsComponent1.setConcurrentConsumers(maxServerTasks);
-                    context.addComponent(componentName1, jmsComponent1);
+                    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+                    JmsComponent jms = jmsComponentAutoAcknowledge(connectionFactory);
+                    jms.setConcurrentConsumers(maxServerTasks);
+                    context.addComponent(componentName, jms);
+
+                    JmsComponent jms1 = jmsComponentAutoAcknowledge(connectionFactory);
+                    jms1.setUseMessageIDAsCorrelationID(false);
+                    jms1.setConcurrentConsumers(maxServerTasks);
+                    context.addComponent(componentName1, jms1);
                     return context;
                 }
             };
 
             ContextBuilder contextBuilderMessageIDDiffComp = new ContextBuilder() {
                 public CamelContext buildContext(CamelContext context) throws Exception {
-                    ConnectionFactory connectionFactory =
-                        CamelJmsTestHelper.createConnectionFactory();
-                    ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
-                    jmsComponent.setConnectionFactory(connectionFactory);
-                    jmsComponent.setUseMessageIDAsCorrelationID(true);
-                    jmsComponent.setConcurrentConsumers(maxServerTasks);
-                    context.addComponent(componentName, jmsComponent);
-
-                    ActiveMQComponent jmsComponent1 = ActiveMQComponent.activeMQComponent();
-                    jmsComponent1.setConnectionFactory(connectionFactory);
-                    jmsComponent1.setUseMessageIDAsCorrelationID(true);
-                    jmsComponent1.setConcurrentConsumers(maxServerTasks);
-                    context.addComponent(componentName1, jmsComponent1);
+                    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+                    JmsComponent jms = jmsComponentAutoAcknowledge(connectionFactory);
+                    jms.setUseMessageIDAsCorrelationID(true);
+                    jms.setConcurrentConsumers(maxServerTasks);
+                    context.addComponent(componentName, jms);
+
+                    JmsComponent jms1 = jmsComponentAutoAcknowledge(connectionFactory);
+                    jms1.setUseMessageIDAsCorrelationID(true);
+                    jms1.setConcurrentConsumers(maxServerTasks);
+                    context.addComponent(componentName1, jms1);
                     return context;
                 }
             };
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsHammerTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsHammerTest.java
deleted file mode 100644
index e51a0ce..0000000
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsHammerTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jms.issues;
-
-import org.apache.activemq.camel.component.ActiveMQComponent;
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent;
-
-/**
- * See MR-170
- */
-@Ignore
-public class JmsHammerTest extends CamelTestSupport {
-
-    private static final Logger LOG = LoggerFactory.getLogger(JmsHammerTest.class);
-
-    private String message;
-    // TODO: AMQ reaches a limit when sending #169.
-    // private int size = 200;
-    private int size = 10;
-
-    public void prepareMessage() throws Exception {
-        StringBuilder sb = new StringBuilder();
-        for (int i = 0; i < 20000; i++) {
-            sb.append("hellothere");
-        }
-        message = sb.toString();
-    }
-
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-        ActiveMQComponent activemq =
-            activeMQComponent("vm://localhost?broker.persistent=false&broker.useJmx=false&jms.redeliveryPolicy.maximumRedeliveries=0" 
-                              + "&jms.redeliveryPolicy.initialRedeliveryDelay=500&jms.useAsyncSend=false&jms.sendTimeout=10000"
-                              + "&jms.maxReconnectAttempts=1&jms.timeout=3000");
-        camelContext.addComponent("activemq", activemq);
-        return camelContext;
-    }
-
-    @Test
-    public void testHammerJms() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(size);
-
-        for (int i = 0; i < size; i++) {
-            template.sendBody("direct:start", message);
-            LOG.info("Send #" + i);
-        }
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        prepareMessage();
-
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("activemq:queue:dropOff", "mock:result");
-            }
-        };
-    }
-}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/temp/JmsProviderTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/temp/JmsProviderTest.java
index d610005..48794b6 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/temp/JmsProviderTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/temp/JmsProviderTest.java
@@ -16,19 +16,22 @@
  */
 package org.apache.camel.component.jms.temp;
 
+import javax.jms.ConnectionFactory;
 import javax.jms.TemporaryQueue;
 import javax.jms.TemporaryTopic;
-import javax.naming.Context;
 
-import org.apache.activemq.camel.component.ActiveMQComponent;
 import org.apache.activemq.command.ActiveMQTempQueue;
 import org.apache.activemq.command.ActiveMQTempTopic;
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.jms.CamelJmsTestHelper;
 import org.apache.camel.component.jms.JmsConfiguration;
 import org.apache.camel.component.jms.JmsEndpoint;
 import org.apache.camel.component.jms.JmsProviderMetadata;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
+import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge;
+
 public class JmsProviderTest extends CamelTestSupport {
     @Test
     public void testTemporaryDestinationTypes() throws Exception {
@@ -50,10 +53,12 @@ public class JmsProviderTest extends CamelTestSupport {
         assertEquals("topicType", ActiveMQTempTopic.class, topicType);
     }
 
-    @Override
-    protected Context createJndiContext() throws Exception {
-        Context context = super.createJndiContext();
-        context.bind("activemq", ActiveMQComponent.activeMQComponent("vm://localhost"));
-        return context;
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext camelContext = super.createCamelContext();
+
+        ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+        camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory));
+
+        return camelContext;
     }
 }
diff --git a/components/camel-jms/src/test/resources/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml b/components/camel-jms/src/test/resources/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml
index c458b84..2a6c2d7 100644
--- a/components/camel-jms/src/test/resources/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml
+++ b/components/camel-jms/src/test/resources/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml
@@ -24,7 +24,7 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-    <bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
+    <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
         <property name="connectionFactory">
             <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                 <property name="brokerURL" value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/>
diff --git a/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/JmsSpringResequencerTest-context.xml b/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/JmsSpringResequencerTest-context.xml
deleted file mode 100644
index 1ca899b..0000000
--- a/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/JmsSpringResequencerTest-context.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
-       
-    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-        <jmxAgent id="agent" disabled="true" />
-
-        <route>
-           <from uri="activemq:queue:in1"/>           
-  		   <resequence>  		        
-                <batch-config batchSize="100" batchTimeout="10000"/>
-    			<simple>body</simple>
-    			<to uri="mock:result"/>
-  			</resequence>
-		</route>
-		
-		<route>
-           <from uri="activemq:queue:in2"/>           
-  		   <resequence>  		        
-                <stream-config timeout="2000"/>
-    			<simple>header.num</simple>
-    			<to uri="mock:result"/>
-  			</resequence>
-		</route>          
-        
-    </camelContext>
-    
-
-    <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
-        <property name="brokerURL" value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/>
-    </bean>
-
-    <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
-        <property name="connectionFactory" ref="jmsConnectionFactory"/>
-        <property name="transacted" value="false"/>
-        <property name="concurrentConsumers" value="10"/>
-    </bean>
-
-    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
-        <property name="configuration" ref="jmsConfig"/>
-    </bean>
-
-</beans>