1 16 package org.apache.commons.vfs.provider.sftp.test; 17 18 import junit.framework.Test; 19 import org.apache.commons.vfs.FileObject; 20 import org.apache.commons.vfs.FileSystemManager; 21 import org.apache.commons.vfs.FileSystemOptions; 22 import org.apache.commons.vfs.impl.DefaultFileSystemManager; 23 import org.apache.commons.vfs.provider.sftp.SftpFileProvider; 24 import org.apache.commons.vfs.provider.sftp.SftpFileSystemConfigBuilder; 25 import org.apache.commons.vfs.provider.sftp.TrustEveryoneUserInfo; 26 import org.apache.commons.vfs.test.AbstractProviderTestConfig; 27 import org.apache.commons.vfs.test.ProviderTestSuite; 28 29 34 public class SftpProviderTestCase 35 extends AbstractProviderTestConfig 36 { 37 public static Test suite() throws Exception 38 { 39 return new ProviderTestSuite(new SftpProviderTestCase()); 40 } 41 42 45 public void prepare(final DefaultFileSystemManager manager) 46 throws Exception 47 { 48 manager.addProvider("sftp", new SftpFileProvider()); 49 } 50 51 54 public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception 55 { 56 final String uri = System.getProperty("test.sftp.uri"); 57 58 FileSystemOptions fileSystemOptions = new FileSystemOptions(); 59 SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(fileSystemOptions, "no"); 60 SftpFileSystemConfigBuilder.getInstance().setUserInfo(fileSystemOptions, new TrustEveryoneUserInfo()); 61 62 return manager.resolveFile(uri, fileSystemOptions); 63 } 64 } 65 | Popular Tags |