Package org.springframework.data.redis.connection.jedis

Examples of org.springframework.data.redis.connection.jedis.JedisConnectionFactory


    public void setSerializer(RedisSerializer serializer) {
        this.serializer = serializer;
    }

    private RedisConnectionFactory createDefaultConnectionFactory() {
        JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
        managedConnectionFactory = true;

        if (host != null) {
            jedisConnectionFactory.setHostName(host);
        }
        if (port != null) {
            jedisConnectionFactory.setPort(port);
        }
        jedisConnectionFactory.afterPropertiesSet();
        connectionFactory = jedisConnectionFactory;
        return jedisConnectionFactory;
    }
View Full Code Here


    public void setSerializer(RedisSerializer serializer) {
        this.serializer = serializer;
    }

    private RedisConnectionFactory createDefaultConnectionFactory() {
        JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
        managedConnectionFactory = true;

        if (host != null) {
            jedisConnectionFactory.setHostName(host);
        }
        if (port != null) {
            jedisConnectionFactory.setPort(port);
        }
        jedisConnectionFactory.afterPropertiesSet();
        connectionFactory = jedisConnectionFactory;
        return jedisConnectionFactory;
    }
View Full Code Here

    public void setSerializer(RedisSerializer serializer) {
        this.serializer = serializer;
    }

    private RedisConnectionFactory createDefaultConnectionFactory() {
        JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
        managedConnectionFactory = true;

        if (host != null) {
            jedisConnectionFactory.setHostName(host);
        }
        if (port != null) {
            jedisConnectionFactory.setPort(port);
        }
        jedisConnectionFactory.afterPropertiesSet();
        connectionFactory = jedisConnectionFactory;
        return jedisConnectionFactory;
    }
View Full Code Here

    logger.info("Redis:");
    createService(VCAP_REDIS_SERVICE, "redis", "2.2");
    int tunnelPort = LOCAL_PORT + 3;
    createTunnelServer(VCAP_REDIS_SERVICE, tunnelPort);

    JedisConnectionFactory connectionFactory = new JedisConnectionFactory();
    connectionFactory.setHostName(LOCAL_HOST);
    connectionFactory.setPort(tunnelPort);
    connectionFactory.setPassword(svc_passwd);
    connectionFactory.setUsePool(true);
    connectionFactory.afterPropertiesSet();
    RedisTemplate<String, String> redisTemplate = new RedisTemplate<String, String>();
    redisTemplate.setConnectionFactory(connectionFactory);
    redisTemplate.afterPropertiesSet();

    ValueOperations<String, String> valueOps = redisTemplate.opsForValue();

    // Test data
    ObjectMapper objectMapper = new ObjectMapper();
    Map<String,Object> dataMap = null;
    try {
      dataMap = objectMapper.readValue(new File("data/load.json"), Map.class);
    } catch (IOException e) {
      e.printStackTrace();
    }
    List<Map<String, Object>> l = (List<Map<String, Object>>) dataMap.get("records");
    Map<String, String> values = new HashMap<String, String>();
    List<String> ids = new ArrayList<String>();
    for (Map<String, Object> m : l) {
      Map<String, Object> rec = (Map<String, Object>) m.get("record");
      String id = "rec-" + rec.get("_id");
      values.put(id, (String) rec.get("name"));
      ids.add(id);
    }
    valueOps.multiSet(values);

    List<String> names = valueOps.multiGet(ids);

    Assert.assertEquals("Did not load the data correctly", 200, names.size());

    connectionFactory.destroy();

    stopTunnelServer();
    removeService(VCAP_REDIS_SERVICE);
    logger.info("Time elapsed: " + (System.currentTimeMillis() - start) / 1000.0d + " sec");
  }
View Full Code Here

    public void setUp() throws Exception {
        redisServer = new RedisServer(6379);
        redisServer.start();

        JedisShardInfo shardInfo = new JedisShardInfo("localhost", 6379);
        connectionFactory = new JedisConnectionFactory();
        connectionFactory.setShardInfo(shardInfo);

        template = new StringRedisTemplate();
        template.setConnectionFactory(connectionFactory);
        template.afterPropertiesSet();
View Full Code Here

  @Inject
  private Environment environment;

  @Bean
  public RedisConnectionFactory redisConnectionFactory() {
    JedisConnectionFactory redis = new JedisConnectionFactory();
    redis.setHostName(environment.getProperty("redis.hostName"));
    redis.setPort(environment.getProperty("redis.port", Integer.class));
    redis.setPassword(environment.getProperty("redis.password"));
    return redis;
  }
View Full Code Here

    return new StringRedisTemplate(jedisConnectionFactory());
  }

  @Bean
  public JedisConnectionFactory jedisConnectionFactory() {
    return new JedisConnectionFactory();
  }
View Full Code Here

    public void setSerializer(RedisSerializer serializer) {
        this.serializer = serializer;
    }

    private RedisConnectionFactory createDefaultConnectionFactory() {
        JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
        managedConnectionFactory = true;

        if (host != null) {
            jedisConnectionFactory.setHostName(host);
        }
        if (port != null) {
            jedisConnectionFactory.setPort(port);
        }
        jedisConnectionFactory.afterPropertiesSet();
        connectionFactory = jedisConnectionFactory;
        return jedisConnectionFactory;
    }
View Full Code Here

    super("REDIS");
  }

  @Override
  protected void obtainResource() throws Exception {
    resource = new JedisConnectionFactory();
    resource.afterPropertiesSet();
    resource.getConnection().close();
  }
View Full Code Here

  @Rule
  public RedisTestSupport redisAvailableRule = new RedisTestSupport();

  @BeforeClass
  public static void setupConnection() {
    connectionFactory = new JedisConnectionFactory();
    connectionFactory.afterPropertiesSet();
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.redis.connection.jedis.JedisConnectionFactory

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.