Introduce @EnabledForTestGroups in Spring's test suite
Closes gh-23476
This commit is contained in:
parent
bbe33832cf
commit
288461a541
|
|
@ -18,10 +18,10 @@ package org.springframework.aop.target.dynamic;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
|
|
@ -77,9 +77,8 @@ public class RefreshableTargetSourceTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testRefreshOverTime() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CountingRefreshableTargetSource ts = new CountingRefreshableTargetSource(true);
|
||||
ts.setRefreshCheckDelay(100);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import org.springframework.core.convert.support.DefaultConversionService;
|
|||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.sample.beans.BooleanTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.IndexedTestBean;
|
||||
|
|
@ -62,6 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.assertj.core.api.Assertions.within;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Shared tests for property accessors.
|
||||
|
|
@ -960,8 +961,8 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void setPrimitiveArrayPropertyLargeMatching() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(LogFactory.getLog(AbstractPropertyAccessorTests.class));
|
||||
|
||||
PrimitiveArrayBean target = new PrimitiveArrayBean();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
|
|||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.TestGroup;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
@ -45,6 +45,7 @@ import static org.springframework.tests.TestResourceUtils.qualifiedResource;
|
|||
* @author Chris Beams
|
||||
* @since 10.03.2004
|
||||
*/
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public class ConcurrentBeanFactoryTests {
|
||||
|
||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd");
|
||||
|
|
@ -73,8 +74,6 @@ public class ConcurrentBeanFactoryTests {
|
|||
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
|
||||
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(
|
||||
qualifiedResource(ConcurrentBeanFactoryTests.class, "context.xml"));
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ import org.springframework.core.io.Resource;
|
|||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.sample.beans.DependenciesBean;
|
||||
import org.springframework.tests.sample.beans.DerivedTestBean;
|
||||
|
|
@ -2292,8 +2293,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testPrototypeCreationIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
|
|
@ -2310,8 +2311,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testPrototypeCreationWithDependencyCheckIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(LifecycleBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
|
|
@ -2331,8 +2332,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
|
||||
@Test
|
||||
@Disabled // TODO re-enable when ConstructorResolver TODO sorted out
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testPrototypeCreationWithConstructorArgumentsIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
|
|
@ -2353,8 +2354,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testPrototypeCreationWithResolvedConstructorArgumentsIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
|
|
@ -2375,8 +2376,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testPrototypeCreationWithPropertiesIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
|
|
@ -2397,8 +2398,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testPrototypeCreationWithResolvedPropertiesIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
|
|
@ -2419,8 +2420,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testSingletonLookupByNameIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class));
|
||||
lbf.freezeConfiguration();
|
||||
|
|
@ -2435,8 +2436,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testSingletonLookupByTypeIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class));
|
||||
lbf.freezeConfiguration();
|
||||
|
|
@ -2797,9 +2798,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
*/
|
||||
@Test
|
||||
@Timeout(1)
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testByTypeLookupIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
lbf.registerBeanDefinition("a" + i, new RootBeanDefinition(A.class));
|
||||
}
|
||||
|
|
@ -2814,8 +2814,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
|
||||
@Test
|
||||
@Timeout(1)
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testRegistrationOfManyBeanDefinitionsIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
lbf.registerBeanDefinition("b", new RootBeanDefinition(B.class));
|
||||
// lbf.getBean("b");
|
||||
|
||||
|
|
@ -2826,8 +2826,8 @@ public class DefaultListableBeanFactoryTests {
|
|||
|
||||
@Test
|
||||
@Timeout(1)
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testRegistrationOfManySingletonsIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
lbf.registerBeanDefinition("b", new RootBeanDefinition(B.class));
|
||||
// lbf.getBean("b");
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
|||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.sample.beans.GenericBean;
|
||||
import org.springframework.tests.sample.beans.GenericIntegerBean;
|
||||
import org.springframework.tests.sample.beans.GenericSetOfIntegerBean;
|
||||
|
|
@ -58,6 +57,7 @@ import org.springframework.tests.sample.beans.TestBean;
|
|||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.springframework.tests.TestGroup.LONG_RUNNING;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
|
@ -651,9 +651,8 @@ public class BeanFactoryGenericsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(LONG_RUNNING)
|
||||
public void testSetBean() throws Exception {
|
||||
Assume.group(TestGroup.LONG_RUNNING);
|
||||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
|
||||
new ClassPathResource("genericBeanTests.xml", getClass()));
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ import java.util.List;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
@ -38,8 +36,6 @@ public class PagedListHolderTests {
|
|||
@Test
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void testPagedListHolder() {
|
||||
Assume.group(TestGroup.LONG_RUNNING);
|
||||
|
||||
TestBean tb1 = new TestBean();
|
||||
tb1.setName("eva");
|
||||
tb1.setAge(25);
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ import org.junit.jupiter.api.BeforeEach;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.cache.AbstractCacheTests;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.tests.TestGroup.LONG_RUNNING;
|
||||
|
||||
/**
|
||||
* @author Costin Leau
|
||||
|
|
@ -73,9 +73,8 @@ public class EhCacheCacheTests extends AbstractCacheTests<EhCacheCache> {
|
|||
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(LONG_RUNNING)
|
||||
public void testExpiredElements() throws Exception {
|
||||
Assume.group(TestGroup.LONG_RUNNING);
|
||||
|
||||
String key = "brancusi";
|
||||
String value = "constantin";
|
||||
Element brancusi = new Element(key, value);
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|||
import org.springframework.context.support.StaticApplicationContext;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
@ -46,6 +45,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
|||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
|
@ -95,9 +95,8 @@ public class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void schedulerWithTaskExecutor() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CountingTaskExecutor taskExecutor = new CountingTaskExecutor();
|
||||
DummyJob.count = 0;
|
||||
|
||||
|
|
@ -137,9 +136,8 @@ public class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void schedulerWithQuartzJobBean() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
DummyJob.param = 0;
|
||||
DummyJob.count = 0;
|
||||
|
||||
|
|
@ -171,9 +169,8 @@ public class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void schedulerWithSpringBeanJobFactory() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
DummyJob.param = 0;
|
||||
DummyJob.count = 0;
|
||||
|
||||
|
|
@ -207,9 +204,8 @@ public class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void schedulerWithSpringBeanJobFactoryAndParamMismatchNotIgnored() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
DummyJob.param = 0;
|
||||
DummyJob.count = 0;
|
||||
|
||||
|
|
@ -244,8 +240,8 @@ public class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void schedulerWithSpringBeanJobFactoryAndQuartzJobBean() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
DummyJobBean.param = 0;
|
||||
DummyJobBean.count = 0;
|
||||
|
||||
|
|
@ -278,8 +274,8 @@ public class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void schedulerWithSpringBeanJobFactoryAndJobSchedulingData() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
DummyJob.param = 0;
|
||||
DummyJob.count = 0;
|
||||
|
||||
|
|
@ -327,8 +323,8 @@ public class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void twoAnonymousMethodInvokingJobDetailFactoryBeans() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
ClassPathXmlApplicationContext ctx = context("multipleAnonymousMethodInvokingJobDetailFB.xml");
|
||||
Thread.sleep(3000);
|
||||
try {
|
||||
|
|
@ -346,8 +342,8 @@ public class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void schedulerAccessorBean() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
ClassPathXmlApplicationContext ctx = context("schedulerAccessorBean.xml");
|
||||
Thread.sleep(3000);
|
||||
try {
|
||||
|
|
@ -401,8 +397,6 @@ public class QuartzSupportTests {
|
|||
*/
|
||||
@Test
|
||||
public void schedulerWithHsqlDataSource() throws Exception {
|
||||
// Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
DummyJob.param = 0;
|
||||
DummyJob.count = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ import org.springframework.core.annotation.Order;
|
|||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.sample.beans.INestedTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
|
|
@ -112,8 +113,8 @@ public class AspectJAutoProxyCreatorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testAspectsAndAdvisorAppliedToPrototypeIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
|
||||
ClassPathXmlApplicationContext ac = newContext("aspectsPlusAdvisor.xml");
|
||||
|
|
@ -134,8 +135,8 @@ public class AspectJAutoProxyCreatorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testAspectsAndAdvisorNotAppliedToPrototypeIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
|
||||
ClassPathXmlApplicationContext ac = newContext("aspectsPlusAdvisor.xml");
|
||||
|
|
@ -156,8 +157,8 @@ public class AspectJAutoProxyCreatorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testAspectsAndAdvisorNotAppliedToManySingletonsIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
|
||||
GenericApplicationContext ac = new GenericApplicationContext();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;
|
|||
import org.springframework.aop.target.HotSwappableTargetSource;
|
||||
import org.springframework.aop.target.SingletonTargetSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.TimeStamped;
|
||||
import org.springframework.tests.aop.advice.CountingAfterReturningAdvice;
|
||||
|
|
@ -163,8 +163,8 @@ public abstract class AbstractAopProxyTests {
|
|||
* CGLIB this will be slow or will run out of memory.
|
||||
*/
|
||||
@Test
|
||||
@EnabledForTestGroups(TestGroup.PERFORMANCE)
|
||||
public void testManyProxies() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
int howMany = 10000;
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start("Create " + howMany + " proxies");
|
||||
|
|
|
|||
|
|
@ -33,11 +33,12 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
|||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
|
@ -45,6 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @author Sam Brannen
|
||||
* @since 2.5
|
||||
*/
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public class AnnotationProcessorPerformanceTests {
|
||||
|
||||
private static final Log factoryLog = LogFactory.getLog(DefaultListableBeanFactory.class);
|
||||
|
|
@ -52,7 +54,6 @@ public class AnnotationProcessorPerformanceTests {
|
|||
|
||||
@BeforeAll
|
||||
public static void commonAssumptions() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,13 +52,14 @@ import org.springframework.core.io.ClassPathResource;
|
|||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.EncodedResource;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.SerializationTestUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
|
@ -245,8 +246,8 @@ public class ApplicationContextExpressionTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void prototypeCreationIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Assume.notLogging(factoryLog);
|
||||
GenericApplicationContext ac = new GenericApplicationContext();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ import org.springframework.beans.factory.support.RootBeanDefinition;
|
|||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.context.LifecycleProcessor;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
|
|
@ -252,9 +252,8 @@ public class DefaultLifecycleProcessorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void smartLifecycleGroupShutdown() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean bean1 = TestSmartLifecycleBean.forShutdownTests(1, 300, stoppedBeans);
|
||||
TestSmartLifecycleBean bean2 = TestSmartLifecycleBean.forShutdownTests(3, 100, stoppedBeans);
|
||||
|
|
@ -283,9 +282,8 @@ public class DefaultLifecycleProcessorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void singleSmartLifecycleShutdown() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean bean = TestSmartLifecycleBean.forShutdownTests(99, 300, stoppedBeans);
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
|
|
@ -391,9 +389,8 @@ public class DefaultLifecycleProcessorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void dependentShutdownFirstEvenIfItsPhaseIsLower() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean beanMin = TestSmartLifecycleBean.forShutdownTests(Integer.MIN_VALUE, 100, stoppedBeans);
|
||||
TestSmartLifecycleBean bean1 = TestSmartLifecycleBean.forShutdownTests(1, 200, stoppedBeans);
|
||||
|
|
@ -465,9 +462,8 @@ public class DefaultLifecycleProcessorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void dependentShutdownFirstAndIsSmartLifecycle() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean beanMin = TestSmartLifecycleBean.forShutdownTests(Integer.MIN_VALUE, 400, stoppedBeans);
|
||||
TestSmartLifecycleBean beanNegative = TestSmartLifecycleBean.forShutdownTests(-99, 100, stoppedBeans);
|
||||
|
|
@ -530,9 +526,8 @@ public class DefaultLifecycleProcessorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void dependentShutdownFirstButNotSmartLifecycle() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean bean1 = TestSmartLifecycleBean.forShutdownTests(1, 200, stoppedBeans);
|
||||
TestLifecycleBean simpleBean = TestLifecycleBean.forShutdownTests(stoppedBeans);
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ import org.springframework.scheduling.config.IntervalTask;
|
|||
import org.springframework.scheduling.config.ScheduledTaskHolder;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
import org.springframework.scheduling.config.TaskManagementConfigUtils;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Tests use of @EnableScheduling on @Configuration classes.
|
||||
|
|
@ -58,9 +58,8 @@ public class EnableSchedulingTests {
|
|||
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void withFixedRateTask() throws InterruptedException {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
ctx = new AnnotationConfigApplicationContext(FixedRateTaskConfig.class);
|
||||
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(2);
|
||||
|
||||
|
|
@ -69,9 +68,8 @@ public class EnableSchedulingTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void withSubclass() throws InterruptedException {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
ctx = new AnnotationConfigApplicationContext(FixedRateTaskConfigSubclass.class);
|
||||
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(2);
|
||||
|
||||
|
|
@ -80,9 +78,8 @@ public class EnableSchedulingTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void withExplicitScheduler() throws InterruptedException {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
ctx = new AnnotationConfigApplicationContext(ExplicitSchedulerConfig.class);
|
||||
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(1);
|
||||
|
||||
|
|
@ -100,9 +97,8 @@ public class EnableSchedulingTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void withExplicitScheduledTaskRegistrar() throws InterruptedException {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
ctx = new AnnotationConfigApplicationContext(ExplicitScheduledTaskRegistrarConfig.class);
|
||||
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(1);
|
||||
|
||||
|
|
@ -123,9 +119,8 @@ public class EnableSchedulingTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void withAmbiguousTaskSchedulers_andSingleTask_disambiguatedByScheduledTaskRegistrarBean() throws InterruptedException {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
ctx = new AnnotationConfigApplicationContext(
|
||||
SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask_disambiguatedByScheduledTaskRegistrar.class);
|
||||
|
||||
|
|
@ -134,9 +129,8 @@ public class EnableSchedulingTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void withAmbiguousTaskSchedulers_andSingleTask_disambiguatedBySchedulerNameAttribute() throws InterruptedException {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
ctx = new AnnotationConfigApplicationContext(
|
||||
SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask_disambiguatedBySchedulerNameAttribute.class);
|
||||
|
||||
|
|
@ -145,9 +139,8 @@ public class EnableSchedulingTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void withTaskAddedVia_configureTasks() throws InterruptedException {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
ctx = new AnnotationConfigApplicationContext(SchedulingEnabled_withTaskAddedVia_configureTasks.class);
|
||||
|
||||
Thread.sleep(100);
|
||||
|
|
@ -155,9 +148,8 @@ public class EnableSchedulingTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void withTriggerTask() throws InterruptedException {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
ctx = new AnnotationConfigApplicationContext(TriggerTaskConfig.class);
|
||||
|
||||
Thread.sleep(100);
|
||||
|
|
@ -165,9 +157,8 @@ public class EnableSchedulingTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void withInitiallyDelayedFixedRateTask() throws InterruptedException {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
ctx = new AnnotationConfigApplicationContext(FixedRateTaskConfig_withInitialDelay.class);
|
||||
|
||||
Thread.sleep(1950);
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ import org.junit.jupiter.api.Disabled;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.task.NoOpRunnable;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
|
@ -34,6 +33,7 @@ import static org.mockito.Mockito.atLeast;
|
|||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Rick Evans
|
||||
|
|
@ -44,8 +44,7 @@ public class ScheduledExecutorFactoryBeanTests {
|
|||
@Test
|
||||
public void testThrowsExceptionIfPoolSizeIsLessThanZero() throws Exception {
|
||||
ScheduledExecutorFactoryBean factory = new ScheduledExecutorFactoryBean();
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
factory.setPoolSize(-1));
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> factory.setPoolSize(-1));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -90,9 +89,8 @@ public class ScheduledExecutorFactoryBeanTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testOneTimeExecutionIsSetUpAndFiresCorrectly() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
Runnable runnable = mock(Runnable.class);
|
||||
|
||||
ScheduledExecutorFactoryBean factory = new ScheduledExecutorFactoryBean();
|
||||
|
|
@ -107,9 +105,8 @@ public class ScheduledExecutorFactoryBeanTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testFixedRepeatedExecutionIsSetUpAndFiresCorrectly() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
Runnable runnable = mock(Runnable.class);
|
||||
|
||||
ScheduledExecutorTask task = new ScheduledExecutorTask(runnable);
|
||||
|
|
@ -126,9 +123,8 @@ public class ScheduledExecutorFactoryBeanTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testFixedRepeatedExecutionIsSetUpAndFiresCorrectlyAfterException() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
Runnable runnable = mock(Runnable.class);
|
||||
willThrow(new IllegalStateException()).given(runnable).run();
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.scripting.support;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
|
|
@ -28,19 +27,20 @@ import org.springframework.context.support.GenericApplicationContext;
|
|||
import org.springframework.scripting.Messenger;
|
||||
import org.springframework.scripting.ScriptCompilationException;
|
||||
import org.springframework.scripting.groovy.GroovyScriptFactory;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Rick Evans
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
*/
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public class ScriptFactoryPostProcessorTests {
|
||||
|
||||
private static final String MESSAGE_TEXT = "Bingo";
|
||||
|
|
@ -77,10 +77,6 @@ public class ScriptFactoryPostProcessorTests {
|
|||
" }\n" +
|
||||
"}";
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoesNothingWhenPostProcessingNonScriptFactoryTypeBeforeInstantiation() throws Exception {
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@ import org.springframework.core.convert.ConversionFailedException;
|
|||
import org.springframework.core.convert.ConverterNotFoundException;
|
||||
import org.springframework.core.convert.TypeDescriptor;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link DefaultConversionService}.
|
||||
|
|
@ -966,8 +966,8 @@ public class DefaultConversionServiceTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testPerformance1() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
StopWatch watch = new StopWatch("integer->string conversionPerformance");
|
||||
watch.start("convert 4,000,000 with conversion service");
|
||||
for (int i = 0; i < 4000000; i++) {
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ import org.springframework.core.convert.converter.GenericConverter;
|
|||
import org.springframework.core.io.DescriptiveResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -55,6 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GenericConversionService}.
|
||||
|
|
@ -343,8 +343,8 @@ public class GenericConversionServiceTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testPerformance2() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
StopWatch watch = new StopWatch("list<string> -> list<integer> conversionPerformance");
|
||||
watch.start("convert 4,000,000 with conversion service");
|
||||
List<String> source = new LinkedList<>();
|
||||
|
|
@ -368,8 +368,8 @@ public class GenericConversionServiceTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testPerformance3() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
StopWatch watch = new StopWatch("map<string, string> -> map<string, integer> conversionPerformance");
|
||||
watch.start("convert 4,000,000 with conversion service");
|
||||
Map<String, String> source = new HashMap<>();
|
||||
|
|
@ -884,6 +884,7 @@ public class GenericConversionServiceTests {
|
|||
|
||||
private static class StringToMyEnumInterfaceConverterFactory implements ConverterFactory<String, MyEnumInterface> {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public <T extends MyEnumInterface> Converter<String, T> getConverter(Class<T> targetType) {
|
||||
return new StringToMyEnumInterfaceConverter(targetType);
|
||||
|
|
@ -897,6 +898,7 @@ public class GenericConversionServiceTests {
|
|||
this.enumType = enumType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convert(String source) {
|
||||
for (T value : enumType.getEnumConstants()) {
|
||||
if (value.getCode().equals(source)) {
|
||||
|
|
@ -911,6 +913,7 @@ public class GenericConversionServiceTests {
|
|||
|
||||
private static class StringToMyEnumBaseInterfaceConverterFactory implements ConverterFactory<String, MyEnumBaseInterface> {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public <T extends MyEnumBaseInterface> Converter<String, T> getConverter(Class<T> targetType) {
|
||||
return new StringToMyEnumBaseInterfaceConverter(targetType);
|
||||
|
|
@ -924,6 +927,7 @@ public class GenericConversionServiceTests {
|
|||
this.enumType = enumType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convert(String source) {
|
||||
for (T value : enumType.getEnumConstants()) {
|
||||
if (value.getBaseCode().equals(source)) {
|
||||
|
|
|
|||
|
|
@ -25,11 +25,10 @@ import org.springframework.core.io.UrlResource;
|
|||
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
|
||||
import org.springframework.core.type.classreading.MetadataReader;
|
||||
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import static org.springframework.tests.TestGroup.LONG_RUNNING;
|
||||
|
||||
/**
|
||||
* Unit tests for checking the behaviour of {@link CachingMetadataReaderFactory} under
|
||||
|
|
@ -39,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @author Costin Leau
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@EnabledForTestGroups(LONG_RUNNING)
|
||||
public class CachingMetadataReaderLeakTests {
|
||||
|
||||
private static final int ITEMS_TO_LOAD = 9999;
|
||||
|
|
@ -47,8 +47,6 @@ public class CachingMetadataReaderLeakTests {
|
|||
|
||||
@Test
|
||||
public void testSignificantLoad() throws Exception {
|
||||
Assume.group(TestGroup.LONG_RUNNING);
|
||||
|
||||
// the biggest public class in the JDK (>60k)
|
||||
URL url = getClass().getResource("/java/awt/Component.class");
|
||||
assertThat(url).isNotNull();
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
|||
* @author Phillip Webb
|
||||
* @author Sam Brannen
|
||||
* @since 3.2
|
||||
* @see EnabledForTestGroups @EnabledForTestGroups
|
||||
* @see #group(TestGroup)
|
||||
* @see #group(TestGroup, Executable)
|
||||
* @see TestGroup
|
||||
|
|
@ -56,7 +57,9 @@ public abstract class Assume {
|
|||
* Assume that a particular {@link TestGroup} is active.
|
||||
* @param group the group that must be active
|
||||
* @throws org.opentest4j.TestAbortedException if the assumption fails
|
||||
* @deprecated as of Spring Framework 5.2 in favor of {@link EnabledForTestGroups}
|
||||
*/
|
||||
@Deprecated
|
||||
public static void group(TestGroup group) {
|
||||
Set<TestGroup> testGroups = TestGroups.loadTestGroups();
|
||||
assumeTrue(testGroups.contains(group),
|
||||
|
|
|
|||
|
|
@ -37,18 +37,18 @@ import static org.springframework.tests.TestGroup.PERFORMANCE;
|
|||
* @author Sam Brannen
|
||||
* @since 5.0
|
||||
*/
|
||||
public class AssumeTests {
|
||||
class AssumeTests {
|
||||
|
||||
private String originalTestGroups;
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void trackOriginalTestGroups() {
|
||||
void trackOriginalTestGroups() {
|
||||
this.originalTestGroups = System.getProperty(TEST_GROUPS_SYSTEM_PROPERTY);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void restoreOriginalTestGroups() {
|
||||
void restoreOriginalTestGroups() {
|
||||
if (this.originalTestGroups != null) {
|
||||
setTestGroups(this.originalTestGroups);
|
||||
}
|
||||
|
|
@ -58,21 +58,24 @@ public class AssumeTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void assumeGroupWithNoActiveTestGroups() {
|
||||
@SuppressWarnings("deprecation")
|
||||
void assumeGroupWithNoActiveTestGroups() {
|
||||
setTestGroups("");
|
||||
Assume.group(LONG_RUNNING);
|
||||
fail("assumption should have failed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void assumeGroupWithNoMatchingActiveTestGroup() {
|
||||
@SuppressWarnings("deprecation")
|
||||
void assumeGroupWithNoMatchingActiveTestGroup() {
|
||||
setTestGroups(PERFORMANCE, CI);
|
||||
Assume.group(LONG_RUNNING);
|
||||
fail("assumption should have failed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void assumeGroupWithMatchingActiveTestGroup() {
|
||||
@SuppressWarnings("deprecation")
|
||||
void assumeGroupWithMatchingActiveTestGroup() {
|
||||
setTestGroups(LONG_RUNNING);
|
||||
try {
|
||||
Assume.group(LONG_RUNNING);
|
||||
|
|
@ -83,15 +86,16 @@ public class AssumeTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void assumeGroupWithBogusActiveTestGroup() {
|
||||
void assumeGroupWithBogusActiveTestGroup() {
|
||||
assertBogusActiveTestGroupBehavior("bogus");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void assumeGroupWithAllMinusBogusActiveTestGroup() {
|
||||
void assumeGroupWithAllMinusBogusActiveTestGroup() {
|
||||
assertBogusActiveTestGroupBehavior("all-bogus");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void assertBogusActiveTestGroupBehavior(String testGroups) {
|
||||
// Should result in something similar to the following:
|
||||
//
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
/**
|
||||
* {@code @EnabledForTestGroups} is used to enable the annotated test class or
|
||||
* test method for one or more {@link TestGroup} {@linkplain #value values}.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 5.2
|
||||
*/
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Inherited
|
||||
@ExtendWith(TestGroupsCondition.class)
|
||||
public @interface EnabledForTestGroups {
|
||||
|
||||
/**
|
||||
* One or more {@link TestGroup}s that must be active.
|
||||
*/
|
||||
TestGroup[] value();
|
||||
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@ import static java.lang.String.format;
|
|||
/**
|
||||
* A test group used to limit when certain tests are run.
|
||||
*
|
||||
* @see EnabledForTestGroups @EnabledForTestGroups
|
||||
* @see Assume#group(TestGroup)
|
||||
* @author Phillip Webb
|
||||
* @author Chris Beams
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
|
||||
import org.junit.jupiter.api.extension.ExecutionCondition;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import static org.junit.jupiter.api.extension.ConditionEvaluationResult.disabled;
|
||||
import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled;
|
||||
import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation;
|
||||
|
||||
/**
|
||||
* {@link ExecutionCondition} for Spring's {@link TestGroup} support.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 5.2
|
||||
* @see EnabledForTestGroups @EnabledForTestGroups
|
||||
*/
|
||||
class TestGroupsCondition implements ExecutionCondition {
|
||||
|
||||
private static final ConditionEvaluationResult ENABLED_BY_DEFAULT = enabled("@EnabledForTestGroups is not present");
|
||||
|
||||
|
||||
@Override
|
||||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
|
||||
Optional<EnabledForTestGroups> optional = findAnnotation(context.getElement(), EnabledForTestGroups.class);
|
||||
if (!optional.isPresent()) {
|
||||
return ENABLED_BY_DEFAULT;
|
||||
}
|
||||
TestGroup[] testGroups = optional.get().value();
|
||||
Assert.state(testGroups.length > 0, "You must declare at least one TestGroup in @EnabledForTestGroups");
|
||||
return (Arrays.stream(testGroups).anyMatch(TestGroups::isGroupActive)) ?
|
||||
enabled("Enabled for TestGroups: " + Arrays.toString(testGroups)) :
|
||||
disabled("Disabled for TestGroups: " + Arrays.toString(testGroups));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -27,12 +27,12 @@ import java.util.List;
|
|||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.sample.objects.TestObject;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
|
|
@ -326,9 +326,8 @@ public class ReflectionUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void getUniqueDeclaredMethods_isFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
class C {
|
||||
void m00() { } void m01() { } void m02() { } void m03() { } void m04() { }
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ import org.springframework.expression.PropertyAccessor;
|
|||
import org.springframework.expression.TypedValue;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Testing variations on map access.
|
||||
|
|
@ -99,8 +99,8 @@ public class MapAccessTests extends AbstractExpressionTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetValuePerformance() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("key", "value");
|
||||
EvaluationContext context = new StandardEvaluationContext(map);
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ import org.springframework.expression.EvaluationContext;
|
|||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
///CLOVER:OFF
|
||||
|
||||
|
|
@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.fail;
|
|||
*
|
||||
* @author Andy Clement
|
||||
*/
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public class PerformanceTests {
|
||||
|
||||
public static final int ITERATIONS = 10000;
|
||||
|
|
@ -47,8 +48,6 @@ public class PerformanceTests {
|
|||
|
||||
@Test
|
||||
public void testPerformanceOfPropertyAccess() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
long starttime = 0;
|
||||
long endtime = 0;
|
||||
|
||||
|
|
@ -91,8 +90,6 @@ public class PerformanceTests {
|
|||
|
||||
@Test
|
||||
public void testPerformanceOfMethodAccess() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
long starttime = 0;
|
||||
long endtime = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|||
import org.springframework.jdbc.datasource.AbstractDriverBasedDataSource;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactoryBean;
|
||||
import org.springframework.jdbc.datasource.init.DataSourceInitializer;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.DEFAULT_DATABASE_NAME;
|
||||
import static org.springframework.tests.TestGroup.LONG_RUNNING;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
|
|
@ -49,17 +49,16 @@ import static org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFacto
|
|||
*/
|
||||
public class JdbcNamespaceIntegrationTests {
|
||||
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(LONG_RUNNING)
|
||||
public void createEmbeddedDatabase() throws Exception {
|
||||
Assume.group(TestGroup.LONG_RUNNING);
|
||||
assertCorrectSetup("jdbc-config.xml", "dataSource", "h2DataSource", "derbyDataSource");
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(LONG_RUNNING)
|
||||
public void createEmbeddedDatabaseAgain() throws Exception {
|
||||
// If Derby isn't cleaned up properly this will fail...
|
||||
Assume.group(TestGroup.LONG_RUNNING);
|
||||
assertCorrectSetup("jdbc-config.xml", "derbyDataSource");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ import org.mockito.InOrder;
|
|||
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.jdbc.UncategorizedSQLException;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.transaction.CannotCreateTransactionException;
|
||||
import org.springframework.transaction.IllegalTransactionStateException;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
|
@ -58,6 +57,7 @@ import static org.mockito.Mockito.inOrder;
|
|||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
|
@ -971,9 +971,8 @@ public class DataSourceTransactionManagerTests {
|
|||
doTestTransactionWithTimeout(1);
|
||||
}
|
||||
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
private void doTestTransactionWithTimeout(int timeout) throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
PreparedStatement ps = mock(PreparedStatement.class);
|
||||
given(con.getAutoCommit()).willReturn(true);
|
||||
given(con.prepareStatement("some SQL statement")).willReturn(ps);
|
||||
|
|
|
|||
|
|
@ -36,13 +36,13 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.htmlunit.DelegatingWebConnection.DelegateWebConnection;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Unit and integration tests for {@link DelegatingWebConnection}.
|
||||
|
|
@ -124,9 +124,8 @@ public class DelegatingWebConnectionTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void verifyExampleInClassLevelJavadoc() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
WebClient webClient = new WebClient();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.standaloneSetup().build();
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ package org.springframework.web.bind;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
|
@ -279,8 +279,8 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetIntParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
|
|
@ -293,8 +293,8 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetLongParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
|
|
@ -307,8 +307,8 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetFloatParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
|
|
@ -321,8 +321,8 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetDoubleParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
|
|
@ -335,8 +335,8 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetBooleanParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
|
|
@ -349,8 +349,8 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetStringParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInfo;
|
||||
|
|
@ -52,8 +51,7 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.server.ServletServerHttpRequest;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.util.concurrent.ListenableFutureCallback;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
import org.springframework.web.socket.TextMessage;
|
||||
|
|
@ -70,6 +68,7 @@ import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
|
|||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Abstract base class for integration tests using the
|
||||
|
|
@ -79,6 +78,7 @@ import static org.assertj.core.api.Assertions.fail;
|
|||
* @author Rossen Stoyanchev
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public abstract class AbstractSockJsIntegrationTests {
|
||||
|
||||
protected Log logger = LogFactory.getLog(getClass());
|
||||
|
|
@ -95,12 +95,6 @@ public abstract class AbstractSockJsIntegrationTests {
|
|||
private String baseUrl;
|
||||
|
||||
|
||||
@BeforeAll
|
||||
public static void performanceTestGroupAssumption() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
}
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(TestInfo testInfo) throws Exception {
|
||||
logger.debug("Setting up '" + testInfo.getTestMethod().get().getName() + "'");
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package org.springframework.scheduling.annotation;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator;
|
||||
|
|
@ -32,8 +31,7 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
|
||||
import org.springframework.dao.support.PersistenceExceptionTranslator;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.transaction.CallCountingTransactionManager;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
|
@ -42,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Integration tests cornering bug SPR-8651, which revealed that @Scheduled methods may
|
||||
|
|
@ -53,20 +52,15 @@ import static org.mockito.Mockito.mock;
|
|||
* @since 3.1
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
class ScheduledAndTransactionalAnnotationIntegrationTests {
|
||||
|
||||
@BeforeAll
|
||||
static void assumePerformanceTests() {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void failsWhenJdkProxyAndScheduledMethodNotPresentOnInterface() {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
ctx.register(Config.class, JdkProxyTxConfig.class, RepoConfigA.class);
|
||||
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(
|
||||
ctx::refresh)
|
||||
assertThatExceptionOfType(BeanCreationException.class)
|
||||
.isThrownBy(ctx::refresh)
|
||||
.satisfies(ex -> assertThat(ex.getRootCause()).isInstanceOf(IllegalStateException.class));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue