本文整理汇总了Java中org.mockftpserver.fake.filesystem.DirectoryEntry类的典型用法代码示例。如果您正苦于以下问题:Java DirectoryEntry类的具体用法?Java DirectoryEntry怎么用?Java DirectoryEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DirectoryEntry类属于org.mockftpserver.fake.filesystem包,在下文中一共展示了DirectoryEntry类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
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;
}
开发者ID:linuxserver,项目名称:davos,代码行数:18,代码来源:FakeFTPServerFactory.java
示例2: handleServeFile
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@Override
protected void handleServeFile(String fs, String path, long timeout) {
FileSystem fileSystem = fakeFtpServer.getFileSystem();
String root = new File(path).getParent();
String userName = StringUtils.randomString(8);
String password = StringUtils.randomString(8);
UserAccount userAccount = new UserAccount(userName, password, root);
if (fileSystem.getEntry(root) == null) {
DirectoryEntry directoryEntry = new DirectoryEntry(root);
directoryEntry.setPermissionsFromString("r-xr-xr-x");
fileSystem.add(directoryEntry);
}
if (fileSystem.getEntry(path) == null) {
FxFileEntity fileEntry = new FxFileEntity(path);
fileSystem.add(fileEntry);
}
fakeFtpServer.addUserAccount(userAccount);
notifyServeApply("ftp", userName, password, NetUtils.getLocalIpAddress(this), fakeFtpServer.getServerControlPort(), path);
}
开发者ID:muyuballs,项目名称:FxExplorer,代码行数:20,代码来源:FtpFileService.java
示例3: init
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@BeforeClass
public void init() {
ftpServer = new FakeFtpServer();
ftpServer.setServerControlPort(0);
ftpServer.addUserAccount(new UserAccount(username, password, rootFolder));
fileSystem = new UnixFakeFileSystem();
fileSystem.add(new DirectoryEntry(rootFolder));
fileSystem.add(new FileEntry("/home/wso2/file1.txt", content));
fileSystem.add(new FileEntry("/home/wso2/file10.txt", content));
fileSystem.add(new FileEntry("/home/wso2/file11.txt", content));
fileSystem.add(new FileEntry("/home/wso2/file2.txt"));
fileSystem.add(new DirectoryEntry("/home/wso2/move"));
fileSystem.add(new DirectoryEntry("/home/wso2/copy"));
ftpServer.setFileSystem(fileSystem);
ftpServer.start();
serverPort = ftpServer.getServerControlPort();
}
开发者ID:wso2,项目名称:carbon-transports,代码行数:18,代码来源:RemoteFileSystemClientConnectorTestCase.java
示例4: retrieveFileListAndMoveTestCase
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@Test(description = "Testing whether correctly move files.", dependsOnMethods = "retrieveFileListTestCase")
public void retrieveFileListAndMoveTestCase() throws ServerConnectorException, InterruptedException {
int expectedEventCount = 2;
fileSystem.add(new DirectoryEntry("/home/wso2/moveFolder"));
Map<String, String> parameters = getPropertyMap("MOVE", true);
parameters.put(Constants.MOVE_AFTER_PROCESS, buildConnectionURL() + "/moveFolder");
parameters.put(Constants.FORCE_CREATE_FOLDER, String.valueOf(true));
CountDownLatch latch = new CountDownLatch(1);
RemoteFileSystemConnectorFactory connectorFactory = new RemoteFileSystemConnectorFactoryImpl();
TestServerRemoteFileSystemListener fileSystemListener =
new TestServerRemoteFileSystemListener(latch, expectedEventCount);
RemoteFileSystemServerConnector testConnector =
connectorFactory.createServerConnector("TestService", parameters, fileSystemListener);
testConnector.start();
latch.await(1, TimeUnit.MINUTES);
List<String> eventList = fileSystemListener.getEventList();
if (eventList.size() == 0) {
Assert.fail("File event didn't triggered.");
}
Assert.assertEquals(eventList.size(), expectedEventCount, "Generated events count mismatch " +
"with the expected.");
Assert.assertTrue(eventList.contains(buildConnectionURL() + "/exe/run.exe"));
Assert.assertTrue(eventList.contains(buildConnectionURL() + "/file1.txt"));
testConnector.stop();
}
开发者ID:wso2,项目名称:carbon-transports,代码行数:26,代码来源:RemoteFileSystemServerConnectorTestCase.java
示例5: clearDirectory
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
/**
* recursively delete directory and all contained files.
*
* @param dir directory to clear
*/
protected void clearDirectory(final File dir) {
if ((testingDst == dir) && "ftp".equals(filesystem)) {
FileSystem fs = new UnixFakeFileSystem();
fs.add(new DirectoryEntry("/sampleuser"));
m_fakeServer.setFileSystem(fs);
}
else {
File[] children = dir.listFiles();
if (null != children) {
for (File file : children) {
if (file.isDirectory()) {
clearDirectory(file);
}
assertTrue("File.delete failed for: " + file.getAbsolutePath(), file.delete());
}
}
}
}
开发者ID:fullsync,项目名称:fullsync,代码行数:24,代码来源:FilesystemTest.java
示例6: addDirectoryWithNameAndNumberOfFiles
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
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));
}
开发者ID:linuxserver,项目名称:davos,代码行数:9,代码来源:FakeFTPServerFactory.java
示例7: starting
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@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);
}
开发者ID:apache,项目名称:apex-malhar,代码行数:30,代码来源:FTPStringInputOperatorTest.java
示例8: init
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@BeforeClass
public void init() {
ftpServer = new FakeFtpServer();
ftpServer.setServerControlPort(0);
ftpServer.addUserAccount(new UserAccount(username, password, rootFolder));
fileSystem = new UnixFakeFileSystem();
fileSystem.add(new DirectoryEntry(rootFolder));
fileSystem.add(new FileEntry("/home/wso2/file1.txt", "some content 1234567890"));
fileSystem.add(new FileEntry("/home/wso2/exe/run.exe", "Test Value"));
ftpServer.setFileSystem(fileSystem);
ftpServer.start();
serverPort = ftpServer.getServerControlPort();
}
开发者ID:wso2,项目名称:carbon-transports,代码行数:15,代码来源:RemoteFileSystemServerConnectorTestCase.java
示例9: retrieveFileListAndDeleteTestCase
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@Test(description = "Testing whether correctly move files.", dependsOnMethods = "retrieveFileListAndMoveTestCase")
public void retrieveFileListAndDeleteTestCase() throws ServerConnectorException, InterruptedException {
int expectedEventCount = 2;
FileSystem fileSystem = new UnixFakeFileSystem();
fileSystem.add(new DirectoryEntry(rootFolder));
fileSystem.add(new FileEntry("/home/wso2/del1.txt"));
fileSystem.add(new FileEntry("/home/wso2/del2.txt"));
ftpServer.setFileSystem(fileSystem);
Map<String, String> parameters = getPropertyMap("DELETE", false);
CountDownLatch latch = new CountDownLatch(1);
RemoteFileSystemConnectorFactory connectorFactory = new RemoteFileSystemConnectorFactoryImpl();
TestServerRemoteFileSystemListener fileSystemListener =
new TestServerRemoteFileSystemListener(latch, expectedEventCount);
RemoteFileSystemServerConnector testConnector =
connectorFactory.createServerConnector("TestService", parameters, fileSystemListener);
testConnector.start();
latch.await(1, TimeUnit.MINUTES);
List<String> eventList = fileSystemListener.getEventList();
if (eventList.size() == 0) {
Assert.fail("File event didn't triggered.");
}
Assert.assertEquals(eventList.size(), expectedEventCount, "Generated events count mismatch " +
"with the expected.");
Assert.assertTrue(eventList.contains(buildConnectionURL() + "/del1.txt"));
Assert.assertTrue(eventList.contains(buildConnectionURL() + "/del2.txt"));
testConnector.stop();
}
开发者ID:wso2,项目名称:carbon-transports,代码行数:29,代码来源:RemoteFileSystemServerConnectorTestCase.java
示例10: start
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
/**
* 启动FTP
*/
private void start() {
queue = new LinkedBlockingDeque<>();
fakeFtpServer = new FakeFtpServer();
fakeFtpServer.addUserAccount(new UserAccount(USERNAME, PASSWORD, HOME_DIR));
FileSystem fileSystem = new WindowsFakeFileSystem();
fileSystem.add(new DirectoryEntry(HOME_DIR));
fakeFtpServer.setFileSystem(fileSystem);
fakeFtpServer.setServerControlPort(21);
fakeFtpServer.start();
int port = fakeFtpServer.getServerControlPort();
ftpPath = "ftp://" + USERNAME + ":" + PASSWORD + "@127.0.0.1:" + port;
}
开发者ID:edgar615,项目名称:javase-study,代码行数:18,代码来源:Main.java
示例11: main
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
public static void main(String[] args) {
FakeFtpServer fakeFtpServer = new FakeFtpServer();
fakeFtpServer.addUserAccount(new UserAccount("user", "pwd", "c:\\data"));
FileSystem fileSystem = new WindowsFakeFileSystem();
fileSystem.add(new DirectoryEntry("c:\\data"));
fileSystem.add(new FileEntry("c:\\data\\file1.txt", "abcdef 1234567890"));
fileSystem.add(new FileEntry("c:\\data\\run.exe"));
fakeFtpServer.setFileSystem(fileSystem);
fakeFtpServer.setServerControlPort(21);
fakeFtpServer.start();
}
开发者ID:edgar615,项目名称:javase-study,代码行数:13,代码来源:MockFtp.java
示例12: testExecuteWindows
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@Test
public void testExecuteWindows() throws Exception {
FakeFtpServer aFakeFtpServer = new FakeFtpServer();
aFakeFtpServer.setServerControlPort(0);
aFakeFtpServer.addUserAccount(new UserAccount("user", "password", "c:\\"));
FileSystem aFileSystem = new WindowsFakeFileSystem();
aFileSystem.add(new DirectoryEntry("c:\\data"));
aFileSystem.add(new FileEntry("c:\\data\\file1.txt", "file1"));
aFileSystem.add(new FileEntry("c:\\data\\file2.html", "file2"));
aFileSystem.add(new FileEntry("c:\\data\\file3.html", "file3"));
aFakeFtpServer.setFileSystem(aFileSystem);
aFakeFtpServer.start();
int aPort = aFakeFtpServer.getServerControlPort();
assertFalse(aFileSystem.exists("c:\\data\\input.csv"));
assertFalse(aFileSystem.exists("c:\\data\\input1000.csv"));
assertFalse(aFileSystem.exists("c:\\data\\mixedindex.csv"));
FTPUploadTasklet aTasklet = new FTPUploadTasklet();
DefaultFtpClientFactory aFtpClientFactory = new DefaultFtpClientFactory();
aFtpClientFactory.setHost("localhost");
aFtpClientFactory.setPort(aPort);
aFtpClientFactory.setUsername("user");
aFtpClientFactory.setPassword("password");
aFtpClientFactory.setSystemKey("WINDOWS");
aTasklet.setFtpClientFactory(aFtpClientFactory);
aTasklet.setLocalBaseDir("src/test/resources/testFiles");
aTasklet.setRemoteBaseDir("c:/data/");
aTasklet.setRegexFilename(".*\\.csv");
aTasklet.execute(null, null);
assertTrue(aFileSystem.exists("c:\\data\\input.csv"));
assertTrue(aFileSystem.exists("c:\\data\\input1000.csv"));
assertTrue(aFileSystem.exists("c:\\data\\mixedindex.csv"));
}
开发者ID:acxio,项目名称:AGIA,代码行数:41,代码来源:FTPUploadTaskletTest.java
示例13: start
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@Override
public void start(String content) {
ftpServer = new FakeFtpServer();
ftpServer.setServerControlPort(8083);
ftpServer.addUserAccount(new UserAccount("user", "pass", "/"));
FileSystem fileSystem = new UnixFakeFileSystem();
fileSystem.add(new DirectoryEntry("/"));
fileSystem.add(new FileEntry("/" + FILE_NAME, content));
ftpServer.setFileSystem(fileSystem);
ftpServer.start();
}
开发者ID:jvalue,项目名称:open-data-service,代码行数:12,代码来源:FtpServer.java
示例14: testExecuteUnix
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@Test
public void testExecuteUnix() throws Exception {
FakeFtpServer aFakeFtpServer = new FakeFtpServer();
aFakeFtpServer.setServerControlPort(0);
aFakeFtpServer.addUserAccount(new UserAccount("user", "password", "/"));
FileSystem aFileSystem = new UnixFakeFileSystem();
aFileSystem.add(new DirectoryEntry("/data"));
aFileSystem.add(new FileEntry("/data/file1.txt", "file1"));
aFileSystem.add(new FileEntry("/data/file2.html", "file2"));
aFileSystem.add(new FileEntry("/data/file3.html", "file3"));
aFakeFtpServer.setFileSystem(aFileSystem);
aFakeFtpServer.start();
int aPort = aFakeFtpServer.getServerControlPort();
assertFalse(aFileSystem.exists("/data/input.csv"));
assertFalse(aFileSystem.exists("/data/input1000.csv"));
assertFalse(aFileSystem.exists("/data/mixedindex.csv"));
FTPUploadTasklet aTasklet = new FTPUploadTasklet();
DefaultFtpClientFactory aFtpClientFactory = new DefaultFtpClientFactory();
aFtpClientFactory.setHost("localhost");
aFtpClientFactory.setPort(aPort);
aFtpClientFactory.setUsername("user");
aFtpClientFactory.setPassword("password");
aTasklet.setFtpClientFactory(aFtpClientFactory);
aTasklet.setLocalBaseDir("src/test/resources/testFiles");
aTasklet.setRemoteBaseDir("/data/");
aTasklet.setRegexFilename(".*\\.csv");
StepContribution aStepContribution = mock(StepContribution.class);
aTasklet.execute(aStepContribution, null);
assertTrue(aFileSystem.exists("/data/input.csv"));
assertTrue(aFileSystem.exists("/data/input1000.csv"));
assertTrue(aFileSystem.exists("/data/mixedindex.csv"));
verify(aStepContribution, times(3)).incrementReadCount();
verify(aStepContribution, times(3)).incrementWriteCount(1);
}
开发者ID:acxio,项目名称:AGIA,代码行数:45,代码来源:FTPUploadTaskletTest.java
示例15: testExecuteUnix
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@Test
public void testExecuteUnix() throws Exception {
assertFalse(new File("target/file2.zip").exists());
assertFalse(new File("target/file3.zip").exists());
FakeFtpServer aFakeFtpServer = new FakeFtpServer();
aFakeFtpServer.setServerControlPort(0);
aFakeFtpServer.addUserAccount(new UserAccount("user", "password", "/"));
FileSystem aFileSystem = new UnixFakeFileSystem();
aFileSystem.add(new DirectoryEntry("/data"));
aFileSystem.add(new FileEntry("/data/file1.txt", "file1"));
aFileSystem.add(new FileEntry("/data/file2.zip", "file2"));
aFileSystem.add(new FileEntry("/data/file3.zip", "file3"));
aFakeFtpServer.setFileSystem(aFileSystem);
aFakeFtpServer.start();
int aPort = aFakeFtpServer.getServerControlPort();
FTPDownloadTasklet aTasklet = new FTPDownloadTasklet();
DefaultFtpClientFactory aFtpClientFactory = new DefaultFtpClientFactory();
aFtpClientFactory.setHost("localhost");
aFtpClientFactory.setPort(aPort);
aFtpClientFactory.setUsername("user");
aFtpClientFactory.setPassword("password");
aFtpClientFactory.setFileTransferMode(2);
aFtpClientFactory.setFileType(2);
aFtpClientFactory.setBufferSize(100000);
aTasklet.setFtpClientFactory(aFtpClientFactory);
aTasklet.setLocalBaseDir("target");
aTasklet.setRemoteBaseDir("/data/");
aTasklet.setRegexFilename(".*\\.zip");
StepContribution aStepContribution = mock(StepContribution.class);
aTasklet.execute(aStepContribution, null);
assertTrue(new File("target/file2.zip").exists());
assertTrue(new File("target/file3.zip").exists());
new File("target/file2.zip").delete();
new File("target/file3.zip").delete();
verify(aStepContribution, times(2)).incrementReadCount();
verify(aStepContribution, times(2)).incrementWriteCount(1);
}
开发者ID:acxio,项目名称:AGIA,代码行数:50,代码来源:FTPDownloadTaskletTest.java
示例16: testExecuteWindows
import org.mockftpserver.fake.filesystem.DirectoryEntry; //导入依赖的package包/类
@Test
public void testExecuteWindows() throws Exception {
assertFalse(new File("target/file2.zip").exists());
assertFalse(new File("target/file3.zip").exists());
FakeFtpServer aFakeFtpServer = new FakeFtpServer();
aFakeFtpServer.setServerControlPort(0);
aFakeFtpServer.addUserAccount(new UserAccount("user", "password", "c:\\"));
FileSystem aFileSystem = new WindowsFakeFileSystem();
aFileSystem.add(new DirectoryEntry("c:\\data"));
aFileSystem.add(new FileEntry("c:\\data\\file1.txt", "file1"));
aFileSystem.add(new FileEntry("c:\\data\\file2.zip", "file2"));
aFileSystem.add(new FileEntry("c:\\data\\file3.zip", "file3"));
aFakeFtpServer.setFileSystem(aFileSystem);
aFakeFtpServer.start();
int aPort = aFakeFtpServer.getServerControlPort();
FTPDownloadTasklet aTasklet = new FTPDownloadTasklet();
DefaultFtpClientFactory aFtpClientFactory = new DefaultFtpClientFactory();
aFtpClientFactory.setHost("localhost");
aFtpClientFactory.setPort(aPort);
aFtpClientFactory.setUsername("user");
aFtpClientFactory.setPassword("password");
aFtpClientFactory.setSystemKey("WINDOWS");
aFtpClientFactory.setFileTransferMode(2);
aFtpClientFactory.setFileType(2);
aFtpClientFactory.setBufferSize(100000);
aTasklet.setFtpClientFactory(aFtpClientFactory);
aTasklet.setLocalBaseDir("target");
aTasklet.setRemoteBaseDir("c:/data/");
aTasklet.setRegexFilename(".*\\.zip");
aTasklet.execute(null, null);
assertTrue(new File("target/file2.zip").exists());
assertTrue(new File("target/file3.zip").exists());
new File("target/file2.zip").delete();
new File("target/file3.zip").delete();
}
开发者ID:acxio,项目名称:AGIA,代码行数:46,代码来源:FTPDownloadTaskletTest.java
注:本文中的org.mockftpserver.fake.filesystem.DirectoryEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论