use of org.springframework.integration.endpoint.SourcePollingChannelAdapter in project spring-integration by spring-projects.
the class InboundChannelAdapterExpressionTests method triggerRef.
@Test
public void triggerRef() {
SourcePollingChannelAdapter adapter = context.getBean("triggerRefProducer", SourcePollingChannelAdapter.class);
assertTrue(adapter.isAutoStartup());
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
Trigger trigger = TestUtils.getPropertyValue(adapter, "trigger", Trigger.class);
assertEquals(context.getBean("customTrigger"), trigger);
assertEquals(context.getBean("triggerRefChannel"), adapterAccessor.getPropertyValue("outputChannel"));
Expression expression = TestUtils.getPropertyValue(adapter, "source.expression", Expression.class);
assertEquals("'triggerRefTest'", expression.getExpressionString());
}
use of org.springframework.integration.endpoint.SourcePollingChannelAdapter in project spring-integration by spring-projects.
the class InboundChannelAdapterExpressionTests method headerExpressions.
@Test
@SuppressWarnings("unchecked")
public void headerExpressions() {
SourcePollingChannelAdapter adapter = context.getBean("headerExpressionsProducer", SourcePollingChannelAdapter.class);
assertFalse(adapter.isAutoStartup());
Map<String, Expression> headerExpressions = TestUtils.getPropertyValue(adapter, "source.headerExpressions", Map.class);
assertEquals(2, headerExpressions.size());
assertEquals("6 * 7", headerExpressions.get("foo").getExpressionString());
assertEquals("x", headerExpressions.get("bar").getExpressionString());
assertEquals(42, headerExpressions.get("foo").getValue());
assertEquals("x", headerExpressions.get("bar").getValue());
}
use of org.springframework.integration.endpoint.SourcePollingChannelAdapter in project spring-integration by spring-projects.
the class PollerWithErrorChannelTests method testWithErrorChannelAndHeaderWithSendFailure.
@Test
public // config the same as above but the error wil come from the send
void testWithErrorChannelAndHeaderWithSendFailure() throws Exception {
ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("PollerWithErrorChannel-context.xml", this.getClass());
SourcePollingChannelAdapter adapter = ac.getBean("withErrorChannelAndHeaderErrorOnSend", SourcePollingChannelAdapter.class);
adapter.start();
PollableChannel errorChannel = ac.getBean("errChannel", PollableChannel.class);
assertNotNull(errorChannel.receive(10000));
adapter.stop();
ac.close();
}
use of org.springframework.integration.endpoint.SourcePollingChannelAdapter in project spring-integration by spring-projects.
the class PollerWithErrorChannelTests method testWithErrorChannelAndHeader.
@Test
public void testWithErrorChannelAndHeader() throws Exception {
ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("PollerWithErrorChannel-context.xml", this.getClass());
SourcePollingChannelAdapter adapter = ac.getBean("withErrorChannelAndHeader", SourcePollingChannelAdapter.class);
adapter.start();
PollableChannel errorChannel = ac.getBean("eChannel", PollableChannel.class);
assertNotNull(errorChannel.receive(10000));
adapter.stop();
ac.close();
}
use of org.springframework.integration.endpoint.SourcePollingChannelAdapter in project spring-integration by spring-projects.
the class PollerWithErrorChannelTests method testWithErrorChannel.
@Test
public void testWithErrorChannel() throws Exception {
ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("PollerWithErrorChannel-context.xml", this.getClass());
SourcePollingChannelAdapter adapter = ac.getBean("withErrorChannel", SourcePollingChannelAdapter.class);
adapter.start();
PollableChannel errorChannel = ac.getBean("eChannel", PollableChannel.class);
assertNotNull(errorChannel.receive(10000));
adapter.stop();
ac.close();
}
Aggregations