Exemple #1
0
        protected const string testDatabaseName = "OrleansMembershipTest";//for relational storage

        protected MembershipTableTestsBase(ConnectionStringFixture fixture, TestEnvironmentFixture environment, LoggerFilterOptions filters)
        {
            this.environment = environment;
            loggerFactory    = TestingUtils.CreateDefaultLoggerFactory(new NodeConfiguration().TraceFileName, filters);
            logger           = new LoggerWrapper <MembershipTableTestsBase>(loggerFactory);

            deploymentId = "test-" + Guid.NewGuid();

            logger.Info("DeploymentId={0}", deploymentId);

            fixture.InitializeConnectionStringAccessor(GetConnectionString);

            var globalConfiguration = new GlobalConfiguration
            {
                DeploymentId         = deploymentId,
                AdoInvariant         = GetAdoInvariant(),
                DataConnectionString = fixture.ConnectionString
            };

            membershipTable = CreateMembershipTable(logger);
            membershipTable.InitializeMembershipTable(globalConfiguration, true).WithTimeout(TimeSpan.FromMinutes(1)).Wait();

            var clientConfiguration = new ClientConfiguration
            {
                DeploymentId         = globalConfiguration.DeploymentId,
                AdoInvariant         = globalConfiguration.AdoInvariant,
                DataConnectionString = globalConfiguration.DataConnectionString
            };

            gatewayListProvider = CreateGatewayListProvider(logger);
            gatewayListProvider.InitializeGatewayListProvider(clientConfiguration).WithTimeout(TimeSpan.FromMinutes(1)).Wait();
        }
Exemple #2
0
        protected const string testDatabaseName = "OrleansMembershipTest";//for relational storage

        protected MembershipTableTestsBase(ConnectionStringFixture fixture)
        {
            TraceLogger.Initialize(new NodeConfiguration());
            logger       = TraceLogger.GetLogger(GetType().Name, TraceLogger.LoggerType.Application);
            deploymentId = "test-" + Guid.NewGuid();

            logger.Info("DeploymentId={0}", deploymentId);

            lock (fixture.SyncRoot)
            {
                if (fixture.ConnectionString == null)
                {
                    fixture.ConnectionString = GetConnectionString();
                }
            }
            var globalConfiguration = new GlobalConfiguration
            {
                DeploymentId         = deploymentId,
                AdoInvariant         = GetAdoInvariant(),
                DataConnectionString = fixture.ConnectionString
            };

            membershipTable = CreateMembershipTable(logger);
            membershipTable.InitializeMembershipTable(globalConfiguration, true, logger).WithTimeout(TimeSpan.FromMinutes(1)).Wait();

            var clientConfiguration = new ClientConfiguration
            {
                DeploymentId         = globalConfiguration.DeploymentId,
                AdoInvariant         = globalConfiguration.AdoInvariant,
                DataConnectionString = globalConfiguration.DataConnectionString
            };

            gatewayListProvider = CreateGatewayListProvider(logger);
            gatewayListProvider.InitializeGatewayListProvider(clientConfiguration, logger).WithTimeout(TimeSpan.FromMinutes(1)).Wait();
        }
Exemple #3
0
        protected MembershipTableTestsBase(ConnectionStringFixture fixture, TestEnvironmentFixture environment, LoggerFilterOptions filters)
        {
            this.environment = environment;
            loggerFactory    = TestingUtils.CreateDefaultLoggerFactory($"{this.GetType()}.log", filters);
            logger           = loggerFactory.CreateLogger(this.GetType().FullName);

            this.clusterId = "test-" + Guid.NewGuid();

            logger.Info("ClusterId={0}", this.clusterId);

            fixture.InitializeConnectionStringAccessor(GetConnectionString);
            this.connectionString = fixture.ConnectionString;
            this.siloOptions      = Options.Create(new SiloOptions {
                ClusterId = this.clusterId
            });
            this.clientOptions = Options.Create(new ClusterClientOptions {
                ClusterId = this.clusterId
            });
            var adoVariant = GetAdoInvariant();

            membershipTable = CreateMembershipTable(logger);
            membershipTable.InitializeMembershipTable(true).WithTimeout(TimeSpan.FromMinutes(1)).Wait();

            clientConfiguration = new ClientConfiguration
            {
                ClusterId            = this.clusterId,
                AdoInvariant         = adoVariant,
                DataConnectionString = fixture.ConnectionString
            };

            this.gatewayOptions = Options.Create(new GatewayOptions());
            gatewayListProvider = CreateGatewayListProvider(logger);
            gatewayListProvider.InitializeGatewayListProvider().WithTimeout(TimeSpan.FromMinutes(1)).Wait();
        }
