Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.cache.config;
|
||||
|
||||
/**
|
||||
* Basic service interface.
|
||||
* Basic service interface for caching tests.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Phillip Webb
|
||||
@@ -83,7 +83,6 @@ public interface CacheableService<T> {
|
||||
|
||||
T throwUncheckedSync(Object arg1);
|
||||
|
||||
// multi annotations
|
||||
T multiCache(Object arg1);
|
||||
|
||||
T multiEvict(Object arg1);
|
||||
@@ -95,4 +94,5 @@ public interface CacheableService<T> {
|
||||
T multiUpdate(Object arg1);
|
||||
|
||||
TestEntity putRefersToResult(TestEntity arg1);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,7 +25,7 @@ import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.annotation.Caching;
|
||||
|
||||
/**
|
||||
* Simple cacheable service
|
||||
* Simple cacheable service.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Phillip Webb
|
||||
@@ -34,8 +34,10 @@ import org.springframework.cache.annotation.Caching;
|
||||
public class DefaultCacheableService implements CacheableService<Long> {
|
||||
|
||||
private final AtomicLong counter = new AtomicLong();
|
||||
|
||||
private final AtomicLong nullInvocations = new AtomicLong();
|
||||
|
||||
|
||||
@Override
|
||||
@Cacheable("testCache")
|
||||
public Long cache(Object arg1) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -65,8 +65,6 @@ public class EnableCachingTests extends AbstractCacheAnnotationTests {
|
||||
assertSame(this.ctx.getBean("errorHandler", CacheErrorHandler.class), ci.getErrorHandler());
|
||||
}
|
||||
|
||||
// --- local tests -------
|
||||
|
||||
@Test
|
||||
public void singleCacheManagerBean() throws Throwable {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
@@ -92,7 +90,7 @@ public class EnableCachingTests extends AbstractCacheAnnotationTests {
|
||||
public void multipleCacheManagerBeans_implementsCachingConfigurer() {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
ctx.register(MultiCacheManagerConfigurer.class);
|
||||
ctx.refresh(); // does not throw
|
||||
ctx.refresh(); // does not throw an exception
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@@ -125,22 +123,17 @@ public class EnableCachingTests extends AbstractCacheAnnotationTests {
|
||||
|
||||
@Test
|
||||
public void emptyConfigSupport() {
|
||||
ConfigurableApplicationContext context =
|
||||
new AnnotationConfigApplicationContext(EmptyConfigSupportConfig.class);
|
||||
|
||||
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EmptyConfigSupportConfig.class);
|
||||
CacheInterceptor ci = context.getBean(CacheInterceptor.class);
|
||||
assertNotNull(ci.getCacheResolver());
|
||||
assertEquals(SimpleCacheResolver.class, ci.getCacheResolver().getClass());
|
||||
assertSame(context.getBean(CacheManager.class),
|
||||
((SimpleCacheResolver)ci.getCacheResolver()).getCacheManager());
|
||||
assertSame(context.getBean(CacheManager.class), ((SimpleCacheResolver)ci.getCacheResolver()).getCacheManager());
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bothSetOnlyResolverIsUsed() {
|
||||
ConfigurableApplicationContext context =
|
||||
new AnnotationConfigApplicationContext(FullCachingConfig.class);
|
||||
|
||||
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(FullCachingConfig.class);
|
||||
CacheInterceptor ci = context.getBean(CacheInterceptor.class);
|
||||
assertSame(context.getBean("cacheResolver"), ci.getCacheResolver());
|
||||
assertSame(context.getBean("keyGenerator"), ci.getKeyGenerator());
|
||||
|
||||
Reference in New Issue
Block a user