Skip to content

Commit

Permalink
using the same instance of JedisMock for both default and read client
Browse files Browse the repository at this point in the history
  • Loading branch information
aravindanr committed Dec 5, 2020
1 parent 2b39a4d commit 317cfd0
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@
*/
package com.netflix.conductor.redis.configuration;

import com.netflix.conductor.redis.configuration.JedisCommandsConfigurer;
import com.netflix.conductor.redis.config.utils.RedisProperties;
import com.netflix.conductor.redis.jedis.JedisMock;
import com.netflix.conductor.redis.jedis.LocalHostSupplierProvider;
import com.netflix.conductor.redis.jedis.LocalhostHostSupplier;
import com.netflix.dyno.connectionpool.HostSupplier;
import com.netflix.dyno.connectionpool.TokenMapSupplier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.commands.JedisCommands;

import static com.netflix.conductor.redis.configuration.RedisCommonConfiguration.DEFAULT_CLIENT_INJECTION_NAME;
import static com.netflix.conductor.redis.configuration.RedisCommonConfiguration.READ_CLIENT_INJECTION_NAME;

@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "db", havingValue = "memory", matchIfMissing = true)
public class InMemoryRedisConfiguration extends JedisCommandsConfigurer {
public class InMemoryRedisConfiguration {

@Bean
public HostSupplier hostSupplier(RedisProperties properties) {
return new LocalHostSupplierProvider(properties).get();
return new LocalhostHostSupplier(properties);
}

@Override
protected JedisCommands createJedisCommands(RedisProperties properties, HostSupplier hostSupplier, TokenMapSupplier tokenMapSupplier) {
@Bean(name = {DEFAULT_CLIENT_INJECTION_NAME, READ_CLIENT_INJECTION_NAME})
public JedisMock jedisMock() {
return new JedisMock();
}
}

0 comments on commit 317cfd0

Please sign in to comment.