use of org.springframework.data.couchbase.cache.CouchbaseCacheConfiguration in project spring-boot by spring-projects.
the class CacheAutoConfigurationTests method couchbaseCacheWithCouchbaseCacheManagerBuilderCustomizer.
@Test
void couchbaseCacheWithCouchbaseCacheManagerBuilderCustomizer() {
this.contextRunner.withUserConfiguration(CouchbaseConfiguration.class).withPropertyValues("spring.cache.type=couchbase", "spring.cache.couchbase.expiration=15s").withBean(CouchbaseCacheManagerBuilderCustomizer.class, () -> (builder) -> builder.cacheDefaults(CouchbaseCacheConfiguration.defaultCacheConfig().entryExpiry(java.time.Duration.ofSeconds(10)))).run((context) -> {
CouchbaseCacheManager cacheManager = getCacheManager(context, CouchbaseCacheManager.class);
CouchbaseCacheConfiguration couchbaseCacheConfiguration = getDefaultCouchbaseCacheConfiguration(cacheManager);
assertThat(couchbaseCacheConfiguration.getExpiry()).isEqualTo(java.time.Duration.ofSeconds(10));
});
}
Aggregations