diff --git a/TransactionProcessorACL.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessorACL.IntegrationTests/Common/DockerHelper.cs index 4c4756c..e5d10ca 100644 --- a/TransactionProcessorACL.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessorACL.IntegrationTests/Common/DockerHelper.cs @@ -222,15 +222,18 @@ public override async Task StartContainersForScenarioRun(String scenarioName) String pataPawaUrlEnvironmentVariable = "OperatorConfiguration:PataPawaPostPay:Url=http://" + this.TestHostContainerName + ":9000/PataPawaPostPayService/basichttp"; String pataPawaApiLogonRequiredEnvironmentVariable = "OperatorConfiguration:PataPawaPostPay:ApiLogonRequired=false"; + String transactionProcessorReadModelConnectionString = $"ConnectionStrings:TransactionProcessorReadModel=\"server={this.SqlServerDetails.sqlServerContainerName};user id=sa;password={this.SqlServerDetails.sqlServerPassword};database=TransactionProcessorReadModel\""; IContainerService transactionProcessorContainer = this.SetupTransactionProcessorContainer("stuartferguson/transactionprocessor", new List { - testNetwork + testNetwork, + Setup.DatabaseServerNetwork }, true, additionalEnvironmentVariables:new List { + transactionProcessorReadModelConnectionString, pataPawaUrlEnvironmentVariable, pataPawaApiLogonRequiredEnvironmentVariable, insecureEventStoreEnvironmentVariable, @@ -313,16 +316,23 @@ public override async Task StartContainersForScenarioRun(String scenarioName) this.HttpClient.BaseAddress = new Uri(TransactionProcessorAclBaseAddressResolver(string.Empty)); await this.LoadEventStoreProjections(this.EventStoreHttpPort, this.IsSecureEventStore).ConfigureAwait(false); + await this.PopulateSubscriptionServiceConfigurationGeneric(this.IsSecureEventStore).ConfigureAwait(false); } - - public async Task PopulateSubscriptionServiceConfiguration(String estateName, Boolean isSecureEventStore) + + public async Task PopulateSubscriptionServiceConfigurationForEstate(String estateName, Boolean isSecureEventStore) { List<(String streamName, String groupName, Int32 maxRetries)> subscriptions = new List<(String streamName, String groupName, Int32 maxRetries)>(); - subscriptions.Add((estateName.Replace(" ", ""), "Reporting", 5)); + subscriptions.Add((estateName.Replace(" ", ""), "Reporting", 2)); subscriptions.Add(($"EstateManagementSubscriptionStream_{estateName.Replace(" ", "")}", "Estate Management", 0)); subscriptions.Add(($"TransactionProcessorSubscriptionStream_{estateName.Replace(" ", "")}", "Transaction Processor", 0)); - await this.PopulateSubscriptionServiceConfiguration(this.EventStoreHttpPort, subscriptions, - isSecureEventStore); + await this.PopulateSubscriptionServiceConfiguration(this.EventStoreHttpPort, subscriptions, isSecureEventStore); + } + public async Task PopulateSubscriptionServiceConfigurationGeneric(Boolean isSecureEventStore) + { + List<(String streamName, String groupName, Int32 maxRetries)> subscriptions = new List<(String streamName, String groupName, Int32 maxRetries)>(); + subscriptions.Add(($"$ce-MerchantBalanceArchive", "Transaction Processor - Ordered", 0)); + subscriptions.Add(($"$et-EstateCreatedEvent", "Transaction Processor - Ordered", 2)); + await this.PopulateSubscriptionServiceConfiguration(this.EventStoreHttpPort, subscriptions, isSecureEventStore); } private async Task RemoveEstateReadModel() diff --git a/TransactionProcessorACL.IntegrationTests/Shared/SharedSteps.cs b/TransactionProcessorACL.IntegrationTests/Shared/SharedSteps.cs index 766dea7..083b778 100644 --- a/TransactionProcessorACL.IntegrationTests/Shared/SharedSteps.cs +++ b/TransactionProcessorACL.IntegrationTests/Shared/SharedSteps.cs @@ -9,6 +9,7 @@ using System.Threading; using System.Threading.Tasks; using Common; + using DataTransferObjects; using EstateManagement.DataTransferObjects; using EstateManagement.DataTransferObjects.Requests; using EstateManagement.DataTransferObjects.Responses; @@ -235,7 +236,7 @@ public async Task GivenIMakeTheFollowingManualMerchantDeposits(Table table) // Get current balance MerchantBalanceResponse previousMerchantBalance = - await this.TestingContext.DockerHelper.EstateClient.GetMerchantBalance(token, estateDetails.EstateId, merchantId, CancellationToken.None); + await this.TestingContext.DockerHelper.TransactionProcessorClient.GetMerchantBalance(token, estateDetails.EstateId, merchantId, CancellationToken.None); MakeMerchantDepositRequest makeMerchantDepositRequest = new MakeMerchantDepositRequest { @@ -264,7 +265,7 @@ public async Task GivenIMakeTheFollowingManualMerchantDeposits(Table table) await Retry.For(async () => { MerchantBalanceResponse currentMerchantBalance = - await this.TestingContext.DockerHelper.EstateClient.GetMerchantBalance(token, + await this.TestingContext.DockerHelper.TransactionProcessorClient.GetMerchantBalance(token, estateDetails.EstateId, merchantId, CancellationToken.None); @@ -574,7 +575,7 @@ public async Task WhenICreateTheFollowingEstates(Table table) // Setup the subscriptions for the estate await Retry.For(async () => { - await this.TestingContext.DockerHelper.PopulateSubscriptionServiceConfiguration(estateName,this.TestingContext.DockerHelper.IsSecureEventStore).ConfigureAwait(false); + await this.TestingContext.DockerHelper.PopulateSubscriptionServiceConfigurationForEstate(estateName,this.TestingContext.DockerHelper.IsSecureEventStore).ConfigureAwait(false); }, retryFor: TimeSpan.FromMinutes(2), retryInterval: TimeSpan.FromSeconds(30)); EstateResponse estate = null; diff --git a/TransactionProcessorACL.IntegrationTests/TransactionProcessorACL.IntegrationTests.csproj b/TransactionProcessorACL.IntegrationTests/TransactionProcessorACL.IntegrationTests.csproj index f1394bf..c899162 100644 --- a/TransactionProcessorACL.IntegrationTests/TransactionProcessorACL.IntegrationTests.csproj +++ b/TransactionProcessorACL.IntegrationTests/TransactionProcessorACL.IntegrationTests.csproj @@ -7,20 +7,21 @@ - + - + + - - + + - + all