use of org.springframework.context.ConfigurableApplicationContext in project spring-framework by spring-projects.
the class EnableJmsTests method fullConfigurableConfiguration.
@Override
public void fullConfigurableConfiguration() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EnableJmsFullConfigurableConfig.class, FullConfigurableBean.class);
testFullConfiguration(context);
}
use of org.springframework.context.ConfigurableApplicationContext in project spring-framework by spring-projects.
the class EnableJmsTests method jmsListeners.
@Override
@Test
public void jmsListeners() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EnableJmsDefaultContainerFactoryConfig.class, JmsListenersBean.class);
testJmsListenerRepeatable(context);
}
use of org.springframework.context.ConfigurableApplicationContext in project spring-framework by spring-projects.
the class EnableJmsTests method sampleConfiguration.
@Override
@Test
public void sampleConfiguration() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EnableJmsSampleConfig.class, SampleBean.class);
testSampleConfiguration(context);
}
use of org.springframework.context.ConfigurableApplicationContext in project spring-framework by spring-projects.
the class JmsListenerAnnotationBeanPostProcessorTests method simpleMessageListener.
@Test
public void simpleMessageListener() throws Exception {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(Config.class, SimpleMessageListenerTestBean.class);
JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
assertEquals("One container should have been registered", 1, factory.getListenerContainers().size());
MessageListenerTestContainer container = factory.getListenerContainers().get(0);
JmsListenerEndpoint endpoint = container.getEndpoint();
assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
assertEquals(SimpleMessageListenerTestBean.class, methodEndpoint.getBean().getClass());
assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMethod());
assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMostSpecificMethod());
SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer();
methodEndpoint.setupListenerContainer(listenerContainer);
assertNotNull(listenerContainer.getMessageListener());
assertTrue("Should have been started " + container, container.isStarted());
// Close and stop the listeners
context.close();
assertTrue("Should have been stopped " + container, container.isStopped());
}
use of org.springframework.context.ConfigurableApplicationContext in project spring-framework by spring-projects.
the class DestroyMethodInferenceTests method xml.
@Test
public void xml() {
ConfigurableApplicationContext ctx = new GenericXmlApplicationContext(getClass(), "DestroyMethodInferenceTests-context.xml");
WithLocalCloseMethod x1 = ctx.getBean("x1", WithLocalCloseMethod.class);
WithLocalCloseMethod x2 = ctx.getBean("x2", WithLocalCloseMethod.class);
WithLocalCloseMethod x3 = ctx.getBean("x3", WithLocalCloseMethod.class);
WithNoCloseMethod x4 = ctx.getBean("x4", WithNoCloseMethod.class);
WithInheritedCloseMethod x8 = ctx.getBean("x8", WithInheritedCloseMethod.class);
assertThat(x1.closed, is(false));
assertThat(x2.closed, is(false));
assertThat(x3.closed, is(false));
assertThat(x4.closed, is(false));
ctx.close();
assertThat(x1.closed, is(false));
assertThat(x2.closed, is(true));
assertThat(x3.closed, is(true));
assertThat(x4.closed, is(false));
assertThat(x8.closed, is(false));
}
Aggregations