Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy authored and PhilippHeuer committed Jul 28, 2024
1 parent dab1110 commit df7a424
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ public void valueLoaderTest() {
@DisplayName("Tests the eviction of entries based on max size")
public void valueLoaderConcurrentTest() throws InterruptedException {
XanthicSpringCacheManager xanthicSpringCacheManager = (XanthicSpringCacheManager) cacheManager;
xanthicSpringCacheManager.registerCache("value-cache", spec -> {
xanthicSpringCacheManager.registerCache("value-cache-concurrent", spec -> {
spec.maxSize(100L);
});
Cache cache = Objects.requireNonNull(cacheManager.getCache("value-cache"));
Cache cache = Objects.requireNonNull(cacheManager.getCache("value-cache-concurrent"));

AtomicInteger callCounter = new AtomicInteger(0);
Callable<String> valueLoader = () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ public class CacheConfiguration {

@Bean
public CacheManager cacheManager() {
XanthicSpringCacheManager cacheManager = new XanthicSpringCacheManager(spec -> {
return new XanthicSpringCacheManager(spec -> {
spec.expiryType(ExpiryType.POST_ACCESS);
});
cacheManager.registerCache("my-custom-cache", spec -> {
spec.maxSize(10L);
});
return cacheManager;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ public void valueLoaderTest() {
@DisplayName("Tests the eviction of entries based on max size")
public void valueLoaderConcurrentTest() throws InterruptedException {
XanthicSpringCacheManager xanthicSpringCacheManager = (XanthicSpringCacheManager) cacheManager;
xanthicSpringCacheManager.registerCache("value-cache", spec -> {
xanthicSpringCacheManager.registerCache("value-cache-concurrent", spec -> {
spec.maxSize(100L);
});
Cache cache = Objects.requireNonNull(cacheManager.getCache("value-cache"));
Cache cache = Objects.requireNonNull(cacheManager.getCache("value-cache-concurrent"));

AtomicInteger callCounter = new AtomicInteger(0);
Callable<String> valueLoader = () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ public class CacheConfiguration {

@Bean
public CacheManager cacheManager() {
XanthicSpringCacheManager cacheManager = new XanthicSpringCacheManager(spec -> {
return new XanthicSpringCacheManager(spec -> {
spec.expiryType(ExpiryType.POST_ACCESS);
});
cacheManager.registerCache("my-custom-cache", spec -> {
spec.maxSize(10L);
});

return cacheManager;
}

}

0 comments on commit df7a424

Please sign in to comment.