Use Gradle test fixture support for spring-context-support
See gh-23550
This commit is contained in:
parent
61d4ee594d
commit
0335db23c9
|
|
@ -59,7 +59,13 @@ public class TestSourcesPlugin implements Plugin<Project> {
|
|||
* Projects which will not be automatically added as a test dependency.
|
||||
* <p>This is used to assist with the migration to Gradle test fixtures.
|
||||
*/
|
||||
private static final List<String> excludedProjects = Arrays.asList("spring-beans", "spring-core", "spring-context");
|
||||
private static final List<String> excludedProjects = Arrays.asList(
|
||||
"spring-beans",
|
||||
"spring-context",
|
||||
"spring-context-indexer",
|
||||
"spring-context-support",
|
||||
"spring-core"
|
||||
);
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -97,7 +103,7 @@ public class TestSourcesPlugin implements Plugin<Project> {
|
|||
dependencyProject.getPlugins().withType(JavaPlugin.class, plugin -> {
|
||||
JavaPluginConvention javaPlugin = dependencyProject.getConvention().getPlugin(JavaPluginConvention.class);
|
||||
SourceSetOutput test = javaPlugin.getSourceSets().findByName(SourceSet.TEST_SOURCE_SET_NAME).getOutput();
|
||||
// System.err.println(String.format("Adding test source dependencies from %s to %s", currentProject.getName(), dependencyProject.getName()));
|
||||
System.err.println(String.format("Adding test source dependencies from %s to %s", currentProject.getName(), dependencyProject.getName()));
|
||||
currentProject.getDependencies().add(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME, test);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ dependencies {
|
|||
testCompile(project(":spring-core")) // for CodeStyleAspect
|
||||
testCompile(project(":spring-test"))
|
||||
testCompile(testFixtures(project(":spring-context")))
|
||||
testCompile(testFixtures(project(":spring-context-support")))
|
||||
testCompile(testFixtures(project(":spring-core")))
|
||||
testCompile("javax.mail:javax.mail-api")
|
||||
testCompileOnly("org.aspectj:aspectjrt")
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ import org.springframework.cache.CacheManager;
|
|||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cache.concurrent.ConcurrentMapCache;
|
||||
import org.springframework.cache.config.AnnotatedJCacheableService;
|
||||
import org.springframework.cache.jcache.config.AbstractJCacheAnnotationTests;
|
||||
import org.springframework.cache.support.SimpleCacheManager;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.AdviceMode;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.contextsupport.testfixture.jcache.AbstractJCacheAnnotationTests;
|
||||
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
package org.springframework.cache.aspectj;
|
||||
|
||||
import org.springframework.cache.jcache.config.AbstractJCacheAnnotationTests;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.contextsupport.testfixture.jcache.AbstractJCacheAnnotationTests;
|
||||
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ import javax.cache.annotation.CacheValue;
|
|||
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.interceptor.SimpleKeyGenerator;
|
||||
import org.springframework.cache.jcache.config.JCacheableService;
|
||||
import org.springframework.cache.jcache.support.TestableCacheKeyGenerator;
|
||||
import org.springframework.cache.jcache.support.TestableCacheResolverFactory;
|
||||
import org.springframework.contextsupport.testfixture.cache.TestableCacheKeyGenerator;
|
||||
import org.springframework.contextsupport.testfixture.cache.TestableCacheResolverFactory;
|
||||
import org.springframework.contextsupport.testfixture.jcache.JCacheableService;
|
||||
|
||||
/**
|
||||
* Repository sample with a @CacheDefaults annotation
|
||||
|
|
|
|||
|
|
@ -25,4 +25,7 @@ dependencies {
|
|||
testRuntime("org.ehcache:ehcache")
|
||||
testRuntime("org.glassfish:javax.el")
|
||||
testRuntime("com.sun.mail:javax.mail")
|
||||
testFixturesApi("org.junit.jupiter:junit-jupiter-api")
|
||||
testFixturesImplementation("org.assertj:assertj-core")
|
||||
testFixturesImplementation("org.mockito:mockito-core")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import org.springframework.context.ConfigurableApplicationContext;
|
|||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.contextsupport.testfixture.jcache.JCacheableService;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.test.fixtures.cache.SomeKeyGenerator;
|
||||
import org.springframework.contextsupport.testfixture.jcache.AbstractJCacheAnnotationTests;
|
||||
import org.springframework.contextsupport.testfixture.jcache.JCacheableService;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.springframework.cache.jcache.interceptor.JCacheInterceptor;
|
|||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.contextsupport.testfixture.jcache.AbstractJCacheAnnotationTests;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package org.springframework.cache.jcache.config;
|
|||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.contextsupport.testfixture.jcache.AbstractJCacheAnnotationTests;
|
||||
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ import javax.cache.annotation.CacheValue;
|
|||
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.interceptor.SimpleKeyGenerator;
|
||||
import org.springframework.cache.jcache.config.JCacheableService;
|
||||
import org.springframework.cache.jcache.support.TestableCacheKeyGenerator;
|
||||
import org.springframework.cache.jcache.support.TestableCacheResolverFactory;
|
||||
import org.springframework.contextsupport.testfixture.cache.TestableCacheKeyGenerator;
|
||||
import org.springframework.contextsupport.testfixture.cache.TestableCacheResolverFactory;
|
||||
import org.springframework.contextsupport.testfixture.jcache.JCacheableService;
|
||||
|
||||
/**
|
||||
* Repository sample with a @CacheDefaults annotation
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
|||
import org.springframework.cache.interceptor.CacheResolver;
|
||||
import org.springframework.cache.interceptor.KeyGenerator;
|
||||
import org.springframework.cache.jcache.AbstractJCacheTests;
|
||||
import org.springframework.cache.jcache.support.TestableCacheKeyGenerator;
|
||||
import org.springframework.cache.jcache.support.TestableCacheResolver;
|
||||
import org.springframework.cache.jcache.support.TestableCacheResolverFactory;
|
||||
import org.springframework.contextsupport.testfixture.cache.TestableCacheKeyGenerator;
|
||||
import org.springframework.contextsupport.testfixture.cache.TestableCacheResolver;
|
||||
import org.springframework.contextsupport.testfixture.cache.TestableCacheResolverFactory;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cache.jcache.support;
|
||||
package org.springframework.contextsupport.testfixture.cache;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cache.jcache.support;
|
||||
package org.springframework.contextsupport.testfixture.cache;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cache.jcache.support;
|
||||
package org.springframework.contextsupport.testfixture.cache;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cache.jcache.config;
|
||||
package org.springframework.contextsupport.testfixture.jcache;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cache.jcache.config;
|
||||
package org.springframework.contextsupport.testfixture.jcache;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
Loading…
Reference in New Issue