public void Specific_stores_should_mask_default()
        {
            using (var db = new ReusableDB())
            {
                var settings = new SettingsHolder();
                settings.Set("Transactions.SuppressDistributedTransactions", true);
                settings.Set("TypesToScan", new Type[0]);
                settings.Set("NServiceBus.Routing.EndpointName", "FakeEndpoint");
                settings.Set("NServiceBus.Transport.TransportInfrastructure", new FakeRavenDBTransportInfrastructure(TransportTransactionMode.None));
                settings.Set("Endpoint.SendOnly", true);

                DocumentStoreManager.SetDocumentStore <StorageType.GatewayDeduplication>(settings, db.NewStore("GatewayDeduplication"));
                DocumentStoreManager.SetDocumentStore <StorageType.Outbox>(settings, db.NewStore("Outbox"));
                DocumentStoreManager.SetDocumentStore <StorageType.Sagas>(settings, db.NewStore("Sagas"));
                DocumentStoreManager.SetDocumentStore <StorageType.Subscriptions>(settings, db.NewStore("Subscriptions"));
                DocumentStoreManager.SetDocumentStore <StorageType.Timeouts>(settings, db.NewStore("Timeouts"));
                DocumentStoreManager.SetDefaultStore(settings, db.NewStore("Default"));

                var readOnly = settings as ReadOnlySettings;

                Assert.AreEqual("GatewayDeduplication", DocumentStoreManager.GetDocumentStore <StorageType.GatewayDeduplication>(readOnly).Identifier);
                Assert.AreEqual("Outbox", DocumentStoreManager.GetDocumentStore <StorageType.Outbox>(readOnly).Identifier);
                Assert.AreEqual("Sagas", DocumentStoreManager.GetDocumentStore <StorageType.Sagas>(readOnly).Identifier);
                Assert.AreEqual("Subscriptions", DocumentStoreManager.GetDocumentStore <StorageType.Subscriptions>(readOnly).Identifier);
                Assert.AreEqual("Timeouts", DocumentStoreManager.GetDocumentStore <StorageType.Timeouts>(readOnly).Identifier);
            }
        }
Esempio n. 2
0
        public void Should_set_specific_document_store()
        {
            var settings = new SettingsHolder();

            DocumentStoreManager.SetDocumentStore <StorageType.Sagas>(settings, FakeStore("Sagas"));
            DocumentStoreManager.SetDocumentStore <StorageType.Timeouts>(settings, FakeStore("Timeouts"));
            DocumentStoreManager.SetDefaultStore(settings, FakeStore("Default"));
            var readOnly = settings as ReadOnlySettings;

            Assert.AreEqual(_fakeStores["Sagas"], DocumentStoreManager.GetDocumentStore <StorageType.Sagas>(readOnly));
            Assert.AreEqual(_fakeStores["Timeouts"], DocumentStoreManager.GetDocumentStore <StorageType.Timeouts>(readOnly));
        }
Esempio n. 3
0
        public void Specific_stores_should_mask_default()
        {
            using (var db = new ReusableDB())
            {
                var cfg = new EndpointConfiguration("FakeEndpoint");
                cfg.UseTransport(new LearningTransport());
                cfg.SendOnly();

                var persistence = cfg.UsePersistence <RavenDBPersistence>();
                var settings    = persistence.GetSettings();

                DocumentStoreManager.SetDocumentStore <StorageType.Outbox>(settings, db.NewStore("Outbox"));
                DocumentStoreManager.SetDocumentStore <StorageType.Sagas>(settings, db.NewStore("Sagas"));
                DocumentStoreManager.SetDocumentStore <StorageType.Subscriptions>(settings, db.NewStore("Subscriptions"));
                DocumentStoreManager.SetDefaultStore(settings, db.NewStore("Default"));

                var readOnly = settings as ReadOnlySettings;

                Assert.AreEqual("Outbox", DocumentStoreManager.GetDocumentStore <StorageType.Outbox>(readOnly, null).Identifier);
                Assert.AreEqual("Sagas", DocumentStoreManager.GetDocumentStore <StorageType.Sagas>(readOnly, null).Identifier);
                Assert.AreEqual("Subscriptions", DocumentStoreManager.GetDocumentStore <StorageType.Subscriptions>(readOnly, null).Identifier);
            }
        }
 /// <summary>
 ///     Configures the storages to use the given document store supplied
 /// </summary>
 /// <param name="cfg"></param>
 /// <param name="storeCreator">A Func that will create the document store on NServiceBus initialization.</param>
 /// <returns></returns>
 public static PersistenceExtensions <RavenDBPersistence> SetDefaultDocumentStore(this PersistenceExtensions <RavenDBPersistence> cfg, Func <ReadOnlySettings, IDocumentStore> storeCreator)
 {
     DocumentStoreManager.SetDefaultStore(cfg.GetSettings(), storeCreator);
     return(cfg);
 }
 /// <summary>
 ///     Configures the storages to use the given document store supplied
 /// </summary>
 /// <param name="cfg"></param>
 /// <param name="documentStore">Document store managed by me as a user</param>
 /// <returns></returns>
 public static PersistenceExtensions <RavenDBPersistence> SetDefaultDocumentStore(this PersistenceExtensions <RavenDBPersistence> cfg, IDocumentStore documentStore)
 {
     DocumentStoreManager.SetDefaultStore(cfg.GetSettings(), documentStore);
     return(cfg);
 }