Example #1
0
 public void Storage_wipes_cache_directory_on_shutdown() {
     Assert.IsFalse(Directory.Exists(_tempDirectory), "temp dir already exists");
     var storage = Storage;
     Assert.IsTrue(Directory.Exists(_tempDirectory), "temp dir did not get created when storage was fired up");
     var cacheFile = Path.Combine(_tempDirectory, "foo");
     File.WriteAllText(cacheFile, "bar");
     Assert.IsTrue(File.Exists(cacheFile), "manually created cache file is missing");
     _s3Storage = null;
     storage.Dispose();
     Assert.IsFalse(Directory.Exists(_tempDirectory), "temp dir is still there after dispose");
 }
Example #2
0
 public void Teardown() {
     MockPlug.DeregisterAll();
     if(!string.IsNullOrEmpty(_tempFilename)) {
         _filestream.Dispose();
         File.Delete(_tempFilename);
     }
     if(_s3Storage != null) {
         _s3Storage.Dispose();
     }
     _s3Storage = null;
 }
Example #3
0
        private static void S3ToFS(AttachmentBE[] attachmentList) {
            XDoc s3config = new XDoc("config")
                .Start("publickey").Value(_public_key).End()
                .Start("privatekey").Value(_private_key).End()
                .Start("bucket").Value(_default_bucket).End()
                .Start("prefix").Value(_prefix).End();
            S3Storage s3 = new S3Storage(s3config);

            XDoc fsconfig = new XDoc("config")
                .Start("path").Value(_attachmentPath).End();
            FSStorage fs = new FSStorage(fsconfig);

            transferFiles(attachmentList, s3, fs);
        }
Example #4
0
        private static void FSToS3(ResourceBE[] attachmentList) {
            XDoc s3config = new XDoc("config")
                .Start("publickey").Value(_public_key).End()
                .Start("privatekey").Value(_private_key).End()
                .Start("bucket").Value(_default_bucket).End()
                .Start("prefix").Value(_prefix).End();
            S3Storage s3 = new S3Storage(s3config, LogUtils.CreateLog<S3Storage>());

            XDoc fsconfig = new XDoc("config")
                .Start("path").Value(_attachmentPath).End();
            FSStorage fs = new FSStorage(fsconfig);

            transferFiles(attachmentList, fs, s3);
        }