32
32
import javax .jms .ConnectionFactory ;
33
33
34
34
import org .apache .activemq .ActiveMQConnectionFactory ;
35
+ import org .apache .logging .log4j .Level ;
35
36
import org .hamcrest .Matchers ;
37
+ import org .junit .Rule ;
36
38
import org .junit .Test ;
37
39
import org .junit .runner .RunWith ;
38
40
60
62
import org .springframework .integration .dsl .MessageChannels ;
61
63
import org .springframework .integration .dsl .Pollers ;
62
64
import org .springframework .integration .endpoint .MethodInvokingMessageSource ;
65
+ import org .springframework .integration .jms .ActiveMQMultiContextTests ;
63
66
import org .springframework .integration .jms .JmsDestinationPollingSource ;
64
67
import org .springframework .integration .scheduling .PollerMetadata ;
65
68
import org .springframework .integration .support .MessageBuilder ;
69
+ import org .springframework .integration .test .rule .Log4j2LevelAdjuster ;
66
70
import org .springframework .integration .test .util .TestUtils ;
67
71
import org .springframework .jms .connection .CachingConnectionFactory ;
68
72
import org .springframework .jms .core .JmsTemplate ;
89
93
*/
90
94
@ RunWith (SpringRunner .class )
91
95
@ DirtiesContext
92
- public class JmsTests {
96
+ public class JmsTests extends ActiveMQMultiContextTests {
93
97
94
98
@ Autowired
95
99
private ListableBeanFactory beanFactory ;
@@ -120,7 +124,7 @@ public class JmsTests {
120
124
private TestChannelInterceptor testChannelInterceptor ;
121
125
122
126
@ Autowired
123
- private ConnectionFactory jmsConnectionFactory ;
127
+ private ConnectionFactory cachingConnectionFactory ;
124
128
125
129
@ Autowired
126
130
private PollableChannel jmsPubSubBridgeChannel ;
@@ -146,6 +150,10 @@ public class JmsTests {
146
150
@ Autowired
147
151
private CountDownLatch redeliveryLatch ;
148
152
153
+ @ Rule
154
+ public final Log4j2LevelAdjuster adjuster = Log4j2LevelAdjuster .forLevel (Level .DEBUG )
155
+ .categories ("org.springframework" , "org.springframework.integration" , "org.apache" );
156
+
149
157
@ Test
150
158
public void testPollingFlow () {
151
159
this .controlBus .send ("@'jmsTests.ContextConfiguration.integerMessageSource.inboundChannelAdapter'.start()" );
@@ -223,7 +231,7 @@ public void testJmsPipelineFlow() {
223
231
224
232
@ Test
225
233
public void testPubSubFlow () {
226
- JmsTemplate template = new JmsTemplate (this .jmsConnectionFactory );
234
+ JmsTemplate template = new JmsTemplate (this .cachingConnectionFactory );
227
235
template .setPubSubDomain (true );
228
236
template .setDefaultDestinationName ("pubsub" );
229
237
template .convertAndSend ("foo" );
@@ -241,6 +249,7 @@ public void testJmsRedeliveryFlow() throws InterruptedException {
241
249
assertTrue (this .redeliveryLatch .await (10 , TimeUnit .SECONDS ));
242
250
243
251
assertNotNull (this .jmsMessageDrivenRedeliveryFlowContainer );
252
+ this .jmsMessageDrivenRedeliveryFlowContainer .stop ();
244
253
}
245
254
246
255
@ MessagingGateway (defaultRequestChannel = "controlBus.input" )
0 commit comments