Search in sources :

Example 1 with TestInjectionLifecycleBean

use of org.apache.ignite.TestInjectionLifecycleBean in project ignite by apache.

the class SpringCacheManagerContextInjectionTest method testBeanInjectionUsingConfigPath.

/**
     * @throws Exception If failed.
     */
public void testBeanInjectionUsingConfigPath() throws Exception {
    new AnnotationConfigApplicationContext(TestPathConfiguration.class);
    Ignite grid = IgnitionEx.grid("springInjectionTest");
    IgniteConfiguration cfg = grid.configuration();
    LifecycleBean[] beans = cfg.getLifecycleBeans();
    assertEquals(2, beans.length);
    TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean) beans[0];
    TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean) beans[1];
    bean1.checkState();
    bean2.checkState();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) LifecycleBean(org.apache.ignite.lifecycle.LifecycleBean) TestInjectionLifecycleBean(org.apache.ignite.TestInjectionLifecycleBean) Ignite(org.apache.ignite.Ignite) TestInjectionLifecycleBean(org.apache.ignite.TestInjectionLifecycleBean)

Example 2 with TestInjectionLifecycleBean

use of org.apache.ignite.TestInjectionLifecycleBean in project ignite by apache.

the class SpringCacheManagerContextInjectionTest method testBeanInjectionUsingConfiguration.

/**
     * @throws Exception If failed.
     */
public void testBeanInjectionUsingConfiguration() throws Exception {
    BeanFactory factory = new AnnotationConfigApplicationContext(TestCfgConfiguration.class);
    TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean) factory.getBean("bean1");
    TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean) factory.getBean("bean2");
    bean1.checkState();
    bean2.checkState();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) BeanFactory(org.springframework.beans.factory.BeanFactory) TestInjectionLifecycleBean(org.apache.ignite.TestInjectionLifecycleBean)

Example 3 with TestInjectionLifecycleBean

use of org.apache.ignite.TestInjectionLifecycleBean in project ignite by apache.

the class SpringTransactionManagerContextInjectionTest method testBeanInjectionUsingConfig.

/**
     * @throws Exception If failed.
     */
public void testBeanInjectionUsingConfig() throws Exception {
    BeanFactory factory = new AnnotationConfigApplicationContext(TestCfgConfiguration.class);
    TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean) factory.getBean("bean1");
    TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean) factory.getBean("bean2");
    bean1.checkState();
    bean2.checkState();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) BeanFactory(org.springframework.beans.factory.BeanFactory) TestInjectionLifecycleBean(org.apache.ignite.TestInjectionLifecycleBean)

Example 4 with TestInjectionLifecycleBean

use of org.apache.ignite.TestInjectionLifecycleBean in project ignite by apache.

the class SpringTransactionManagerContextInjectionTest method testBeanInjectionUsingConfigPath.

/**
     * @throws Exception If failed.
     */
public void testBeanInjectionUsingConfigPath() throws Exception {
    BeanFactory factory = new AnnotationConfigApplicationContext(TestPathConfiguration.class);
    Ignite grid = IgnitionEx.grid("springInjectionTest");
    IgniteConfiguration cfg = grid.configuration();
    LifecycleBean[] beans = cfg.getLifecycleBeans();
    assertEquals(2, beans.length);
    TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean) beans[0];
    TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean) beans[1];
    bean1.checkState();
    bean2.checkState();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BeanFactory(org.springframework.beans.factory.BeanFactory) LifecycleBean(org.apache.ignite.lifecycle.LifecycleBean) TestInjectionLifecycleBean(org.apache.ignite.TestInjectionLifecycleBean) Ignite(org.apache.ignite.Ignite) TestInjectionLifecycleBean(org.apache.ignite.TestInjectionLifecycleBean)

Aggregations

TestInjectionLifecycleBean (org.apache.ignite.TestInjectionLifecycleBean)4 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)4 BeanFactory (org.springframework.beans.factory.BeanFactory)3 Ignite (org.apache.ignite.Ignite)2 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 LifecycleBean (org.apache.ignite.lifecycle.LifecycleBean)2