List of usage examples for org.springframework.integration.file.remote.session Session getClientInstance
Object getClientInstance();
From source file:org.springframework.integration.ftp.outbound.FtpServerOutboundTests.java
@Test @SuppressWarnings("unchecked") public void testMGETOnNullDir() throws IOException { Session<FTPFile> session = ftpSessionFactory.getSession(); ((FTPClient) session.getClientInstance()).changeWorkingDirectory("ftpSource"); session.close();/* ww w . j a va 2 s . c o m*/ this.inboundMGet.send(new GenericMessage<Object>("")); Message<?> result = this.output.receive(1000); assertNotNull(result); List<File> localFiles = (List<File>) result.getPayload(); assertThat(localFiles.size(), Matchers.greaterThan(0)); for (File file : localFiles) { assertThat(file.getName(), isOneOf(" localTarget1.txt", "localTarget2.txt")); assertThat(file.getName(), not(containsString("null"))); } }
From source file:org.springframework.integration.ftp.outbound.FtpServerOutboundTests.java
@Test @SuppressWarnings("unchecked") public void testLsForNullDir() throws IOException { Session<FTPFile> session = ftpSessionFactory.getSession(); ((FTPClient) session.getClientInstance()).changeWorkingDirectory("ftpSource"); session.close();/*from w w w. j a v a 2s . c o m*/ this.inboundLs.send(new GenericMessage<String>("foo")); Message<?> receive = this.output.receive(10000); assertNotNull(receive); assertThat(receive.getPayload(), instanceOf(List.class)); List<String> files = (List<String>) receive.getPayload(); assertEquals(2, files.size()); assertThat(files, containsInAnyOrder(" ftpSource1.txt", "ftpSource2.txt")); FTPFile[] ftpFiles = ftpSessionFactory.getSession().list(null); for (FTPFile ftpFile : ftpFiles) { if (!ftpFile.isDirectory()) { assertTrue(files.contains(ftpFile.getName())); } } }
From source file:org.springframework.integration.ftp.outbound.FtpServerOutboundTests.java
@Test public void testInboundChannelAdapterWithNullDir() throws IOException { Session<FTPFile> session = ftpSessionFactory.getSession(); ((FTPClient) session.getClientInstance()).changeWorkingDirectory("ftpSource"); session.close();/*from www . j ava 2 s . c o m*/ this.ftpInbound.start(); Message<?> message = this.output.receive(10000); assertNotNull(message); assertThat(message.getPayload(), instanceOf(File.class)); assertEquals(" ftpSource1.txt", ((File) message.getPayload()).getName()); message = this.output.receive(10000); assertNotNull(message); assertThat(message.getPayload(), instanceOf(File.class)); assertEquals("ftpSource2.txt", ((File) message.getPayload()).getName()); assertNull(this.output.receive(10)); this.ftpInbound.stop(); }