Examples of RedisConnectionFactory


Examples of org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory

   * @return object returned by the action
   */
  public <T> T execute(RedisCallback<T> action, boolean exposeConnection, boolean pipeline) {
    Assert.notNull(action, "Callback object must not be null");

    RedisConnectionFactory factory = getConnectionFactory();
    RedisConnection conn = RedisConnectionUtils.getConnection(factory);

    boolean existingConnection = TransactionSynchronizationManager.hasResource(factory);
    preProcessConnection(conn, existingConnection);

View Full Code Here

Examples of org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory

  }


  @Override
  public <T> T execute(SessionCallback<T> session) {
    RedisConnectionFactory factory = getConnectionFactory();
    // bind connection
    RedisConnectionUtils.bindConnection(factory);
    try {
      return session.execute(this);
    } finally {
View Full Code Here

Examples of org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory

  public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("config.xml", RedisHashDemo.class);
   
    // clear out old test data first
    RedisConnectionFactory connectionFactory = context.getBean(RedisConnectionFactory.class);
    RedisTemplate<String, String> redisTemplate = new RedisTemplate<String, String>(connectionFactory);
    Set<String> keys = redisTemplate.keys(RedisHashPersonRepository.REDIS_KEY_PATTERN);
    if (keys != null && keys.size() > 0) {
      redisTemplate.delete(keys);
    }
View Full Code Here

Examples of org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory

  public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("config.xml", RedisSetDemo.class);
   
    // clear out old test data first
    RedisConnectionFactory connectionFactory = context.getBean(RedisConnectionFactory.class);
    new RedisTemplate<String, Person>(connectionFactory)
        .delete(Collections.singletonList(RedisSetPersonRepository.REDIS_KEY));
   
    PersonRepository personRepository = context.getBean(RedisSetPersonRepository.class);
   
View Full Code Here

Examples of org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory

public class SessionTest {

  @Test
  public void testSession() throws Exception {
    final RedisConnection conn = mock(RedisConnection.class);
    RedisConnectionFactory factory = mock(RedisConnectionFactory.class);

    when(factory.getConnection()).thenReturn(conn);
    final StringRedisTemplate template = new StringRedisTemplate(factory);

    template.execute(new SessionCallback<Object>() {
      @Override
      public Object execute(RedisOperations operations) {
View Full Code Here

Examples of org.springframework.data.redis.connection.RedisConnectionFactory

  private static String deployerQueue = "queue.deployer." + System.currentTimeMillis();

  @Test
  public void testProcessor() throws Exception {
    RedisConnectionFactory connectionFactory = redisAvailableRule.getResource();
    RedisQueueOutboundChannelAdapter adapter = new RedisQueueOutboundChannelAdapter(deployerQueue,
        connectionFactory);
    adapter.setBeanFactory(BusTestUtils.MOCK_BF);
    adapter.setExtractPayload(false);
    adapter.afterPropertiesSet();
View Full Code Here

Examples of org.springframework.data.redis.connection.RedisConnectionFactory

    adapter.handleMessage(message);
  }

  @Test
  public void testSimpleStream() throws Exception {
    RedisConnectionFactory connectionFactory = redisAvailableRule.getResource();
    RedisQueueOutboundChannelAdapter adapter = new RedisQueueOutboundChannelAdapter(deployerQueue,
        connectionFactory);
    adapter.setBeanFactory(BusTestUtils.MOCK_BF);
    adapter.setExtractPayload(false);
    adapter.afterPropertiesSet();
View Full Code Here

Examples of org.springframework.data.redis.connection.RedisConnectionFactory

      cf.setPort(6379);
      cf.afterPropertiesSet();
      return cf;
    }
    catch (RedisConnectionFailureException e) {
      RedisConnectionFactory mockCF = mock(RedisConnectionFactory.class);
      when(mockCF.getConnection()).thenReturn(mock(RedisConnection.class));
      return mockCF;
    }
  }
View Full Code Here

Examples of org.springframework.data.redis.connection.RedisConnectionFactory

      cf.setPort(6379);
      cf.afterPropertiesSet();
      return cf;
    }
    catch (RedisConnectionFailureException e) {
      RedisConnectionFactory mockCF = mock(RedisConnectionFactory.class);
      when(mockCF.getConnection()).thenReturn(mock(RedisConnection.class));
      return mockCF;
    }
  }
View Full Code Here

Examples of org.springframework.data.redis.connection.RedisConnectionFactory

      cf.getConnection().close();
      return cf;
    } // The following is to have setup properly finishing
    // The actual test(s) won't be executed thx to RedisAvailableRule
    catch (RedisConnectionFailureException e) {
      RedisConnectionFactory mockCF = mock(RedisConnectionFactory.class);
      when(mockCF.getConnection()).thenReturn(mock(RedisConnection.class));
      return mockCF;
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.