Search in sources :

Example 41 with RedisConnectionFactory

use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-integration by spring-projects.

the class RedisQueueGatewayIntegrationTests method setup.

public void setup() {
    RedisConnectionFactory jcf = getConnectionFactoryForTest();
    jcf.getConnection().del(this.queueName);
}
Also used : RedisConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory)

Example 42 with RedisConnectionFactory

use of org.springframework.data.redis.connection.RedisConnectionFactory in project pivotal-cla by pivotalsoftware.

the class SessionConfig method cloudRedisConnectionFactory.

@Profile(GitHubClaProfiles.CLOUDFOUNDRY)
@Bean
public RedisConnectionFactory cloudRedisConnectionFactory() {
    CloudFactory cloudFactory = new CloudFactory();
    Cloud cloud = cloudFactory.getCloud();
    RedisConnectionFactory connectionFactory = cloud.getSingletonServiceConnector(RedisConnectionFactory.class, null);
    if (connectionFactory instanceof LettuceConnectionFactory) {
        ((LettuceConnectionFactory) connectionFactory).setShutdownTimeout(0);
    }
    return connectionFactory;
}
Also used : CloudFactory(org.springframework.cloud.CloudFactory) Cloud(org.springframework.cloud.Cloud) LettuceConnectionFactory(org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory) RedisConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory) Profile(org.springframework.context.annotation.Profile) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 43 with RedisConnectionFactory

use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-session by spring-projects.

the class AbstractHttpSessionListenerTests method createMockRedisConnection.

static RedisConnectionFactory createMockRedisConnection() {
    RedisConnectionFactory factory = mock(RedisConnectionFactory.class);
    RedisConnection connection = mock(RedisConnection.class);
    given(factory.getConnection()).willReturn(connection);
    given(connection.getConfig(anyString())).willReturn(new Properties());
    return factory;
}
Also used : Properties(java.util.Properties) RedisConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory) RedisConnection(org.springframework.data.redis.connection.RedisConnection)

Example 44 with RedisConnectionFactory

use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-session by spring-projects.

the class RedisHttpSessionConfigurationTests method primaryConnectionFactoryRedisConfig.

@Test
public void primaryConnectionFactoryRedisConfig() {
    registerAndRefresh(RedisConfig.class, PrimaryConnectionFactoryRedisConfig.class);
    RedisOperationsSessionRepository repository = this.context.getBean(RedisOperationsSessionRepository.class);
    RedisConnectionFactory redisConnectionFactory = this.context.getBean("primaryRedisConnectionFactory", RedisConnectionFactory.class);
    assertThat(repository).isNotNull();
    assertThat(redisConnectionFactory).isNotNull();
    RedisOperations redisOperations = (RedisOperations) ReflectionTestUtils.getField(repository, "sessionRedisOperations");
    assertThat(redisOperations).isNotNull();
    assertThat(ReflectionTestUtils.getField(redisOperations, "connectionFactory")).isEqualTo(redisConnectionFactory);
}
Also used : RedisOperations(org.springframework.data.redis.core.RedisOperations) RedisOperationsSessionRepository(org.springframework.session.data.redis.RedisOperationsSessionRepository) SpringSessionRedisConnectionFactory(org.springframework.session.data.redis.config.annotation.SpringSessionRedisConnectionFactory) RedisConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory) Test(org.junit.Test)

Example 45 with RedisConnectionFactory

use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-session by spring-projects.

the class RedisHttpSessionConfigurationXmlTests method connectionFactory.

static RedisConnectionFactory connectionFactory() {
    RedisConnectionFactory factory = mock(RedisConnectionFactory.class);
    RedisConnection connection = mock(RedisConnection.class);
    given(factory.getConnection()).willReturn(connection);
    given(connection.getConfig(anyString())).willReturn(new Properties());
    return factory;
}
Also used : Properties(java.util.Properties) RedisConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory) RedisConnection(org.springframework.data.redis.connection.RedisConnection)

Aggregations

RedisConnectionFactory (org.springframework.data.redis.connection.RedisConnectionFactory)100 Test (org.junit.Test)83 RedisAvailable (org.springframework.integration.redis.rules.RedisAvailable)62 GenericMessage (org.springframework.messaging.support.GenericMessage)22 BeanFactory (org.springframework.beans.factory.BeanFactory)19 StringRedisTemplate (org.springframework.data.redis.core.StringRedisTemplate)17 MessageGroup (org.springframework.integration.store.MessageGroup)14 SimpleMessageGroup (org.springframework.integration.store.SimpleMessageGroup)13 ArrayList (java.util.ArrayList)12 Properties (java.util.Properties)10 Message (org.springframework.messaging.Message)10 ApplicationContext (org.springframework.context.ApplicationContext)9 List (java.util.List)8 DefaultRedisList (org.springframework.data.redis.support.collections.DefaultRedisList)8 RedisList (org.springframework.data.redis.support.collections.RedisList)8 RedisConnection (org.springframework.data.redis.connection.RedisConnection)7 DefaultRedisZSet (org.springframework.data.redis.support.collections.DefaultRedisZSet)7 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)6 TypedTuple (org.springframework.data.redis.core.ZSetOperations.TypedTuple)6 LiteralExpression (org.springframework.expression.common.LiteralExpression)6