Examples of RedisConnectionFactory


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

  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

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

  }

  @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

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

      @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

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

    @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

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

    @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

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

  @Test
  public void testSession() throws Exception {
    final RedisConnection conn = mock(RedisConnection.class);
    final StringRedisConnection stringConn = mock(StringRedisConnection.class);
    RedisConnectionFactory factory = mock(RedisConnectionFactory.class);
    final StringRedisTemplate template = spy(new StringRedisTemplate(factory));
    when(factory.getConnection()).thenReturn(conn);
    doReturn(stringConn).when(template).preProcessConnection(eq(conn), anyBoolean());

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

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

   */
  public <T> T execute(RedisCallback<T> action, boolean exposeConnection, boolean pipeline) {
    Assert.isTrue(initialized, "template not initialized; call afterPropertiesSet() before using it");
    Assert.notNull(action, "Callback object must not be null");

    RedisConnectionFactory factory = getConnectionFactory();
    RedisConnection conn = null;
    try {

      if (enableTransactionSupport) {
        // only bind resources in case of potential transaction synchronization
View Full Code Here

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

  public <T> T execute(SessionCallback<T> session) {
    Assert.isTrue(initialized, "template not initialized; call afterPropertiesSet() before using it");
    Assert.notNull(session, "Callback object must not be null");

    RedisConnectionFactory factory = getConnectionFactory();
    // bind connection
    RedisConnectionUtils.bindConnection(factory, enableTransactionSupport);
    try {
      return session.execute(this);
    } finally {
View Full Code Here

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

  public List<Object> executePipelined(final SessionCallback<?> session, final RedisSerializer<?> resultSerializer) {
    Assert.isTrue(initialized, "template not initialized; call afterPropertiesSet() before using it");
    Assert.notNull(session, "Callback object must not be null");

    RedisConnectionFactory factory = getConnectionFactory();
    // bind connection
    RedisConnectionUtils.bindConnection(factory, enableTransactionSupport);
    try {
      return execute(new RedisCallback<List<Object>>() {
        public List<Object> doInRedis(RedisConnection connection) throws DataAccessException {
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.