@Test void createCache_withMockedRedisConnectionFactory_createsAndDestroysConnectionFactory() throws Exception { RedisConnectionFactory connectionFactory = Mockito.mock( RedisConnectionFactory.class, Mockito.withSettings().extraInterfaces(DisposableBean.class)); RedisCacheFactory redisCacheFactory = new RedisCacheFactory() { @Override protected RedisConnectionFactory createConnectionClient(String hostName, int port) { assertThat(hostName).isEqualTo("someHost"); assertThat(port).isEqualTo(4711); return connectionFactory; } }; Cache cache = redisCacheFactory.createCache("test", "someHost", 4711); redisCacheFactory.destroy(); assertThat(cache).isNotNull(); assertThat(cache.getName()).isEqualTo("test"); assertThat(cache.getNativeCache()).isNotNull(); DisposableBean disposableBean = (DisposableBean) connectionFactory; Mockito.verify(disposableBean, Mockito.times(1)).destroy(); }
@Override public Cache createCache(String cacheName, String host, int port) throws Exception { return RedisCacheManager.builder(getConnectionFactory(host, port)).build() .getCache(cacheName); }
RedisCacheFactory extends AbstractCacheFactory<RedisConnectionFactory> { @Override public Cache createCache(String cacheName, String host, int port) throws Exception { return RedisCacheManager.builder(getConnectionFactory(host, port)).build() .getCache(cacheName); } }
RedisCacheFactory extends AbstractCacheFactory<RedisConnectionFactory> { @Override public Cache createCache(String cacheName, String host, int port) throws Exception { return RedisCacheManager.builder(getConnectionFactory(host, port)).build() .getCache(cacheName); } RedisCacheFactory();  RedisCacheFactory(Map<String, Integer> expiryTimePerCache, int expiryTime); }
RedisCacheFactory extends AbstractCacheFactory<RedisConnectionFactory> { @Override public Cache createCache(String cacheName, String host, int port) throws Exception { return RedisCacheManager.builder(getConnectionFactory(host, port)).build() .getCache(cacheName); } RedisCacheFactory();  RedisCacheFactory(Map<String, Integer> expiryTimePerCache, int expiryTime); @Override boolean isSupportingCacheArchitecture(String architecture); @Override Cache createCache(String cacheName, String host, int port); }
RedisCacheFactory extends AbstractCacheFactory<RedisConnectionFactory> { @Override public Cache createCache(String cacheName, String host, int port) throws Exception { return RedisCacheManager.builder(getConnectionFactory(host, port)).build() .getCache(cacheName); } RedisCacheFactory();  RedisCacheFactory(Map<String, Integer> expiryTimePerCache, int expiryTime); @Override boolean isSupportingCacheArchitecture(String architecture); @Override Cache createCache(String cacheName, String host, int port);  }