Polishing

This commit is contained in:
Juergen Hoeller
2015-08-26 11:04:14 +02:00
parent 91b473fec5
commit e05fb494f5
6 changed files with 41 additions and 46 deletions

View File

@@ -61,10 +61,12 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
return new AnnotationConfigApplicationContext(EnableCachingConfig.class);
}
@Test
public void fullCachingConfig() throws Exception {
AnnotationConfigApplicationContext context =
new AnnotationConfigApplicationContext(FullCachingConfig.class);
DefaultJCacheOperationSource cos = context.getBean(DefaultJCacheOperationSource.class);
assertSame(context.getBean(KeyGenerator.class), cos.getKeyGenerator());
assertSame(context.getBean("cacheResolver", CacheResolver.class),
@@ -103,14 +105,14 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
@Test
public void exceptionCacheResolverLazilyRequired() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
NoExceptionCacheResolverConfig.class);
ConfigurableApplicationContext context =
new AnnotationConfigApplicationContext(NoExceptionCacheResolverConfig.class);
try {
DefaultJCacheOperationSource cos = context.getBean(DefaultJCacheOperationSource.class);
assertSame(context.getBean("cacheResolver"), cos.getCacheResolver());
JCacheableService<?> service = context.getBean(JCacheableService.class);
service.cache("id");
// This call requires the cache manager to be set
@@ -149,11 +151,11 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
}
}
@Configuration
@EnableCaching
public static class FullCachingConfig implements JCacheConfigurer {
@Override
@Bean
public CacheManager cacheManager() {
@@ -185,6 +187,7 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
}
}
@Configuration
@EnableCaching
public static class EmptyConfigSupportConfig extends JCacheConfigurerSupport {
@@ -194,6 +197,7 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
}
}
@Configuration
@EnableCaching
static class FullCachingConfigSupport extends JCacheConfigurerSupport {
@@ -223,6 +227,7 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
}
}
@Configuration
@EnableCaching
static class NoExceptionCacheResolverConfig extends JCacheConfigurerSupport {