Ejemplo n.º 1
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();
        }
        public AzureGossipTableTests()
        {
            this.loggerFactory = TestingUtils.CreateDefaultLoggerFactory($"{this.GetType().Name}.log");
            this.logger        = this.loggerFactory.CreateLogger <AzureGossipTableTests>();

            this.globalServiceId = Guid.NewGuid();

            IPAddress ip;

            if (!IPAddress.TryParse("127.0.0.1", out ip))
            {
                this.logger.Error(-1, "Could not parse ip address");
                return;
            }
            IPEndPoint ep1 = new IPEndPoint(ip, 21111);

            this.siloAddress1 = SiloAddress.New(ep1, 0);
            IPEndPoint ep2 = new IPEndPoint(ip, 21112);

            this.siloAddress2 = SiloAddress.New(ep2, 0);

            this.logger.Info("Global ServiceId={0}", this.globalServiceId);

            this.gossipTable = new AzureTableBasedGossipChannel(this.loggerFactory);
            var done = this.gossipTable.Initialize(globalServiceId.ToString(), TestDefaultConfiguration.DataConnectionString);

            if (!done.Wait(Timeout))
            {
                throw new TimeoutException("Could not create/read table.");
            }
        }
Ejemplo n.º 3
0
        protected const string testDatabaseName = "OrleansReminderTest";//for relational storage

        protected ReminderTableTestsBase(ConnectionStringFixture fixture, TestEnvironmentFixture clusterFixture, LoggerFilterOptions filters)
        {
            loggerFactory       = TestingUtils.CreateDefaultLoggerFactory($"{this.GetType()}.log", filters);
            this.ClusterFixture = clusterFixture;
            logger = loggerFactory.CreateLogger <ReminderTableTestsBase>();
            var serviceId = Guid.NewGuid();
            var clusterId = "test-" + serviceId;

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

            fixture.InitializeConnectionStringAccessor(GetConnectionString);

            var globalConfiguration = new GlobalConfiguration
            {
                ServiceId = serviceId,
                ClusterId = clusterId,
                AdoInvariantForReminders         = GetAdoInvariant(),
                DataConnectionStringForReminders = fixture.ConnectionString
            };

            var rmndr = CreateRemindersTable();

            rmndr.Init(globalConfiguration).WithTimeout(TimeSpan.FromMinutes(1)).Wait();
            remindersTable = rmndr;
        }
Ejemplo n.º 4
0
        public async Task AzureTableStorage_ConvertToFromStorageFormat(int?stringLength, string useJson)
        {
            var testName = string.Format("{0}({1} = {2}, {3} = {4})",
                                         nameof(AzureTableStorage_ConvertToFromStorageFormat),
                                         nameof(stringLength), stringLength == null ? "default" : stringLength.ToString(),
                                         nameof(useJson), useJson);

            var state = TestStoreGrainState.NewRandomState(stringLength);

            EnsureEnvironmentSupportsState(state);

            var storage = await InitAzureTableStorageProvider(useJson, testName);

            var initialState = state.State;

            var logger = new LoggerWrapper <PersistenceProviderTests_Local>(TestingUtils.CreateDefaultLoggerFactory($"{this.GetType().Name}.log"));

            storage.InitLogger(logger);

            var entity = new DynamicTableEntity();

            storage.ConvertToStorageFormat(initialState, entity);

            var convertedState = (TestStoreGrainState)storage.ConvertFromStorageFormat(entity);

            Assert.NotNull(convertedState);
            Assert.Equal(initialState.A, convertedState.A);
            Assert.Equal(initialState.B, convertedState.B);
            Assert.Equal(initialState.C, convertedState.C);
        }
Ejemplo n.º 5
0
        public AzureQueueDataManagerTests()
        {
            var loggerFactory = TestingUtils.CreateDefaultLoggerFactory(TestingUtils.CreateTraceFileName("Client", DateTime.Now.ToString("yyyyMMdd_hhmmss")));

            logger             = loggerFactory.CreateLogger <AzureQueueDataManagerTests>();
            this.loggerFactory = loggerFactory;
        }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
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();
        }
        public AzureQueueDataManagerTests()
        {
            ClientConfiguration config = new ClientConfiguration();
            var loggerFactory          = TestingUtils.CreateDefaultLoggerFactory(TestingUtils.CreateTraceFileName(config.ClientName, config.DeploymentId));

            logger             = loggerFactory.CreateLogger <AzureQueueDataManagerTests>();
            this.loggerFactory = loggerFactory;
        }
