Search in sources :

Example 1 with ClassPathXmlApplicationContext

use of cn.taketoday.context.support.ClassPathXmlApplicationContext in project today-infrastructure by TAKETODAY.

the class MixinProxyTargetClassTrueConfig method testTwoAdviceAspect.

@Test
public void testTwoAdviceAspect() {
    ClassPathXmlApplicationContext bf = newContext("twoAdviceAspect.xml");
    ITestBean adrian1 = (ITestBean) bf.getBean("adrian");
    testAgeAspect(adrian1, 0, 2);
}
Also used : ITestBean(cn.taketoday.beans.testfixture.beans.ITestBean) ClassPathXmlApplicationContext(cn.taketoday.context.support.ClassPathXmlApplicationContext) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with ClassPathXmlApplicationContext

use of cn.taketoday.context.support.ClassPathXmlApplicationContext in project today-infrastructure by TAKETODAY.

the class MixinProxyTargetClassTrueConfig method testAspectsAndAdvisorAreApplied.

@Test
public void testAspectsAndAdvisorAreApplied() {
    ClassPathXmlApplicationContext ac = newContext("aspectsPlusAdvisor.xml");
    ITestBean shouldBeWeaved = (ITestBean) ac.getBean("adrian");
    doTestAspectsAndAdvisorAreApplied(ac, shouldBeWeaved);
}
Also used : ITestBean(cn.taketoday.beans.testfixture.beans.ITestBean) ClassPathXmlApplicationContext(cn.taketoday.context.support.ClassPathXmlApplicationContext) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with ClassPathXmlApplicationContext

use of cn.taketoday.context.support.ClassPathXmlApplicationContext in project today-infrastructure by TAKETODAY.

the class GenericCounterAspect method setup.

@SuppressWarnings("unchecked")
@org.junit.jupiter.api.BeforeEach
public void setup() {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
    counterAspect = (GenericCounterAspect) ctx.getBean("counterAspect");
    counterAspect.count = 0;
    testBean = (DerivedInterface<String>) ctx.getBean("testBean");
}
Also used : ClassPathXmlApplicationContext(cn.taketoday.context.support.ClassPathXmlApplicationContext)

Example 4 with ClassPathXmlApplicationContext

use of cn.taketoday.context.support.ClassPathXmlApplicationContext in project today-infrastructure by TAKETODAY.

the class CounterAspect method setup.

@BeforeEach
public void setup() {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
    counterAspect = (CounterAspect) ctx.getBean("counterAspect");
    counterAspect.reset();
    testBean = (GenericReturnTypeVariationClass) ctx.getBean("testBean");
}
Also used : ClassPathXmlApplicationContext(cn.taketoday.context.support.ClassPathXmlApplicationContext) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with ClassPathXmlApplicationContext

use of cn.taketoday.context.support.ClassPathXmlApplicationContext in project today-infrastructure by TAKETODAY.

the class TestMethodInterceptor method setup.

@BeforeEach
public void setup() {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
    testBean = (AnnotatedTestBean) ctx.getBean("testBean");
}
Also used : ClassPathXmlApplicationContext(cn.taketoday.context.support.ClassPathXmlApplicationContext) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ClassPathXmlApplicationContext (cn.taketoday.context.support.ClassPathXmlApplicationContext)213 Test (org.junit.jupiter.api.Test)149 ITestBean (cn.taketoday.beans.testfixture.beans.ITestBean)62 BeforeEach (org.junit.jupiter.api.BeforeEach)44 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)32 Advised (cn.taketoday.aop.framework.Advised)18 DataSource (javax.sql.DataSource)18 ApplicationContext (cn.taketoday.context.ApplicationContext)12 BeanFactory (cn.taketoday.beans.factory.BeanFactory)10 BadSqlGrammarException (cn.taketoday.jdbc.BadSqlGrammarException)10 ConfigurableApplicationContext (cn.taketoday.context.ConfigurableApplicationContext)8 JdbcTemplate (cn.taketoday.jdbc.core.JdbcTemplate)8 StopWatch (cn.taketoday.util.StopWatch)7 AbstractDriverBasedDataSource (cn.taketoday.jdbc.datasource.AbstractDriverBasedDataSource)6 MBeanServer (javax.management.MBeanServer)6 ObjectName (javax.management.ObjectName)6 SqlSessionFactory (org.apache.ibatis.session.SqlSessionFactory)6 AdviceBindingCollaborator (cn.taketoday.aop.aspectj.AdviceBindingTestAspect.AdviceBindingCollaborator)4 RootBeanDefinition (cn.taketoday.beans.factory.support.RootBeanDefinition)4 TestBean (cn.taketoday.beans.testfixture.beans.TestBean)4