public StreamProjection( ICollectionWrapper <StreamReadModel, Int64> streamReadModelCollection, IDocumentWriter documentWriter, IBlobStore blobStore, IQueueManager queueDispatcher, IReader <DocumentDescriptorReadModel, DocumentDescriptorId> documentDescriptorReadModel) { if (queueDispatcher is IObserveProjection) { Observe(queueDispatcher as IObserveProjection); } _streamReadModelCollection = streamReadModelCollection; _documentDescriptorReadModel = documentDescriptorReadModel; _documentWriter = documentWriter; _blobStore = blobStore; _streamReadModelCollection.Attach(this, false); if (_streamReadModelCollection.All.Any()) { _lastId = _streamReadModelCollection.All.Max(s => s.Id); } else { _lastId = 0; } }
/// <summary> /// Initializes a new instance of the <see cref="StickersController"/> class. /// </summary> public StickersController() { var connectionString = CloudConfigurationManager.GetSetting("StorageConnectionString"); this.stickerStore = new StickerStore(connectionString, CloudConfigurationManager.GetSetting("StickersTableName")); this.blobStore = new BlobStore(connectionString, CloudConfigurationManager.GetSetting("StickersBlobContainerName")); }
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"); } }
public void Init() { Clock.Freeze(); _blobStore = new InMemoryBlobStore(); _accounts = new Accounts(new InMemoryEventStore()); _treasury = new Treasury(_blobStore, _accounts); }
public void Initialize() { string connectionString = ConfigurationManager.AppSettings.Get("StorageConnectionString"); string blobContainerName = ConfigurationManager.AppSettings.Get("ImageBlobContainerName"); this.blobStore = new BlobStore(connectionString, blobContainerName); }
/// <summary> /// Given the collection of stream of document store, it starts scanning stream collection /// to undestand new blob that are added to the system and need to be copied. /// </summary> /// <param name="commitsCollection">Collection of all the commits of documenstore</param> /// <param name="blobStore">Blob store that points to store for original blob.</param> private void SyncFiles(IMongoCollection <BsonDocument> commitsCollection, IBlobStore blobStore) { var commits = commitsCollection .Find(Builders <BsonDocument> .Filter.Gte("_id", _info.LastCommit)) .Sort(Builders <BsonDocument> .Sort.Ascending("_id")) .ToEnumerable(); foreach (var commit in commits) { BsonArray events = commit["Events"].AsBsonArray; var checkpointToken = commit["_id"].AsInt64; foreach (var evt in events) { var body = evt["Payload"]["Body"].AsBsonDocument; var type = body["_t"].AsString; if (type.StartsWith("DocumentDescriptorInitialized")) { ScanCommit(blobStore, checkpointToken, body, false); } else if (type.StartsWith("DocumentDescriptorDeleted")) { ScanCommit(blobStore, checkpointToken, body, true); } } _info.LastCommit = checkpointToken + 1; } }
public void Export(IBlobStore target) { if (target == null) { throw new ArgumentNullException(nameof(target)); } var container = target; var instancePool = mInstancePool; foreach (var type in mSchema.GetKnownElements().SelectMany(x => x.ConcreteTypes)) { var section = PersistedNode.GetContainerKey(type); var sectionContainer = container.GetChildStore(section); foreach (var instance in instancePool.GetAll(type)) { var key = new StringKey($"{instance.Key}.json"); using (var writer = sectionContainer.Open(key).AsText().Write()) { try { instance.Serialize(writer, mConverters); } catch (Exception exception) { throw new InvalidDataException($"Object \"{instance.Key}\" ({section}): {exception.Message}", exception); } } } } }
public void SetUp() { _tempLocalDirectory = Path.GetTempPath() + Guid.NewGuid().ToString(); Directory.CreateDirectory(_tempLocalDirectory); if (_blobStoreToTest == "filesystem") { _sut = new FileSystemBlobStore(MongoDbTestConnectionProvider.OriginalsDb, "originals", _tempLocalDirectory, new CounterService(MongoDbTestConnectionProvider.SystemDb)) { Logger = new ConsoleLogger() }; } else if (_blobStoreToTest == "gridfs") { MongoDbTestConnectionProvider.DropTestsTenant(); _sut = new GridFsBlobStore ( MongoDbTestConnectionProvider.OriginalsDbLegacy, new CounterService(MongoDbTestConnectionProvider.SystemDb) ) { Logger = new ConsoleLogger() }; } }
public void SetUp() { var config = new DocumentStoreTestConfiguration(); MongoDbTestConnectionProvider.DropTestsTenant(); config.SetTestAddress(TestConfig.ServerAddress); _documentStoreService = new DocumentStoreBootstrapper(); _documentStoreService.Start(config); TenantContext.Enter(new TenantId(TestConfig.Tenant)); var tenant = ContainerAccessor.Instance.Resolve <TenantManager>().Current; _bus = tenant.Container.Resolve <ICommandBus>(); _filestore = tenant.Container.Resolve <IBlobStore>(); Assert.IsTrue(_bus is IInProcessCommandBus); //Issue: https://github.com/ProximoSrl/Jarvis.DocumentStore/issues/26 //you need to resolve the IReader that in turns resolves the ProjectionEngine, becauase if you //directly resolve the ITriggerProjectionsUpdate, projection engine will be resolved multiple times. tenant.Container.Resolve <IReader <StreamReadModel, Int64> >(); _projections = tenant.Container.Resolve <ITriggerProjectionsUpdate>(); _handleWriter = tenant.Container.Resolve <IDocumentWriter>(); _documentReader = tenant.Container.Resolve <IReader <DocumentDescriptorReadModel, DocumentDescriptorId> >(); }
public ItemStore(IStorageLocator storageLocator) { _table = storageLocator.GetTable(TABLE_NAME); _rawBlob = storageLocator.GetBlob(RAW_BLOB_NAME); _finishedBlob = storageLocator.GetBlob(FINISHED_BLOB_NAME); _queue = storageLocator.GetQueue(QUEUE_NAME); }
public void SetUp() { var config = new DocumentStoreTestConfiguration(_engineVersion); MongoDbTestConnectionProvider.DropTestsTenant(); config.SetTestAddress(TestConfig.TestHostServiceAddress); _documentStoreService = new DocumentStoreBootstrapper(); _documentStoreService.Start(config); _documentStoreClient = new DocumentStoreServiceClient( TestConfig.ServerAddress, TestConfig.Tenant ); _tenant = ContainerAccessor.Instance.Resolve <TenantManager>().GetTenant(new TenantId(TestConfig.Tenant)); //Issue: https://github.com/ProximoSrl/Jarvis.DocumentStore/issues/26 //you need to resolve the IReader that in turns resolves the ProjectionEngine, becauase if you //directly resolve the ITriggerProjectionsUpdate, projection engine will be resolved multiple times. _tenant.Container.Resolve <IReader <StreamReadModel, Int64> >(); _projections = _tenant.Container.Resolve <ITriggerProjectionsUpdate>(); _documentDescriptorCollection = MongoDbTestConnectionProvider.ReadModelDb.GetCollection <DocumentDescriptorReadModel>("rm.DocumentDescriptor"); _documentCollection = MongoDbTestConnectionProvider.ReadModelDb.GetCollection <DocumentReadModel>("rm.Document"); _commitCollection = MongoDbTestConnectionProvider.ReadModelDb.GetCollection <BsonDocument>("Commits"); _blobStore = _tenant.Container.Resolve <IBlobStore>(); MongoFlatMapper.EnableFlatMapping(true); }
public RecycleBinController( IRecycleBin recycleBin, IBlobStore blobStore ) { _recycleBin = recycleBin; _blobStore = blobStore; }
public RecycleBinController( IRecycleBin recycleBin, IBlobStore blobStore ) { _recycleBin = recycleBin; _blobStore = blobStore; }
public FormatStoreMultipartStreamProvider( IBlobStore store, DocumentFormat format ) : base(Path.GetTempPath()) { _store = store; _format = format; }
public ConsentFormController(IMembershipService membershipService, IBlobStore blobStore, IViewRepository<ConsentFormEditModel> viewRepository, IDocumentParser documentParser) : base(membershipService, blobStore) { _viewRepository = viewRepository; _documentParser = documentParser; }
public FormatStoreMultipartStreamProvider( IBlobStore store, DocumentFormat format ) : base(Path.GetTempPath()) { _store = store; _format = format; }
public PetImageUseCase(IUserStore userStore, IPetStore petStore, IBlobStore blobStore, IEntityFactory entityFactory) { _userStore = userStore; _blobStore = blobStore; _petStore = petStore; _entityFactory = entityFactory; }
public PluginHostContext([NotNull] IBlobStore pluginRoot) { if (pluginRoot == null) { throw new ArgumentNullException(nameof(pluginRoot)); } mPluginRoot = pluginRoot; }
public AlbumManager( IAlbumRepository albumRepository, IBlobStore blobStore, IUploadedFilesRepository uploadedFilesRepository) { _albumRepository = albumRepository; _blobStore = blobStore; _uploadedFilesRepository = uploadedFilesRepository; }
public DeduplicationHelper( DocumentStoreConfiguration config, DocumentDescriptorByHashReader hashReader, IBlobStore blobStore) { _config = config; _hashReader = hashReader; _blobStore = blobStore; }
public FileStoreMultipartStreamProvider( IBlobStore store, DocumentStoreConfiguration config ) : base(Path.GetTempPath()) { _store = store; _config = config; }
public FileStoreMultipartStreamProvider( IBlobStore store, DocumentStoreConfiguration config ) : base(Path.GetTempPath()) { _store = store; _config = config; }
public AzureBlobController(ICache cache, IBlobStore blob, IVersionBlobStore versionBlob, IChunkBlobStore chunkBlob) : base(cache) { Blob = blob; VersionBlob = versionBlob; ChunkBlob = chunkBlob; DomainContext = GetDomainContext(); }
public ImageController( IFileUploader fileUploader, IBlobStore blobStore, IAlbumManager albumManager) { _fileUploader = fileUploader; _blobStore = blobStore; _albumManager = albumManager; }
public void AddExternalDataSource(IBlobStore store) { if (store == null) { throw new ArgumentNullException(nameof(store)); } mStores.Add(store); }
public DeduplicationHelper( DocumentStoreConfiguration config, DocumentDescriptorByHashReader hashReader, IBlobStore blobStore) { _config = config; _hashReader = hashReader; _blobStore = blobStore; }
public AgentController(IAgentViewRepository agentViewRepository, IMembershipService membershipService, IModelConverter<Agent, AgentEditModel> agentModelConverter, IMessageCenter mailService, IBlobStore blobStore, IUnitOfWork unitOfWork) : base(membershipService, blobStore) { _membershipService = membershipService; _agentModelConverter = agentModelConverter; _mailService = mailService; _unitOfWork = unitOfWork; _agentViewRepository = agentViewRepository; }
protected SettingProvider([NotNull] IBlobStore store) { if (store == null) { throw new ArgumentNullException(nameof(store)); } mStore = store; mSettingGroups = new Dictionary <StringKey, IKeyValueStore <string> >(); }
public static BlobId Save <T>(this IBlobStore store, DocumentFormat format, T data) { using (var writer = store.CreateNew(format, new FileNameWithExtension(typeof(T).Name, "json"))) { var stringValue = JsonConvert.SerializeObject(data, PocoSerializationSettings.Default); using (var sw = new StreamWriter(writer.WriteStream, Encoding.UTF8)) { sw.Write(stringValue); } return(writer.BlobId); } }
public PatientDashboardController(IMembershipService membershipService, IBlobStore blobStore, IPatientDashboardModelConverter dashboardModelConverter, IPatientViewRepository patientViewRepository, IUnitOfWork unitOfWork, IAppointmentViewRepository appointmentViewRepository, IUserProcedureConsentService userProcedureConsentService) : base(membershipService, blobStore) { _dashboardModelConverter = dashboardModelConverter; _patientViewRepository = patientViewRepository; _unitOfWork = unitOfWork; _appointmentViewRepository = appointmentViewRepository; _userProcedureConsentService = userProcedureConsentService; }
public DocumentWorkflow( ICommandBus commandBus, IBlobStore blobStore, DeduplicationHelper deduplicationHelper, ICollectionWrapper <DocumentDescriptorReadModel, DocumentDescriptorId> documents, IHandleMapper handleMapper) { _commandBus = commandBus; _blobStore = blobStore; _deduplicationHelper = deduplicationHelper; _documents = documents; _handleMapper = handleMapper; }
public SASController( BlobServiceOptions options, ILoggerFactory loggerFactory, ISASStore sasStore, IContainerStore containerStore, IBlobStore blobStore) { _options = options ?? throw new ArgumentNullException(nameof(options)); _logger = loggerFactory?.CreateLogger <ContainersController>() ?? throw new ArgumentNullException(nameof(loggerFactory)); _sasStore = sasStore ?? throw new ArgumentNullException(nameof(sasStore)); _containerStore = containerStore ?? throw new ArgumentNullException(nameof(containerStore)); _blobStore = blobStore ?? throw new ArgumentNullException(nameof(blobStore)); }
internal List <ITableRow> Execute() { this.connection.StartTransaction(System.Data.IsolationLevel.ReadCommitted); DbCommand command = this.connection.CreateCommand(this.query.QueryString); var adapter = this.connection.CreateDataAdapter(command); var dataset = new DataSet(); adapter.Fill(dataset); List <ITableRow> rows = new List <ITableRow>(); for (int i = 0; i < dataset.Tables[0].Rows.Count; i++) { TableRow row = new TableRow(); Dictionary <IColumn, object> columnValues = new Dictionary <IColumn, object>(); row.ColumnValues = columnValues; object[] values = dataset.Tables[0].Rows[i].ItemArray; for (int j = 0; j < values.Count(); j++) { object value = values[j] == DBNull.Value ? null : values[j]; if (((SelectFilter)query).Columns[j].Type.Equals(typeof(DateTime))) { value = DateTime.SpecifyKind((DateTime)values[j], DateTimeKind.Utc); } if (((SelectFilter)query).Columns[j].Type.Equals(typeof(DateTime?)) && value != null) { value = DateTime.SpecifyKind((DateTime)value, DateTimeKind.Utc); } columnValues.Add(((SelectFilter)query).Columns[j], value); } if (this.table.BlobNameColumn != null) { object blobName = columnValues[this.table.BlobNameColumn]; object blobContainer = columnValues[this.table.BlobContainerColumn]; IBlobStore blobStore = BlobStoreFactory.Instance.GetBlobStore(); byte[] blobValue = blobStore.GetBlob(blobContainer.ToString(), blobName.ToString()); columnValues.Add(this.table.BlobValueColumn, blobValue); } rows.Add(row); } return(rows); }
public void SetUp() { longFolderName = Path.Combine(Path.GetTempPath(), new String('a', 230)); _blobId = new BlobId(_originalFormat, 1); _pathToTask = Path.Combine(longFolderName, "File_1.dsimport"); _fileToImport = Path.Combine(longFolderName, "A Word Document.docx"); _fileUri = new Uri(Path.Combine(longFolderName, "A word document.docx")); ClearQueueTempFolder(); Directory.CreateDirectory(longFolderName); File.Copy(Path.Combine(TestConfig.DocumentsFolder, "Queue\\File_1.dsimport"), _pathToTask); File.Copy(TestConfig.PathToWordDocument, _fileToImport); var accessor = Substitute.For <ITenantAccessor>(); var tenant = Substitute.For <ITenant>(); tenant.Id.Returns(new TenantId("tests")); var container = Substitute.For <IWindsorContainer>(); _commandBus = Substitute.For <ICommandBus>(); var identityGenerator = Substitute.For <IIdentityGenerator>(); _blobstore = Substitute.For <IBlobStore>(); _blobstore.Upload(Arg.Is(_originalFormat), Arg.Any <string>()).Returns(_blobId); _blobstore.Upload(Arg.Is(_originalFormat), Arg.Any <FileNameWithExtension>(), Arg.Any <Stream>()).Returns(_blobId); accessor.GetTenant(_testTenant).Returns(tenant); accessor.Current.Returns(tenant); tenant.Container.Returns(container); container.Resolve <IBlobStore>().Returns(_blobstore); container.Resolve <IIdentityGenerator>().Returns(identityGenerator); container.Resolve <IMongoDatabase>().Returns(MongoDbTestConnectionProvider.ReadModelDb); var collection = MongoDbTestConnectionProvider.ReadModelDb.GetCollection <ImportFailure>("sys.importFailures"); collection.Drop(); DocumentStoreTestConfiguration config = new DocumentStoreTestConfiguration(tenantId: "tests"); config.SetFolderToMonitor(longFolderName); var sysDb = config.TenantSettings.Single(t => t.TenantId == "tests").Get <IMongoDatabase>("system.db"); sysDb.Drop(); _queue = new ImportFormatFromFileQueue(config, accessor, _commandBus) { Logger = new ConsoleLogger() }; _queue.DeleteTaskFileAfterImport = false; }
public ResourcesController(IMembershipService membershipService, IBlobStore blobStore, IViewRepository<FileEditModelSync> viewRepository, IViewModelBuilder<FileEditModelSync> modelBuilder, IEntityConverter<DocumentSubcategory, CategoryEditModel> catConverter, IModelConverter<SharedDocument, FileEditModelSync> fileModelConverter, IViewRepository<UserProcedurePatientDocViewModel> patientDocViewRepository, IFileService fileService, IUnitOfWork unitOfWork) : base(membershipService, blobStore) { _viewRepository = viewRepository; _modelBuilder = modelBuilder; _catConverter = catConverter; _fileModelConverter = fileModelConverter; _patientDocViewRepository = patientDocViewRepository; _fileService = fileService; _unitOfWork = unitOfWork; }
public ImageModule(IRootPathProvider rootPathProvider, ICommandParser commandParser, IBlobStore store, IImageGenerator imageGenerator) { Post["/image/"] = _ => { Command c = null; if (!commandParser.TryParse(Request.Form.text.HasValue ? (string)Request.Form.text : string.Empty, out c)) { // Invalid input. Early return. return Response.AsJson(UnknownResponse); } if (string.Compare(c.Preamble, Command.HelpConstant, StringComparison.OrdinalIgnoreCase) == 0) { // Help request. Early return. return Response.AsJson(HelpResponse); } var imageId = string.Format("{0}-{1}-{2}.jpg", c.Preamble, Nancy.Helpers.HttpUtility.UrlEncode(c.TopLine ?? string.Empty), Nancy.Helpers.HttpUtility.UrlEncode(c.BottomLine ?? string.Empty)); if (!store.Exists(imageId)) { var img = imageGenerator.GenerateImage(c.Preamble, c.TopLine, c.BottomLine); if (img != null) { using (var ms = new MemoryStream()) { img.Save(ms, ImageFormat.Jpeg); ms.Seek(0, SeekOrigin.Begin); store.Store(imageId, ms); } } else { // We failed to generate an image; send unknown response return Response.AsJson(new Models.UnknownResponse()); } } return Response.AsJson( new Models.ImageResponse(store.GetUri(imageId).ToString(), string.Format("{0} {1}", c.TopLine, c.BottomLine))); }; }
public BlobMetaDataController( BlobServiceOptions options, ILoggerFactory loggerFactory, IStorageService storageService, IBlobStore blobStore, IBlobMetaDataStore blobMetaDataStore, IContainerStore containerStore) { _options = options ?? throw new ArgumentNullException(nameof(options)); _logger = loggerFactory?.CreateLogger <BlobsController>() ?? throw new ArgumentNullException(nameof(loggerFactory)); _storageService = storageService ?? throw new ArgumentNullException(nameof(storageService)); _blobStore = blobStore ?? throw new ArgumentNullException(nameof(blobStore)); _blobMetaDataStore = blobMetaDataStore ?? throw new ArgumentNullException(nameof(blobMetaDataStore)); _containerStore = containerStore ?? throw new ArgumentNullException(nameof(containerStore)); }
internal object Execute(ITableRow row) { this.connection.StartTransaction(System.Data.IsolationLevel.ReadCommitted); // Save the blob first if (table.BlobValueColumn != null && table.BlobNameColumn != null) { object guidObject = null; Guid blobName = Guid.Empty; if (!row.ColumnValues.TryGetValue(table.BlobNameColumn, out guidObject)) { blobName = Guid.NewGuid(); row.ColumnValues.Add(table.BlobNameColumn, blobName); } else { blobName = (Guid)guidObject; } object blobValue = null; if (!row.ColumnValues.TryGetValue(table.BlobValueColumn, out blobValue)) { row.ColumnValues[table.BlobNameColumn] = Guid.Empty; blobName = Guid.Empty; } IBlobStore blobStore = BlobStoreFactory.Instance.GetBlobStore(); blobStore.SaveBlob(row.BlobContainer, blobName.ToString(), (byte[])blobValue); } // Save the row in the table DbCommand command = this.BuildInsertCommand(row); if (table.Identity != null) { SqlParameter outParameter = new SqlParameter(string.Format("@{0}", table.Identity.Name), DatabaseInsertOperator.GetSqlType(table.Identity.Type)); outParameter.Direction = ParameterDirection.Output; command.Parameters.Add(outParameter); } object outParam = command.ExecuteScalar(); this.connection.CommitTransaction(); return(null); }
/// <summary> /// Scan a BsonDocument looking for the <see cref="BlobId"/> of the blob and if a <see cref="BlobId" /> /// is found it update the dump of file to disk. /// </summary> /// <param name="originalBlobStore"></param> /// <param name="body"></param> /// <param name="deleted"></param> private void ScanCommit(IBlobStore originalBlobStore, Int64 commitId, BsonDocument body, Boolean deleted) { if (Logger.IsDebugEnabled) { Logger.Debug($"Scanning commit {commitId} for event {body["_t"].AsString}"); } if (body.Names.Contains("BlobId")) { string blobId = body["BlobId"].AsString; if (blobId.StartsWith("original")) { Logger.Info($"Copy blob {blobId} to fileStore"); UpdateDumpOfFile(blobId, originalBlobStore, deleted); } } }
public void SetUp() { var config = new DocumentStoreTestConfiguration(); MongoDbTestConnectionProvider.DropTestsTenant(); config.SetTestAddress(TestConfig.ServerAddress); _documentStoreService = new DocumentStoreBootstrapper(); _documentStoreService.Start(config); TenantContext.Enter(new TenantId(TestConfig.Tenant)); var tenant = ContainerAccessor.Instance.Resolve<TenantManager>().Current; _bus = tenant.Container.Resolve<ICommandBus>(); _filestore = tenant.Container.Resolve<IBlobStore>(); Assert.IsTrue(_bus is IInProcessCommandBus); _projections = tenant.Container.Resolve<ITriggerProjectionsUpdate>(); _handleWriter = tenant.Container.Resolve<IDocumentWriter>(); _documentReader = tenant.Container.Resolve<IReader<DocumentDescriptorReadModel, DocumentDescriptorId>>(); }
public void SetUp() { longFolderName = Path.Combine(Path.GetTempPath(), new String('a', 230)); _blobId = new BlobId(_originalFormat, 1); _pathToTask = Path.Combine(longFolderName, "File_1.dsimport"); _fileToImport = Path.Combine(longFolderName, "A Word Document.docx"); _fileUri = new Uri(Path.Combine(longFolderName, "A word document.docx")); ClearQueueTempFolder(); Directory.CreateDirectory(longFolderName); File.Copy(Path.Combine(TestConfig.DocumentsFolder, "Queue\\File_1.dsimport"), _pathToTask); File.Copy(TestConfig.PathToWordDocument, _fileToImport); var accessor = Substitute.For<ITenantAccessor>(); var tenant = Substitute.For<ITenant>(); tenant.Id.Returns(new TenantId("tests")); var container = Substitute.For<IWindsorContainer>(); _commandBus = Substitute.For<ICommandBus>(); var identityGenerator = Substitute.For<IIdentityGenerator>(); _blobstore = Substitute.For<IBlobStore>(); _blobstore.Upload(Arg.Is(_originalFormat), Arg.Any<string>()).Returns(_blobId); _blobstore.Upload(Arg.Is(_originalFormat), Arg.Any<FileNameWithExtension>(), Arg.Any<Stream>()).Returns(_blobId); accessor.GetTenant(_testTenant).Returns(tenant); accessor.Current.Returns(tenant); tenant.Container.Returns(container); container.Resolve<IBlobStore>().Returns(_blobstore); container.Resolve<IIdentityGenerator>().Returns(identityGenerator); container.Resolve<IMongoDatabase>().Returns(MongoDbTestConnectionProvider.ReadModelDb); var collection = MongoDbTestConnectionProvider.ReadModelDb.GetCollection<ImportFailure>("sys.importFailures"); collection.Drop(); DocumentStoreTestConfiguration config = new DocumentStoreTestConfiguration(tenantId : "tests"); config.SetFolderToMonitor(longFolderName); var sysDb = config.TenantSettings.Single(t => t.TenantId == "tests").Get<IMongoDatabase>("system.db"); sysDb.Drop(); _queue = new ImportFormatFromFileQueue(config, accessor, _commandBus) { Logger = new ConsoleLogger() }; _queue.DeleteTaskFileAfterImport = false; }
public void SetUp() { BlobStore = Substitute.For <IBlobStore>(); IdentityGenerator = Substitute.For <IIdentityGenerator>(); _handleWriter = Substitute.For <IDocumentWriter>(); DocumentReader = Substitute.For <IMongoDbReader <DocumentDescriptorReadModel, DocumentDescriptorId> >(); DocumentDeletedReader = Substitute.For <IMongoDbReader <DocumentDeletedReadModel, String> >(); QueueDispatcher = Substitute.For <IQueueManager>(); CounterService = Substitute.For <ICounterService>(); var bus = Substitute.For <IInProcessCommandBus>(); var configuration = new DocumentStoreTestConfiguration(); Controller = new DocumentsController( BlobStore, configuration, IdentityGenerator, DocumentReader, DocumentDeletedReader, bus, _handleWriter, QueueDispatcher, CounterService, null) { Request = new HttpRequestMessage { RequestUri = new Uri("http://localhost/api/products") }, Logger = new ConsoleLogger(), Configuration = new HttpConfiguration(), RequestContext = { RouteData = new HttpRouteData( route: new HttpRoute(), values: new HttpRouteValueDictionary { { "controller", "file" } }) } }; // Controller.Configuration.MapHttpAttributeRoutes(); Controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); }
public RemoteClassifierTrainingServer(Uri uri, IBlobStore blobStore) { _blobStore = blobStore; _server = uri.CreateRemoteService(null, false); _server.AddHandler(new UriRoute(uri, "status", Verb.Get), ServerStatus); _server.AddAsyncHandler(new UriRoute(uri, null, Verb.Create), Process); _server.AddAsyncHandler(new UriRoute(uri, null, Verb.Get), ListKeys); _server.AddAsyncHandler(new UriRoute(uri, "{key}", Verb.Get), Restore); _server.AddHandler(new UriRoute(uri, "{key}", Verb.Delete), Delete); _outputMapper = new OutputMapperFactory<double, string>().Create(new string[] { "" }); _trainingContextFactory = new MultilayerNetworkTrainingContextFactory<string>(_outputMapper); _trainingContexts = new Dictionary<string, IRawClassifierTrainingContext<NetworkParameters>>(); }
public AccountManager(ICredentialAuthentication credentialAuthentication, IBackgroundOperationScheduler backgroundProcessor, IContextVerifier contextVerifier, ISettingsManager settingsManager, IUserAuthorization accessManager, IPersistenceCommands pcommands, IAppUrlProvider apiProvider, IReferralManager refManager, IUserContext userContext, IUserNotifier notifier, //IEmailPush messagePush, IBlobStore blobStore, IAccountQuery query) { ThrowNullArguments(() => userContext, () => query, () => credentialAuthentication, () => backgroundProcessor, () => contextVerifier, () => accessManager, () => blobStore, //() => messagePush, () => pcommands, () => settingsManager, () => apiProvider, () => refManager, () => notifier); UserContext = userContext; _query = query; _credentialAuth = credentialAuthentication; _contextVerifier = contextVerifier; _authorizer = accessManager; _blobStore = blobStore; //_messagePush = messagePush; _settingsManager = settingsManager; _apiProvider = apiProvider; _refManager = refManager; _pcommand = pcommands; _notifier = notifier; _backgroundProcessor = backgroundProcessor; }
public void SetUp() { BlobStore = Substitute.For<IBlobStore>(); IdentityGenerator = Substitute.For<IIdentityGenerator>(); _handleWriter = Substitute.For<IDocumentWriter>(); DocumentReader = Substitute.For<IMongoDbReader<DocumentDescriptorReadModel, DocumentDescriptorId>>(); DocumentDeletedReader = Substitute.For<IMongoDbReader<DocumentDeletedReadModel, String>>(); QueueDispatcher = Substitute.For<IQueueManager>(); CounterService = Substitute.For<ICounterService>(); var bus = Substitute.For<IInProcessCommandBus>(); var configuration = new DocumentStoreTestConfiguration(); Controller = new DocumentsController( BlobStore, configuration, IdentityGenerator, DocumentReader, DocumentDeletedReader, bus, _handleWriter, QueueDispatcher, CounterService, null) { Request = new HttpRequestMessage { RequestUri = new Uri("http://localhost/api/products") }, Logger = new ConsoleLogger(), Configuration = new HttpConfiguration(), RequestContext = { RouteData = new HttpRouteData( route: new HttpRoute(), values: new HttpRouteValueDictionary {{"controller", "file"}}) } }; // Controller.Configuration.MapHttpAttributeRoutes(); Controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); }
public void SetUp() { _collectionWrapper = Substitute.For<ICollectionWrapper<StreamReadModel, Int64>>(); rmStream = new List<StreamReadModel>(); rmDocuments = new List<DocumentDescriptorReadModel>(); _collectionWrapper.When(r => r.Insert( Arg.Any<DomainEvent>(), Arg.Any<StreamReadModel>())) .Do(cinfo => rmStream.Add((StreamReadModel)cinfo.Args()[1])); _collectionWrapper.All.Returns(rmStream.AsQueryable()); _readerDocumentReadModel = Substitute.For<IReader<DocumentDescriptorReadModel, DocumentDescriptorId>>(); _readerDocumentReadModel.AllUnsorted.Returns(rmDocuments.AsQueryable()); _readerDocumentReadModel.AllSortedById.Returns(rmDocuments.AsQueryable().OrderBy(r => r.Id)); _readerDocumentReadModel.FindOneById(Arg.Any<DocumentDescriptorId>()) .Returns(cinfo => rmDocuments.SingleOrDefault(d => d.Id == (DocumentDescriptorId)cinfo.Args()[0])); _handleWriter = Substitute.For<IDocumentWriter>(); _blobStore = Substitute.For<IBlobStore>(); }
public DocumentsController( IBlobStore blobStore, DocumentStoreConfiguration configService, IIdentityGenerator identityGenerator, IMongoDbReader<DocumentDescriptorReadModel, DocumentDescriptorId> documentDescriptorReader, IMongoDbReader<DocumentDeletedReadModel, String> documentDeletedReader, IInProcessCommandBus commandBus, IDocumentWriter handleWriter, IQueueManager queueDispatcher, ICounterService counterService, IDocumentFormatTranslator documentFormatTranslator) { _blobStore = blobStore; _configService = configService; _identityGenerator = identityGenerator; _documentDescriptorReader = documentDescriptorReader; _documentDeletedReader = documentDeletedReader; _handleWriter = handleWriter; _queueDispatcher = queueDispatcher; _counterService = counterService; _documentFormatTranslator = documentFormatTranslator; CommandBus = commandBus; }
public DashboardController(IBlobStore blobStore, IMongoDbReader<DocumentStats, string> docStats) { DocStats = docStats; BlobStore = blobStore; }
public CleanupJob(IRecycleBin recycleBin, IBlobStore blobStore) { RecycleBin = recycleBin; BlobStore = blobStore; Logger = NullLogger.Instance; }
public BlobStoreByFormat(IBlobStore originals, IBlobStore artifacts) { _originals = originals; _artifacts = artifacts; }
public void SetUp() { var config = new DocumentStoreTestConfiguration(_engineVersion); MongoDbTestConnectionProvider.DropTestsTenant(); config.SetTestAddress(TestConfig.ServerAddress); _documentStoreService = new DocumentStoreBootstrapper(); _documentStoreService.Start(config); _documentStoreClient = new DocumentStoreServiceClient( TestConfig.ServerAddress, TestConfig.Tenant ); _tenant = ContainerAccessor.Instance.Resolve<TenantManager>().Current; _projections = _tenant.Container.Resolve<ITriggerProjectionsUpdate>(); _documentDescriptorCollection = MongoDbTestConnectionProvider.ReadModelDb.GetCollection<DocumentDescriptorReadModel>("rm.DocumentDescriptor"); _documentCollection = MongoDbTestConnectionProvider.ReadModelDb.GetCollection<DocumentReadModel>("rm.Document"); _commitCollection = MongoDbTestConnectionProvider.ReadModelDb.GetCollection<BsonDocument>("Commits"); _blobStore = _tenant.Container.Resolve<IBlobStore>(); MongoFlatMapper.EnableFlatMapping(true); }
public void TestFixtureSetUp() { _originals = NSubstitute.Substitute.For<IBlobStore>(); _artifacts = NSubstitute.Substitute.For<IBlobStore>(); _manager = new BlobStoreByFormat(_originals, _artifacts); }
public FileManagingController(IMembershipService membershipService, IBlobStore blobStore) : base(membershipService) { _blobStore = blobStore; }
public AdminController(IMembershipService membershipService, IViewRepository<DoctorEditModel> doctorViewRepository, IBlobStore blobStore, IReportCalculationService reportService) : base(membershipService, blobStore) { _doctorViewRepository = doctorViewRepository; _reportService = reportService; }