@Override public int compareTo(FileInfo<F> o) { return this.getFilename().compareTo(o.getFilename()); }
@Test //INT-2275 public void testFtpOutboundGatewayInsideChain() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "FtpOutboundInsideChainTests-context.xml", getClass()); MessageChannel channel = context.getBean("ftpOutboundGatewayInsideChain", MessageChannel.class); channel.send(MessageBuilder.withPayload("remote-test-dir").build()); PollableChannel output = context.getBean("output", PollableChannel.class); Message<?> result = output.receive(); Object payload = result.getPayload(); assertTrue(payload instanceof List<?>); @SuppressWarnings("unchecked") List<? extends FileInfo<?>> remoteFiles = (List<? extends FileInfo<?>>) payload; assertEquals(3, remoteFiles.size()); List<String> files = Arrays.asList(new File("remote-test-dir").list()); for (FileInfo<?> remoteFile : remoteFiles) { assertTrue(files.contains(remoteFile.getFilename())); } context.close(); }
@Test //INT-2275 public void testFtpOutboundGatewayInsideChain() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "SftpOutboundInsideChainTests-context.xml", getClass()); MessageChannel channel = context.getBean("outboundGatewayInsideChain", MessageChannel.class); channel.send(MessageBuilder.withPayload("remote-test-dir").build()); PollableChannel output = context.getBean("replyChannel", PollableChannel.class); Message<?> result = output.receive(); Object payload = result.getPayload(); assertTrue(payload instanceof List<?>); @SuppressWarnings("unchecked") List<? extends FileInfo<?>> remoteFiles = (List<? extends FileInfo<?>>) payload; assertEquals(3, remoteFiles.size()); List<String> files = Arrays.asList(new File("remote-test-dir").list()); for (FileInfo<?> remoteFile : remoteFiles) { assertTrue(files.contains(remoteFile.getFilename())); } context.close(); }