Ejemplo n.º 9
0
 internal MultipleStreamsTestRunner(IInternalClusterClient client, string streamProvider, int testNum = 0, bool fullTest = true)
 {
     this.client             = client;
     this.streamProviderName = streamProvider;
     this.logger             = (TestingUtils.CreateDefaultLoggerFactory($"{this.GetType().Name}.log")).CreateLogger <MultipleStreamsTestRunner>();
     this.testNumber         = testNum;
     this.runFullTest        = fullTest;
 }
Ejemplo n.º 10
0
 internal SingleStreamTestRunner(IInternalClusterClient client, string streamProvider, int testNum = 0, bool fullTest = true)
 {
     this.client             = client;
     this.streamProviderName = streamProvider;
     this.logger             = new LoggerWrapper <SingleStreamTestRunner>(TestingUtils.CreateDefaultLoggerFactory($"{this.GetType().Name}.log"));
     this.testNumber         = testNum;
     this.runFullTest        = fullTest;
     this.random             = TestConstants.random;
 }
Ejemplo n.º 11
0
        internal static ILoggerFactory InitSchedulerLogging()
        {
            var filters = new LoggerFilterOptions();

            filters.AddFilter("Scheduler", LogLevel.Trace);
            filters.AddFilter("Scheduler.WorkerPoolThread", LogLevel.Trace);
            var loggerFactory = TestingUtils.CreateDefaultLoggerFactory(TestingUtils.CreateTraceFileName("Silo", DateTime.Now.ToString("yyyyMMdd_hhmmss")), filters);

            return(loggerFactory);
        }
        public ReminderTests_Azure_Standalone(ITestOutputHelper output, TestEnvironmentFixture fixture)
        {
            this.output        = output;
            this.fixture       = fixture;
            this.loggerFactory = TestingUtils.CreateDefaultLoggerFactory($"{GetType().Name}.log");
            this.log           = this.loggerFactory.CreateLogger <ReminderTests_Azure_Standalone>();

            this.serviceId = Guid.NewGuid().ToString();

            TestUtils.ConfigureClientThreadPoolSettingsForStorageTests(1000);
        }
        protected SqlStatisticsPublisherTestsBase(ConnectionStringFixture fixture, TestEnvironmentFixture environment)
        {
            this.environment   = environment;
            this.loggerFactory = TestingUtils.CreateDefaultLoggerFactory(new NodeConfiguration().TraceFileName);
            logger             = new LoggerWrapper <SqlStatisticsPublisherTestsBase>(loggerFactory);

            fixture.InitializeConnectionStringAccessor(GetConnectionString);

            ConnectionString = fixture.ConnectionString;

            StatisticsPublisher = new SqlStatisticsPublisher();
            StatisticsPublisher.Init("Test", new StatisticsPublisherProviderRuntime(logger),
                                     new StatisticsPublisherProviderConfig(AdoInvariant, ConnectionString)).Wait();
        }
        internal static ILoggerFactory InitSchedulerLogging()
        {
            var filters = new LoggerFilterOptions();

            filters.AddFilter("Scheduler", LogLevel.Trace);
            filters.AddFilter("Scheduler.WorkerPoolThread", LogLevel.Trace);
            var orleansConfig = new ClusterConfiguration();

            orleansConfig.StandardLoad();
            NodeConfiguration config = orleansConfig.CreateNodeConfigurationForSilo("Primary");
            var loggerFactory        = TestingUtils.CreateDefaultLoggerFactory(TestingUtils.CreateTraceFileName(config.SiloName, orleansConfig.Globals.ClusterId), filters);

            return(loggerFactory);
        }
Ejemplo n.º 15
0
        public ReminderTests_Base(BaseTestClusterFixture fixture)
        {
            HostedCluster = fixture.HostedCluster;
            GrainFactory  = fixture.GrainFactory;

            var filters = new LoggerFilterOptions();

#if DEBUG
            filters.AddFilter("Storage", LogLevel.Trace);
            filters.AddFilter("Reminder", LogLevel.Trace);
#endif

            log = TestingUtils.CreateDefaultLoggerFactory(TestingUtils.CreateTraceFileName("client", DateTime.Now.ToString("yyyyMMdd_hhmmss")), filters).CreateLogger <ReminderTests_Base>();
        }
        protected SqlStatisticsPublisherTestsBase(ConnectionStringFixture fixture, TestEnvironmentFixture environment)
        {
            this.environment = environment;
            this.loggerFactory = TestingUtils.CreateDefaultLoggerFactory($"{this.GetType()}.log");
            logger = loggerFactory.CreateLogger<SqlStatisticsPublisherTestsBase>();

            fixture.InitializeConnectionStringAccessor(GetConnectionString);

            ConnectionString = fixture.ConnectionString;

            StatisticsPublisher = new AdoNetStatisticsPublisher();
            StatisticsPublisher.Init("Test", new StatisticsPublisherProviderRuntime(),
                new StatisticsPublisherProviderConfig(AdoInvariant, ConnectionString)).Wait();
        }
        public ReminderTests_Base(BaseTestClusterFixture fixture)
        {
            HostedCluster = fixture.HostedCluster;
            GrainFactory  = fixture.GrainFactory;

            ClientConfiguration configuration = ClientConfiguration.LoadFromFile("ClientConfigurationForTesting.xml");
            var filters = new LoggerFilterOptions();

#if DEBUG
            filters.AddFilter("Storage", LogLevel.Trace);
            filters.AddFilter("Reminder", LogLevel.Trace);
#endif

            log = TestingUtils.CreateDefaultLoggerFactory(TestingUtils.CreateTraceFileName(configuration.ClientName, configuration.ClusterId), filters).CreateLogger <ReminderTests_Base>();
        }
