use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class JpaMessageHandlerParserTests method advised.
@Test
public void advised() throws Exception {
setUp("JpaMessageHandlerParserTests.xml", getClass());
EventDrivenConsumer consumer = this.context.getBean("advised", EventDrivenConsumer.class);
final AbstractMessageChannel inputChannel = TestUtils.getPropertyValue(consumer, "inputChannel", AbstractMessageChannel.class);
assertEquals("target", inputChannel.getComponentName());
final MessageHandler handler = TestUtils.getPropertyValue(consumer, "handler", MessageHandler.class);
adviceCalled = 0;
handler.handleMessage(new GenericMessage<String>("foo"));
assertEquals(1, adviceCalled);
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class MarshallingTransformerParserTests method testParse.
@Test
public void testParse() throws Exception {
EventDrivenConsumer consumer = (EventDrivenConsumer) appContext.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 = appContext.getBean(SmartLifecycleRoleController.class);
@SuppressWarnings("unchecked") List<SmartLifecycle> list = (List<SmartLifecycle>) TestUtils.getPropertyValue(roleController, "lifecycles", MultiValueMap.class).get("foo");
assertThat(list, contains((SmartLifecycle) consumer));
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class UnmarshallingTransformerParserTests method testParse.
@Test
public void testParse() throws Exception {
EventDrivenConsumer consumer = (EventDrivenConsumer) appContext.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 = appContext.getBean(SmartLifecycleRoleController.class);
@SuppressWarnings("unchecked") List<SmartLifecycle> list = (List<SmartLifecycle>) TestUtils.getPropertyValue(roleController, "lifecycles", MultiValueMap.class).get("foo");
assertThat(list, contains((SmartLifecycle) consumer));
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class XPathMessageSplitterParserTests method testXPathExpressionRef.
@Test
public void testXPathExpressionRef() throws Exception {
TestXmlApplicationContext ctx = TestXmlApplicationContextHelper.getTestAppContext(channelDefinitions + "<si-xml:xpath-expression id='xpathOne' expression='//name'/>" + "<si-xml:xpath-splitter id='splitter' xpath-expression-ref='xpathOne' input-channel='test-input' output-channel='test-output' />");
EventDrivenConsumer consumer = (EventDrivenConsumer) ctx.getBean("splitter");
DirectFieldAccessor fieldAccessor = new DirectFieldAccessor(consumer);
Object handler = fieldAccessor.getPropertyValue("handler");
fieldAccessor = new DirectFieldAccessor(handler);
Object documnetBuilderFactory = fieldAccessor.getPropertyValue("documentBuilderFactory");
assertTrue("DocumnetBuilderFactory was not expected stub ", documnetBuilderFactory instanceof DocumentBuilderFactory);
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class JmsOutboundChannelAdapterParserTests method adapterWithDefaultConnectionFactory.
@Test
public void adapterWithDefaultConnectionFactory() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsOutboundWithDefaultConnectionFactory.xml", this.getClass());
EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("adapter");
DirectFieldAccessor accessor = new DirectFieldAccessor(new DirectFieldAccessor(endpoint).getPropertyValue("handler"));
assertNotNull(accessor.getPropertyValue("jmsTemplate"));
context.close();
}
Aggregations