Search in sources :

Example 6 with SmartLifecycleRoleController

use of org.springframework.integration.support.SmartLifecycleRoleController in project spring-integration by spring-projects.

the class XPathRouterParserTests method testParse.

@Test
public void testParse() throws Exception {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("XPathRouterTests-context.xml", this.getClass());
    EventDrivenConsumer consumer = (EventDrivenConsumer) context.getBean("parseOnly");
    assertEquals(2, TestUtils.getPropertyValue(consumer, "handler.order"));
    assertEquals(123L, TestUtils.getPropertyValue(consumer, "handler.messagingTemplate.sendTimeout"));
    assertEquals(-1, TestUtils.getPropertyValue(consumer, "phase"));
    assertFalse(TestUtils.getPropertyValue(consumer, "autoStartup", Boolean.class));
    SmartLifecycleRoleController roleController = context.getBean(SmartLifecycleRoleController.class);
    @SuppressWarnings("unchecked") List<SmartLifecycle> list = (List<SmartLifecycle>) TestUtils.getPropertyValue(roleController, "lifecycles", MultiValueMap.class).get("foo");
    assertThat(list, contains((SmartLifecycle) consumer));
    context.close();
}
Also used : EventDrivenConsumer(org.springframework.integration.endpoint.EventDrivenConsumer) SmartLifecycleRoleController(org.springframework.integration.support.SmartLifecycleRoleController) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) List(java.util.List) SmartLifecycle(org.springframework.context.SmartLifecycle) Test(org.junit.Test)

Example 7 with SmartLifecycleRoleController

use of org.springframework.integration.support.SmartLifecycleRoleController in project spring-integration by spring-projects.

the class XsltPayloadTransformerParserTests method testParse.

@Test
public void testParse() throws Exception {
    EventDrivenConsumer consumer = (EventDrivenConsumer) applicationContext.getBean("parseOnly");
    assertEquals(2, TestUtils.getPropertyValue(consumer, "handler.order"));
    assertEquals(123L, TestUtils.getPropertyValue(consumer, "handler.messagingTemplate.sendTimeout"));
    assertEquals(-1, TestUtils.getPropertyValue(consumer, "phase"));
    assertFalse(TestUtils.getPropertyValue(consumer, "autoStartup", Boolean.class));
    SmartLifecycleRoleController roleController = applicationContext.getBean(SmartLifecycleRoleController.class);
    @SuppressWarnings("unchecked") List<SmartLifecycle> list = (List<SmartLifecycle>) TestUtils.getPropertyValue(roleController, "lifecycles", MultiValueMap.class).get("foo");
    assertThat(list, contains((SmartLifecycle) consumer));
}
Also used : EventDrivenConsumer(org.springframework.integration.endpoint.EventDrivenConsumer) SmartLifecycleRoleController(org.springframework.integration.support.SmartLifecycleRoleController) List(java.util.List) SmartLifecycle(org.springframework.context.SmartLifecycle) Test(org.junit.Test)

Example 8 with SmartLifecycleRoleController

use of org.springframework.integration.support.SmartLifecycleRoleController in project spring-integration by spring-projects.

the class XmlPayloadValidatingFilterParserTests method testParse.

@Test
public void testParse() throws Exception {
    EventDrivenConsumer consumer = (EventDrivenConsumer) ac.getBean("parseOnly");
    assertEquals(2, TestUtils.getPropertyValue(consumer, "handler.order"));
    assertEquals(123L, TestUtils.getPropertyValue(consumer, "handler.messagingTemplate.sendTimeout"));
    assertEquals(-1, TestUtils.getPropertyValue(consumer, "phase"));
    assertFalse(TestUtils.getPropertyValue(consumer, "autoStartup", Boolean.class));
    SmartLifecycleRoleController roleController = ac.getBean(SmartLifecycleRoleController.class);
    @SuppressWarnings("unchecked") List<SmartLifecycle> list = (List<SmartLifecycle>) TestUtils.getPropertyValue(roleController, "lifecycles", MultiValueMap.class).get("foo");
    assertThat(list, contains((SmartLifecycle) consumer));
}
Also used : EventDrivenConsumer(org.springframework.integration.endpoint.EventDrivenConsumer) SmartLifecycleRoleController(org.springframework.integration.support.SmartLifecycleRoleController) List(java.util.List) SmartLifecycle(org.springframework.context.SmartLifecycle) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 SmartLifecycle (org.springframework.context.SmartLifecycle)8 SmartLifecycleRoleController (org.springframework.integration.support.SmartLifecycleRoleController)8 List (java.util.List)7 EventDrivenConsumer (org.springframework.integration.endpoint.EventDrivenConsumer)7 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)2 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)1 JmsMessageDrivenEndpoint (org.springframework.integration.jms.JmsMessageDrivenEndpoint)1 AbstractMessageListenerContainer (org.springframework.jms.listener.AbstractMessageListenerContainer)1