use of org.springframework.cache.CacheManager in project spring-boot by spring-projects.
the class AbstractCacheAutoConfigurationTests method getCacheManager.
protected <T extends CacheManager> T getCacheManager(AssertableApplicationContext loaded, Class<T> type) {
CacheManager cacheManager = loaded.getBean(CacheManager.class);
assertThat(cacheManager).as("Wrong cache manager type").isInstanceOf(type);
return type.cast(cacheManager);
}
use of org.springframework.cache.CacheManager in project spring-boot by spring-projects.
the class AutoConfigureCacheWithExistingCacheManagerIntegrationTests method shouldNotReplaceExistingCacheManager.
@Test
void shouldNotReplaceExistingCacheManager() {
CacheManager bean = this.applicationContext.getBean(CacheManager.class);
assertThat(bean).isInstanceOf(ConcurrentMapCacheManager.class);
}
use of org.springframework.cache.CacheManager in project spring-boot by spring-projects.
the class AutoConfigureCacheIntegrationTests method shouldConfigureNoOpCacheManager.
@Test
void shouldConfigureNoOpCacheManager() {
CacheManager bean = this.applicationContext.getBean(CacheManager.class);
assertThat(bean).isInstanceOf(NoOpCacheManager.class);
}
use of org.springframework.cache.CacheManager in project spring-boot by spring-projects.
the class CachesEndpointTests method namedCacheWithSeveralCacheManagers.
@Test
void namedCacheWithSeveralCacheManagers() {
Map<String, CacheManager> cacheManagers = new LinkedHashMap<>();
cacheManagers.put("test", new ConcurrentMapCacheManager("b", "dupe-cache"));
cacheManagers.put("another", new ConcurrentMapCacheManager("c", "dupe-cache"));
CachesEndpoint endpoint = new CachesEndpoint(cacheManagers);
assertThatExceptionOfType(NonUniqueCacheException.class).isThrownBy(() -> endpoint.cache("dupe-cache", null)).withMessageContaining("dupe-cache").withMessageContaining("test").withMessageContaining("another");
}
use of org.springframework.cache.CacheManager in project spring-boot by spring-projects.
the class CachesEndpointTests method allCachesWithSeveralCacheManagers.
@Test
void allCachesWithSeveralCacheManagers() {
Map<String, CacheManager> cacheManagers = new LinkedHashMap<>();
cacheManagers.put("test", new ConcurrentMapCacheManager("a", "b"));
cacheManagers.put("another", new ConcurrentMapCacheManager("a", "c"));
CachesEndpoint endpoint = new CachesEndpoint(cacheManagers);
Map<String, CacheManagerDescriptor> allDescriptors = endpoint.caches().getCacheManagers();
assertThat(allDescriptors).containsOnlyKeys("test", "another");
assertThat(allDescriptors.get("test").getCaches()).containsOnlyKeys("a", "b");
assertThat(allDescriptors.get("another").getCaches()).containsOnlyKeys("a", "c");
}
Aggregations