Support @Sql as a merged composed annotation
Issue: SPR-13973
This commit is contained in:
parent
d572b022cc
commit
c6f6e192c0
|
|
@ -50,9 +50,7 @@ import org.springframework.core.annotation.AliasFor;
|
|||
* multiple instances of {@code @Sql}.
|
||||
*
|
||||
* <p>This annotation may be used as a <em>meta-annotation</em> to create custom
|
||||
* <em>composed annotations</em>; however, attribute overrides are not currently
|
||||
* supported for {@linkplain Repeatable repeatable} annotations that are used as
|
||||
* meta-annotations.
|
||||
* <em>composed annotations</em>.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 4.1
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
|
|
@ -26,7 +26,7 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
|
@ -129,10 +129,10 @@ public class SqlScriptsTestExecutionListener extends AbstractTestExecutionListen
|
|||
private void executeSqlScripts(TestContext testContext, ExecutionPhase executionPhase) throws Exception {
|
||||
boolean classLevel = false;
|
||||
|
||||
Set<Sql> sqlAnnotations = AnnotationUtils.getRepeatableAnnotations(testContext.getTestMethod(), Sql.class,
|
||||
Set<Sql> sqlAnnotations = AnnotatedElementUtils.getMergedRepeatableAnnotations(testContext.getTestMethod(), Sql.class,
|
||||
SqlGroup.class);
|
||||
if (sqlAnnotations.isEmpty()) {
|
||||
sqlAnnotations = AnnotationUtils.getRepeatableAnnotations(testContext.getTestClass(), Sql.class,
|
||||
sqlAnnotations = AnnotatedElementUtils.getMergedRepeatableAnnotations(testContext.getTestClass(), Sql.class,
|
||||
SqlGroup.class);
|
||||
if (!sqlAnnotations.isEmpty()) {
|
||||
classLevel = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue