Browse Source

Use Gradle test fixture support for spring-context-support

See gh-23550
pull/24287/head
Sam Brannen 5 years ago
parent
commit
0335db23c9
  1. 10
      buildSrc/src/main/java/org/springframework/build/testsources/TestSourcesPlugin.java
  2. 1
      spring-aspects/spring-aspects.gradle
  3. 2
      spring-aspects/src/test/java/org/springframework/cache/aspectj/JCacheAspectJJavaConfigTests.java
  4. 2
      spring-aspects/src/test/java/org/springframework/cache/aspectj/JCacheAspectJNamespaceConfigTests.java
  5. 6
      spring-aspects/src/test/java/org/springframework/cache/config/AnnotatedJCacheableService.java
  6. 3
      spring-context-support/spring-context-support.gradle
  7. 1
      spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheCustomInterceptorTests.java
  8. 2
      spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheJavaConfigTests.java
  9. 1
      spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheNamespaceDrivenTests.java
  10. 1
      spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheStandaloneConfigTests.java
  11. 6
      spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotatedJCacheableService.java
  12. 6
      spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotationCacheOperationSourceTests.java
  13. 2
      spring-context-support/src/testFixtures/java/org/springframework/contextsupport/testfixture/cache/TestableCacheKeyGenerator.java
  14. 2
      spring-context-support/src/testFixtures/java/org/springframework/contextsupport/testfixture/cache/TestableCacheResolver.java
  15. 2
      spring-context-support/src/testFixtures/java/org/springframework/contextsupport/testfixture/cache/TestableCacheResolverFactory.java
  16. 2
      spring-context-support/src/testFixtures/java/org/springframework/contextsupport/testfixture/jcache/AbstractJCacheAnnotationTests.java
  17. 2
      spring-context-support/src/testFixtures/java/org/springframework/contextsupport/testfixture/jcache/JCacheableService.java

10
buildSrc/src/main/java/org/springframework/build/testsources/TestSourcesPlugin.java

@ -59,7 +59,13 @@ public class TestSourcesPlugin implements Plugin<Project> { @@ -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> { @@ -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);
});
}

1
spring-aspects/spring-aspects.gradle

@ -25,6 +25,7 @@ dependencies { @@ -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")

2
spring-aspects/src/test/java/org/springframework/cache/aspectj/JCacheAspectJJavaConfigTests.java vendored

@ -23,13 +23,13 @@ import org.springframework.cache.CacheManager; @@ -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

2
spring-aspects/src/test/java/org/springframework/cache/aspectj/JCacheAspectJNamespaceConfigTests.java vendored

@ -16,9 +16,9 @@ @@ -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

6
spring-aspects/src/test/java/org/springframework/cache/config/AnnotatedJCacheableService.java vendored

@ -30,9 +30,9 @@ import javax.cache.annotation.CacheValue; @@ -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

3
spring-context-support/spring-context-support.gradle

@ -25,4 +25,7 @@ dependencies { @@ -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")
}

1
spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheCustomInterceptorTests.java vendored

@ -37,6 +37,7 @@ import org.springframework.context.ConfigurableApplicationContext; @@ -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;

2
spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheJavaConfigTests.java vendored

@ -43,6 +43,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext @@ -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;

1
spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheNamespaceDrivenTests.java vendored

@ -24,6 +24,7 @@ import org.springframework.cache.jcache.interceptor.JCacheInterceptor; @@ -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;

1
spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheStandaloneConfigTests.java vendored

@ -18,6 +18,7 @@ package org.springframework.cache.jcache.config; @@ -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

6
spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotatedJCacheableService.java vendored

@ -30,9 +30,9 @@ import javax.cache.annotation.CacheValue; @@ -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

6
spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotationCacheOperationSourceTests.java vendored

@ -32,9 +32,9 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -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;

2
spring-context-support/src/test/java/org/springframework/cache/jcache/support/TestableCacheKeyGenerator.java → spring-context-support/src/testFixtures/java/org/springframework/contextsupport/testfixture/cache/TestableCacheKeyGenerator.java vendored

@ -14,7 +14,7 @@ @@ -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;

2
spring-context-support/src/test/java/org/springframework/cache/jcache/support/TestableCacheResolver.java → spring-context-support/src/testFixtures/java/org/springframework/contextsupport/testfixture/cache/TestableCacheResolver.java vendored

@ -14,7 +14,7 @@ @@ -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;

2
spring-context-support/src/test/java/org/springframework/cache/jcache/support/TestableCacheResolverFactory.java → spring-context-support/src/testFixtures/java/org/springframework/contextsupport/testfixture/cache/TestableCacheResolverFactory.java vendored

@ -14,7 +14,7 @@ @@ -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;

2
spring-context-support/src/test/java/org/springframework/cache/jcache/config/AbstractJCacheAnnotationTests.java → spring-context-support/src/testFixtures/java/org/springframework/contextsupport/testfixture/jcache/AbstractJCacheAnnotationTests.java vendored

@ -14,7 +14,7 @@ @@ -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;

2
spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheableService.java → spring-context-support/src/testFixtures/java/org/springframework/contextsupport/testfixture/jcache/JCacheableService.java vendored

@ -14,7 +14,7 @@ @@ -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…
Cancel
Save