Skip to content

Commit 595ef3a

Browse files
committed
INT-4519: JmsTests Polishing
1 parent 0545a7b commit 595ef3a

File tree

1 file changed

+12
-3
lines changed
  • spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl

1 file changed

+12
-3
lines changed

spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
import javax.jms.ConnectionFactory;
3333

3434
import org.apache.activemq.ActiveMQConnectionFactory;
35+
import org.apache.logging.log4j.Level;
3536
import org.hamcrest.Matchers;
37+
import org.junit.Rule;
3638
import org.junit.Test;
3739
import org.junit.runner.RunWith;
3840

@@ -60,9 +62,11 @@
6062
import org.springframework.integration.dsl.MessageChannels;
6163
import org.springframework.integration.dsl.Pollers;
6264
import org.springframework.integration.endpoint.MethodInvokingMessageSource;
65+
import org.springframework.integration.jms.ActiveMQMultiContextTests;
6366
import org.springframework.integration.jms.JmsDestinationPollingSource;
6467
import org.springframework.integration.scheduling.PollerMetadata;
6568
import org.springframework.integration.support.MessageBuilder;
69+
import org.springframework.integration.test.rule.Log4j2LevelAdjuster;
6670
import org.springframework.integration.test.util.TestUtils;
6771
import org.springframework.jms.connection.CachingConnectionFactory;
6872
import org.springframework.jms.core.JmsTemplate;
@@ -89,7 +93,7 @@
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

Comments
 (0)