本文整理汇总了Java中org.mockftpserver.fake.filesystem.UnixFakeFileSystem类的典型用法代码示例。如果您正苦于以下问题:Java UnixFakeFileSystem类的具体用法?Java UnixFakeFileSystem怎么用?Java UnixFakeFileSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnixFakeFileSystem类属于org.mockftpserver.fake.filesystem包,在下文中一共展示了UnixFakeFileSystem类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startftp
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的package包/类
@BeforeClass
protected void startftp() throws Exception
{
fakeFtpServer = new FakeFtpServer();
fakeFtpServer.setServerControlPort(8089); // use any free port
FileSystem fileSystem = new UnixFakeFileSystem();
fileSystem.add(new FileEntry("/data/s1-level-1-calibration.xsd", "<schema/>"));
fileSystem.add(new FileEntry("/data/s1-object-types.xsd", "<schema/>"));
fileSystem.add(new FileEntry("/data/GOM_EXT_2PNPDE20070312_232536_000000542056_00202_26308_1271.N1", "GOMOS DATA!"));
fileSystem.add(new FileEntry ("/data/S1A_IW_SLC__1SDV_20141003T054235_20141003T054304_002661_002F66_D5C8.SAFE/manifest.safe", "<XFDU/>"));
fileSystem.add(new FileEntry ("/data/S1A_EW_GRDH_1SSH_20120101T022934_20120101T022945_001770_000001_AF02.SAFE/manifest.safe", "<XFDU/>"));
fileSystem.add(new FileEntry("/data/manifest.safe", "<XFDU/>"));
fakeFtpServer.setFileSystem(fileSystem);
UserAccount userAccount = new UserAccount("user", "password", "/");
fakeFtpServer.addUserAccount(userAccount);
fakeFtpServer.start();
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:22,代码来源:ScannerFactoryTest.java
示例2: setup
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的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
示例3: init
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的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: clearDirectory
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的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
示例5: starting
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的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
示例6: init
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的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
示例7: retrieveFileListAndDeleteTestCase
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的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
示例8: start
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的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
示例9: testFtp
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的package包/类
@Test
public void testFtp() throws Exception {
FakeFtpServer fakeFtpServer = new FakeFtpServer();
fakeFtpServer.setServerControlPort(0);
FileSystem fileSystem = new UnixFakeFileSystem();
File file =
new File(currentThread().getContextClassLoader().getResource("remote-download-source/parseNoError").getFile())
.listFiles()[0];
String value = FileUtils.readFileToString(file);
fileSystem.add(new FileEntry("/testfile", value));
fakeFtpServer.setFileSystem(fileSystem);
UserAccount userAccount = new UserAccount("testuser", "pass", "/");
fakeFtpServer.addUserAccount(userAccount);
fakeFtpServer.start();
int port = fakeFtpServer.getServerControlPort();
RemoteDownloadSource origin =
new RemoteDownloadSource(getBean(
"ftp://localhost:" + String.valueOf(port) + "/",
true,
"testuser",
"pass",
null,
null,
null,
true,
DataFormat.JSON,
null,
false,
"*"
));
SourceRunner runner = new SourceRunner.Builder(RemoteDownloadDSource.class, origin)
.addOutputLane("lane")
.build();
runner.runInit();
List<Record> expected = getExpectedRecords();
String offset = RemoteDownloadSource.NOTHING_READ;
StageRunner.Output op = runner.runProduce(offset, 1000);
List<Record> actual = op.getRecords().get("lane");
Assert.assertEquals(expected.size(), actual.size());
for (int i = 0; i < 2; i++) {
Assert.assertEquals(expected.get(i).get(), actual.get(i).get());
}
runner.runDestroy();
}
开发者ID:streamsets,项目名称:datacollector,代码行数:47,代码来源:TestRemoteDownloadSource.java
示例10: testExecuteUnix
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的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
示例11: testExecuteUnix
import org.mockftpserver.fake.filesystem.UnixFakeFileSystem; //导入依赖的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
注:本文中的org.mockftpserver.fake.filesystem.UnixFakeFileSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论