Package org.springframework.context.support

Examples of org.springframework.context.support.AbstractApplicationContext.refresh()


*/
public class SpringCompositeComponentTestCase extends TestCase {

    public void testAppContextStart() {
        AbstractApplicationContext appContext = EasyMock.createMock(AbstractApplicationContext.class);
        appContext.refresh();
        appContext.setParent(EasyMock.isA(ApplicationContext.class));
        appContext.start();
        replay(appContext);
        SpringCompositeComponent component = new SpringCompositeComponent("spring", appContext, null, null, null);
        component.start();
View Full Code Here


            context.getEnvironment().setActiveProfiles(profiles);
        }

        // ensure the context has been refreshed at least once
        if (!context.isActive()) {
            context.refresh();
        }

        return context;
    }
View Full Code Here

            context.getEnvironment().setActiveProfiles(profiles);
        }

        // ensure the context has been refreshed at least once
        if (!context.isActive()) {
            context.refresh();
        }

        return context;
    }
View Full Code Here

                DefaultListableBeanFactory f = super.createBeanFactory();
                f.addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
                return f;
            }
        };
        ctx.refresh();

        // Test realm
        Object obj = ctx.getBean("realm");
        assertNotNull(obj);
        assertTrue(obj instanceof Config);
View Full Code Here

        // check listener
        assertTrue(new GetApplicationListeners(ac).invoke().contains(loader2));

        // listener be notified
        ac.refresh();
        assertTrue(loader2.contextRefreshed);
    }

    @Test
    public void extender_reset() {
View Full Code Here

        assertFalse(new GetApplicationListeners(ac).invoke().contains(loader2));
        assertTrue(new GetApplicationListeners(ac).invoke().contains(loader3));

        // listener be notified
        ac.refresh();
        assertFalse(loader2.contextRefreshed);
        assertTrue(loader3.contextRefreshed);
    }

    private String contextResourceType() {
View Full Code Here

        // check listener
        assertTrue(new GetApplicationListeners(ac).invoke().contains(loader2));

        // listener be notified
        ac.refresh();
        assertTrue(loader2.contextRefreshed);
    }

    @Test
    public void extender_reset() {
View Full Code Here

        assertFalse(new GetApplicationListeners(ac).invoke().contains(loader2));
        assertTrue(new GetApplicationListeners(ac).invoke().contains(loader3));

        // listener be notified
        ac.refresh();
        assertFalse(loader2.contextRefreshed);
        assertTrue(loader3.contextRefreshed);
    }

    private String contextResourceType() {
View Full Code Here

  public void readsServerAddressesCorrectly() {

    reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-bean.xml"));

    AbstractApplicationContext context = new GenericApplicationContext(factory);
    context.refresh();

    assertThat(context.getBean("mongo2", Mongo.class), is(notNullValue()));
    context.close();
  }
}
View Full Code Here

  @Test
  public void dropsEventIfNotForCorrectDomainType() {

    AbstractApplicationContext context = new ClassPathXmlApplicationContext();
    context.refresh();

    SamplePersonEventListener listener = new SamplePersonEventListener();
    context.addApplicationListener(listener);

    context.publishEvent(new BeforeConvertEvent<Person>(new Person("Dave", "Matthews")));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.