Assume TestGroup.PERFORMANCE for AnnotationProcessorPerformanceTests

This commit applies the TestGroup.PERFORMANCE assumption for all test
methods within AnnotationProcessorPerformanceTests.
This commit is contained in:
Sam Brannen 2015-03-07 15:43:09 +01:00
parent b1fdb4a773
commit 789d904658
1 changed files with 9 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,6 +20,8 @@ import javax.annotation.Resource;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -45,10 +47,14 @@ public class AnnotationProcessorPerformanceTests {
private static final Log factoryLog = LogFactory.getLog(DefaultListableBeanFactory.class); private static final Log factoryLog = LogFactory.getLog(DefaultListableBeanFactory.class);
@Test @Before
public void testPrototypeCreationWithResourcePropertiesIsFastEnough() { public void commonAssumptions() {
Assume.group(TestGroup.PERFORMANCE); Assume.group(TestGroup.PERFORMANCE);
Assume.notLogging(factoryLog); Assume.notLogging(factoryLog);
}
@Test
public void testPrototypeCreationWithResourcePropertiesIsFastEnough() {
GenericApplicationContext ctx = new GenericApplicationContext(); GenericApplicationContext ctx = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx); AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx);
ctx.refresh(); ctx.refresh();
@ -65,14 +71,11 @@ public class AnnotationProcessorPerformanceTests {
assertSame(spouse, tb.getSpouse()); assertSame(spouse, tb.getSpouse());
} }
sw.stop(); sw.stop();
//System.out.println(sw.getTotalTimeMillis());
assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000); assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000);
} }
@Test @Test
public void testPrototypeCreationWithOverriddenResourcePropertiesIsFastEnough() { public void testPrototypeCreationWithOverriddenResourcePropertiesIsFastEnough() {
Assume.group(TestGroup.PERFORMANCE);
Assume.notLogging(factoryLog);
GenericApplicationContext ctx = new GenericApplicationContext(); GenericApplicationContext ctx = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx); AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx);
ctx.refresh(); ctx.refresh();
@ -90,14 +93,11 @@ public class AnnotationProcessorPerformanceTests {
assertSame(spouse, tb.getSpouse()); assertSame(spouse, tb.getSpouse());
} }
sw.stop(); sw.stop();
//System.out.println(sw.getTotalTimeMillis());
assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000); assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000);
} }
@Test @Test
public void testPrototypeCreationWithAutowiredPropertiesIsFastEnough() { public void testPrototypeCreationWithAutowiredPropertiesIsFastEnough() {
Assume.group(TestGroup.PERFORMANCE);
Assume.notLogging(factoryLog);
GenericApplicationContext ctx = new GenericApplicationContext(); GenericApplicationContext ctx = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx); AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx);
ctx.refresh(); ctx.refresh();
@ -114,14 +114,11 @@ public class AnnotationProcessorPerformanceTests {
assertSame(spouse, tb.getSpouse()); assertSame(spouse, tb.getSpouse());
} }
sw.stop(); sw.stop();
//System.out.println(sw.getTotalTimeMillis());
assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000); assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000);
} }
@Test @Test
public void testPrototypeCreationWithOverriddenAutowiredPropertiesIsFastEnough() { public void testPrototypeCreationWithOverriddenAutowiredPropertiesIsFastEnough() {
// Assume.group(TestGroup.PERFORMANCE);
Assume.notLogging(factoryLog);
GenericApplicationContext ctx = new GenericApplicationContext(); GenericApplicationContext ctx = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx); AnnotationConfigUtils.registerAnnotationConfigProcessors(ctx);
ctx.refresh(); ctx.refresh();
@ -139,7 +136,6 @@ public class AnnotationProcessorPerformanceTests {
assertSame(spouse, tb.getSpouse()); assertSame(spouse, tb.getSpouse());
} }
sw.stop(); sw.stop();
System.out.println(sw.getTotalTimeMillis());
assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 6000); assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 6000);
} }
@ -153,7 +149,6 @@ public class AnnotationProcessorPerformanceTests {
} }
} }
private static class AutowiredAnnotatedTestBean extends TestBean { private static class AutowiredAnnotatedTestBean extends TestBean {
@Override @Override