Exemple #4
0
        protected MembershipTableTestsBase(ConnectionStringFixture fixture, TestEnvironmentFixture environment, LoggerFilterOptions filters)
        {
            this.environment = environment;
            loggerFactory    = TestingUtils.CreateDefaultLoggerFactory($"{this.GetType()}.log", filters);
            logger           = new LoggerWrapper <MembershipTableTestsBase>(loggerFactory);

            this.clusterId = "test-" + Guid.NewGuid();

            logger.Info("ClusterId={0}", this.clusterId);

            fixture.InitializeConnectionStringAccessor(GetConnectionString);
            this.connectionString = fixture.ConnectionString;
            globalConfiguration   = new GlobalConfiguration
            {
                ClusterId            = this.clusterId,
                AdoInvariant         = GetAdoInvariant(),
                DataConnectionString = fixture.ConnectionString
            };

            membershipTable = CreateMembershipTable(logger);
            membershipTable.InitializeMembershipTable(true).WithTimeout(TimeSpan.FromMinutes(1)).Wait();

            clientConfiguration = new ClientConfiguration
            {
                ClusterId            = globalConfiguration.ClusterId,
                AdoInvariant         = globalConfiguration.AdoInvariant,
                DataConnectionString = globalConfiguration.DataConnectionString
            };

            gatewayListProvider = CreateGatewayListProvider(logger);
            gatewayListProvider.InitializeGatewayListProvider().WithTimeout(TimeSpan.FromMinutes(1)).Wait();
        }
        protected const string testDatabaseName = "OrleansMembershipTest";//for relational storage

        protected MembershipTableTestsBase(ConnectionStringFixture fixture, TestEnvironmentFixture environment)
        {
            this.environment = environment;
            LogManager.Initialize(new NodeConfiguration());
            logger       = LogManager.GetLogger(GetType().Name, LoggerType.Application);
            deploymentId = "test-" + Guid.NewGuid();

            logger.Info("DeploymentId={0}", deploymentId);

            fixture.InitializeConnectionStringAccessor(GetConnectionString);

            var globalConfiguration = new GlobalConfiguration
            {
                DeploymentId         = deploymentId,
                AdoInvariant         = GetAdoInvariant(),
                DataConnectionString = fixture.ConnectionString
            };

            membershipTable = CreateMembershipTable(logger);
            membershipTable.InitializeMembershipTable(globalConfiguration, true, logger).WithTimeout(TimeSpan.FromMinutes(1)).Wait();

            var clientConfiguration = new ClientConfiguration
            {
                DeploymentId         = globalConfiguration.DeploymentId,
                AdoInvariant         = globalConfiguration.AdoInvariant,
                DataConnectionString = globalConfiguration.DataConnectionString
            };

            gatewayListProvider = CreateGatewayListProvider(logger);
            gatewayListProvider.InitializeGatewayListProvider(clientConfiguration, logger).WithTimeout(TimeSpan.FromMinutes(1)).Wait();
        }
