@Bean public DirectChannel requests() { return new DirectChannel(); }
@Bean public QueueChannel replies() { return new QueueChannel(); }
public static void main (String[] args) throws Exception { @SuppressWarnings("resource") ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext( "/META-INF/spring/integration/gmail-imap-idle-config.xml"); DirectChannel inputChannel = ac.getBean("receiveChannel", DirectChannel.class); inputChannel.subscribe(new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { logger.info("Message: " + message); } }); } }
@Test public void testEmpty() { inputChannel.send(MessageBuilder.withPayload("").build()); Message<?> outMessage = testChannel.receive(0); assertNull("No messages expected", outMessage); } }
private String channelName(MessageChannel channel) { String name = null; if (this.integrationObjectSupportPresent) { if (channel instanceof IntegrationObjectSupport) { name = ((IntegrationObjectSupport) channel).getComponentName(); } if (name == null && channel instanceof AbstractMessageChannel) { name = ((AbstractMessageChannel) channel).getFullChannelName(); } } if (name == null) { name = channel.toString(); } return name; }
@Bean public DirectChannel requests() { return new DirectChannel(); }
@Test public void testEmpty() { inputChannel.send(MessageBuilder.withPayload("").build()); Message<?> outMessage = testChannel.receive(0); assertNull("No messages expected", outMessage); } }
public static void main (String[] args) throws Exception { @SuppressWarnings("resource") ApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/gmail-pop3-config.xml"); DirectChannel inputChannel = ac.getBean("receiveChannel", DirectChannel.class); inputChannel.subscribe(new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { logger.info("Message: " + message); } }); } }
@Bean public DirectChannel replies() { return new DirectChannel(); }
@Test public void testNone() { inputChannel.send(MessageBuilder.withPayload(" ,, ,,, ,,,,, ,,,,,,, ").build()); Message<?> outMessage = testChannel.receive(0); assertNull("No messages expected", outMessage); }
@Bean public DirectChannel requests() { return new DirectChannel(); }
@Bean public DirectChannel requests() { return new DirectChannel(); }
@Bean public DirectChannel replies() { return new DirectChannel(); }
@Bean public DirectChannel requests() { return new DirectChannel(); }
@Bean public DirectChannel requests() { return new DirectChannel(); }
@Bean public DirectChannel replies() { return new DirectChannel(); }
@Bean public MessageChannel gatewayChannel() { return new DirectChannel(); }
@Bean public MessageChannel fromTcp() { return new DirectChannel(); }
@Test public void testMandatoryJobExplorer() { // given DirectChannel inputChannel = new DirectChannel(); this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("A JobExplorer must be provided"); // when new RemotePartitioningWorkerStepBuilder("step") .inputChannel(inputChannel) .tasklet(this.tasklet); // then // expected exception }
@Test public void testMandatoryOutputChannel() { // given RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>() .itemWriter(items -> { }) .inputChannel(new DirectChannel()); this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("An OutputChannel must be provided"); // when builder.build(); // then // expected exception }