INT-3394: Use Jedis Client in Tests

JIRA: https://jira.spring.io/browse/INT-3394

INT-3394: Restore `awaitContainerSubscribed`
This commit is contained in:
Artem Bilan
2014-05-05 10:49:04 +03:00
committed by Gary Russell
parent 0e63ae0685
commit faf104e608
28 changed files with 77 additions and 91 deletions

View File

@@ -78,6 +78,7 @@ subprojects { subproject ->
jackson2Version = '2.3.2'
javaxActivationVersion = '1.1.1'
javaxMailVersion = '1.4.7'
jedisVersion = '2.4.2'
jmsApiVersion = '1.1-rev-1'
jpaApiVersion = '2.0.0'
jrubyVersion = '1.7.12'
@@ -85,7 +86,6 @@ subprojects { subproject ->
jsonpathVersion = '0.9.1'
junitVersion = '4.11'
jythonVersion = '2.5.3'
lettuceVersion = '2.3.3'
log4jVersion = '1.2.17'
mockitoVersion = '1.9.5'
mysqlVersion = '5.1.29'
@@ -268,7 +268,7 @@ project('spring-integration-file') {
testCompile project(":spring-integration-redis")
testCompile project(":spring-integration-redis").sourceSets.test.output
testCompile project(":spring-integration-gemfire")
testCompile "com.lambdaworks:lettuce:$lettuceVersion"
testCompile "redis.clients:jedis:$jedisVersion"
}
}
@@ -481,7 +481,7 @@ project('spring-integration-redis') {
exclude group: 'org.springframework', module: 'spring-core'
exclude group: 'org.springframework', module: 'spring-tx'
}
testCompile "com.lambdaworks:lettuce:$lettuceVersion"
testCompile "redis.clients:jedis:$jedisVersion"
testCompile "org.slf4j:slf4j-log4j12:$slf4jVersion"
}
}
@@ -584,7 +584,7 @@ project('spring-integration-twitter') {
compile("javax.activation:activation:$javaxActivationVersion", optional)
testCompile project(":spring-integration-redis")
testCompile project(":spring-integration-redis").sourceSets.test.output
testCompile "com.lambdaworks:lettuce:$lettuceVersion"
testCompile "redis.clients:jedis:$jedisVersion"
}
}

View File

