use of org.springframework.boot.actuate.cache.CachesEndpoint.CacheEntry in project spring-boot by spring-projects.
the class CachesEndpointTests method namedCacheWithUnknownCache.
@Test
void namedCacheWithUnknownCache() {
CachesEndpoint endpoint = new CachesEndpoint(Collections.singletonMap("test", new ConcurrentMapCacheManager("b", "a")));
CacheEntry entry = endpoint.cache("unknown", null);
assertThat(entry).isNull();
}
use of org.springframework.boot.actuate.cache.CachesEndpoint.CacheEntry in project spring-boot by spring-projects.
the class CachesEndpointWebExtension method cache.
@ReadOperation
public WebEndpointResponse<CacheEntry> cache(@Selector String cache, @Nullable String cacheManager) {
try {
CacheEntry entry = this.delegate.cache(cache, cacheManager);
int status = (entry != null) ? WebEndpointResponse.STATUS_OK : WebEndpointResponse.STATUS_NOT_FOUND;
return new WebEndpointResponse<>(entry, status);
} catch (NonUniqueCacheException ex) {
return new WebEndpointResponse<>(WebEndpointResponse.STATUS_BAD_REQUEST);
}
}
use of org.springframework.boot.actuate.cache.CachesEndpoint.CacheEntry in project spring-boot by spring-projects.
the class CachesEndpointTests method namedCacheWithSingleCacheManager.
@Test
void namedCacheWithSingleCacheManager() {
CachesEndpoint endpoint = new CachesEndpoint(Collections.singletonMap("test", new ConcurrentMapCacheManager("b", "a")));
CacheEntry entry = endpoint.cache("a", null);
assertThat(entry).isNotNull();
assertThat(entry.getCacheManager()).isEqualTo("test");
assertThat(entry.getName()).isEqualTo("a");
assertThat(entry.getTarget()).isEqualTo(ConcurrentHashMap.class.getName());
}
use of org.springframework.boot.actuate.cache.CachesEndpoint.CacheEntry 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.boot.actuate.cache.CachesEndpoint.CacheEntry 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