use of org.springframework.jms.config.DefaultJmsListenerContainerFactory in project spring-boot by spring-projects.
the class JmsAutoConfigurationTests method testDefaultContainerFactoryWithJtaTransactionManager.
@Test
public void testDefaultContainerFactoryWithJtaTransactionManager() {
this.context = createContext(TestConfiguration7.class, EnableJmsConfiguration.class);
JmsListenerContainerFactory<?> jmsListenerContainerFactory = this.context.getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class);
assertThat(jmsListenerContainerFactory.getClass()).isEqualTo(DefaultJmsListenerContainerFactory.class);
DefaultMessageListenerContainer listenerContainer = ((DefaultJmsListenerContainerFactory) jmsListenerContainerFactory).createListenerContainer(mock(JmsListenerEndpoint.class));
assertThat(listenerContainer.isSessionTransacted()).isFalse();
assertThat(new DirectFieldAccessor(listenerContainer).getPropertyValue("transactionManager")).isSameAs(this.context.getBean(JtaTransactionManager.class));
}
use of org.springframework.jms.config.DefaultJmsListenerContainerFactory in project spring-boot by spring-projects.
the class JmsAutoConfigurationTests method testDefaultContainerFactoryNoTransactionManager.
@Test
public void testDefaultContainerFactoryNoTransactionManager() {
this.context = createContext(EnableJmsConfiguration.class);
JmsListenerContainerFactory<?> jmsListenerContainerFactory = this.context.getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class);
assertThat(jmsListenerContainerFactory.getClass()).isEqualTo(DefaultJmsListenerContainerFactory.class);
DefaultMessageListenerContainer listenerContainer = ((DefaultJmsListenerContainerFactory) jmsListenerContainerFactory).createListenerContainer(mock(JmsListenerEndpoint.class));
assertThat(listenerContainer.isSessionTransacted()).isTrue();
assertThat(new DirectFieldAccessor(listenerContainer).getPropertyValue("transactionManager")).isNull();
}
Aggregations