@@ -60,7 +60,8 @@ public class SubscribableRedisChannelTests extends RedisAvailableTests {
channel.afterPropertiesSet();
channel.start();
this.awaitContainerSubscribed(TestUtils.getPropertyValue(channel, "container", RedisMessageListenerContainer.class));
this.awaitContainerSubscribed(TestUtils.getPropertyValue(channel, "container",
RedisMessageListenerContainer.class));
final CountDownLatch latch = new CountDownLatch(3);
MessageHandler handler = new MessageHandler() {
@@ -96,13 +97,15 @@ public class SubscribableRedisChannelTests extends RedisAvailableTests {
MessageListenerAdapter listener = channelMapping.entrySet().iterator().next().getValue().iterator().next();
Object delegate = TestUtils.getPropertyValue(listener, "delegate");
try {
ReflectionUtils.findMethod(delegate.getClass(), "handleMessage", String.class).invoke(delegate, "Hello, world!");
ReflectionUtils.findMethod(delegate.getClass(), "handleMessage", String.class).invoke(delegate,
"Hello, world!");
fail("Exception expected");
}
catch (InvocationTargetException e) {
Throwable cause = e.getCause();
assertNotNull(cause);
assertEquals("Dispatcher has no subscribers for redis-channel 'si.test.channel.no.subs' (dhnsChannel).", cause.getMessage());
assertEquals("Dispatcher has no subscribers for redis-channel 'si.test.channel.no.subs' (dhnsChannel).",
cause.getMessage());
}
}

View File

@@ -12,7 +12,7 @@
<int-redis:publish-subscribe-channel id="redisChannel" topic-name="si.test.topic"
serializer="redisSerializer"/>
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -16,9 +16,7 @@
package org.springframework.integration.redis.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -45,12 +43,13 @@ import org.springframework.messaging.support.GenericMessage;
* @author Gunnar Hillert
* @author Artem Bilan
*/
public class RedisChannelParserTests extends RedisAvailableTests{
public class RedisChannelParserTests extends RedisAvailableTests {
@Test
@RedisAvailable
public void testPubSubChannelConfig(){
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("RedisChannelParserTests-context.xml", this.getClass());
ClassPathXmlApplicationContext context =
new ClassPathXmlApplicationContext("RedisChannelParserTests-context.xml", this.getClass());
SubscribableChannel redisChannel = context.getBean("redisChannel", SubscribableChannel.class);
RedisConnectionFactory connectionFactory =
TestUtils.getPropertyValue(redisChannel, "connectionFactory", RedisConnectionFactory.class);
@@ -71,10 +70,12 @@ public class RedisChannelParserTests extends RedisAvailableTests{
@Test
@RedisAvailable
public void testPubSubChannelUsage() throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("RedisChannelParserTests-context.xml", this.getClass());
ClassPathXmlApplicationContext context =
new ClassPathXmlApplicationContext("RedisChannelParserTests-context.xml", this.getClass());
SubscribableChannel redisChannel = context.getBean("redisChannel", SubscribableChannel.class);
this.awaitContainerSubscribed(TestUtils.getPropertyValue(redisChannel, "container", RedisMessageListenerContainer.class));
this.awaitContainerSubscribed(TestUtils.getPropertyValue(redisChannel, "container",
RedisMessageListenerContainer.class));
final Message<?> m = new GenericMessage<String>("Hello Redis");

View File

@@ -17,7 +17,7 @@
<int:channel id="testErrorChannel" />
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -86,7 +86,8 @@ public class RedisInboundChannelAdapterParserTests extends RedisAvailableTests {
@RedisAvailable
public void testInboundChannelAdapterMessaging() throws Exception {
RedisInboundChannelAdapter adapter = context.getBean("adapter", RedisInboundChannelAdapter.class);
this.awaitContainerSubscribedWithPatterns(TestUtils.getPropertyValue(adapter, "container", RedisMessageListenerContainer.class));
this.awaitContainerSubscribedWithPatterns(TestUtils.getPropertyValue(adapter, "container",
RedisMessageListenerContainer.class));
RedisConnectionFactory connectionFactory = this.getConnectionFactoryForTest();

View File

@@ -27,7 +27,7 @@
<int:queue/>
</int:channel>
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -83,7 +83,8 @@ public class RedisOutboundChannelAdapterParserTests extends RedisAvailableTests
@RedisAvailable
public void testOutboundChannelAdapterMessaging() throws Exception{
MessageChannel sendChannel = context.getBean("sendChannel", MessageChannel.class);
this.awaitContainerSubscribed(TestUtils.getPropertyValue(fooInbound, "container", RedisMessageListenerContainer.class));
this.awaitContainerSubscribed(TestUtils.getPropertyValue(fooInbound, "container",
RedisMessageListenerContainer.class));
sendChannel.send(new GenericMessage<String>("Hello Redis"));
QueueChannel receiveChannel = context.getBean("receiveChannel", QueueChannel.class);
Message<?> message = receiveChannel.receive(5000);
@@ -102,7 +103,8 @@ public class RedisOutboundChannelAdapterParserTests extends RedisAvailableTests
@RedisAvailable
public void testOutboundChannelAdapterWithinChain() throws Exception{
MessageChannel sendChannel = context.getBean("redisOutboudChain", MessageChannel.class);
this.awaitContainerSubscribed(TestUtils.getPropertyValue(fooInbound, "container", RedisMessageListenerContainer.class));
this.awaitContainerSubscribed(TestUtils.getPropertyValue(fooInbound, "container",
RedisMessageListenerContainer.class));
sendChannel.send(new GenericMessage<String>("Hello Redis from chain"));
QueueChannel receiveChannel = context.getBean("receiveChannel", QueueChannel.class);
Message<?> message = receiveChannel.receive(5000);

View File

@@ -10,7 +10,7 @@
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
<bean id="redisConnectionFactory"
class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -8,7 +8,7 @@
http://www.springframework.org/schema/integration/redis http://www.springframework.org/schema/integration/redis/spring-integration-redis.xsd">
<bean id="redisConnectionFactory"
class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -16,7 +16,7 @@
<int:poller fixed-rate="2000" max-messages-per-poll="10"/>
</int-redis:store-inbound-channel-adapter>
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -16,11 +16,8 @@
package org.springframework.integration.redis.inbound;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import org.hamcrest.Matchers;
import org.junit.Test;
@@ -41,7 +38,7 @@ import org.springframework.messaging.Message;
* @author Artem Bilan
* @since 2.1
*/
public class RedisInboundChannelAdapterTests extends RedisAvailableTests{
public class RedisInboundChannelAdapterTests extends RedisAvailableTests {
@Test
@RedisAvailable
@@ -65,7 +62,8 @@ public class RedisInboundChannelAdapterTests extends RedisAvailableTests{
adapter.afterPropertiesSet();
adapter.start();
this.awaitContainerSubscribed(TestUtils.getPropertyValue(adapter, "container", RedisMessageListenerContainer.class));
this.awaitContainerSubscribed(TestUtils.getPropertyValue(adapter, "container",
RedisMessageListenerContainer.class));
StringRedisTemplate redisTemplate = new StringRedisTemplate(connectionFactory);
redisTemplate.afterPropertiesSet();
@@ -93,7 +91,8 @@ public class RedisInboundChannelAdapterTests extends RedisAvailableTests{
adapter.afterPropertiesSet();
adapter.start();
this.awaitContainerSubscribed(TestUtils.getPropertyValue(adapter, "container", RedisMessageListenerContainer.class));
this.awaitContainerSubscribed(TestUtils.getPropertyValue(adapter, "container",
RedisMessageListenerContainer.class));
RedisTemplate<?, ?> template = new RedisTemplate<Object, Object>();
template.setConnectionFactory(connectionFactory);

View File

@@ -10,7 +10,7 @@
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
<bean id="redisConnectionFactory"
class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -31,6 +31,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.hamcrest.Matchers;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
@@ -210,6 +211,8 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests {
@Test
@RedisAvailable
@SuppressWarnings("unchecked")
@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();

View File

@@ -85,7 +85,7 @@
<int:queue/>
</int:channel>
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -58,7 +58,7 @@
</int:channel>
<bean id="redisConnectionFactory"
class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -50,7 +50,7 @@
<bean id="redisConnectionFactory"
class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -16,11 +16,7 @@
package org.springframework.integration.redis.outbound;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.List;
@@ -43,8 +39,6 @@ import org.springframework.messaging.PollableChannel;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.lambdaworks.redis.protocol.CommandType;
/**
* @author Artem Bilan
* @author Gary Russell
@@ -81,7 +75,7 @@ public class RedisOutboundGatewayTests extends RedisAvailableTests {
@Test
@RedisAvailable
public void testPingPongCommand() {
this.pingChannel.send(MessageBuilder.withPayload("foo").setHeader(RedisHeaders.COMMAND, CommandType.PING).build());
this.pingChannel.send(MessageBuilder.withPayload("foo").setHeader(RedisHeaders.COMMAND, "PING").build());
Message<?> receive = this.replyChannel.receive(1000);
assertNotNull(receive);
assertTrue(Arrays.equals("PONG".getBytes(), (byte[]) receive.getPayload()));
@@ -93,14 +87,14 @@ public class RedisOutboundGatewayTests extends RedisAvailableTests {
final String queueName = "si.test.testRedisOutboundGateway";
String payload = "testing";
this.leftPushRightPopChannel.send(MessageBuilder.withPayload(payload)
.setHeader(RedisHeaders.COMMAND, CommandType.LPUSH)
.setHeader(RedisHeaders.COMMAND, "LPUSH")
.setHeader("queue", queueName)
.build());
Message<?> receive = this.replyChannel.receive(1000);
assertNotNull(receive);
this.leftPushRightPopChannel.send(MessageBuilder.withPayload(payload)
.setHeader(RedisHeaders.COMMAND, CommandType.RPOP)
.setHeader(RedisHeaders.COMMAND, "RPOP")
.setHeader("queue", queueName)
.build());
receive = this.replyChannel.receive(1000);
@@ -111,9 +105,10 @@ public class RedisOutboundGatewayTests extends RedisAvailableTests {
@Test
@RedisAvailable
public void testIncrementAtomicCommand() {
// Since 'atomicInteger' is lazy-init to avoid early Redis connection, we have to initialize it before send the INCR command.
// Since 'atomicInteger' is lazy-init to avoid early Redis connection,
// we have to initialize it before send the INCR command.
this.beanFactory.getBean("atomicInteger");
this.incrementAtomicIntegerChannel.send(MessageBuilder.withPayload(CommandType.INCR).build());
this.incrementAtomicIntegerChannel.send(MessageBuilder.withPayload("INCR").build());
Message<?> receive = this.replyChannel.receive(1000);
assertNotNull(receive);
assertEquals(11L, receive.getPayload());
@@ -128,17 +123,18 @@ public class RedisOutboundGatewayTests extends RedisAvailableTests {
@Test
@RedisAvailable
public void testGetCommand() {
this.setDelCommandChannel.send(MessageBuilder.withPayload(new String[]{"foo", "bar"}).setHeader(RedisHeaders.COMMAND, CommandType.SET).build());
this.setDelCommandChannel.send(MessageBuilder.withPayload(new String[]{"foo", "bar"})
.setHeader(RedisHeaders.COMMAND, "SET").build());
Message<?> receive = this.replyChannel.receive(1000);
assertNotNull(receive);
assertEquals("OK", receive.getPayload());
assertTrue(Arrays.equals("OK".getBytes(), (byte[]) receive.getPayload()));
this.getCommandChannel.send(MessageBuilder.withPayload("foo").build());
receive = this.replyChannel.receive(1000);
assertNotNull(receive);
assertTrue(Arrays.equals("bar".getBytes(), (byte[]) receive.getPayload()));
this.setDelCommandChannel.send(MessageBuilder.withPayload("foo").setHeader(RedisHeaders.COMMAND, CommandType.DEL).build());
this.setDelCommandChannel.send(MessageBuilder.withPayload("foo").setHeader(RedisHeaders.COMMAND, "DEL").build());
receive = this.replyChannel.receive(1000);
assertNotNull(receive);
assertEquals(1L, receive.getPayload());

View File

@@ -8,7 +8,7 @@
http://www.springframework.org/schema/integration/redis http://www.springframework.org/schema/integration/redis/spring-integration-redis.xsd">
<bean id="redisConnectionFactory"
class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -61,7 +61,7 @@
map-key-expression="headers['baz']"
collection-type="PROPERTIES"/>
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -20,7 +20,7 @@ import org.junit.rules.MethodRule;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
/**
* @author Oleg Zhurakousky
@@ -31,14 +31,14 @@ public final class RedisAvailableRule implements MethodRule {
public static final int REDIS_PORT = 6379;
static ThreadLocal<LettuceConnectionFactory> connectionFactoryResource = new ThreadLocal<LettuceConnectionFactory>();
static ThreadLocal<JedisConnectionFactory> connectionFactoryResource = new ThreadLocal<JedisConnectionFactory>();
public Statement apply(final Statement base, final FrameworkMethod method, Object target) {
RedisAvailable redisAvailable = method.getAnnotation(RedisAvailable.class);
if (redisAvailable != null) {
LettuceConnectionFactory connectionFactory = null;
JedisConnectionFactory connectionFactory = null;
try {
connectionFactory = new LettuceConnectionFactory();
connectionFactory = new JedisConnectionFactory();
connectionFactory.setPort(REDIS_PORT);
connectionFactory.afterPropertiesSet();
connectionFactory.getConnection();
@@ -63,7 +63,7 @@ public final class RedisAvailableRule implements MethodRule {
base.evaluate();
}
finally {
LettuceConnectionFactory connectionFactory = connectionFactoryResource.get();
JedisConnectionFactory connectionFactory = connectionFactoryResource.get();
connectionFactoryResource.remove();
if (connectionFactory != null) {
connectionFactory.destroy();

View File

@@ -21,7 +21,6 @@ import org.junit.Rule;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.BoundListOperations;
import org.springframework.data.redis.core.BoundZSetOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
@@ -45,7 +44,7 @@ public class RedisAvailableTests {
if (this.connectionFactory != null) {
return this.connectionFactory;
}
LettuceConnectionFactory connectionFactory = RedisAvailableRule.connectionFactoryResource.get();
RedisConnectionFactory connectionFactory = RedisAvailableRule.connectionFactoryResource.get();
this.connectionFactory = connectionFactory;
return connectionFactory;
}
@@ -59,7 +58,7 @@ public class RedisAvailableTests {
Thread.sleep(100);
}
assertTrue("RedisMessageListenerContainer Failed to Subscribe", n < 100);
// wait another second because of race condition in Lettuce
// wait another second because of race condition
Thread.sleep(1000);
}
@@ -73,7 +72,7 @@ public class RedisAvailableTests {
Thread.sleep(100);
}
assertTrue("RedisMessageListenerContainer Failed to Subscribe with patterns", n < 100);
// wait another second because of race condition in Lettuce
// wait another second because of race condition
Thread.sleep(1000);
}

View File

@@ -6,7 +6,11 @@
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd">
<beans:bean id="messageStore" class="org.springframework.integration.redis.store.RedisMessageStore">
<beans:constructor-arg value="#{T(org.springframework.integration.redis.store.DelayerHandlerRescheduleIntegrationTests).connectionFactory}"/>
<beans:constructor-arg>
<beans:bean class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<beans:property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</beans:bean>
</beans:constructor-arg>
</beans:bean>
<channel id="output">

View File

@@ -13,26 +13,18 @@
package org.springframework.integration.redis.store;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assert.*;
import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.handler.DelayHandler;
import org.springframework.integration.redis.rules.RedisAvailable;
import org.springframework.integration.redis.rules.RedisAvailableRule;
import org.springframework.integration.redis.rules.RedisAvailableTests;
import org.springframework.integration.store.MessageGroup;
import org.springframework.integration.store.MessageGroupStore;
@@ -52,23 +44,9 @@ public class DelayerHandlerRescheduleIntegrationTests extends RedisAvailableTest
public static final String DELAYER_ID = "delayerWithRedisMS";
public static LettuceConnectionFactory connectionFactory;
@Rule
public LongRunningIntegrationTest longTests = new LongRunningIntegrationTest();
@BeforeClass
public static void setup() {
connectionFactory = new LettuceConnectionFactory();
connectionFactory.setPort(RedisAvailableRule.REDIS_PORT);
connectionFactory.afterPropertiesSet();
}
@AfterClass
public static void tearDown() {
connectionFactory.destroy();
}
@Test
@RedisAvailable
public void testDelayerHandlerRescheduleWithRedisMessageStore() throws Exception {

View File

@@ -7,7 +7,7 @@
<bean id="cms" class="org.springframework.integration.redis.store.RedisChannelMessageStore">
<constructor-arg>
<bean class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>
</constructor-arg>
@@ -23,7 +23,7 @@
<bean id="priorityCms" class="org.springframework.integration.redis.store.RedisChannelPriorityMessageStore">
<constructor-arg>
<bean class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>
</constructor-arg>

View File

@@ -15,7 +15,7 @@
<constructor-arg ref="redisConnectionFactory"/>
</bean>
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>

View File

@@ -13,7 +13,7 @@
<bean id="redisLockRegistry" class="org.springframework.integration.redis.util.RedisLockRegistry">
<constructor-arg>
<bean class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>
</constructor-arg>
@@ -28,7 +28,7 @@
<bean id="redisLockRegistry2" class="org.springframework.integration.redis.util.RedisLockRegistry">
<constructor-arg>
<bean class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>
</constructor-arg>

View File

@@ -25,7 +25,7 @@
<constructor-arg name="connectionFactory" ref="redisConnectionFactory"/>
</bean>
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="port" value="#{T(org.springframework.integration.redis.rules.RedisAvailableRule).REDIS_PORT}"/>
</bean>