use of org.springframework.boot.actuate.cache.CachesEndpoint.CacheManagerDescriptor in project spring-boot by spring-projects.
the class CachesEndpointTests method allCachesWithSingleCacheManager.
@Test
void allCachesWithSingleCacheManager() {
CachesEndpoint endpoint = new CachesEndpoint(Collections.singletonMap("test", new ConcurrentMapCacheManager("a", "b")));
Map<String, CacheManagerDescriptor> allDescriptors = endpoint.caches().getCacheManagers();
assertThat(allDescriptors).containsOnlyKeys("test");
CacheManagerDescriptor descriptors = allDescriptors.get("test");
assertThat(descriptors.getCaches()).containsOnlyKeys("a", "b");
assertThat(descriptors.getCaches().get("a").getTarget()).isEqualTo(ConcurrentHashMap.class.getName());
assertThat(descriptors.getCaches().get("b").getTarget()).isEqualTo(ConcurrentHashMap.class.getName());
}
use of org.springframework.boot.actuate.cache.CachesEndpoint.CacheManagerDescriptor 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