Search in sources :

Example 1 with INestedTestBean

use of org.springframework.tests.sample.beans.INestedTestBean in project spring-framework by spring-projects.

the class TestBeanAdvisor method testAspectsAndAdvisorNotAppliedToPrototypeIsFastEnough.

@Test
public void testAspectsAndAdvisorNotAppliedToPrototypeIsFastEnough() {
    Assume.group(TestGroup.PERFORMANCE);
    Assume.notLogging(factoryLog);
    ClassPathXmlApplicationContext ac = newContext("aspectsPlusAdvisor.xml");
    StopWatch sw = new StopWatch();
    sw.start("Prototype Creation");
    for (int i = 0; i < 100000; i++) {
        INestedTestBean shouldNotBeWeaved = (INestedTestBean) ac.getBean("i21");
        if (i < 10) {
            assertFalse(AopUtils.isAopProxy(shouldNotBeWeaved));
        }
    }
    sw.stop();
    // What's a reasonable expectation for _any_ server or developer machine load?
    // 3 seconds?
    assertStopWatchTimeLimit(sw, 6000);
}
Also used : INestedTestBean(org.springframework.tests.sample.beans.INestedTestBean) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) JoinPoint(org.aspectj.lang.JoinPoint) ProceedingJoinPoint(org.aspectj.lang.ProceedingJoinPoint) StopWatch(org.springframework.util.StopWatch) Test(org.junit.Test)

Aggregations

JoinPoint (org.aspectj.lang.JoinPoint)1 ProceedingJoinPoint (org.aspectj.lang.ProceedingJoinPoint)1 Test (org.junit.Test)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1 INestedTestBean (org.springframework.tests.sample.beans.INestedTestBean)1 StopWatch (org.springframework.util.StopWatch)1