use of org.springframework.cache.CacheManager in project spring-boot by spring-projects.
the class CachesEndpointTests method namedCacheWithSeveralCacheManagersWithCacheManagerFilter.
@Test
void namedCacheWithSeveralCacheManagersWithCacheManagerFilter() {
Map<String, CacheManager> cacheManagers = new LinkedHashMap<>();
cacheManagers.put("test", new ConcurrentMapCacheManager("b", "a"));
cacheManagers.put("another", new ConcurrentMapCacheManager("c", "a"));
CachesEndpoint endpoint = new CachesEndpoint(cacheManagers);
CacheEntry entry = endpoint.cache("a", "test");
assertThat(entry).isNotNull();
assertThat(entry.getCacheManager()).isEqualTo("test");
assertThat(entry.getName()).isEqualTo("a");
}
use of org.springframework.cache.CacheManager in project spring-boot by spring-projects.
the class CachesEndpointTests method clearCacheWithSeveralCacheManagersWithCacheManagerFilter.
@Test
void clearCacheWithSeveralCacheManagersWithCacheManagerFilter() {
Map<String, CacheManager> cacheManagers = new LinkedHashMap<>();
Cache a = mockCache("a");
Cache b = mockCache("b");
cacheManagers.put("test", cacheManager(a, b));
Cache anotherA = mockCache("a");
cacheManagers.put("another", cacheManager(anotherA));
CachesEndpoint endpoint = new CachesEndpoint(cacheManagers);
assertThat(endpoint.clearCache("a", "another")).isTrue();
then(a).should(never()).clear();
then(anotherA).should().clear();
then(b).should(never()).clear();
}
use of org.springframework.cache.CacheManager in project spring-boot by spring-projects.
the class CachesEndpointTests method namedCacheWithWrongCacheManager.
@Test
void namedCacheWithWrongCacheManager() {
Map<String, CacheManager> cacheManagers = new LinkedHashMap<>();
cacheManagers.put("test", new ConcurrentMapCacheManager("b", "a"));
cacheManagers.put("another", new ConcurrentMapCacheManager("c", "a"));
CachesEndpoint endpoint = new CachesEndpoint(cacheManagers);
CacheEntry entry = endpoint.cache("c", "test");
assertThat(entry).isNull();
}
Aggregations