/// <summary> /// Returns a file system implementation, which is assigned /// to the <see cref="TestContext.FileSystem"/> property. /// </summary> /// <param name="localTestFolder">The temporary test folder that is /// used by the context. This is actually just the <see cref="TestContext.LocalTestRoot"/> /// reference.</param> protected override IFileSystemProvider InitFileSystem(DirectoryInfo localTestFolder) { //init empty zip file ZipFilePath = Path.Combine(localTestFolder.FullName, "TestArchive.zip"); var zip = new ZipFile(ZipFilePath); zip.Save(); zip.Dispose(); //init transfer stores var downloadTransferStore = new TestTransferStore<ZipDownloadTransfer>(); var uploadTransferStore = new TestTransferStore<ZipUploadTransfer>(); //init configuration var tempFactory = new TempFileStreamFactory(LocalTestRoot.FullName); var zipFile = new FileInfo(ZipFilePath); var configuration = new ZipFileSystemConfiguration(zipFile, tempFactory); configuration.RootName = "Test Root"; configuration.DownloadStore = downloadTransferStore; configuration.UploadStore = uploadTransferStore; configuration.DownloadTokenExpirationTime = TimeSpan.FromHours(24); configuration.UploadTokenExpirationTime = TimeSpan.FromHours(24); configuration.DefaultDownloadBlockSize = 32768; configuration.MaxDownloadBlockSize = 32768 * 2; configuration.MaxUploadBlockSize = 32768 * 4; configuration.MaxUploadFileSize = (long)1024 * 1024 * 2048; //2GB limit //create provider Provider = new ZipFileProvider(configuration); return Provider; }
public void Init() { rootDirectory = TestUtil.CreateTestDirectory(); //init provider DownloadTransferStore = new TestTransferStore<LocalDownloadTransfer>(); UploadTransferStore = new TestTransferStore<LocalUploadTransfer>(); var configuration = LocalFileSystemConfiguration.CreateForRootDirectory(rootDirectory, true); configuration.DownloadStore = DownloadTransferStore; configuration.UploadStore = UploadTransferStore; configuration.DownloadTokenExpirationTime = TimeSpan.FromHours(24); configuration.UploadTokenExpirationTime = TimeSpan.FromHours(24); configuration.DefaultDownloadBlockSize = 32768; configuration.MaxDownloadBlockSize = 32768 * 2; configuration.MaxUploadBlockSize = 32768 * 4; AdjustFileSystemConfiguration(configuration); FileSystemConfiguration = configuration; provider = new LocalFileSystemProvider(FileSystemConfiguration); root = provider.GetFileSystemRoot(); InitInternal(); }
public void Init() { rootDirectory = TestUtil.CreateTestDirectory(); //init provider DownloadTransferStore = new TestTransferStore <LocalDownloadTransfer>(); UploadTransferStore = new TestTransferStore <LocalUploadTransfer>(); var configuration = LocalFileSystemConfiguration.CreateForRootDirectory(rootDirectory, true); configuration.DownloadStore = DownloadTransferStore; configuration.UploadStore = UploadTransferStore; configuration.DownloadTokenExpirationTime = TimeSpan.FromHours(24); configuration.UploadTokenExpirationTime = TimeSpan.FromHours(24); configuration.DefaultDownloadBlockSize = 32768; configuration.MaxDownloadBlockSize = 32768 * 2; configuration.MaxUploadBlockSize = 32768 * 4; AdjustFileSystemConfiguration(configuration); FileSystemConfiguration = configuration; provider = new LocalFileSystemProvider(FileSystemConfiguration); root = provider.GetFileSystemRoot(); InitInternal(); }
/// <summary> /// Creates file system provider that is managed on the /// server side. This is just a <see cref="LocalFileSystemProvider"/> /// which manages an empty temp directory. /// </summary> /// <returns></returns> protected virtual IFileSystemProvider GetServiceProvider() { var root = FileUtil.CreateTempFolder("_Vfs.Restful.Server.Test"); var configuration = LocalFileSystemConfiguration.CreateForRootDirectory(root, true); var downloadTransferStore = new TestTransferStore<LocalDownloadTransfer>(); var uploadTransferStore = new TestTransferStore<LocalUploadTransfer>(); configuration.DownloadStore = downloadTransferStore; configuration.UploadStore = uploadTransferStore; configuration.DownloadTokenExpirationTime = TimeSpan.FromHours(24); configuration.UploadTokenExpirationTime = TimeSpan.FromHours(24); configuration.DefaultDownloadBlockSize = 32768; configuration.MaxDownloadBlockSize = 32768 * 2; configuration.MaxUploadBlockSize = 32768 * 4; configuration.MaxUploadFileSize = (long)1024 * 1024 * 2048; //2GB limit return new LocalFileSystemProvider(configuration); }
/// <summary> /// Creates file system provider that is managed on the /// server side. This is just a <see cref="LocalFileSystemProvider"/> /// which manages an empty temp directory. /// </summary> /// <returns></returns> protected virtual IFileSystemProvider GetServiceProvider() { var root = FileUtil.CreateTempFolder("_Vfs.Restful.Server.Test"); var configuration = LocalFileSystemConfiguration.CreateForRootDirectory(root, true); var downloadTransferStore = new TestTransferStore <LocalDownloadTransfer>(); var uploadTransferStore = new TestTransferStore <LocalUploadTransfer>(); configuration.DownloadStore = downloadTransferStore; configuration.UploadStore = uploadTransferStore; configuration.DownloadTokenExpirationTime = TimeSpan.FromHours(24); configuration.UploadTokenExpirationTime = TimeSpan.FromHours(24); configuration.DefaultDownloadBlockSize = 32768; configuration.MaxDownloadBlockSize = 32768 * 2; configuration.MaxUploadBlockSize = 32768 * 4; configuration.MaxUploadFileSize = (long)1024 * 1024 * 2048; //2GB limit return(new LocalFileSystemProvider(configuration)); }
/// <summary> /// Returns a file system implementation, which is assigned /// to the <see cref="TestContext.FileSystem"/> property. /// </summary> /// <param name="localTestFolder">The temporary test folder that is /// used by the context. This is actually just the <see cref="TestContext.LocalTestRoot"/> /// reference.</param> protected override IFileSystemProvider InitFileSystem(DirectoryInfo localTestFolder) { //use independent test folder var rootDirectory = FileUtil.CreateTempFolder("_Vfs.Local.TestRepository"); //init provider var downloadTransferStore = new TestTransferStore<LocalDownloadTransfer>(); var uploadTransferStore = new TestTransferStore<LocalUploadTransfer>(); var configuration = LocalFileSystemConfiguration.CreateForRootDirectory(rootDirectory, true); configuration.DownloadStore = downloadTransferStore; configuration.UploadStore = uploadTransferStore; configuration.DownloadTokenExpirationTime = TimeSpan.FromHours(24); configuration.UploadTokenExpirationTime = TimeSpan.FromHours(24); configuration.DefaultDownloadBlockSize = 32768; configuration.MaxDownloadBlockSize = 32768 * 2; configuration.MaxUploadBlockSize = 32768 * 4; configuration.MaxUploadFileSize = (long)1024*1024*2048; //2GB limit return new LocalFileSystemProvider(configuration); }
/// <summary> /// Returns a file system implementation, which is assigned /// to the <see cref="TestContext.FileSystem"/> property. /// </summary> /// <param name="localTestFolder">The temporary test folder that is /// used by the context. This is actually just the <see cref="TestContext.LocalTestRoot"/> /// reference.</param> protected override IFileSystemProvider InitFileSystem(DirectoryInfo localTestFolder) { //use independent test folder var rootDirectory = FileUtil.CreateTempFolder("_Vfs.Local.TestRepository"); //init provider var downloadTransferStore = new TestTransferStore <LocalDownloadTransfer>(); var uploadTransferStore = new TestTransferStore <LocalUploadTransfer>(); var configuration = LocalFileSystemConfiguration.CreateForRootDirectory(rootDirectory, true); configuration.DownloadStore = downloadTransferStore; configuration.UploadStore = uploadTransferStore; configuration.DownloadTokenExpirationTime = TimeSpan.FromHours(24); configuration.UploadTokenExpirationTime = TimeSpan.FromHours(24); configuration.DefaultDownloadBlockSize = 32768; configuration.MaxDownloadBlockSize = 32768 * 2; configuration.MaxUploadBlockSize = 32768 * 4; configuration.MaxUploadFileSize = (long)1024 * 1024 * 2048; //2GB limit return(new LocalFileSystemProvider(configuration)); }
/// <summary> /// Returns a file system implementation, which is assigned /// to the <see cref="TestContext.FileSystem"/> property. /// </summary> /// <param name="localTestFolder">The temporary test folder that is /// used by the context. This is actually just the <see cref="TestContext.LocalTestRoot"/> /// reference.</param> protected override IFileSystemProvider InitFileSystem(DirectoryInfo localTestFolder) { //init empty zip file ZipFilePath = Path.Combine(localTestFolder.FullName, "TestArchive.zip"); var zip = new ZipFile(ZipFilePath); zip.Save(); zip.Dispose(); //init transfer stores var downloadTransferStore = new TestTransferStore <ZipDownloadTransfer>(); var uploadTransferStore = new TestTransferStore <ZipUploadTransfer>(); //init configuration var tempFactory = new TempFileStreamFactory(LocalTestRoot.FullName); var zipFile = new FileInfo(ZipFilePath); var configuration = new ZipFileSystemConfiguration(zipFile, tempFactory); configuration.RootName = "Test Root"; configuration.DownloadStore = downloadTransferStore; configuration.UploadStore = uploadTransferStore; configuration.DownloadTokenExpirationTime = TimeSpan.FromHours(24); configuration.UploadTokenExpirationTime = TimeSpan.FromHours(24); configuration.DefaultDownloadBlockSize = 32768; configuration.MaxDownloadBlockSize = 32768 * 2; configuration.MaxUploadBlockSize = 32768 * 4; configuration.MaxUploadFileSize = (long)1024 * 1024 * 2048; //2GB limit //create provider Provider = new ZipFileProvider(configuration); return(Provider); }