Package org.springframework.data.redis.connection

Examples of org.springframework.data.redis.connection.RedisConnection.ping()


  @Test
  public void testConnect() {
    SrpConnectionFactory factory = new SrpConnectionFactory(SettingsUtils.getHost(), SettingsUtils.getPort());
    factory.afterPropertiesSet();
    RedisConnection connection = factory.getConnection();
    connection.ping();
  }

  @Test
  public void testConnectInvalidHost() {
    SrpConnectionFactory factory = new SrpConnectionFactory();
View Full Code Here


  public void testConnectWithPassword() {
    SrpConnectionFactory factory = new SrpConnectionFactory(SettingsUtils.getHost(), SettingsUtils.getPort());
    factory.setPassword("foob");
    factory.afterPropertiesSet();
    RedisConnection connection = factory.getConnection();
    connection.ping();
    RedisConnection connection2 = factory.getConnection();
    connection2.ping();
  }
}
View Full Code Here

    factory.setPassword("foob");
    factory.afterPropertiesSet();
    RedisConnection connection = factory.getConnection();
    connection.ping();
    RedisConnection connection2 = factory.getConnection();
    connection2.ping();
  }
}
View Full Code Here

  public void testConnectionStaysOpenWhenPooled() {
    JredisConnectionFactory factory2 = new JredisConnectionFactory(new JredisPool(SettingsUtils.getHost(),
        SettingsUtils.getPort()));
    RedisConnection conn2 = factory2.getConnection();
    conn2.close();
    conn2.ping();
  }

  @Test
  public void testConnectionNotReturnedOnException() {
    GenericObjectPoolConfig config = new GenericObjectPoolConfig();
View Full Code Here

    JredisConnectionFactory factory2 = new JredisConnectionFactory(new JredisPool(SettingsUtils.getHost(),
        SettingsUtils.getPort(), config));
    RedisConnection conn2 = factory2.getConnection();
    ((JRedis) conn2.getNativeConnection()).quit();
    try {
      conn2.ping();
      fail("Expected RedisConnectionFailureException trying to use a closed connection");
    } catch (RedisConnectionFailureException e) {}
    conn2.close();
    // Verify we get a new connection from the pool and not the broken one
    RedisConnection conn3 = factory2.getConnection();
View Full Code Here

      fail("Expected RedisConnectionFailureException trying to use a closed connection");
    } catch (RedisConnectionFailureException e) {}
    conn2.close();
    // Verify we get a new connection from the pool and not the broken one
    RedisConnection conn3 = factory2.getConnection();
    conn3.ping();
  }

  @Test(expected = UnsupportedOperationException.class)
  public void testMultiExec() throws Exception {
    super.testMultiExec();
View Full Code Here

  public void testConnectWithPassword() {
    factory.setPassword("foo");
    factory.afterPropertiesSet();
    RedisConnection conn = factory.getConnection();
    // Test shared and dedicated conns
    conn.ping();
    conn.bLPop(1, "key".getBytes());
    conn.close();
  }
}
View Full Code Here

    pool.afterPropertiesSet();
    LettuceConnectionFactory factory2 = new LettuceConnectionFactory(pool);
    factory2.afterPropertiesSet();
    RedisConnection connection = factory2.getConnection();
    // Use the connection to make sure the channel is initialized, else nothing happens on close
    connection.ping();
    connection.close();
    // The shared connection should not be closed
    connection.ping();

    // The dedicated connection should not be closed b/c it's part of a pool
View Full Code Here

    RedisConnection connection = factory2.getConnection();
    // Use the connection to make sure the channel is initialized, else nothing happens on close
    connection.ping();
    connection.close();
    // The shared connection should not be closed
    connection.ping();

    // The dedicated connection should not be closed b/c it's part of a pool
    connection.multi();
    connection.close();
    factory2.destroy();
View Full Code Here

    LettuceConnectionFactory factory2 = new LettuceConnectionFactory(pool);
    factory2.setShareNativeConnection(false);
    factory2.afterPropertiesSet();
    RedisConnection connection = factory2.getConnection();
    // Use the connection to make sure the channel is initialized, else nothing happens on close
    connection.ping();
    connection.close();
    // The dedicated connection should not be closed
    connection.ping();

    connection.close();
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.