3232import javax .jms .ConnectionFactory ;
3333
3434import org .apache .activemq .ActiveMQConnectionFactory ;
35+ import org .apache .logging .log4j .Level ;
3536import org .hamcrest .Matchers ;
37+ import org .junit .Rule ;
3638import org .junit .Test ;
3739import org .junit .runner .RunWith ;
3840
6062import org .springframework .integration .dsl .MessageChannels ;
6163import org .springframework .integration .dsl .Pollers ;
6264import org .springframework .integration .endpoint .MethodInvokingMessageSource ;
65+ import org .springframework .integration .jms .ActiveMQMultiContextTests ;
6366import org .springframework .integration .jms .JmsDestinationPollingSource ;
6467import org .springframework .integration .scheduling .PollerMetadata ;
6568import org .springframework .integration .support .MessageBuilder ;
69+ import org .springframework .integration .test .rule .Log4j2LevelAdjuster ;
6670import org .springframework .integration .test .util .TestUtils ;
6771import org .springframework .jms .connection .CachingConnectionFactory ;
6872import org .springframework .jms .core .JmsTemplate ;
8993 */
9094@ RunWith (SpringRunner .class )
9195@ DirtiesContext
92- public class JmsTests {
96+ public class JmsTests extends ActiveMQMultiContextTests {
9397
9498 @ Autowired
9599 private ListableBeanFactory beanFactory ;
@@ -120,7 +124,7 @@ public class JmsTests {
120124 private TestChannelInterceptor testChannelInterceptor ;
121125
122126 @ Autowired
123- private ConnectionFactory jmsConnectionFactory ;
127+ private ConnectionFactory cachingConnectionFactory ;
124128
125129 @ Autowired
126130 private PollableChannel jmsPubSubBridgeChannel ;
@@ -146,6 +150,10 @@ public class JmsTests {
146150 @ Autowired
147151 private CountDownLatch redeliveryLatch ;
148152
153+ @ Rule
154+ public final Log4j2LevelAdjuster adjuster = Log4j2LevelAdjuster .forLevel (Level .DEBUG )
155+ .categories ("org.springframework" , "org.springframework.integration" , "org.apache" );
156+
149157 @ Test
150158 public void testPollingFlow () {
151159 this .controlBus .send ("@'jmsTests.ContextConfiguration.integerMessageSource.inboundChannelAdapter'.start()" );
@@ -223,7 +231,7 @@ public void testJmsPipelineFlow() {
223231
224232 @ Test
225233 public void testPubSubFlow () {
226- JmsTemplate template = new JmsTemplate (this .jmsConnectionFactory );
234+ JmsTemplate template = new JmsTemplate (this .cachingConnectionFactory );
227235 template .setPubSubDomain (true );
228236 template .setDefaultDestinationName ("pubsub" );
229237 template .convertAndSend ("foo" );
@@ -241,6 +249,7 @@ public void testJmsRedeliveryFlow() throws InterruptedException {
241249 assertTrue (this .redeliveryLatch .await (10 , TimeUnit .SECONDS ));
242250
243251 assertNotNull (this .jmsMessageDrivenRedeliveryFlowContainer );
252+ this .jmsMessageDrivenRedeliveryFlowContainer .stop ();
244253 }
245254
246255 @ MessagingGateway (defaultRequestChannel = "controlBus.input" )
0 commit comments