Ejemplo n.º 18
0
        protected const string testDatabaseName = "OrleansReminderTest";//for relational storage

        protected ReminderTableTestsBase(ConnectionStringFixture fixture, TestEnvironmentFixture clusterFixture, LoggerFilterOptions filters)
        {
            this.connectionStringFixture = fixture;
            fixture.InitializeConnectionStringAccessor(GetConnectionString);
            loggerFactory       = TestingUtils.CreateDefaultLoggerFactory($"{this.GetType()}.log", filters);
            this.ClusterFixture = clusterFixture;
            logger = loggerFactory.CreateLogger <ReminderTableTestsBase>();
            var serviceId = Guid.NewGuid().ToString() + "/foo";
            var clusterId = "test-" + serviceId + "/foo2";

            logger.Info("ClusterId={0}", clusterId);
            this.clusterOptions = Options.Create(new ClusterOptions {
                ClusterId = clusterId, ServiceId = serviceId
            });

            this.remindersTable = this.CreateRemindersTable();
        }
Ejemplo n.º 19
0
        public void SiloConfig_OldAzure()
        {
            const string filename = "Config_OldAzure.xml";

            TestingUtils.CreateDefaultLoggerFactory(new NodeConfiguration().TraceFileName);
            var siloConfig = new ClusterConfiguration();

            siloConfig.LoadFromFile(filename);

            Assert.Equal(GlobalConfiguration.LivenessProviderType.AzureTable, siloConfig.Globals.LivenessType);               // LivenessType
            Assert.Equal(GlobalConfiguration.ReminderServiceProviderType.AzureTable, siloConfig.Globals.ReminderServiceType); // ReminderServiceType

            Assert.NotNull(siloConfig.Globals.DataConnectionString);                                                          // DataConnectionString should not be null
            Assert.False(string.IsNullOrWhiteSpace(siloConfig.Globals.DataConnectionString), "DataConnectionString should not be blank");

            Assert.True(siloConfig.Globals.UseAzureSystemStore, "Should be using Azure storage");
            Assert.False(siloConfig.Globals.UseSqlSystemStore, "Should not be using SqlServer storage");
        }
        protected ReminderTableTestsBase(ClusterFixture clusterFixture, LoggerFilterOptions filters)
        {
            this.clusterFixture = clusterFixture;

            loggerFactory = TestingUtils.CreateDefaultLoggerFactory($"{GetType()}.log", filters);
            logger        = loggerFactory.CreateLogger <ReminderTableTestsBase>();
            string serviceId = Guid.NewGuid().ToString();
            string clusterId = "test-" + serviceId;

            logger.Info("ClusterId={0}", clusterId);
            clusterOptions = Options.Create(new ClusterOptions {
                ClusterId = clusterId, ServiceId = serviceId
            });

            IReminderTable rmndr = CreateRemindersTable();

            rmndr.Init().WithTimeout(TimeSpan.FromMinutes(1)).Wait();
            remindersTable = rmndr;
        }
Ejemplo n.º 21
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();
        }
Ejemplo n.º 22
0
        protected const string testDatabaseName = "OrleansReminderTest";//for relational storage

        protected ReminderTableTestsBase(ConnectionStringFixture fixture, TestEnvironmentFixture clusterFixture, LoggerFilterOptions filters)
        {
            this.connectionStringFixture = fixture;
            fixture.InitializeConnectionStringAccessor(GetConnectionString);
            loggerFactory       = TestingUtils.CreateDefaultLoggerFactory($"{this.GetType()}.log", filters);
            this.ClusterFixture = clusterFixture;
            logger = loggerFactory.CreateLogger <ReminderTableTestsBase>();
            var serviceId = Guid.NewGuid();
            var clusterId = "test-" + serviceId;

            logger.Info("ClusterId={0}", clusterId);
            this.siloOptions = Options.Create(new SiloOptions {
                ClusterId = clusterId, ServiceId = serviceId
            });

            var rmndr = CreateRemindersTable();

            rmndr.Init().WithTimeout(TimeSpan.FromMinutes(1)).Wait();
            remindersTable = rmndr;
        }
