Search in sources :

Example 1 with AbstractJmsListenerEndpoint

use of org.springframework.jms.config.AbstractJmsListenerEndpoint in project spring-framework by spring-projects.

the class JmsListenerAnnotationBeanPostProcessorTests method metaAnnotationIsDiscovered.

@Test
void metaAnnotationIsDiscovered() throws Exception {
    try (ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(Config.class, MetaAnnotationTestBean.class)) {
        JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
        assertThat(factory.getListenerContainers().size()).as("one container should have been registered").isEqualTo(1);
        JmsListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint();
        assertThat(endpoint.getClass()).as("Wrong endpoint type").isEqualTo(MethodJmsListenerEndpoint.class);
        MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
        assertThat(methodEndpoint.getBean().getClass()).isEqualTo(MetaAnnotationTestBean.class);
        assertThat(methodEndpoint.getMethod()).isEqualTo(MetaAnnotationTestBean.class.getMethod("handleIt", String.class));
        assertThat(methodEndpoint.getMostSpecificMethod()).isEqualTo(MetaAnnotationTestBean.class.getMethod("handleIt", String.class));
        assertThat(((AbstractJmsListenerEndpoint) endpoint).getDestination()).isEqualTo("metaTestQueue");
    }
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) AbstractJmsListenerEndpoint(org.springframework.jms.config.AbstractJmsListenerEndpoint) JmsListenerEndpoint(org.springframework.jms.config.JmsListenerEndpoint) MethodJmsListenerEndpoint(org.springframework.jms.config.MethodJmsListenerEndpoint) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) AbstractJmsListenerEndpoint(org.springframework.jms.config.AbstractJmsListenerEndpoint) JmsListenerContainerTestFactory(org.springframework.jms.config.JmsListenerContainerTestFactory) MethodJmsListenerEndpoint(org.springframework.jms.config.MethodJmsListenerEndpoint) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1 AbstractJmsListenerEndpoint (org.springframework.jms.config.AbstractJmsListenerEndpoint)1 JmsListenerContainerTestFactory (org.springframework.jms.config.JmsListenerContainerTestFactory)1 JmsListenerEndpoint (org.springframework.jms.config.JmsListenerEndpoint)1 MethodJmsListenerEndpoint (org.springframework.jms.config.MethodJmsListenerEndpoint)1