@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2023 the original author or authors .
* Copyright 2002 - 2024 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -105,8 +105,7 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@@ -105,8 +105,7 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
void containerAreStartedByDefault ( ) {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext (
EnableJmsDefaultContainerFactoryConfig . class , DefaultBean . class ) ;
JmsListenerContainerTestFactory factory =
context . getBean ( JmsListenerContainerTestFactory . class ) ;
JmsListenerContainerTestFactory factory = context . getBean ( JmsListenerContainerTestFactory . class ) ;
MessageListenerTestContainer container = factory . getListenerContainers ( ) . get ( 0 ) ;
assertThat ( container . isAutoStartup ( ) ) . isTrue ( ) ;
assertThat ( container . isStarted ( ) ) . isTrue ( ) ;
@ -116,8 +115,7 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@@ -116,8 +115,7 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
void containerCanBeStarterViaTheRegistry ( ) {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext (
EnableJmsAutoStartupFalseConfig . class , DefaultBean . class ) ;
JmsListenerContainerTestFactory factory =
context . getBean ( JmsListenerContainerTestFactory . class ) ;
JmsListenerContainerTestFactory factory = context . getBean ( JmsListenerContainerTestFactory . class ) ;
MessageListenerTestContainer container = factory . getListenerContainers ( ) . get ( 0 ) ;
assertThat ( container . isAutoStartup ( ) ) . isFalse ( ) ;
assertThat ( container . isStarted ( ) ) . isFalse ( ) ;
@ -132,9 +130,9 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@@ -132,9 +130,9 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext (
EnableJmsHandlerMethodFactoryConfig . class , ValidationBean . class ) ;
assertThatExceptionOfType ( ListenerExecutionFailedException . class ) . isThrownBy ( ( ) - >
testJmsHandlerMethodFactoryConfiguration ( context ) )
. withCauseInstanceOf ( MethodArgumentNotValidException . class ) ;
assertThatExceptionOfType ( ListenerExecutionFailedException . class )
. isThrownBy ( ( ) - > testJmsHandlerMethodFactoryConfiguration ( context ) )
. withCauseInstanceOf ( MethodArgumentNotValidException . class ) ;
}
@Override
@ -156,19 +154,20 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@@ -156,19 +154,20 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Test
void composedJmsListeners ( ) {
try ( ConfigurableApplicationContext context = new AnnotationConfigApplicationContext (
EnableJmsDefaultContainerFactoryConfig . class , ComposedJmsListenersBean . class ) ) {
JmsListenerContainerTestFactory simpleFactory = context . getBean ( "jmsListenerContainerFactory" ,
JmsListenerContainerTestFactory . class ) ;
EnableJmsDefaultContainerFactoryConfig . class , ComposedJmsListenersBean . class ) ) {
JmsListenerContainerTestFactory simpleFactory =
context . getBean ( "jmsListenerContainerFactory" , JmsListenerContainerTestFactory . class ) ;
assertThat ( simpleFactory . getListenerContainers ( ) ) . hasSize ( 2 ) ;
MethodJmsListenerEndpoint first = ( MethodJmsListenerEndpoint ) simpleFactory . getListenerContainer (
"first" ) . getEndpoint ( ) ;
MethodJmsListenerEndpoint first = ( MethodJmsListenerEndpoint )
simpleFactory . getListenerContainer ( "first" ) . getEndpoint ( ) ;
assertThat ( first . getId ( ) ) . isEqualTo ( "first" ) ;
assertThat ( first . getDestination ( ) ) . isEqualTo ( "orderQueue" ) ;
assertThat ( first . getConcurrency ( ) ) . isNull ( ) ;
MethodJmsListenerEndpoint second = ( MethodJmsListenerEndpoint ) simpleFactory . getListenerContainer (
"second" ) . getEndpoint ( ) ;
MethodJmsListenerEndpoint second = ( MethodJmsListenerEndpoint )
simpleFactory . getListenerContainer ( "second" ) . getEndpoint ( ) ;
assertThat ( second . getId ( ) ) . isEqualTo ( "second" ) ;
assertThat ( second . getDestination ( ) ) . isEqualTo ( "billingQueue" ) ;
assertThat ( second . getConcurrency ( ) ) . isEqualTo ( "2-10" ) ;
@ -178,9 +177,9 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@@ -178,9 +177,9 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Test
void unknownFactory ( ) {
// not found
assertThatExceptionOfType ( BeanCreationException . class ) . isThrownBy ( ( ) - >
new AnnotationConfigApplicationContext ( EnableJmsSampleConfig . class , CustomBean . class ) )
. withMessageContaining ( "customFactory" ) ;
assertThatExceptionOfType ( BeanCreationException . class )
. isThrownBy ( ( ) - > new AnnotationConfigApplicationContext ( EnableJmsSampleConfig . class , CustomBean . class ) )
. withMessageContaining ( "customFactory" ) ;
}
@Test