From a1980264691917813037c7015d9a886b938893b0 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 27 Feb 2014 15:21:07 +0100 Subject: [PATCH] fix CI build Prior to this commit, AnnotatedJCacheableService contained an annotated method demonstrating a failure scenario. This could break depending on the order of the methods array as AopUtils creates the proxy if the pointcut matches by checking each method. On the CI server, the first method was this invalid use case so checking if the proxy has to be created lead to an unexpected exception. This scenario has been moved to its own private class now. --- .../interceptor/AnnotatedJCacheableService.java | 6 ------ .../AnnotationCacheOperationSourceTests.java | 12 +++++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotatedJCacheableService.java b/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotatedJCacheableService.java index 94c84a202f..5ea84fa6b0 100644 --- a/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotatedJCacheableService.java +++ b/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotatedJCacheableService.java @@ -177,12 +177,6 @@ public class AnnotatedJCacheableService implements JCacheableService { public void noAnnotation() { } - @CacheRemove - @CacheRemoveAll - public void multiAnnotations() { - - } - @Override public long exceptionInvocations() { return exceptionCounter.get(); diff --git a/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotationCacheOperationSourceTests.java b/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotationCacheOperationSourceTests.java index ad16df23e3..f37184c422 100644 --- a/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotationCacheOperationSourceTests.java +++ b/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotationCacheOperationSourceTests.java @@ -25,6 +25,8 @@ import java.util.Comparator; import javax.cache.annotation.CacheDefaults; import javax.cache.annotation.CacheKeyGenerator; +import javax.cache.annotation.CacheRemove; +import javax.cache.annotation.CacheRemoveAll; import javax.cache.annotation.CacheResult; import org.junit.Before; @@ -105,7 +107,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests { @Test public void multiAnnotations() { thrown.expect(IllegalStateException.class); - getCacheOperation(AnnotatedJCacheableService.class, name.getMethodName()); + getCacheOperation(InvalidCases.class, name.getMethodName()); } @Test @@ -259,4 +261,12 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests { } } + static class InvalidCases { + + @CacheRemove + @CacheRemoveAll + public void multiAnnotations() { + } + } + }