Some fixes and improvements
https://build.spring.io/browse/INT-MJATS41-629 * Revert to SF and SA BUILD-SNAPSHOTs * Upgrade to Spring Security 4.1 * Fix `RedisQueueMessageDrivenEndpointTests.testInt3442ProperlyStop()` for `atLeastOnce()` verification because in between stop and the last `rightPush` there might be one more `pop` and push again because of `listening = false` state * There is still sporadic `OutboundGatewayFunctionTests.testLazyContainerWithDest()`, so revise all the JMS tests for: - proper `ApplicationContext.stop()` in the end of test - `@DirtiesContext` if `SpringJUnit4ClassRunner` is in use - `TaskScheduler.destroy()` if that The JMS fix might relate to the https://jira.spring.io/browse/INT-4030, therefore consider this fix for cherry-picking into `4.2.x` (excluding `build.gradle` changes)
This commit is contained in:
@@ -133,15 +133,15 @@ subprojects { subproject ->
|
||||
slf4jVersion = "1.7.21"
|
||||
tomcatVersion = "8.0.33"
|
||||
smackVersion = '4.1.7'
|
||||
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '1.6.0.RC1'
|
||||
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '1.6.0.BUILD-SNAPSHOT'
|
||||
springDataJpaVersion = '1.10.1.RELEASE'
|
||||
springDataMongoVersion = '1.9.1.RELEASE'
|
||||
springDataRedisVersion = '1.7.1.RELEASE'
|
||||
springGemfireVersion = '1.8.1.RELEASE'
|
||||
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '4.0.3.RELEASE'
|
||||
springSecurityVersion = '4.1.0.RELEASE'
|
||||
springSocialTwitterVersion = '1.1.2.RELEASE'
|
||||
springRetryVersion = '1.1.2.RELEASE'
|
||||
springVersion = project.hasProperty('springVersion') ? project.springVersion : '4.3.0.RC2'
|
||||
springVersion = project.hasProperty('springVersion') ? project.springVersion : '4.3.0.BUILD-SNAPSHOT'
|
||||
springWsVersion = '2.3.0.RELEASE'
|
||||
xmlUnitVersion = '1.6'
|
||||
xstreamVersion = '1.4.7'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -93,6 +93,7 @@ public class ChannelPublishingJmsMessageListenerTests {
|
||||
ErrorMessage received = (ErrorMessage) errorChannel.receive(0);
|
||||
assertNotNull(received);
|
||||
assertThat(received.getPayload().getMessage(), startsWith("Inbound conversion failed"));
|
||||
listener.stop();
|
||||
}
|
||||
|
||||
private void startBackgroundReplier(final PollableChannel channel) {
|
||||
@@ -114,9 +115,11 @@ public class ChannelPublishingJmsMessageListenerTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
public javax.jms.Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
|
||||
public javax.jms.Message toMessage(Object object, Session session)
|
||||
throws JMSException, MessageConversionException {
|
||||
return new StubTextMessage("test-to");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -71,7 +71,7 @@ import org.springframework.util.ObjectUtils;
|
||||
*/
|
||||
public class JmsOutboundGatewayTests extends LogAdjustingTestSupport {
|
||||
|
||||
final Log logger = LogFactory.getLog(this.getClass());
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
@Test
|
||||
public void testContainerBeanNameWhenNoGatewayBeanName() {
|
||||
@@ -268,6 +268,7 @@ public class JmsOutboundGatewayTests extends LogAdjustingTestSupport {
|
||||
org.springframework.messaging.Message<?> received = queueChannel.receive(20000);
|
||||
assertNotNull(received);
|
||||
assertEquals("bar", received.getPayload());
|
||||
gateway.stop();
|
||||
connectionFactory1.destroy();
|
||||
connectionFactory2.destroy();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -38,6 +39,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@DirtiesContext
|
||||
public class JmsOutboundInsideChainTests {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -143,8 +143,10 @@ public class OutboundGatewayConnectionTests {
|
||||
assertTrue(latch4.await(10, TimeUnit.SECONDS));
|
||||
assertNotNull(reply.get());
|
||||
|
||||
broker.stop();
|
||||
gateway.stop();
|
||||
broker.stop();
|
||||
|
||||
scheduler.destroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,7 +88,8 @@ public class OutboundGatewayFunctionTests extends LogAdjustingTestSupport {
|
||||
.thenReturn(scheduler);
|
||||
final JmsOutboundGateway gateway = new JmsOutboundGateway();
|
||||
gateway.setBeanFactory(beanFactory);
|
||||
gateway.setConnectionFactory(getConnectionFactory());
|
||||
ConnectionFactory connectionFactory = getConnectionFactory();
|
||||
gateway.setConnectionFactory(connectionFactory);
|
||||
gateway.setRequestDestination(requestQueue1);
|
||||
gateway.setReplyDestination(replyQueue1);
|
||||
gateway.setCorrelationKey("JMSCorrelationID");
|
||||
@@ -112,7 +113,7 @@ public class OutboundGatewayFunctionTests extends LogAdjustingTestSupport {
|
||||
});
|
||||
assertTrue(latch1.await(10, TimeUnit.SECONDS));
|
||||
JmsTemplate template = new JmsTemplate();
|
||||
template.setConnectionFactory(getConnectionFactory());
|
||||
template.setConnectionFactory(connectionFactory);
|
||||
template.setReceiveTimeout(5000);
|
||||
javax.jms.Message request = template.receive(requestQueue1);
|
||||
assertNotNull(request);
|
||||
@@ -128,6 +129,7 @@ public class OutboundGatewayFunctionTests extends LogAdjustingTestSupport {
|
||||
assertNotNull(reply.get());
|
||||
|
||||
gateway.stop();
|
||||
scheduler.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -180,6 +182,7 @@ public class OutboundGatewayFunctionTests extends LogAdjustingTestSupport {
|
||||
assertNotNull(reply.get());
|
||||
|
||||
gateway.stop();
|
||||
scheduler.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -232,6 +235,7 @@ public class OutboundGatewayFunctionTests extends LogAdjustingTestSupport {
|
||||
assertNotNull(reply.get());
|
||||
|
||||
gateway.stop();
|
||||
scheduler.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -284,6 +288,7 @@ public class OutboundGatewayFunctionTests extends LogAdjustingTestSupport {
|
||||
assertNotNull(reply.get());
|
||||
|
||||
gateway.stop();
|
||||
scheduler.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -336,6 +341,7 @@ public class OutboundGatewayFunctionTests extends LogAdjustingTestSupport {
|
||||
assertNotNull(reply.get());
|
||||
|
||||
gateway.stop();
|
||||
scheduler.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -388,6 +394,7 @@ public class OutboundGatewayFunctionTests extends LogAdjustingTestSupport {
|
||||
assertNotNull(reply.get());
|
||||
|
||||
gateway.stop();
|
||||
scheduler.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -452,10 +459,12 @@ public class OutboundGatewayFunctionTests extends LogAdjustingTestSupport {
|
||||
|
||||
gateway.stop();
|
||||
assertFalse(container.isRunning());
|
||||
scheduler.destroy();
|
||||
}
|
||||
|
||||
private ConnectionFactory getConnectionFactory() {
|
||||
ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
|
||||
ActiveMQConnectionFactory activeMQConnectionFactory =
|
||||
new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
|
||||
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(activeMQConnectionFactory);
|
||||
cachingConnectionFactory.setCacheConsumers(false);
|
||||
return cachingConnectionFactory;
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
@@ -43,6 +44,7 @@ import org.springframework.util.ErrorHandler;
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@DirtiesContext
|
||||
public class DefaultConfigurationTests {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.channel.AbstractMessageChannel;
|
||||
import org.springframework.integration.channel.ChannelInterceptorAware;
|
||||
@@ -43,13 +43,14 @@ public class GlobalChannelInterceptorTests {
|
||||
@Test
|
||||
public void testJmsChannel() {
|
||||
ActiveMqTestUtils.prepare();
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"GlobalChannelInterceptorTests-context.xml", GlobalChannelInterceptorTests.class);
|
||||
ChannelInterceptorAware jmsChannel = context.getBean("jmsChannel", AbstractMessageChannel.class);
|
||||
List<ChannelInterceptor> interceptors = jmsChannel.getChannelInterceptors();
|
||||
assertNotNull(interceptors);
|
||||
assertEquals(1, interceptors.size());
|
||||
assertTrue(interceptors.get(0) instanceof SampleInterceptor);
|
||||
context.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.history.MessageHistory;
|
||||
import org.springframework.integration.jms.SubscribableJmsChannel;
|
||||
@@ -67,17 +67,21 @@ public class JmsChannelHistoryTests {
|
||||
}).when(template).convertAndSend(Mockito.any(Message.class));
|
||||
channel.send(message);
|
||||
verify(template, times(1)).convertAndSend(Mockito.any(Message.class));
|
||||
channel.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFullConfig() throws Exception {
|
||||
ActiveMqTestUtils.prepare();
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("JmsChannelHistoryTests-context.xml", this.getClass());
|
||||
ConfigurableApplicationContext ac =
|
||||
new ClassPathXmlApplicationContext("JmsChannelHistoryTests-context.xml", this.getClass());
|
||||
SubscribableChannel channel = ac.getBean("jmsChannel", SubscribableChannel.class);
|
||||
PollableChannel resultChannel = ac.getBean("resultChannel", PollableChannel.class);
|
||||
channel.send(new GenericMessage<String>("hello"));
|
||||
Message<?> resultMessage = resultChannel.receive(5000);
|
||||
Message<?> resultMessage = resultChannel.receive(10000);
|
||||
MessageHistory history = MessageHistory.read(resultMessage);
|
||||
assertTrue(history.get(0).contains("jmsChannel"));
|
||||
ac.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -30,6 +30,7 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -39,6 +40,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext
|
||||
public class JmsDynamicDestinationTests {
|
||||
|
||||
@Autowired
|
||||
@@ -100,6 +102,7 @@ public class JmsDynamicDestinationTests {
|
||||
public String two(String message) {
|
||||
return message + "!!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -41,6 +42,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext
|
||||
public class JmsHeaderEnricherTests {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -38,10 +38,11 @@ import org.springframework.messaging.PollableChannel;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
public class JmsInboundChannelAdapterParserTests {
|
||||
|
||||
long timeoutOnReceive = 3000;
|
||||
private long timeoutOnReceive = 3000;
|
||||
|
||||
@Test
|
||||
public void adapterWithJmsTemplate() {
|
||||
@@ -56,7 +57,6 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
assertEquals("jms:inbound-channel-adapter", componentHistoryRecord.get("type"));
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("polling-test", message.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"jmsInboundWithJmsTemplate.xml", this.getClass());
|
||||
JmsTemplate jmsTemplate =
|
||||
TestUtils.getPropertyValue(context.getBean("inboundAdapterWithoutJmsTemplate"), "source.jmsTemplate", JmsTemplate.class);
|
||||
TestUtils.getPropertyValue(context.getBean("inboundAdapterWithoutJmsTemplate"),
|
||||
"source.jmsTemplate", JmsTemplate.class);
|
||||
assertTrue(jmsTemplate.isSessionTransacted());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
assertEquals("polling-test", message.getPayload());
|
||||
assertFalse(TestUtils.getPropertyValue(context.getBean("adapter"), "source.jmsTemplate", JmsTemplate.class)
|
||||
.isSessionTransacted());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@@ -93,7 +92,6 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
Message<?> message = output.receive(timeoutOnReceive);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("polling-test", message.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@@ -115,14 +113,13 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void adpaterWithDestinationAndDefaultConnectionFactory() {
|
||||
public void testAdapterWithDestinationAndDefaultConnectionFactory() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"jmsInboundWithDestinationAndDefaultConnectionFactory.xml", this.getClass());
|
||||
PollableChannel output = (PollableChannel) context.getBean("output");
|
||||
Message<?> message = output.receive(timeoutOnReceive);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("polling-test", message.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@@ -139,7 +136,6 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
Message<?> message = output.receive(timeoutOnReceive);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("polling-test", message.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@@ -152,8 +148,7 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("polling-test", message.getPayload());
|
||||
assertEquals("foo", message.getHeaders().get("testProperty"));
|
||||
assertEquals(new Integer(123), message.getHeaders().get("testAttribute"));
|
||||
context.stop();
|
||||
assertEquals(123, message.getHeaders().get("testAttribute"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@@ -165,7 +160,6 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
Message<?> message = output.receive(timeoutOnReceive);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("test [with selector: TestProperty = 'foo']", message.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@@ -187,7 +181,6 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
Message<?> message = output.receive(timeoutOnReceive);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("converted-test", message.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@@ -199,7 +192,6 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
Message<?> message = output.receive(timeoutOnReceive);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("converted-test", message.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,18 +48,22 @@ public class JmsMessageHistoryTests {
|
||||
@Test
|
||||
public void testInboundAdapter() throws Exception {
|
||||
ActiveMqTestUtils.prepare();
|
||||
ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("MessageHistoryTests-context.xml", JmsMessageHistoryTests.class);
|
||||
ConfigurableApplicationContext applicationContext =
|
||||
new ClassPathXmlApplicationContext("MessageHistoryTests-context.xml", JmsMessageHistoryTests.class);
|
||||
SampleGateway gateway = applicationContext.getBean("sampleGateway", SampleGateway.class);
|
||||
PollableChannel jmsInputChannel = applicationContext.getBean("jmsInputChannel", PollableChannel.class);
|
||||
gateway.send("hello");
|
||||
Message<?> message = jmsInputChannel.receive(5000);
|
||||
Iterator<Properties> historyIterator = message.getHeaders().get(MessageHistory.HEADER_NAME, MessageHistory.class).iterator();
|
||||
Iterator<Properties> historyIterator = message.getHeaders()
|
||||
.get(MessageHistory.HEADER_NAME, MessageHistory.class)
|
||||
.iterator();
|
||||
Properties event1 = historyIterator.next();
|
||||
assertEquals("jms:inbound-channel-adapter", event1.getProperty(MessageHistory.TYPE_PROPERTY));
|
||||
assertEquals("sampleJmsInboundAdapter", event1.getProperty(MessageHistory.NAME_PROPERTY));
|
||||
Properties event2 = historyIterator.next();
|
||||
assertEquals("channel", event2.getProperty(MessageHistory.TYPE_PROPERTY));
|
||||
assertEquals("jmsInputChannel", event2.getProperty(MessageHistory.NAME_PROPERTY));
|
||||
applicationContext.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -115,6 +119,7 @@ public class JmsMessageHistoryTests {
|
||||
headers.remove("outbound_history");
|
||||
return headers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -136,6 +141,7 @@ public class JmsMessageHistoryTests {
|
||||
public String getComponentType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.jms.listener.SessionAwareMessageListener;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -44,6 +45,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext
|
||||
public class JmsPriorityTests {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.integration.jms.config;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -29,7 +29,7 @@ import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
@@ -50,7 +50,7 @@ public class JmsWithMarshallingMessageConverterTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void demoWithMarshallingConverter() {
|
||||
ActiveMqTestUtils.prepare();
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext(
|
||||
ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext(
|
||||
"JmsWithMarshallingMessageConverterTests-context.xml", JmsWithMarshallingMessageConverterTests.class);
|
||||
MessageChannel input = ac.getBean("outbound-gateway-channel", MessageChannel.class);
|
||||
PollableChannel output = ac.getBean("output", PollableChannel.class);
|
||||
@@ -60,6 +60,7 @@ public class JmsWithMarshallingMessageConverterTests {
|
||||
// check for couple of JMS headers, make sure they are present
|
||||
assertNotNull(headers.get("jms_redelivered"));
|
||||
assertEquals("HELLO", replyMessage.getPayload());
|
||||
ac.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +88,7 @@ public class JmsWithMarshallingMessageConverterTests {
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +104,7 @@ public class JmsWithMarshallingMessageConverterTests {
|
||||
io.read(bytes);
|
||||
return new GenericMessage<String>(new String(bytes));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -37,6 +38,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext
|
||||
public class GatewaySerializedReplyChannelTests {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.internal.verification.VerificationModeFactory.atLeastOnce;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -116,7 +117,8 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests {
|
||||
|
||||
PollableChannel channel = new QueueChannel();
|
||||
|
||||
RedisQueueMessageDrivenEndpoint endpoint = new RedisQueueMessageDrivenEndpoint(queueName, this.connectionFactory);
|
||||
RedisQueueMessageDrivenEndpoint endpoint =
|
||||
new RedisQueueMessageDrivenEndpoint(queueName, this.connectionFactory);
|
||||
endpoint.setBeanFactory(Mockito.mock(BeanFactory.class));
|
||||
endpoint.setOutputChannel(channel);
|
||||
endpoint.setReceiveTimeout(1000);
|
||||
@@ -274,15 +276,14 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests {
|
||||
|
||||
assertTrue(stopLatch.await(10, TimeUnit.SECONDS));
|
||||
|
||||
Mockito.verify(boundListOperations).rightPush(Mockito.any(byte[].class));
|
||||
Mockito.verify(boundListOperations, atLeastOnce()).rightPush(Mockito.any(byte[].class));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@RedisAvailable
|
||||
@SuppressWarnings("unchecked")
|
||||
@Ignore
|
||||
//JedisConnectionFactory doesn't support proper 'destroy()' and allows to create new fresh Redis connection
|
||||
@Ignore("JedisConnectionFactory doesn't support proper 'destroy()' and allows to create new fresh Redis connection")
|
||||
public void testInt3196Recovery() throws Exception {
|
||||
String queueName = "test.si.Int3196Recovery";
|
||||
QueueChannel channel = new QueueChannel();
|
||||
@@ -398,7 +399,8 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests {
|
||||
break;
|
||||
}
|
||||
Thread.sleep(100);
|
||||
} while (!endpoint.isListening());
|
||||
}
|
||||
while (!endpoint.isListening());
|
||||
|
||||
assertTrue(n < 100);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user