org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration Java Examples
The following examples show how to use
org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RedisLockServiceAutoConfigurationTests.java From spring-cloud-cluster with Apache License 2.0 | 6 votes |
@Test public void testChangeTimeout() throws Exception { EnvironmentTestUtils .addEnvironment( this.context, "spring.cloud.cluster.redis.lock.expireAfter:1234"); context.register(RedisAutoConfiguration.class, RedisLockServiceAutoConfiguration.class); context.refresh(); RedisLockService service = context.getBean(RedisLockService.class); RedisLockRegistry redisLockRegistry = TestUtils.readField("redisLockRegistry", service); String registryKey = TestUtils.readField("registryKey", redisLockRegistry); Long expireAfter = TestUtils.readField("expireAfter", redisLockRegistry); assertThat(registryKey, is(RedisLockService.DEFAULT_REGISTRY_KEY)); assertThat(expireAfter, is(1234l)); }
Example #2
Source File: RedisLockServiceAutoConfigurationTests.java From spring-cloud-cluster with Apache License 2.0 | 5 votes |
@Test public void testDefaults() { EnvironmentTestUtils.addEnvironment(this.context); context.register(RedisAutoConfiguration.class, RedisLockServiceAutoConfiguration.class); context.refresh(); assertThat(context.containsBean("redisLockService"), is(true)); }
Example #3
Source File: RedisLockServiceAutoConfigurationTests.java From spring-cloud-cluster with Apache License 2.0 | 5 votes |
@Test public void testDisabled() throws Exception { EnvironmentTestUtils .addEnvironment( this.context, "spring.cloud.cluster.redis.lock.enabled:false"); context.register(RedisAutoConfiguration.class, RedisLockServiceAutoConfiguration.class); context.refresh(); assertThat(context.containsBean("redisLockService"), is(false)); }
Example #4
Source File: RedisLockServiceAutoConfigurationTests.java From spring-cloud-cluster with Apache License 2.0 | 5 votes |
@Test public void testGlobalLeaderDisabled() throws Exception { EnvironmentTestUtils .addEnvironment( this.context, "spring.cloud.cluster.lock.enabled:false", "spring.cloud.cluster.redis.lock.enabled:true"); context.register(RedisAutoConfiguration.class, RedisLockServiceAutoConfiguration.class); context.refresh(); assertThat(context.containsBean("redisLockService"), is(false)); }
Example #5
Source File: RedisLockServiceAutoConfigurationTests.java From spring-cloud-cluster with Apache License 2.0 | 5 votes |
@Test public void testChangeRole() throws Exception { EnvironmentTestUtils .addEnvironment( this.context, "spring.cloud.cluster.lock.role:foo"); context.register(RedisAutoConfiguration.class, RedisLockServiceAutoConfiguration.class); context.refresh(); RedisLockService service = context.getBean(RedisLockService.class); RedisLockRegistry redisLockRegistry = TestUtils.readField("redisLockRegistry", service); String registryKey = TestUtils.readField("registryKey", redisLockRegistry); assertThat(registryKey, is("foo")); }
Example #6
Source File: RedisIT.java From spring-cloud-cluster with Apache License 2.0 | 5 votes |
@Before public void setup() { context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context); context.register(RedisAutoConfiguration.class); context.refresh(); connectionFactory = context.getBean(RedisConnectionFactory.class); redisTemplate = new RedisTemplate<String, String>(); redisTemplate.setConnectionFactory(connectionFactory); redisTemplate.setKeySerializer(new StringRedisSerializer()); redisTemplate.setValueSerializer(new StringRedisSerializer()); redisTemplate.afterPropertiesSet(); cleanLocks(); }