コード例 #1
0
        public async Task StartContainersForScenarioRun(String scenarioName)
        {
            String traceFolder = FdOs.IsWindows() ? $"C:\\home\\txnproc\\trace\\{scenarioName}" : $"/home/txnproc/trace/{scenarioName}";

            Logging.Enabled();

            Guid testGuid = Guid.NewGuid();

            this.TestId = testGuid;

            // Setup the container names
            this.SecurityServiceContainerName = $"securityservice{testGuid:N}";

            this.TestNetwork = this.SetupTestNetwork();

            this.SecurityServiceContainer = this.SetupSecurityServiceContainer(traceFolder);
            this.SecurityServicePort      = this.SecurityServiceContainer.ToHostExposedEndpoint("5001/tcp").Port;

            Func <String, String> securityServiceBaseAddressResolver = api => $"https://localhost:{this.SecurityServicePort}";
            HttpClient            httpClient = new HttpClient();

            this.SecurityServiceClient = new SecurityServiceClient(securityServiceBaseAddressResolver, httpClient);

            Console.Out.WriteLine($"Security Service Port is [{this.SecurityServicePort}]");

            await Task.Delay(30000).ConfigureAwait(false);

            ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault;
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MerchantDomainService" /> class.
 /// </summary>
 /// <param name="estateAggregateRepository">The estate aggregate repository.</param>
 /// <param name="merchantAggregateRepository">The merchant aggregate repository.</param>
 /// <param name="securityServiceClient">The security service client.</param>
 public MerchantDomainService(IAggregateRepository <EstateAggregate, DomainEventRecord.DomainEvent> estateAggregateRepository,
                              IAggregateRepository <MerchantAggregate, DomainEventRecord.DomainEvent> merchantAggregateRepository,
                              ISecurityServiceClient securityServiceClient)
 {
     this.EstateAggregateRepository   = estateAggregateRepository;
     this.MerchantAggregateRepository = merchantAggregateRepository;
     this.SecurityServiceClient       = securityServiceClient;
 }
コード例 #3
0
        /// <summary>
        /// Handles the LoginButtonClick event of the LoginPage control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private async void LoginPage_LoginButtonClick(Object sender,
                                                      EventArgs e)
        {
            try
            {
                ISecurityServiceClient securityServiceClient = App.Container.Resolve <ISecurityServiceClient>();
                //this.LoginViewModel.EmailAddress = "*****@*****.**";
                //this.LoginViewModel.Password = "******";

                await this.Database.InsertLogMessage(DatabaseContext.CreateDebugLogMessage("About to Get Configuration"));

                await this.GetConfiguration();

                await
                this.Database.InsertLogMessage(DatabaseContext
                                               .CreateDebugLogMessage($"About to Get Token for User [{this.LoginViewModel.EmailAddress} with Password [{this.LoginViewModel.Password}]]"));


                // Attempt to login with the user details
                TokenResponse tokenResponse = await securityServiceClient.GetToken(this.LoginViewModel.EmailAddress,
                                                                                   this.LoginViewModel.Password,
                                                                                   App.Configuration.ClientId,
                                                                                   App.Configuration.ClientSecret,
                                                                                   CancellationToken.None);

                await this.Database.InsertLogMessage(DatabaseContext.CreateDebugLogMessage($"About to Cache Token {tokenResponse.AccessToken}"));

                // Cache the user token
                App.TokenResponse = tokenResponse;

                // Go to signed in page
                this.MainPage.Init(this.MainPageViewModel);
                this.MainPage.VoucherButtonClicked += this.MainPage_VoucherButtonClicked;
                this.MainPage.SupportButtonClicked += this.MainPage_SupportButtonClicked;

                Application.Current.MainPage = new NavigationPage((Page)this.MainPage);
            }
            catch (ApplicationException aex)
            {
                await this.Database.InsertLogMessages(DatabaseContext.CreateErrorLogMessages(aex));

                CrossToastPopUp.Current.ShowToastWarning(aex.Message);
            }
            catch (Exception ex)
            {
                await this.Database.InsertLogMessages(DatabaseContext.CreateErrorLogMessages(ex));

                if (ex.InnerException != null && ex.InnerException is ApplicationException)
                {
                    // Application needs to be upgraded to latest version
                    CrossToastPopUp.Current.ShowToastError("Application version is incompatible, please upgrade to the latest version!!", ToastLength.Long);
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastWarning("Incorrect username or password entered, please try again!");
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VoucherDomainService"/> class.
 /// </summary>
 /// <param name="voucherAggregateRepository">The voucher aggregate repository.</param>
 /// <param name="securityServiceClient">The security service client.</param>
 /// <param name="estateClient">The estate client.</param>
 /// <param name="dbContextFactory">The database context factory.</param>
 public VoucherDomainService(IAggregateRepository <VoucherAggregate, DomainEventRecord.DomainEvent> voucherAggregateRepository,
                             ISecurityServiceClient securityServiceClient,
                             IEstateClient estateClient,
                             IDbContextFactory <EstateReportingGenericContext> dbContextFactory)
 {
     this.VoucherAggregateRepository = voucherAggregateRepository;
     this.SecurityServiceClient      = securityServiceClient;
     this.EstateClient     = estateClient;
     this.DbContextFactory = dbContextFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SignInPresenter" /> class.
 /// </summary>
 /// <param name="navigationService">The navigation service.</param>
 /// <param name="signInPage">The sign in page.</param>
 /// <param name="signInPageViewModel">The sign in page view model.</param>
 /// <param name="securityServiceClient">The security service client.</param>
 public SignInPresenter(INavigationService navigationService,
                        ISignInPage signInPage, SignInPageViewModel signInPageViewModel,
                        ISignedInGolfClubAdministratorPage signedInGolfClubAdministratorPage,
                        ISecurityServiceClient securityServiceClient)
 {
     this.NavigationService   = navigationService;
     this.SignInPage          = signInPage;
     this.SignInPageViewModel = signInPageViewModel;
     this.SignedInGolfClubAdministratorPage = signedInGolfClubAdministratorPage;
     this.SecurityServiceClient             = securityServiceClient;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="VoucherDomainEventHandler" /> class.
 /// </summary>
 /// <param name="securityServiceClient">The security service client.</param>
 /// <param name="voucherAggregateRepository">The voucher aggregate repository.</param>
 /// <param name="dbContextFactory">The database context factory.</param>
 /// <param name="messagingServiceClient">The messaging service client.</param>
 /// <param name="fileSystem">The file system.</param>
 public VoucherDomainEventHandler(ISecurityServiceClient securityServiceClient,
                                  IAggregateRepository <VoucherAggregate, DomainEventRecord.DomainEvent> voucherAggregateRepository,
                                  IDbContextFactory <EstateReportingGenericContext> dbContextFactory,
                                  IMessagingServiceClient messagingServiceClient,
                                  IFileSystem fileSystem)
 {
     this.SecurityServiceClient      = securityServiceClient;
     this.VoucherAggregateRepository = voucherAggregateRepository;
     this.DbContextFactory           = dbContextFactory;
     this.MessagingServiceClient     = messagingServiceClient;
     this.FileSystem = fileSystem;
 }
コード例 #7
0
        /// <summary>
        /// Starts the containers for scenario run.
        /// </summary>
        /// <param name="scenarioName">Name of the scenario.</param>
        public override async Task StartContainersForScenarioRun(String scenarioName)
        {
            String traceFolder = FdOs.IsWindows() ? $"C:\\home\\txnproc\\trace\\{scenarioName}" : $"/home/txnproc/trace/{scenarioName}";

            Logging.Enabled();

            Guid testGuid = Guid.NewGuid();

            this.TestId = testGuid;

            (String, String, String)dockerCredentials = ("https://www.docker.com", "stuartferguson", "Sc0tland");

            // Setup the container names
            this.SecurityServiceContainerName       = $"identity-server";
            this.SecurityServiceTestUIContainerName = $"securityservicetestui{testGuid:N}";

            INetworkService testNetwork = this.SetupTestNetwork();

            this.TestNetworks.Add(testNetwork);

            IContainerService securityServiceContainer = SetupSecurityServiceContainer(this.SecurityServiceContainerName,
                                                                                       this.Logger,
                                                                                       "securityservice",
                                                                                       testNetwork,
                                                                                       5001,
                                                                                       dockerCredentials,
                                                                                       traceFolder);

            this.SecurityServicePort = securityServiceContainer.ToHostExposedEndpoint("5001/tcp").Port;

            IContainerService securityServiceTestUIContainer = DockerHelper.SetupSecurityServiceTestUIContainer(this.SecurityServiceTestUIContainerName,
                                                                                                                this.SecurityServiceContainerName,
                                                                                                                this.SecurityServicePort,
                                                                                                                testNetwork,
                                                                                                                ("estateUIClient", "Secret1"));

            this.SecurityServiceTestUIPort = securityServiceTestUIContainer.ToHostExposedEndpoint("5004/tcp").Port;

            Func <String, String> securityServiceBaseAddressResolver = api => $"https://localhost:{this.SecurityServicePort}";
            HttpClient            httpClient = new HttpClient();

            this.SecurityServiceClient = new SecurityServiceClient(securityServiceBaseAddressResolver, httpClient);

            this.Containers.AddRange(new List <IContainerService>
            {
                securityServiceContainer,
                securityServiceTestUIContainer
            });
        }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LoginPresenter" /> class.
 /// </summary>
 /// <param name="loginPage">The login page.</param>
 /// <param name="mainPage">The main page.</param>
 /// <param name="loginViewModel">The login view model.</param>
 /// <param name="device">The device.</param>
 /// <param name="securityServiceClient">The security service client.</param>
 /// <param name="transactionProcessorAclClient">The transaction processor acl client.</param>
 /// <param name="analysisLogger">The analysis logger.</param>
 public LoginPresenter(ILoginPage loginPage,
                       IMainPage mainPage,
                       LoginViewModel loginViewModel,
                       IDevice device,
                       ISecurityServiceClient securityServiceClient,
                       ITransactionProcessorACLClient transactionProcessorAclClient,
                       IAnalysisLogger analysisLogger)
 {
     this.MainPage                      = mainPage;
     this.LoginPage                     = loginPage;
     this.LoginViewModel                = loginViewModel;
     this.Device                        = device;
     this.SecurityServiceClient         = securityServiceClient;
     this.TransactionProcessorAclClient = transactionProcessorAclClient;
     this.AnalysisLogger                = analysisLogger;
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SignInPresenter"/> class.
 /// </summary>
 /// <param name="signInPage">The sign in page.</param>
 /// <param name="signInViewModel">The sign in view model.</param>
 /// <param name="registrationPage">The registration page.</param>
 /// <param name="registrationViewModel">The registration view model.</param>
 /// <param name="securityServiceClient">The security service client.</param>
 /// <param name="apiClient">The API client.</param>
 public SignInPresenter(ISignInPage signInPage,
                        SignInViewModel signInViewModel,
                        IRegistrationPage registrationPage,
                        RegistrationViewModel registrationViewModel,
                        ISecurityServiceClient securityServiceClient,
                        IClient apiClient,
                        IDevice device)
 {
     this.SignInPage            = signInPage;
     this.SignInViewModel       = signInViewModel;
     this.RegistrationPage      = registrationPage;
     this.RegistrationViewModel = registrationViewModel;
     this.SecurityServiceClient = securityServiceClient;
     this.ApiClient             = apiClient;
     this.Device = device;
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FileRequestHandler"/> class.
 /// </summary>
 /// <param name="fileProcessorManager">The file processor manager.</param>
 /// <param name="fileAggregateRepository">The file aggregate repository.</param>
 /// <param name="transactionProcessorClient">The transaction processor client.</param>
 /// <param name="estateClient">The estate client.</param>
 /// <param name="securityServiceClient">The security service client.</param>
 /// <param name="fileFormatHandlerResolver">The file format handler resolver.</param>
 /// <param name="fileSystem">The file system.</param>
 public FileRequestHandler(IFileProcessorManager fileProcessorManager,
                           IAggregateRepository <FileImportLogAggregate, DomainEventRecord.DomainEvent> fileImportLogAggregateRepository,
                           IAggregateRepository <FileAggregate, DomainEventRecord.DomainEvent> fileAggregateRepository,
                           ITransactionProcessorClient transactionProcessorClient,
                           IEstateClient estateClient,
                           ISecurityServiceClient securityServiceClient,
                           Func <String, IFileFormatHandler> fileFormatHandlerResolver,
                           IFileSystem fileSystem)
 {
     this.FileProcessorManager             = fileProcessorManager;
     this.FileImportLogAggregateRepository = fileImportLogAggregateRepository;
     this.FileAggregateRepository          = fileAggregateRepository;
     this.TransactionProcessorClient       = transactionProcessorClient;
     this.EstateClient              = estateClient;
     this.SecurityServiceClient     = securityServiceClient;
     this.FileFormatHandlerResolver = fileFormatHandlerResolver;
     this.FileSystem = fileSystem;
 }
コード例 #11
0
        /// <summary>
        /// Starts the containers for scenario run.
        /// </summary>
        /// <param name="scenarioName">Name of the scenario.</param>
        public override async Task StartContainersForScenarioRun(String scenarioName)
        {
            this.HostTraceFolder = FdOs.IsWindows() ? $"D:\\home\\txnproc\\trace\\{scenarioName}" : $"//home//txnproc//trace//{scenarioName}";

            Logging.Enabled();

            Guid testGuid = Guid.NewGuid();

            this.TestId = testGuid;

            this.Logger.LogInformation($"Test Id is {testGuid}");

            // Setup the container names
            this.SecurityServiceContainerName      = $"securityservice{testGuid:N}";
            this.EstateManagementContainerName     = $"estate{testGuid:N}";
            this.EventStoreContainerName           = $"eventstore{testGuid:N}";
            this.EstateReportingContainerName      = $"estatereporting{testGuid:N}";
            this.TransactionProcessorContainerName = $"txnprocessor{testGuid:N}";
            this.TestHostContainerName             = $"testhosts{testGuid:N}";
            this.VoucherManagementContainerName    = $"vouchermanagement{testGuid:N}";
            this.FileProcessorContainerName        = $"fileprocessor{testGuid:N}";

            String eventStoreAddress = $"http://{this.EventStoreContainerName}";

            this.ClientDetails     = ("serviceClient", "Secret1");
            this.SqlServerDetails  = (Setup.SqlServerContainerName, Setup.SqlUserName, Setup.SqlPassword);
            this.DockerCredentials = ("https://www.docker.com", "stuartferguson", "Sc0tland");

            INetworkService testNetwork = DockerHelper.SetupTestNetwork();

            this.TestNetworks.Add(testNetwork);

            IContainerService eventStoreContainer = this.SetupEventStoreContainer("eventstore/eventstore:21.10.0-buster-slim", testNetwork);

            this.EventStoreHttpPort = eventStoreContainer.ToHostExposedEndpoint($"{DockerHelper.EventStoreHttpDockerPort}/tcp").Port;

            String insecureEventStoreEnvironmentVariable    = "EventStoreSettings:Insecure=true";
            String persistentSubscriptionPollingInSeconds   = "AppSettings:PersistentSubscriptionPollingInSeconds=10";
            String internalSubscriptionServiceCacheDuration = "AppSettings:InternalSubscriptionServiceCacheDuration=0";
            String operationTimeoutEnvironmentVariable      = "EventStoreSettings:OperationTimeoutInSeconds=60";

            IContainerService estateManagementContainer = this.SetupEstateManagementContainer("stuartferguson/estatemanagement",
                                                                                              new List <INetworkService>
            {
                testNetwork,
                Setup.DatabaseServerNetwork
            },
                                                                                              true,
                                                                                              additionalEnvironmentVariables: new List <String>
            {
                insecureEventStoreEnvironmentVariable,
                persistentSubscriptionPollingInSeconds,
                internalSubscriptionServiceCacheDuration
            });

            IContainerService securityServiceContainer = this.SetupSecurityServiceContainer("stuartferguson/securityservice",
                                                                                            testNetwork,
                                                                                            true);

            IContainerService voucherManagementContainer = this.SetupVoucherManagementContainer("stuartferguson/vouchermanagement",
                                                                                                new List <INetworkService>
            {
                testNetwork
            },
                                                                                                true,
                                                                                                additionalEnvironmentVariables: new List <String>
            {
                insecureEventStoreEnvironmentVariable,
                persistentSubscriptionPollingInSeconds,
                internalSubscriptionServiceCacheDuration
            });

            IContainerService transactionProcessorContainer = this.SetupTransactionProcessorContainer("stuartferguson/transactionprocessor",
                                                                                                      new List <INetworkService>
            {
                testNetwork
            },
                                                                                                      true,
                                                                                                      additionalEnvironmentVariables: new List <String>
            {
                insecureEventStoreEnvironmentVariable,
                persistentSubscriptionPollingInSeconds,
                internalSubscriptionServiceCacheDuration,
                $"AppSettings:VoucherManagementApi=http://{this.VoucherManagementContainerName}:{DockerHelper.VoucherManagementDockerPort}"
            });

            IContainerService estateReportingContainer = this.SetupEstateReportingContainer("stuartferguson/estatereporting",
                                                                                            new List <INetworkService>
            {
                testNetwork,
                Setup.DatabaseServerNetwork
            },
                                                                                            true,
                                                                                            additionalEnvironmentVariables: new List <String>
            {
                insecureEventStoreEnvironmentVariable,
                persistentSubscriptionPollingInSeconds,
                internalSubscriptionServiceCacheDuration,
            });

            IContainerService testhostContainer = this.SetupTestHostContainer("stuartferguson/testhosts",
                                                                              new List <INetworkService>
            {
                testNetwork,
                Setup.DatabaseServerNetwork
            },
                                                                              true);

            IContainerService fileProcessorContainer = this.SetupFileProcessorContainer("fileprocessor",
                                                                                        new List <INetworkService>
            {
                testNetwork,
                Setup.DatabaseServerNetwork
            },
                                                                                        additionalEnvironmentVariables: new List <String>
            {
                insecureEventStoreEnvironmentVariable,
                persistentSubscriptionPollingInSeconds,
                internalSubscriptionServiceCacheDuration,
                operationTimeoutEnvironmentVariable
            });

            this.Containers.AddRange(new List <IContainerService>
            {
                eventStoreContainer,
                estateManagementContainer,
                securityServiceContainer,
                transactionProcessorContainer,
                estateReportingContainer,
                testhostContainer,
                voucherManagementContainer,
                fileProcessorContainer
            });

            // Cache the ports
            this.EstateManagementApiPort = estateManagementContainer.ToHostExposedEndpoint("5000/tcp").Port;
            this.EstateReportingApiPort  = estateReportingContainer.ToHostExposedEndpoint("5005/tcp").Port;
            this.SecurityServicePort     = securityServiceContainer.ToHostExposedEndpoint("5001/tcp").Port;
            this.FileProcessorPort       = fileProcessorContainer.ToHostExposedEndpoint("5009/tcp").Port;

            // Setup the base address resolvers
            String EstateManagementBaseAddressResolver(String api) => $"http://127.0.0.1:{this.EstateManagementApiPort}";
            String SecurityServiceBaseAddressResolver(String api) => $"https://127.0.0.1:{this.SecurityServicePort}";
            String FileProcessorBaseAddressResolver(String api) => $"http://127.0.0.1:{this.FileProcessorPort}";
            String EstateReportingBaseAddressResolver(String api) => $"http://127.0.0.1:{this.EstateReportingApiPort}";

            HttpClientHandler clientHandler = new HttpClientHandler
            {
                ServerCertificateCustomValidationCallback = (message,
                                                             certificate2,
                                                             arg3,
                                                             arg4) =>
                {
                    return(true);
                }
            };
            HttpClient httpClient = new HttpClient(clientHandler);

            this.EstateClient          = new EstateClient(EstateManagementBaseAddressResolver, httpClient);
            this.SecurityServiceClient = new SecurityServiceClient(SecurityServiceBaseAddressResolver, httpClient);
            this.EstateReportingClient = new EstateReportingClient(EstateReportingBaseAddressResolver, httpClient);
            this.FileProcessorClient   = new FileProcessorClient(FileProcessorBaseAddressResolver, httpClient);

            await this.LoadEventStoreProjections(this.EventStoreHttpPort).ConfigureAwait(false);
        }
コード例 #12
0
        /// <summary>
        /// Starts the containers for scenario run.
        /// </summary>
        /// <param name="scenarioName">Name of the scenario.</param>
        public override async Task StartContainersForScenarioRun(String scenarioName)
        {
            this.HostTraceFolder = null;
            if (DockerHelper.GetDockerEnginePlatform() == DockerEnginePlatform.Linux)
            {
                this.HostTraceFolder = FdOs.IsWindows() ? $"F:\\home\\txnproc\\trace\\{scenarioName}" : $"//home//txnproc//trace//{scenarioName}";
            }

            Logging.Enabled();

            Guid testGuid = Guid.NewGuid();

            this.TestId = testGuid;

            this.Logger.LogInformation($"Test Id is {testGuid}");

            // Setup the container names
            this.SecurityServiceContainerName    = $"sferguson.ddns.net";
            this.EstateManagementContainerName   = $"estate{testGuid:N}";
            this.EstateReportingContainerName    = $"estatereporting{testGuid:N}";
            this.EstateManagementUiContainerName = $"estateadministrationui{testGuid:N}";
            this.EventStoreContainerName         = $"eventstore{testGuid:N}";

            String eventStoreAddress = $"http://{this.EventStoreContainerName}";

            this.ClientDetails     = ("serviceClient", "Secret1");
            this.SqlServerDetails  = (Setup.SqlServerContainerName, Setup.SqlUserName, Setup.SqlPassword);
            this.DockerCredentials = ("https://www.docker.com", "stuartferguson", "Sc0tland");

            INetworkService testNetwork = DockerHelper.SetupTestNetwork($"testnetwork{this.TestId:N}");

            this.TestNetworks.Add(testNetwork);

            // Setup the docker image names
            String eventStoreImageName      = "eventstore/eventstore:21.2.0-buster-slim";
            String estateMangementImageName = "stuartferguson/estatemanagement";
            String estateReportingImageName = "stuartferguson/estatereporting";

            DockerEnginePlatform enginePlatform = DockerHelper.GetDockerEnginePlatform();

            if (enginePlatform == DockerEnginePlatform.Windows)
            {
                estateMangementImageName = "stuartferguson/estatemanagementwindows";
                estateReportingImageName = "stuartferguson/estatereportingwindows";
                eventStoreImageName      = "stuartferguson/eventstore";
            }

            IContainerService eventStoreContainer = this.SetupEventStoreContainer(eventStoreImageName, testNetwork);

            this.EventStoreHttpPort = eventStoreContainer.ToHostExposedEndpoint($"{DockerHelper.EventStoreHttpDockerPort}/tcp").Port;

            String insecureEventStoreEnvironmentVariable    = "EventStoreSettings:Insecure=true";
            String persistentSubscriptionPollingInSeconds   = "AppSettings:PersistentSubscriptionPollingInSeconds=10";
            String internalSubscriptionServiceCacheDuration = "AppSettings:InternalSubscriptionServiceCacheDuration=0";

            List <String> estateManagementVariables = new List <String>();

            estateManagementVariables.Add($"SecurityConfiguration:ApiName=estateManagement{this.TestId.ToString("N")}");
            estateManagementVariables.Add($"EstateRoleName=Estate{this.TestId.ToString("N")}");
            estateManagementVariables.Add($"MerchantRoleName=Merchant{this.TestId.ToString("N")}");
            estateManagementVariables.AddRange(new List <String> {
                insecureEventStoreEnvironmentVariable,
                persistentSubscriptionPollingInSeconds,
                internalSubscriptionServiceCacheDuration
            });


            IContainerService estateManagementContainer = this.SetupEstateManagementContainer(estateMangementImageName,
                                                                                              new List <INetworkService>
            {
                testNetwork,
                Setup.DatabaseServerNetwork
            },
                                                                                              securityServicePort: 55001,
                                                                                              additionalEnvironmentVariables: estateManagementVariables,
                                                                                              forceLatestImage: true);

            IContainerService estateReportingContainer = this.SetupEstateReportingContainer(estateReportingImageName,
                                                                                            new List <INetworkService>
            {
                testNetwork,
                Setup.DatabaseServerNetwork
            },
                                                                                            true,
                                                                                            additionalEnvironmentVariables: new List <String>
            {
                insecureEventStoreEnvironmentVariable,
                persistentSubscriptionPollingInSeconds,
                internalSubscriptionServiceCacheDuration
            });

            IContainerService estateManagementUiContainer = SetupEstateManagementUIContainer(this.EstateManagementUiContainerName,
                                                                                             this.Logger,
                                                                                             "estateadministrationui",
                                                                                             new List <INetworkService>
            {
                testNetwork
            },
                                                                                             this.EstateManagementContainerName,
                                                                                             this.EstateReportingContainerName,
                                                                                             this.HostTraceFolder,
                                                                                             this.DockerCredentials,
                                                                                             ($"estateUIClient{this.TestId.ToString("N")}", "Secret1"));

            this.Containers.AddRange(new List <IContainerService>
            {
                eventStoreContainer,
                estateManagementContainer,
                estateReportingContainer,
                estateManagementUiContainer
            });

            // Cache the ports
            this.EstateManagementApiPort = estateManagementContainer.ToHostExposedEndpoint("5000/tcp").Port;
            this.EventStoreHttpPort      = eventStoreContainer.ToHostExposedEndpoint("2113/tcp").Port;
            this.EstateManagementUIPort  = estateManagementUiContainer.ToHostExposedEndpoint("5004/tcp").Port;

            // Setup the base address resolvers
            String EstateManagementBaseAddressResolver(String api) => $"http://127.0.0.1:{this.EstateManagementApiPort}";

            HttpClientHandler clientHandler = new HttpClientHandler
            {
                ServerCertificateCustomValidationCallback = (message,
                                                             certificate2,
                                                             arg3,
                                                             arg4) =>
                {
                    return(true);
                }
            };
            HttpClient httpClient = new HttpClient(clientHandler);

            this.EstateClient = new EstateClient(EstateManagementBaseAddressResolver, httpClient);
            Func <String, String> securityServiceBaseAddressResolver = api => $"https://sferguson.ddns.net:55001";

            this.SecurityServiceClient = new SecurityServiceClient(securityServiceBaseAddressResolver, httpClient);

            await LoadEventStoreProjections().ConfigureAwait(false);
        }
コード例 #13
0
 public VoucherManagementACLApplicationService(ISecurityServiceClient securityServiceClient,
                                               IVoucherManagementClient voucherManagementClient)
 {
     this.SecurityServiceClient   = securityServiceClient;
     this.VoucherManagementClient = voucherManagementClient;
 }
コード例 #14
0
        /// <summary>
        /// Starts the containers for scenario run.
        /// </summary>
        /// <param name="scenarioName">Name of the scenario.</param>
        public override async Task StartContainersForScenarioRun(String scenarioName)
        {
            String traceFolder = FdOs.IsWindows() ? $"D:\\home\\txnproc\\trace\\{scenarioName}" : $"//home//txnproc//trace//{scenarioName}";

            Logging.Enabled();

            Guid testGuid = Guid.NewGuid();

            this.TestId = testGuid;

            this.Logger.LogInformation($"Test Id is {testGuid}");

            // Setup the container names
            this.SecurityServiceContainerName  = $"securityservice{testGuid:N}";
            this.EventStoreContainerName       = $"eventstore{testGuid:N}";
            this.MessagingServiceContainerName = $"messagingservice{testGuid:N}";

            String eventStoreAddress = $"http://{this.EventStoreContainerName}";

            (String, String, String)dockerCredentials = ("https://www.docker.com", "stuartferguson", "Sc0tland");

            INetworkService testNetwork = DockerHelper.SetupTestNetwork();

            this.TestNetworks.Add(testNetwork);
            IContainerService eventStoreContainer =
                DockerHelper.SetupEventStoreContainer(this.EventStoreContainerName, this.Logger, "eventstore/eventstore:20.10.0-buster-slim", testNetwork, traceFolder, true);

            IContainerService securityServiceContainer = DockerHelper.SetupSecurityServiceContainer(this.SecurityServiceContainerName,
                                                                                                    this.Logger,
                                                                                                    "stuartferguson/securityservice",
                                                                                                    testNetwork,
                                                                                                    traceFolder,
                                                                                                    dockerCredentials,
                                                                                                    true);

            IContainerService messagingServiceContainer = DockerHelper.SetupMessagingServiceContainer(this.MessagingServiceContainerName,
                                                                                                      this.Logger,
                                                                                                      "messagingservice",
                                                                                                      new List <INetworkService> {
                testNetwork
            },
                                                                                                      traceFolder,
                                                                                                      dockerCredentials,
                                                                                                      this.SecurityServiceContainerName,
                                                                                                      eventStoreAddress,
                                                                                                      ("serviceClient", "Secret1"));

            this.Containers.AddRange(new List <IContainerService>
            {
                eventStoreContainer,
                securityServiceContainer,
                messagingServiceContainer
            });

            // Cache the ports
            this.SecurityServicePort  = securityServiceContainer.ToHostExposedEndpoint("5001/tcp").Port;
            this.EventStoreHttpPort   = eventStoreContainer.ToHostExposedEndpoint("2113/tcp").Port;
            this.MessagingServicePort = messagingServiceContainer.ToHostExposedEndpoint("5006/tcp").Port;

            // Setup the base address resolvers
            String SecurityServiceBaseAddressResolver(String api) => $"https://127.0.0.1:{this.SecurityServicePort}";
            String MessagingServiceBaseAddressResolver(String api) => $"http://127.0.0.1:{this.MessagingServicePort}";

            HttpClientHandler clientHandler = new HttpClientHandler
            {
                ServerCertificateCustomValidationCallback = (message,
                                                             certificate2,
                                                             arg3,
                                                             arg4) =>
                {
                    return(true);
                }
            };
            HttpClient httpClient = new HttpClient(clientHandler);

            this.SecurityServiceClient  = new SecurityServiceClient(SecurityServiceBaseAddressResolver, httpClient);
            this.MessagingServiceClient = new MessagingServiceClient(MessagingServiceBaseAddressResolver, httpClient);
        }