From 60032e0012aa0535b9afac4b86833bfc60e5bd5e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 11 Dec 2012 18:07:48 -0800 Subject: [PATCH] Ignore performance-sensitive tests by default Make use of the new JUnit functionality introduced in the previous commit to 'Assume' that perfomance- and timing-sensitive tests should run only when TestGroup.PERFORMANCE is selected, i.e. when -PtestGroups="performance" has been provided at the Gradle command line. The net effect is that these tests are now ignored by default, which will result in far fewer false-negative CI build failures due to resource contention and other external factors that cause slowdowns. We will set up a dedicated performance CI build to run these tests on an isolated machine, etc. Issue: SPR-9984 --- .../beans/BeanWrapperTests.java | 8 ++-- .../DefaultListableBeanFactoryTests.java | 39 +++++++------------ .../AspectJAutoProxyCreatorTests.java | 21 +++++----- .../AnnotationProcessorPerformanceTests.java | 27 ++++++------- .../ApplicationContextExpressionTests.java | 8 ++-- .../annotation/EnableSchedulingTests.java | 8 ++++ .../GenericConversionServiceTests.java | 5 +++ .../expression/spel/PerformanceTests.java | 7 ++++ .../web/bind/ServletRequestUtilsTests.java | 7 ++++ .../bind/PortletRequestUtilsTests.java | 29 +++++++++++++- ...ansactionalAnnotationIntegrationTests.java | 8 ++++ 11 files changed, 105 insertions(+), 62 deletions(-) diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java index 930c530961e..7da97104176 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java @@ -49,6 +49,8 @@ import org.springframework.beans.propertyeditors.CustomNumberEditor; import org.springframework.beans.propertyeditors.StringArrayPropertyEditor; import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.beans.support.DerivedFromProtectedBaseBean; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.core.convert.ConversionFailedException; import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.support.DefaultConversionService; @@ -1139,10 +1141,8 @@ public final class BeanWrapperTests { @Test public void testLargeMatchingPrimitiveArray() { - if (LogFactory.getLog(BeanWrapperTests.class).isTraceEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(LogFactory.getLog(BeanWrapperTests.class)); PrimitiveArrayBean tb = new PrimitiveArrayBean(); BeanWrapper bw = new BeanWrapperImpl(tb); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java index bc9f1ffba10..35f3420ca04 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java @@ -72,6 +72,8 @@ import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.factory.xml.ConstructorDependenciesBean; import org.springframework.beans.factory.xml.DependenciesBean; import org.springframework.beans.propertyeditors.CustomNumberEditor; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.core.MethodParameter; import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.support.DefaultConversionService; @@ -1693,10 +1695,8 @@ public class DefaultListableBeanFactoryTests { @Test public void testPrototypeCreationIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); @@ -1713,10 +1713,8 @@ public class DefaultListableBeanFactoryTests { @Test public void testPrototypeCreationWithDependencyCheckIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition rbd = new RootBeanDefinition(LifecycleBean.class); rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); @@ -1759,10 +1757,8 @@ public class DefaultListableBeanFactoryTests { @Test @Ignore // TODO re-enable when ConstructorResolver TODO sorted out public void testPrototypeCreationWithConstructorArgumentsIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); @@ -1809,10 +1805,8 @@ public class DefaultListableBeanFactoryTests { @Test public void testPrototypeCreationWithResolvedConstructorArgumentsIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); @@ -1833,10 +1827,8 @@ public class DefaultListableBeanFactoryTests { @Test public void testPrototypeCreationWithPropertiesIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); @@ -1882,10 +1874,8 @@ public class DefaultListableBeanFactoryTests { */ @Test public void testPrototypeCreationWithResolvedPropertiesIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); @@ -2200,6 +2190,7 @@ public class DefaultListableBeanFactoryTests { */ @Test(timeout=1000) public void testByTypeLookupIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); for (int i = 0; i < 1000; i++) { diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java index 66aa6e0e579..0c2927961dc 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeFalse; import java.lang.reflect.Method; @@ -50,6 +51,8 @@ import org.springframework.beans.factory.config.MethodInvokingFactoryBean; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.GenericApplicationContext; @@ -112,10 +115,8 @@ public final class AspectJAutoProxyCreatorTests { @Test public void testAspectsAndAdvisorAppliedToPrototypeIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); ClassPathXmlApplicationContext ac = newContext("aspectsPlusAdvisor.xml"); StopWatch sw = new StopWatch(); sw.start("Prototype Creation"); @@ -134,10 +135,8 @@ public final class AspectJAutoProxyCreatorTests { @Test public void testAspectsAndAdvisorNotAppliedToPrototypeIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); ClassPathXmlApplicationContext ac = newContext("aspectsPlusAdvisor.xml"); StopWatch sw = new StopWatch(); sw.start("Prototype Creation"); @@ -156,10 +155,8 @@ public final class AspectJAutoProxyCreatorTests { @Test public void testAspectsAndAdvisorNotAppliedToManySingletonsIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); GenericApplicationContext ac = new GenericApplicationContext(); new XmlBeanDefinitionReader(ac).loadBeanDefinitions(new ClassPathResource(qName("aspectsPlusAdvisor.xml"), getClass())); diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java index e225b5cfe99..12b0a100b71 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java @@ -17,6 +17,7 @@ package org.springframework.context.annotation; import static org.junit.Assert.*; +import static org.junit.Assume.assumeFalse; import javax.annotation.Resource; @@ -30,6 +31,8 @@ import org.springframework.beans.factory.annotation.Required; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.context.support.GenericApplicationContext; import org.springframework.util.StopWatch; @@ -44,10 +47,8 @@ public class AnnotationProcessorPerformanceTests { @Test public void testPrototypeCreationWithResourcePropertiesIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); GenericApplicationContext ctx = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx); ctx.refresh(); @@ -70,10 +71,8 @@ public class AnnotationProcessorPerformanceTests { @Test public void testPrototypeCreationWithOverriddenResourcePropertiesIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); GenericApplicationContext ctx = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx); ctx.refresh(); @@ -97,10 +96,8 @@ public class AnnotationProcessorPerformanceTests { @Test public void testPrototypeCreationWithAutowiredPropertiesIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); GenericApplicationContext ctx = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx); ctx.refresh(); @@ -123,10 +120,8 @@ public class AnnotationProcessorPerformanceTests { @Test public void testPrototypeCreationWithOverriddenAutowiredPropertiesIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); GenericApplicationContext ctx = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx); ctx.refresh(); diff --git a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java index 16eccd8d33e..b23b6861162 100644 --- a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java +++ b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java @@ -38,6 +38,8 @@ import org.springframework.beans.factory.support.AutowireCandidateQualifier; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.context.annotation.AnnotationConfigUtils; import org.springframework.context.support.GenericApplicationContext; import org.springframework.util.SerializationTestUtils; @@ -218,10 +220,8 @@ public class ApplicationContextExpressionTests { @Test public void prototypeCreationIsFastEnough() { - if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { - // Skip this test: Trace logging blows the time limit. - return; - } + Assume.group(TestGroup.PERFORMANCE); + Assume.notLogging(factoryLog); GenericApplicationContext ac = new GenericApplicationContext(); RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); diff --git a/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java b/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java index 349c6ec3870..d4be14d47b6 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java @@ -19,8 +19,11 @@ package org.springframework.scheduling.annotation; import java.util.Date; import java.util.concurrent.atomic.AtomicInteger; +import org.junit.Before; import org.junit.Test; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -43,6 +46,11 @@ import static org.junit.Assert.*; */ public class EnableSchedulingTests { + @Before + public void setUp() { + Assume.group(TestGroup.PERFORMANCE); + } + @Test public void withFixedRateTask() throws InterruptedException { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); diff --git a/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java b/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java index 41333498ba9..fadd6933a78 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java @@ -35,6 +35,8 @@ import java.util.UUID; import org.junit.Test; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.core.convert.ConversionFailedException; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; @@ -398,6 +400,7 @@ public class GenericConversionServiceTests { @Test public void testPerformance1() { + Assume.group(TestGroup.PERFORMANCE); GenericConversionService conversionService = new DefaultConversionService(); StopWatch watch = new StopWatch("integer->string conversionPerformance"); watch.start("convert 4,000,000 with conversion service"); @@ -415,6 +418,7 @@ public class GenericConversionServiceTests { @Test public void testPerformance2() throws Exception { + Assume.group(TestGroup.PERFORMANCE); GenericConversionService conversionService = new DefaultConversionService(); StopWatch watch = new StopWatch("list -> list conversionPerformance"); watch.start("convert 4,000,000 with conversion service"); @@ -442,6 +446,7 @@ public class GenericConversionServiceTests { @Test public void testPerformance3() throws Exception { + Assume.group(TestGroup.PERFORMANCE); GenericConversionService conversionService = new DefaultConversionService(); StopWatch watch = new StopWatch("map -> map conversionPerformance"); watch.start("convert 4,000,000 with conversion service"); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java index 231a3adff0f..0d3efa95ddb 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java @@ -19,6 +19,8 @@ package org.springframework.expression.spel; import junit.framework.Assert; import org.junit.Test; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; @@ -43,6 +45,8 @@ public class PerformanceTests { @Test public void testPerformanceOfPropertyAccess() throws Exception { + Assume.group(TestGroup.PERFORMANCE); + long starttime = 0; long endtime = 0; @@ -89,7 +93,10 @@ public class PerformanceTests { } } + @Test public void testPerformanceOfMethodAccess() throws Exception { + Assume.group(TestGroup.PERFORMANCE); + long starttime = 0; long endtime = 0; diff --git a/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java b/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java index 51e2f501d80..cba2d487f23 100644 --- a/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java +++ b/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java @@ -19,6 +19,8 @@ package org.springframework.web.bind; import static org.junit.Assert.*; import org.junit.Test; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.util.StopWatch; @@ -399,6 +401,7 @@ public class ServletRequestUtilsTests { @Test public void testGetLongParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockHttpServletRequest request = new MockHttpServletRequest(); StopWatch sw = new StopWatch(); sw.start(); @@ -412,6 +415,7 @@ public class ServletRequestUtilsTests { @Test public void testGetFloatParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockHttpServletRequest request = new MockHttpServletRequest(); StopWatch sw = new StopWatch(); sw.start(); @@ -425,6 +429,7 @@ public class ServletRequestUtilsTests { @Test public void testGetDoubleParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockHttpServletRequest request = new MockHttpServletRequest(); StopWatch sw = new StopWatch(); sw.start(); @@ -438,6 +443,7 @@ public class ServletRequestUtilsTests { @Test public void testGetBooleanParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockHttpServletRequest request = new MockHttpServletRequest(); StopWatch sw = new StopWatch(); sw.start(); @@ -451,6 +457,7 @@ public class ServletRequestUtilsTests { @Test public void testGetStringParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockHttpServletRequest request = new MockHttpServletRequest(); StopWatch sw = new StopWatch(); sw.start(); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java index 3730a69e12b..c903e01a663 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java @@ -18,6 +18,9 @@ package org.springframework.web.portlet.bind; import junit.framework.TestCase; +import org.junit.Test; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.mock.web.portlet.MockPortletRequest; import org.springframework.util.StopWatch; @@ -28,8 +31,9 @@ import static org.junit.Assert.*; * @author Juergen Hoeller * @author Mark Fisher */ -public class PortletRequestUtilsTests extends TestCase { +public class PortletRequestUtilsTests { + @Test public void testIntParameter() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param1", "5"); @@ -68,6 +72,7 @@ public class PortletRequestUtilsTests extends TestCase { } } + @Test public void testIntParameters() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param", new String[] {"1", "2", "3"}); @@ -90,9 +95,9 @@ public class PortletRequestUtilsTests extends TestCase { catch (PortletRequestBindingException ex) { // expected } - } + @Test public void testLongParameter() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param1", "5"); @@ -131,6 +136,7 @@ public class PortletRequestUtilsTests extends TestCase { } } + @Test public void testLongParameters() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.setParameter("param", new String[] {"1", "2", "3"}); @@ -162,6 +168,7 @@ public class PortletRequestUtilsTests extends TestCase { assertEquals(2, values[1]); } + @Test public void testFloatParameter() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param1", "5.5"); @@ -200,6 +207,7 @@ public class PortletRequestUtilsTests extends TestCase { } } + @Test public void testFloatParameters() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param", new String[] {"1.5", "2.5", "3"}); @@ -224,6 +232,7 @@ public class PortletRequestUtilsTests extends TestCase { } } + @Test public void testDoubleParameter() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param1", "5.5"); @@ -262,6 +271,7 @@ public class PortletRequestUtilsTests extends TestCase { } } + @Test public void testDoubleParameters() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param", new String[] {"1.5", "2.5", "3"}); @@ -286,6 +296,7 @@ public class PortletRequestUtilsTests extends TestCase { } } + @Test public void testBooleanParameter() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param1", "true"); @@ -319,6 +330,7 @@ public class PortletRequestUtilsTests extends TestCase { assertFalse(PortletRequestUtils.getRequiredBooleanParameter(request, "paramEmpty")); } + @Test public void testBooleanParameters() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param", new String[] {"true", "yes", "off", "1", "bogus"}); @@ -342,6 +354,7 @@ public class PortletRequestUtilsTests extends TestCase { } } + @Test public void testStringParameter() throws PortletRequestBindingException { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param1", "str"); @@ -365,7 +378,9 @@ public class PortletRequestUtilsTests extends TestCase { assertEquals("", PortletRequestUtils.getRequiredStringParameter(request, "paramEmpty")); } + @Test public void testGetIntParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockPortletRequest request = new MockPortletRequest(); StopWatch sw = new StopWatch(); sw.start(); @@ -376,7 +391,9 @@ public class PortletRequestUtilsTests extends TestCase { assertThat(sw.getTotalTimeMillis(), lessThan(250L)); } + @Test public void testGetLongParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockPortletRequest request = new MockPortletRequest(); StopWatch sw = new StopWatch(); sw.start(); @@ -387,7 +404,9 @@ public class PortletRequestUtilsTests extends TestCase { assertThat(sw.getTotalTimeMillis(), lessThan(250L)); } + @Test public void testGetFloatParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockPortletRequest request = new MockPortletRequest(); StopWatch sw = new StopWatch(); sw.start(); @@ -398,7 +417,9 @@ public class PortletRequestUtilsTests extends TestCase { assertThat(sw.getTotalTimeMillis(), lessThan(350L)); } + @Test public void testGetDoubleParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockPortletRequest request = new MockPortletRequest(); StopWatch sw = new StopWatch(); sw.start(); @@ -409,7 +430,9 @@ public class PortletRequestUtilsTests extends TestCase { assertThat(sw.getTotalTimeMillis(), lessThan(250L)); } + @Test public void testGetBooleanParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockPortletRequest request = new MockPortletRequest(); StopWatch sw = new StopWatch(); sw.start(); @@ -420,7 +443,9 @@ public class PortletRequestUtilsTests extends TestCase { assertThat(sw.getTotalTimeMillis(), lessThan(250L)); } + @Test public void testGetStringParameterWithDefaultValueHandlingIsFastEnough() { + Assume.group(TestGroup.PERFORMANCE); MockPortletRequest request = new MockPortletRequest(); StopWatch sw = new StopWatch(); sw.start(); diff --git a/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java b/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java index eb715261ea0..b2fbd959d26 100644 --- a/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java +++ b/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java @@ -18,10 +18,13 @@ package org.springframework.scheduling.annotation; import java.util.concurrent.atomic.AtomicInteger; +import org.junit.Before; import org.junit.Test; import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.BeanCreationException; +import org.springframework.build.junit.Assume; +import org.springframework.build.junit.TestGroup; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -48,6 +51,11 @@ import static org.junit.Assert.*; */ public class ScheduledAndTransactionalAnnotationIntegrationTests { + @Before + public void setUp() { + Assume.group(TestGroup.PERFORMANCE); + } + @Test public void failsWhenJdkProxyAndScheduledMethodNotPresentOnInterface() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();