Exemple #1
0
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_regionInfo  = scene.GetSceneModule <RegionInfo>();
            m_permissions = scene.GetSceneModule <LLPermissions>();

            m_estateClient = scene.Simian.GetAppModule <IEstateClient>();
            if (m_estateClient != null)
            {
                if (!m_estateClient.TryGetEstate(scene.ID, out m_estate))
                {
                    // FIXME: Get the config file entry for this sim's estate name and join it or
                    // create it if it doesn't exist
                }
            }

            m_udp = m_scene.GetSceneModule <LLUDP>();
            if (m_udp != null)
            {
                m_udp.AddPacketHandler(PacketType.RequestRegionInfo, RequestRegionInfoHandler);
                m_udp.AddPacketHandler(PacketType.EstateCovenantRequest, EstateCovenantRequestHandler);
                m_udp.AddPacketHandler(PacketType.EstateOwnerMessage, EstateOwnerMessageHandler);
                m_udp.AddPacketHandler(PacketType.GodlikeMessage, GodlikeMessageHandler);
                m_udp.AddPacketHandler(PacketType.GodUpdateRegionInfo, GodUpdateRegionInfoHandler);
            }
        }
Exemple #2
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;
 }
Exemple #3
0
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_parcels = m_scene.GetSceneModule <IParcels>();

            m_userClient      = m_scene.Simian.GetAppModule <IUserClient>();
            m_inventoryClient = m_scene.Simian.GetAppModule <IInventoryClient>();
            m_groupsClient    = m_scene.Simian.GetAppModule <IGroupsClient>();
            m_estateClient    = m_scene.Simian.GetAppModule <IEstateClient>();
        }
Exemple #4
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;
 }
        /// <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);
        }
Exemple #6
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);
        }
Exemple #7
0
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_regionInfo = scene.GetSceneModule<RegionInfo>();
            m_permissions = scene.GetSceneModule<LLPermissions>();

            m_estateClient = scene.Simian.GetAppModule<IEstateClient>();
            if (m_estateClient != null)
            {
                if (!m_estateClient.TryGetEstate(scene.ID, out m_estate))
                {
                    // FIXME: Get the config file entry for this sim's estate name and join it or
                    // create it if it doesn't exist
                }
            }

            m_udp = m_scene.GetSceneModule<LLUDP>();
            if (m_udp != null)
            {
                m_udp.AddPacketHandler(PacketType.RequestRegionInfo, RequestRegionInfoHandler);
                m_udp.AddPacketHandler(PacketType.EstateCovenantRequest, EstateCovenantRequestHandler);
                m_udp.AddPacketHandler(PacketType.EstateOwnerMessage, EstateOwnerMessageHandler);
                m_udp.AddPacketHandler(PacketType.GodlikeMessage, GodlikeMessageHandler);
                m_udp.AddPacketHandler(PacketType.GodUpdateRegionInfo, GodUpdateRegionInfoHandler);
            }
        }
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_parcels = m_scene.GetSceneModule<IParcels>();

            m_userClient = m_scene.Simian.GetAppModule<IUserClient>();
            m_inventoryClient = m_scene.Simian.GetAppModule<IInventoryClient>();
            m_groupsClient = m_scene.Simian.GetAppModule<IGroupsClient>();
            m_estateClient = m_scene.Simian.GetAppModule<IEstateClient>();
        }
 public GetAgencyQuery(IEstateClient client)
 {
     _client = client;
 }