Ejemplo n.º 23
0
        public AzureGossipTableTests()
        {
            loggerFactory = TestingUtils.CreateDefaultLoggerFactory($"{this.GetType().Name}.log");
            logger        = new LoggerWrapper <AzureGossipTableTests>(loggerFactory);

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

            IPAddress ip;

            if (!IPAddress.TryParse("127.0.0.1", out ip))
            {
                logger.Error(-1, "Could not parse ip address");
                return;
            }
            IPEndPoint ep1 = new IPEndPoint(ip, 21111);

            siloAddress1 = SiloAddress.New(ep1, 0);
            IPEndPoint ep2 = new IPEndPoint(ip, 21112);

            siloAddress2 = SiloAddress.New(ep2, 0);

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

            GlobalConfiguration config = new GlobalConfiguration
            {
                ServiceId            = globalServiceId,
                ClusterId            = "0",
                DeploymentId         = deploymentId,
                DataConnectionString = TestDefaultConfiguration.DataConnectionString
            };

            gossipTable = new AzureTableBasedGossipChannel(loggerFactory);
            var done = gossipTable.Initialize(config.ServiceId, config.DataConnectionString);

            if (!done.Wait(timeout))
            {
                throw new TimeoutException("Could not create/read table.");
            }
        }
Ejemplo n.º 24
0
        protected override AzureTableGrainDirectory GetGrainDirectory()
        {
            TestUtils.CheckForAzureStorage();

            var clusterOptions = new ClusterOptions
            {
                ClusterId = Guid.NewGuid().ToString("N"),
                ServiceId = Guid.NewGuid().ToString("N"),
            };

            var directoryOptions = new AzureTableGrainDirectoryOptions();

            directoryOptions.ConfigureTestDefaults();

            var loggerFactory = TestingUtils.CreateDefaultLoggerFactory("AzureGrainDirectoryTests.log");

            var directory = new AzureTableGrainDirectory(directoryOptions, Options.Create(clusterOptions), loggerFactory);

            directory.InitializeIfNeeded().GetAwaiter().GetResult();

            return(directory);
        }
Ejemplo n.º 25
0
        public void SiloConfig_SqlServer()
        {
            const string filename = "DevTestServerConfiguration.xml";
            Guid         myGuid   = Guid.Empty;

            TestingUtils.CreateDefaultLoggerFactory(new NodeConfiguration().TraceFileName);
            var orleansConfig = new ClusterConfiguration();

            orleansConfig.LoadFromFile(filename);

            output.WriteLine(orleansConfig.Globals);

            Assert.Equal(GlobalConfiguration.LivenessProviderType.SqlServer, orleansConfig.Globals.LivenessType);               // LivenessType
            Assert.Equal(GlobalConfiguration.ReminderServiceProviderType.SqlServer, orleansConfig.Globals.ReminderServiceType); // ReminderServiceType

            Assert.NotNull(orleansConfig.Globals.DataConnectionString);                                                         // DataConnectionString should not be null
            Assert.False(string.IsNullOrWhiteSpace(orleansConfig.Globals.DataConnectionString));                                // DataConnectionString should not be blank

            Assert.False(orleansConfig.Globals.UseAzureSystemStore);                                                            // Should not be using Azure storage
            Assert.True(orleansConfig.Globals.UseSqlSystemStore);                                                               // Should be using SqlServer storage

            Assert.Equal(orleansConfig.Globals.ServiceId, myGuid);                                                              // ServiceId
        }
Ejemplo n.º 26
0
 public AzureSiloTests()
 {
     this.loggerFactory = TestingUtils.CreateDefaultLoggerFactory("AzureSiloTests.log");
 }
Ejemplo n.º 27
0
 public AssemblyLoaderTests()
 {
     this.defaultLoggerFactory =
         TestingUtils.CreateDefaultLoggerFactory("AssemblyLoaderTests.log");
     this.logger = new LoggerWrapper <AssemblyLoaderTests>(defaultLoggerFactory);
 }
Ejemplo n.º 28
0
 public AssemblyLoaderTests()
 {
     this.defaultLoggerFactory =
         TestingUtils.CreateDefaultLoggerFactory("AssemblyLoaderTests.log");
     this.logger = defaultLoggerFactory.CreateLogger <AssemblyLoaderTests>();
 }