use of com.fiftyonred.mock_jedis.MockJedis in project druid by druid-io.
the class RedisCacheProviderWithConfig method setUp.
@Before
public void setUp() {
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(cacheConfig.getMaxTotalConnections());
poolConfig.setMaxIdle(cacheConfig.getMaxIdleConnections());
poolConfig.setMinIdle(cacheConfig.getMinIdleConnections());
MockJedisPool pool = new MockJedisPool(poolConfig, "localhost");
// orginal MockJedis do not support 'milliseconds' in long type,
// for test we override to support it
pool.setClient(new MockJedis("localhost") {
@Override
public String psetex(byte[] key, long milliseconds, byte[] value) {
return this.psetex(key, (int) milliseconds, value);
}
});
cache = new RedisStandaloneCache(pool, cacheConfig);
}
Aggregations