@ -385,14 +385,17 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
@@ -385,14 +385,17 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
@ -64,4 +64,10 @@ public abstract class AbstractBeanFactoryAwareAdvisingPostProcessor extends Abst
@@ -64,4 +64,10 @@ public abstract class AbstractBeanFactoryAwareAdvisingPostProcessor extends Abst
@ -49,7 +49,7 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
@@ -49,7 +49,7 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
@ -76,7 +76,7 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
@@ -76,7 +76,7 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
logger.debug("Performing dependency injection for test context ["+testContext+"].");
}
@ -91,7 +91,7 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
@@ -91,7 +91,7 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
logger.debug("Reinjecting dependencies for test context ["+testContext+"].");
@ -112,11 +112,12 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
@@ -112,11 +112,12 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
privateStringbeanName="replace me with ["+getClass().getName()+"]";
@Autowired
privateApplicationContextapplicationContext;
privateEmployeeemployee;
@Autowired
@ -63,41 +56,49 @@ public class GroovySpringContextTests implements BeanNameAware, InitializingBean
@@ -63,41 +56,49 @@ public class GroovySpringContextTests implements BeanNameAware, InitializingBean
assertTrue("This test bean should have been initialized due to InitializingBean semantics.",
this.beanInitialized);
publicvoidverifyBeanNameSet(){
assertTrue("The bean name of this test instance should have been set to the fully qualified class name "+
"due to BeanNameAware semantics.",this.beanName.startsWith(getClass().getName()));
}
@Test
publicfinalvoidverifyBeanNameSet(){
assertEquals("The bean name of this test instance should have been set to the fully qualified class name "
+"due to BeanNameAware semantics.",getClass().getName(),this.beanName);
publicvoidverifyBeanInitialized(){
assertTrue("This test bean should have been initialized due to InitializingBean semantics.",
this.beanInitialized);
}
@Test
publicfinalvoidverifyAnnotationAutowiredFields(){
publicvoidverifyAnnotationAutowiredFields(){
assertNull("The nonrequiredLong property should NOT have been autowired.",this.nonrequiredLong);
assertNotNull("The application context should have been autowired.",this.applicationContext);
assertNotNull("The pet field should have been autowired.",this.pet);
@ -105,18 +106,18 @@ public class GroovySpringContextTests implements BeanNameAware, InitializingBean
@@ -105,18 +106,18 @@ public class GroovySpringContextTests implements BeanNameAware, InitializingBean
@ -51,10 +51,6 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
@@ -51,10 +51,6 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
privatestaticfinalStringSUE="sue";
privatestaticfinalStringYODA="yoda";
privatebooleanbeanInitialized=false;
privateStringbeanName="replace me with ["+getClass().getName()+"]";
privateEmployeeemployee;
@Autowired
@ -68,54 +64,86 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
@@ -68,54 +64,86 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
assertNull("The nonrequiredLong property should NOT have been autowired.",this.nonrequiredLong);
assertNotNull("The pet field should have been autowired.",this.pet);
@ -124,7 +152,7 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
@@ -124,7 +152,7 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
@ -132,58 +160,33 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
@@ -132,58 +160,33 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
@ -82,13 +81,9 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@@ -82,13 +81,9 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
privateStringbeanName="replace me with ["+getClass().getName()+"]";
privateEmployeeemployee;
@ -124,31 +119,20 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@@ -124,31 +119,20 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@ -162,33 +146,46 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@@ -162,33 +146,46 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
assertNull("The nonrequiredLong field should NOT have been autowired.",this.nonrequiredLong);
assertEquals("The quux field should have been autowired via @Autowired and @Qualifier.","Quux",this.quux);
assertEquals("The namedFoo field should have been injected via @Inject and @Named.","Quux",this.namedQuux);
assertSame("@Autowired/@Qualifier and @Inject/@Named quux should be the same object.",this.quux,
this.namedQuux);
assertSame("@Autowired/@Qualifier and @Inject/@Named quux should be the same object.",this.quux,this.namedQuux);
assertNotNull("The pet field should have been autowired.",this.autowiredPet);
assertNotNull("The pet field should have been injected.",this.injectedPet);
@ -198,13 +195,13 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@@ -198,13 +195,13 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
assertNotNull("Literal @Value field should have been autowired",this.literalFieldValue);
assertNotNull("SpEL @Value field should have been autowired.",this.spelFieldValue);
assertEquals("enigma",this.literalFieldValue);
@ -212,7 +209,7 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@@ -212,7 +209,7 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
}
@Test
publicfinalvoidverifyAutowiredAtValueMethods(){
publicvoidverifyAutowiredAtValueMethods(){
assertNotNull("Literal @Value method parameter should have been autowired.",this.literalParameterValue);
assertNotNull("SpEL @Value method parameter should have been autowired.",this.spelParameterValue);
@ -220,12 +217,12 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@@ -220,12 +217,12 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@ -61,9 +61,6 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@@ -61,9 +61,6 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
privatestaticintnumTearDownCalls=0;
privatestaticintnumTearDownCallsInTransaction=0;
privatebooleanbeanInitialized=false;
privateStringbeanName="replace me with ["+getClass().getName()+"]";
privateEmployeeemployee;
@ -71,51 +68,39 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@@ -71,51 +68,39 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
privatePetpet;
@Autowired(required=false)
protectedLongnonrequiredLong;
privateLongnonrequiredLong;
@Resource()
protectedStringfoo;
protectedStringbar;
@Resource
privateStringfoo;
privateStringbar;
privateintcreatePerson(Stringname){
returnjdbcTemplate.update("INSERT INTO person VALUES(?)",name);
}
privateStringbeanName;
privateintdeletePerson(Stringname){
returnjdbcTemplate.update("DELETE FROM person WHERE name=?",name);
@ -132,12 +117,51 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@@ -132,12 +117,51 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
assertEquals(numTearDownCallsInTransaction,NUM_TX_TESTS,"number of calls to tearDown() within a transaction.");
}
@BeforeMethod
voidsetUp(){
numSetUpCalls++;
if(inTransaction()){
numSetUpCallsInTransaction++;
}
assertNumRowsInPersonTable((inTransaction()?2:1),"before a test method");
}
@AfterMethod
voidtearDown(){
numTearDownCalls++;
if(inTransaction()){
numTearDownCallsInTransaction++;
}
assertNumRowsInPersonTable((inTransaction()?4:1),"after a test method");
}
@BeforeTransaction
voidbeforeTransaction(){
assertNumRowsInPersonTable(1,"before a transactional test method");
@ -147,15 +171,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@@ -147,15 +171,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
voidverifyBeanInitialized(){
assertInTransaction(false);
assertTrue(beanInitialized,
"This test instance should have been initialized due to InitializingBean semantics.");
"The bean name of this test instance should have been set due to BeanNameAware semantics.");
"This test instance should have been initialized due to InitializingBean semantics.");
}
@Test
@ -189,21 +205,6 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@@ -189,21 +205,6 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
assertEquals(bar,"Bar","The setBar() method should have been injected via @Resource.");
}
@BeforeTransaction
voidbeforeTransaction(){
assertNumRowsInPersonTable(1,"before a transactional test method");
assertAddPerson(YODA);
}
@BeforeMethod
voidsetUp()throwsException{
numSetUpCalls++;
if(inTransaction()){
numSetUpCallsInTransaction++;
}
assertNumRowsInPersonTable((inTransaction()?2:1),"before a test method");
}
@Test
voidmodifyTestDataWithinTransaction(){
assertInTransaction(true);
@ -212,19 +213,22 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@@ -212,19 +213,22 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans