internal void SetDirection(BlobStoreType source, BlobStoreType destination)
        {
            switch (source)
            {
            case BlobStoreType.GridFs:
                _originalStore = _config.OriginalGridFsBlobStore;
                _artifactStore = _config.ArtifactsGridFsBlobStore;
                break;

            case BlobStoreType.FileSystem:
                _originalStore = _config.OriginalFileSystemBlobStore;
                _artifactStore = _config.ArtifactsFileSystemBlobStore;

                break;

            default:
                throw new NotSupportedException($"Source {source} not supported");
            }
            switch (destination)
            {
            case BlobStoreType.GridFs:
                _destinationOriginalStore          = _config.OriginalGridFsBlobStore;
                _destinationArtifactsStoreAdvanced = _config.ArtifactsGridFsBlobStore;
                break;

            case BlobStoreType.FileSystem:
                _destinationOriginalStore          = _config.OriginalFileSystemBlobStore;
                _destinationArtifactsStoreAdvanced = _config.ArtifactsFileSystemBlobStore;
                break;

            default:
                throw new NotSupportedException($"Source {source} not supported");
            }
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            _tempLocalDirectory = Path.GetTempPath() + Guid.NewGuid().ToString();
            Directory.CreateDirectory(_tempLocalDirectory);

            if (_blobStoreToTest == "filesystem")
            {
                var fsStore = new FileSystemBlobStore(
                    MongoDbTestConnectionProvider.OriginalsDb,
                    FileSystemBlobStore.OriginalDescriptorStorageCollectionName,
                    _tempLocalDirectory,
                    new CounterService(MongoDbTestConnectionProvider.SystemDb),
                    "",
                    "")
                {
                    Logger = new ConsoleLogger()
                };
                _sut         = fsStore;
                _sutAdvanced = fsStore as IBlobStoreAdvanced;
            }
            else if (_blobStoreToTest == "gridfs")
            {
                MongoDbTestConnectionProvider.DropTestsTenant();

                var gridfsStore = new GridFsBlobStore
                                  (
                    MongoDbTestConnectionProvider.OriginalsDbLegacy,
                    new CounterService(MongoDbTestConnectionProvider.SystemDb)
                                  )
                {
                    Logger = new ConsoleLogger()
                };
                _sut         = gridfsStore;
                _sutAdvanced = gridfsStore as IBlobStoreAdvanced;
            }
        }
 private bool BlobExists(IBlobStoreAdvanced blobStoreAdvanced, BlobId blobId)
 {
     return(blobStoreAdvanced.BlobExists(blobId));
 }