Search in sources :

Example 1 with EhCacheCacheManager

use of org.springframework.cache.ehcache.EhCacheCacheManager in project spring-boot by spring-projects.

the class CacheAutoConfigurationTests method ehcacheCacheWithCaches.

@Test
public void ehcacheCacheWithCaches() {
    load(DefaultCacheConfiguration.class, "spring.cache.type=ehcache");
    EhCacheCacheManager cacheManager = validateCacheManager(EhCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames()).containsOnly("cacheTest1", "cacheTest2");
    assertThat(this.context.getBean(net.sf.ehcache.CacheManager.class)).isEqualTo(cacheManager.getCacheManager());
}
Also used : EhCacheCacheManager(org.springframework.cache.ehcache.EhCacheCacheManager) Test(org.junit.Test)

Example 2 with EhCacheCacheManager

use of org.springframework.cache.ehcache.EhCacheCacheManager in project spring-boot by spring-projects.

the class CacheAutoConfigurationTests method ehcacheCacheWithExistingCacheManager.

@Test
public void ehcacheCacheWithExistingCacheManager() {
    load(EhCacheCustomCacheManager.class, "spring.cache.type=ehcache");
    EhCacheCacheManager cacheManager = validateCacheManager(EhCacheCacheManager.class);
    assertThat(cacheManager.getCacheManager()).isEqualTo(this.context.getBean("customEhCacheCacheManager"));
}
Also used : EhCacheCacheManager(org.springframework.cache.ehcache.EhCacheCacheManager) Test(org.junit.Test)

Example 3 with EhCacheCacheManager

use of org.springframework.cache.ehcache.EhCacheCacheManager in project spring-boot by spring-projects.

the class CacheAutoConfigurationTests method ehcacheCacheWithConfig.

@Test
public void ehcacheCacheWithConfig() {
    load(DefaultCacheConfiguration.class, "spring.cache.type=ehcache", "spring.cache.ehcache.config=cache/ehcache-override.xml");
    EhCacheCacheManager cacheManager = validateCacheManager(EhCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames()).containsOnly("cacheOverrideTest1", "cacheOverrideTest2");
}
Also used : EhCacheCacheManager(org.springframework.cache.ehcache.EhCacheCacheManager) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 EhCacheCacheManager (org.springframework.cache.ehcache.EhCacheCacheManager)3