Package org.springframework.data.redis.connection

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


    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

      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

      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

      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

  public void redisIsUp() throws Exception {
    Properties info = new Properties();
    info.put("redis_version", "2.8.9");

    RedisConnection redisConnection = mock(RedisConnection.class);
    RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class);
    given(redisConnectionFactory.getConnection()).willReturn(redisConnection);
    given(redisConnection.info()).willReturn(info);
    RedisHealthIndicator healthIndicator = new RedisHealthIndicator(
        redisConnectionFactory);

    Health health = healthIndicator.health();
View Full Code Here

  }

  @Test
  public void redisIsDown() throws Exception {
    RedisConnection redisConnection = mock(RedisConnection.class);
    RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class);
    given(redisConnectionFactory.getConnection()).willReturn(redisConnection);
    given(redisConnection.info()).willThrow(
        new RedisConnectionFailureException("Connection failed"));
    RedisHealthIndicator healthIndicator = new RedisHealthIndicator(
        redisConnectionFactory);
View Full Code Here

      @Override
      public void evaluate() throws Throwable {

        WithRedisDriver withRedisDriver = description.getAnnotation(WithRedisDriver.class);
        RedisConnectionFactory redisConnectionFactory = getConnectionFactory();

        if (withRedisDriver != null && redisConnectionFactory != null) {

          boolean valid = true;
          for (RedisDriver driver : withRedisDriver.value()) {
View Full Code Here

    @SuppressWarnings({ "rawtypes" })
    @Bean
    public RedisTemplate redisTemplate() {

      RedisConnection connectionMock = mock(RedisConnection.class);
      RedisConnectionFactory factoryMock = mock(RedisConnectionFactory.class);

      when(factoryMock.getConnection()).thenReturn(connectionMock);

      RedisTemplate template = new RedisTemplate();
      template.setConnectionFactory(factoryMock);

      return template;
View Full Code Here

    @SuppressWarnings({ "rawtypes" })
    @Bean
    public RedisTemplate redisTemplate() {

      RedisConnection connectionMock = mock(RedisConnection.class);
      RedisConnectionFactory factoryMock = mock(RedisConnectionFactory.class);

      when(factoryMock.getConnection()).thenReturn(connectionMock);

      RedisTemplate template = new RedisTemplate();
      template.setConnectionFactory(factoryMock);

      return template;
View Full Code Here

TOP

Related Classes of org.springframework.data.redis.connection.RedisConnectionFactory

Copyright © 2018 www.massapicom. 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.