Search in sources :

Example 11 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project spring-boot by spring-projects.

the class JmsAutoConfigurationTests method testPubSubDomainOverride.

@Test
public void testPubSubDomainOverride() {
    load(TestConfiguration.class, "spring.jms.pubSubDomain:false");
    JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
    ActiveMQConnectionFactory connectionFactory = this.context.getBean(ActiveMQConnectionFactory.class);
    assertThat(jmsTemplate).isNotNull();
    assertThat(jmsTemplate.isPubSubDomain()).isFalse();
    assertThat(connectionFactory).isNotNull();
    assertThat(connectionFactory).isEqualTo(jmsTemplate.getConnectionFactory());
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) JmsTemplate(org.springframework.jms.core.JmsTemplate) Test(org.junit.Test)

Example 12 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project spring-boot by spring-projects.

the class JmsAutoConfigurationTests method testActiveMQOverriddenPoolAndRemoteServer.

@Test
public void testActiveMQOverriddenPoolAndRemoteServer() {
    load(TestConfiguration.class, "spring.activemq.pool.enabled:true", "spring.activemq.brokerUrl:tcp://remote-host:10000");
    JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
    PooledConnectionFactory pool = this.context.getBean(PooledConnectionFactory.class);
    assertThat(jmsTemplate).isNotNull();
    assertThat(pool).isNotNull();
    assertThat(pool).isEqualTo(jmsTemplate.getConnectionFactory());
    ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool.getConnectionFactory();
    assertThat(factory.getBrokerURL()).isEqualTo("tcp://remote-host:10000");
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) JmsTemplate(org.springframework.jms.core.JmsTemplate) PooledConnectionFactory(org.apache.activemq.pool.PooledConnectionFactory) Test(org.junit.Test)

Example 13 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project spring-boot by spring-projects.

the class JmsAutoConfigurationTests method testDefaultJmsConfiguration.

@Test
public void testDefaultJmsConfiguration() {
    load(TestConfiguration.class);
    ActiveMQConnectionFactory connectionFactory = this.context.getBean(ActiveMQConnectionFactory.class);
    JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
    JmsMessagingTemplate messagingTemplate = this.context.getBean(JmsMessagingTemplate.class);
    assertThat(connectionFactory).isEqualTo(jmsTemplate.getConnectionFactory());
    assertThat(messagingTemplate.getJmsTemplate()).isEqualTo(jmsTemplate);
    assertThat(((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory()).getBrokerURL()).isEqualTo(ACTIVEMQ_EMBEDDED_URL);
    assertThat(this.context.containsBean("jmsListenerContainerFactory")).isTrue();
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) JmsMessagingTemplate(org.springframework.jms.core.JmsMessagingTemplate) JmsTemplate(org.springframework.jms.core.JmsTemplate) Test(org.junit.Test)

Example 14 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project spring-boot by spring-projects.

the class JmsAutoConfigurationTests method testActiveMQOverriddenPoolAndStandalone.

@Test
public void testActiveMQOverriddenPoolAndStandalone() {
    load(TestConfiguration.class, "spring.activemq.pool.enabled:true", "spring.activemq.inMemory:false");
    JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
    PooledConnectionFactory pool = this.context.getBean(PooledConnectionFactory.class);
    assertThat(jmsTemplate).isNotNull();
    assertThat(pool).isNotNull();
    assertThat(pool).isEqualTo(jmsTemplate.getConnectionFactory());
    ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool.getConnectionFactory();
    assertThat(factory.getBrokerURL()).isEqualTo(ACTIVEMQ_NETWORK_URL);
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) JmsTemplate(org.springframework.jms.core.JmsTemplate) PooledConnectionFactory(org.apache.activemq.pool.PooledConnectionFactory) Test(org.junit.Test)

Example 15 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project spring-boot by spring-projects.

the class JmsAutoConfigurationTests method testActiveMQOverriddenStandalone.

@Test
public void testActiveMQOverriddenStandalone() {
    load(TestConfiguration.class, "spring.activemq.inMemory:false");
    JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
    ActiveMQConnectionFactory connectionFactory = this.context.getBean(ActiveMQConnectionFactory.class);
    assertThat(jmsTemplate).isNotNull();
    assertThat(connectionFactory).isNotNull();
    assertThat(connectionFactory).isEqualTo(jmsTemplate.getConnectionFactory());
    assertThat(((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory()).getBrokerURL()).isEqualTo(ACTIVEMQ_NETWORK_URL);
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) JmsTemplate(org.springframework.jms.core.JmsTemplate) Test(org.junit.Test)

Aggregations

ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)69 CamelContext (org.apache.camel.CamelContext)25 SjmsComponent (org.apache.camel.component.sjms.SjmsComponent)16 ConnectionFactory (javax.jms.ConnectionFactory)11 Test (org.junit.Test)10 PooledConnectionFactory (org.apache.activemq.pool.PooledConnectionFactory)9 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)8 JmsTemplate (org.springframework.jms.core.JmsTemplate)7 Connection (javax.jms.Connection)6 Session (javax.jms.Session)6 Before (org.junit.Before)5 MessageProducer (javax.jms.MessageProducer)4 RouteBuilder (org.apache.camel.builder.RouteBuilder)4 SimpleRegistry (org.apache.camel.impl.SimpleRegistry)4 File (java.io.File)3 Destination (javax.jms.Destination)3 JMSException (javax.jms.JMSException)3 MessageConsumer (javax.jms.MessageConsumer)3 BrokerService (org.apache.activemq.broker.BrokerService)3 ArrayList (java.util.ArrayList)2