Exemple #1
0
        private static async Task <ITransactionLogStorage> AzureStorageFactory()
        {
            var client      = new ClientBuilder().Configure <ClusterOptions>(o => o.ServiceId = o.ClusterId = "fake").Build();
            var azureConfig = Options.Create(new AzureTransactionLogOptions()
            {
                // TODO: Find better way for test isolation.
                TableName        = $"TransactionLog{((uint)Guid.NewGuid().GetHashCode()) % 100000}",
                ConnectionString = "UseDevelopmentStorage=true"
            });
            AzureTransactionLogStorage storage = new AzureTransactionLogStorage(client.ServiceProvider.GetRequiredService <SerializationManager>(), azureConfig);
            await storage.Initialize();

            return(storage);
        }
        private static async Task <ITransactionLogStorage> AzureStorageFactory()
        {
            var config      = new ClientConfiguration();
            var environment = SerializationTestEnvironment.InitializeWithDefaults(config);
            var azureConfig = Options.Create(new AzureTransactionLogOptions()
            {
                // TODO: Find better way for test isolation.
                TableName        = $"TransactionLog{((uint)Guid.NewGuid().GetHashCode()) % 100000}",
                ConnectionString = TestDefaultConfiguration.DataConnectionString
            });
            AzureTransactionLogStorage storage = new AzureTransactionLogStorage(environment.SerializationManager, azureConfig);
            await storage.Initialize();

            return(storage);
        }
        private static async Task <AzureTransactionLogStorage> StorageFactory(AzureTransactionLogOptions azureOptions, AzureTransactionArchiveLogOptions archiveOptions)
        {
            var config      = new ClientConfiguration();
            var environment = SerializationTestEnvironment.InitializeWithDefaults(config);
            var azureConfig = Options.Create(azureOptions);
            AzureTransactionLogStorage storage = new AzureTransactionLogStorage(environment.SerializationManager, azureConfig,
                                                                                Options.Create(archiveOptions), Options.Create(new ClusterOptions()
            {
                ClusterId = Guid.NewGuid().ToString(),
                ServiceId = ClusterServiceId
            }));
            await storage.Initialize();

            return(storage);
        }
Exemple #4
0
        private static async Task <ITransactionLogStorage> StorageFactory()
        {
            TestFixture.CheckForAzureStorage(TestDefaultConfiguration.DataConnectionString);
            var config      = new ClientConfiguration();
            var environment = SerializationTestEnvironment.InitializeWithDefaults(config);
            var azureConfig = Options.Create(new AzureTransactionLogOptions()
            {
                // TODO: Find better way for test isolation.
                TableName        = "TransactionLog",
                ConnectionString = TestDefaultConfiguration.DataConnectionString
            });
            AzureTransactionLogStorage storage = new AzureTransactionLogStorage(environment.SerializationManager, azureConfig,
                                                                                Options.Create(new AzureTransactionArchiveLogOptions()), Options.Create(new ClusterOptions()
            {
                ClusterId = Guid.NewGuid().ToString(),
                ServiceId = Guid.NewGuid().ToString()
            }));
            await storage.Initialize();

            return(storage);
        }
        private static async Task <ITransactionLogStorage> AzureStorageFactory()
        {
            var serviceId = Guid.NewGuid().ToString();
            var clusterId = Guid.NewGuid().ToString();
            var client    = new ClientBuilder().Configure <ClusterOptions>(o =>
            {
                o.ServiceId = serviceId;
                o.ClusterId = clusterId;
            }).Build();
            var azureConfig = Options.Create(new AzureTransactionLogOptions()
            {
                // TODO: Find better way for test isolation.
                TableName        = "TransactionLog",
                ConnectionString = "UseDevelopmentStorage=true"
            });
            AzureTransactionLogStorage storage = new AzureTransactionLogStorage(client.ServiceProvider.GetRequiredService <SerializationManager>(), azureConfig,
                                                                                Options.Create(new AzureTransactionArchiveLogOptions()), Options.Create(new ClusterOptions()
            {
                ClusterId = clusterId, ServiceId = serviceId
            }));
            await storage.Initialize();

            return(storage);
        }