Exemple #6
0
        protected MembershipTableTestsBase(ClusterConfiguration clusterConfiguration)
        {
            ConstructorInfo loggerGlobalConfiguration = typeof(Logger).GetConstructors
                                                            (BindingFlags.Instance | BindingFlags.NonPublic)[0];

            //logger = (TraceLogger)loggerGlobalConfiguration.Invoke(new object[] { GetType().Name, TraceLogger.LoggerType.Application });

            //logger = (TraceLogger)loggerGlobalConfiguration.Invoke(new object[] {});

            this.logger = new NoOpTestLogger();

            //LogManager.Initialize(new NodeConfiguration());
            //logger = LogManager.GetLogger(GetType().Name, TraceLogger.LoggerType.Application);

            //logger = new TraceLogger(GetType().Name, TraceLogger.LoggerType.Application);

            //        MethodInfo dynMethod = this.GetType().GetMethod("Draw_" + itemType,
            //BindingFlags.NonPublic | BindingFlags.Instance);
            //        dynMethod.Invoke(this, new object[] { methodParams });

            ConstructorInfo ctorGlobalConfiguration = typeof(GlobalConfiguration).GetConstructors
                                                          (BindingFlags.Instance | BindingFlags.NonPublic)[0];

            GlobalConfiguration globalConfiguration = (GlobalConfiguration)ctorGlobalConfiguration.Invoke(new object[] {});

            globalConfiguration.DeploymentId = globalConfiguration.DeploymentId;
            //globalConfiguration.AdoInvariant = GetAdoInvariant();
            globalConfiguration.DataConnectionString = clusterConfiguration.Globals.DataConnectionString;

            deploymentId = clusterConfiguration.Globals.DeploymentId;

            globalConfiguration.LivenessType            = clusterConfiguration.Globals.LivenessType;
            globalConfiguration.MembershipTableAssembly = clusterConfiguration.Globals.MembershipTableAssembly;
            globalConfiguration.ReminderServiceType     = clusterConfiguration.Globals.ReminderServiceType;
            globalConfiguration.DeploymentId            = clusterConfiguration.Globals.DeploymentId;

            membershipTable = CreateMembershipTable(logger);
            membershipTable.InitializeMembershipTable(globalConfiguration, IsTrue, logger).WithTimeout(TimeSpan.FromMinutes(1)).Wait();

            var clientConfiguration = new ClientConfiguration
            {
                DeploymentId         = globalConfiguration.DeploymentId,
                AdoInvariant         = globalConfiguration.AdoInvariant,
                DataConnectionString = globalConfiguration.DataConnectionString
            };

            gatewayListProvider = CreateGatewayListProvider(logger);
            gatewayListProvider.InitializeGatewayListProvider(clientConfiguration, logger).WithTimeout(TimeSpan.FromMinutes(1)).Wait();
        }
        protected MembershipTableTestsBase()
        {
            var sp = new ServiceCollection().AddLogging(b => b.AddConsole()).BuildServiceProvider();

            loggerFactory = sp.GetRequiredService <ILoggerFactory>();
            logger        = loggerFactory.CreateLogger(this.GetType().FullName);

            this.clusterId = "test-" + Guid.NewGuid();

            logger?.Info("ClusterId={0}", this.clusterId);

            membershipTable = CreateMembershipTable(logger, accountEndpoint, accountKey);
            membershipTable.InitializeMembershipTable(true).WithTimeout(TimeSpan.FromMinutes(3)).Wait();

            gatewayListProvider = CreateGatewayListProvider(logger, accountEndpoint, accountKey);
            gatewayListProvider.InitializeGatewayListProvider().WithTimeout(TimeSpan.FromMinutes(3)).Wait();
        }
Exemple #8
0
        protected MembershipTableTestsBase(/*ConnectionStringFixture fixture, TestEnvironmentFixture environment, */ LoggerFilterOptions filters)
        {
            //this.environment = environment;
            //loggerFactory = TestingUtils.CreateDefaultLoggerFactory($"{this.GetType()}.log", filters);
            //logger = loggerFactory.CreateLogger(this.GetType().FullName);

            this.clusterId = "test-" + Guid.NewGuid();

            logger?.Info("ClusterId={0}", this.clusterId);

            //fixture.InitializeConnectionStringAccessor(GetConnectionString);
            //this.connectionString = fixture.ConnectionString;
            var adoVariant = GetAdoInvariant();

            membershipTable = CreateMembershipTable(logger, accountEndpoint, accountKey);
            membershipTable.InitializeMembershipTable(true).WithTimeout(TimeSpan.FromMinutes(3)).Wait();

            gatewayListProvider = CreateGatewayListProvider(logger, accountEndpoint, accountKey);
            gatewayListProvider.InitializeGatewayListProvider().WithTimeout(TimeSpan.FromMinutes(3)).Wait();
        }
Exemple #9
0
        protected MembershipTableTestsBase(LoggerFilterOptions filters)
        {
            loggerFactory = TestingUtils.CreateDefaultLoggerFactory($"{this.GetType()}.log", filters);
            logger        = loggerFactory.CreateLogger(this.GetType().FullName);

            this.clusterId = "test-" + Guid.NewGuid();

            logger.Info("ClusterId={0}", this.clusterId);

            this.clusterOptions = Options.Create(new ClusterOptions {
                ClusterId = this.clusterId
            });

            membershipTable = CreateMembershipTable(logger);
            membershipTable.InitializeMembershipTable(true).Wait();

            this.gatewayOptions = Options.Create(new GatewayOptions());
            gatewayListProvider = CreateGatewayListProvider(logger);
            gatewayListProvider.InitializeGatewayListProvider().Wait();
        }