org.mockftpserver.fake.filesystem.DirectoryEntry Java Examples
The following examples show how to use
org.mockftpserver.fake.filesystem.DirectoryEntry.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FakeFTPServerFactory.java From davos with MIT License | 7 votes |
public static FakeFtpServer setup() { server = new FakeFtpServer(); server.addUserAccount(new UserAccount("user", "password", "/tmp")); server.setServerControlPort(0); FileSystem fileSystem = new UnixFakeFileSystem(); fileSystem.add(new DirectoryEntry("/tmp")); fileSystem.add(new FileEntry("/tmp/file1.txt", "hello world")); fileSystem.add(new FileEntry("/tmp/file2.txt", "hello world")); fileSystem.add(new FileEntry("/tmp/file3.txt", "hello world")); server.setFileSystem(fileSystem); server.start(); return server; }
Example #2
Source File: GetTest.java From cs-actions with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { FileSystem fileSystem = new UnixFakeFileSystem(); fileSystem.add(new DirectoryEntry("/data")); fileSystem.add(new FileEntry("/data/foobar.txt","abdef 1234567890")); fakeFtpServer = new FakeFtpServer(); fakeFtpServer.setFileSystem(fileSystem); fakeFtpServer.setServerControlPort(0); fakeFtpServer.addUserAccount(new UserAccount("user","password","/data")); fakeFtpServer.start(); getOperation = new Get(); ftpService = new FTPService(); }
Example #3
Source File: FtpClientIntegrationTest.java From tutorials with MIT License | 6 votes |
@Before public void setup() throws IOException { fakeFtpServer = new FakeFtpServer(); fakeFtpServer.addUserAccount(new UserAccount("user", "password", "/data")); FileSystem fileSystem = new UnixFakeFileSystem(); fileSystem.add(new DirectoryEntry("/data")); fileSystem.add(new FileEntry("/data/foobar.txt", "abcdef 1234567890")); fakeFtpServer.setFileSystem(fileSystem); fakeFtpServer.setServerControlPort(0); fakeFtpServer.start(); ftpClient = new FtpClient("localhost", fakeFtpServer.getServerControlPort(), "user", "password"); ftpClient.open(); }
Example #4
Source File: TestURL.java From konduit-serving with Apache License 2.0 | 5 votes |
@Test public void testFTP() throws IOException, InterruptedException { assumeTrue(SystemUtils.IS_OS_WINDOWS); FakeFtpServer fakeFtpServer = new FakeFtpServer(); String homeDir = testDir.newFolder().getAbsolutePath(); fakeFtpServer.addUserAccount(new UserAccount("user", "password", homeDir)); val fileSystem = new WindowsFakeFileSystem(); fileSystem.add(new DirectoryEntry(homeDir)); fileSystem.add(new FileEntry(homeDir + File.separator + "config.json", "{\"pipelineSteps\": []}")); fakeFtpServer.setFileSystem(fileSystem); fakeFtpServer.start(); System.out.println("FTP started on : " + fakeFtpServer.getServerControlPort()); FtpClient ftpClient = new FtpClient(); ftpClient.connect("localhost"); if (ftpClient.login("user", "password")) { String url = FTP + "user:password@" + HOST + ":" + 21 + "/config.json"; File dataFile = URIResolver.getFile(url); String data = FileUtils.readFileToString(dataFile, "UTF-8"); assertTrue(data.contains("pipelineSteps")); fakeFtpServer.stop(); } else { fakeFtpServer.stop(); fail(); } }
Example #5
Source File: TestFTP.java From localization_nifi with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { fakeFtpServer.setServerControlPort(0); fakeFtpServer.addUserAccount(new UserAccount(username, password, "c:\\data")); FileSystem fileSystem = new WindowsFakeFileSystem(); fileSystem.add(new DirectoryEntry("c:\\data")); fakeFtpServer.setFileSystem(fileSystem); fakeFtpServer.start(); ftpPort = fakeFtpServer.getServerControlPort(); }
Example #6
Source File: FakeFTPServerFactory.java From davos with MIT License | 5 votes |
public static void addDirectoryWithNameAndNumberOfFiles(String name, int numberOfFiles) { server.getFileSystem().add(new DirectoryEntry("/tmp/" + name)); int i; for (i = 0; i < numberOfFiles; i++) server.getFileSystem().add(new FileEntry("/tmp/" + name + "/file" + i)); }
Example #7
Source File: FTPStringInputOperatorTest.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
@Override protected void starting(org.junit.runner.Description description) { UnixFakeFileSystem fileSystem = new UnixFakeFileSystem(); DirectoryEntry homeDirectory = new DirectoryEntry("/home/test"); fileSystem.add(homeDirectory); fileSystem.add(new FileEntry(homeDirectory.getPath() + "/1.txt", "1\n10\n")); fileSystem.add(new FileEntry(homeDirectory.getPath() + "/2.txt", "2\n20\n")); fakeFtpServer = new FakeFtpServer(); fakeFtpServer.setServerControlPort(0); fakeFtpServer.addUserAccount(new UserAccount("testUser", "test", homeDirectory.getPath())); fakeFtpServer.setFileSystem(fileSystem); fakeFtpServer.start(); ftpOperator = new FTPStringInputOperator(); ftpOperator.setHost("localhost"); ftpOperator.setPort(fakeFtpServer.getServerControlPort()); ftpOperator.setUserName("testUser"); ftpOperator.setPassword("test"); ftpOperator.setDirectory(homeDirectory.getPath()); ftpOperator.setup(mockOperatorContext(11, new Attribute.AttributeMap.DefaultAttributeMap())); sink = new CollectorTestSink<>(); ftpOperator.output.setSink(sink); }
Example #8
Source File: PutTest.java From cs-actions with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { fileSystem = new UnixFakeFileSystem(); fileSystem.add(new DirectoryEntry("/data")); fakeFtpServer = new FakeFtpServer(); fakeFtpServer.setFileSystem(fileSystem); fakeFtpServer.setServerControlPort(0); fakeFtpServer.addUserAccount(new UserAccount("user", "password", "/data")); fakeFtpServer.start(); putOperation = new Put(); ftpService = new FTPService(); localFile = temporaryFolder.newFile("localfile.txt"); }
Example #9
Source File: TestFTP.java From nifi with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { fakeFtpServer.setServerControlPort(0); fakeFtpServer.addUserAccount(new UserAccount(username, password, "c:\\data")); FileSystem fileSystem = new WindowsFakeFileSystem(); fileSystem.add(new DirectoryEntry("c:\\data")); fakeFtpServer.setFileSystem(fileSystem); fakeFtpServer.start(); ftpPort = fakeFtpServer.getServerControlPort(); }
Example #10
Source File: JdkFtpClientIntegrationTest.java From tutorials with MIT License | 5 votes |
@Before public void setup() throws IOException { fakeFtpServer = new FakeFtpServer(); fakeFtpServer.addUserAccount(new UserAccount("user", "password", "/data")); FileSystem fileSystem = new UnixFakeFileSystem(); fileSystem.add(new DirectoryEntry("/data")); fileSystem.add(new FileEntry("/data/foobar.txt", "abcdef 1234567890")); fakeFtpServer.setFileSystem(fileSystem); fakeFtpServer.setServerControlPort(0); fakeFtpServer.start(); }