コード例 #1
0
        public async Task Reminders_AzureTable_InsertNewRowAndReadBack()
        {
            log.Info(TestContext.TestName);

            string         deploymentId = NewDeploymentId();
            IReminderTable table        = new AzureBasedReminderTable();
            var            config       = new GlobalConfiguration()
            {
                ServiceId            = ServiceId,
                DeploymentId         = deploymentId,
                DataConnectionString = StorageTestConstants.DataConnectionString
            };
            await table.Init(config, log);

            ReminderEntry[] rows = (await GetAllRows(table)).ToArray();
            Assert.AreEqual(0, rows.Count(), "The reminder table (sid={0}, did={1}) was not empty.", ServiceId, deploymentId);

            ReminderEntry expected = NewReminderEntry();
            await table.UpsertRow(expected);

            rows = (await GetAllRows(table)).ToArray();

            Assert.AreEqual(1, rows.Count(), "The reminder table (sid={0}, did={1}) did not contain the correct number of rows (1).", ServiceId, deploymentId);
            ReminderEntry actual = rows[0];

            Assert.AreEqual(expected.GrainRef, actual.GrainRef, "The newly inserted reminder table (sid={0}, did={1}) row did not contain the expected grain reference.", ServiceId, deploymentId);
            Assert.AreEqual(expected.ReminderName, actual.ReminderName, "The newly inserted reminder table (sid={0}, did={1}) row did not have the expected reminder name.", ServiceId, deploymentId);
            Assert.AreEqual(expected.Period, actual.Period, "The newly inserted reminder table (sid={0}, did={1}) row did not have the expected period.", ServiceId, deploymentId);
            // the following assertion fails but i don't know why yet-- the timestamps appear identical in the error message. it's not really a priority to hunt down the reason, however, because i have high confidence it is working well enough for the moment.
            /*Assert.AreEqual(expected.StartAt, actual.StartAt, "The newly inserted reminder table (sid={0}, did={1}) row did not contain the correct start time.", ServiceId, deploymentId);*/
            Assert.IsFalse(string.IsNullOrWhiteSpace(actual.ETag), "The newly inserted reminder table (sid={0}, did={1}) row contains an invalid etag.", ServiceId, deploymentId);
        }
コード例 #2
0
        public async Task Reminders_AzureTable_InsertNewRowAndReadBack()
        {
            string clusterId      = NewClusterId();
            var    clusterOptions = Options.Create(new ClusterOptions {
                ClusterId = clusterId, ServiceId = this.serviceId
            });
            var storageOptions = Options.Create(new AzureTableReminderStorageOptions());

            storageOptions.Value.ConfigureTestDefaults();
            IReminderTable table = new AzureBasedReminderTable(this.fixture.Services.GetRequiredService <GrainReferenceKeyStringConverter>(), this.loggerFactory, clusterOptions, storageOptions);
            await table.Init();

            ReminderEntry[] rows = (await GetAllRows(table)).ToArray();
            Assert.Empty(rows); // "The reminder table (sid={0}, did={1}) was not empty.", ServiceId, clusterId);

            ReminderEntry expected = NewReminderEntry();
            await table.UpsertRow(expected);

            rows = (await GetAllRows(table)).ToArray();

            Assert.Single(rows); // "The reminder table (sid={0}, did={1}) did not contain the correct number of rows (1).", ServiceId, clusterId);
            ReminderEntry actual = rows[0];

            Assert.Equal(expected.GrainRef, actual.GrainRef);         // "The newly inserted reminder table (sid={0}, did={1}) row did not contain the expected grain reference.", ServiceId, clusterId);
            Assert.Equal(expected.ReminderName, actual.ReminderName); // "The newly inserted reminder table (sid={0}, did={1}) row did not have the expected reminder name.", ServiceId, clusterId);
            Assert.Equal(expected.Period, actual.Period);             // "The newly inserted reminder table (sid={0}, did={1}) row did not have the expected period.", ServiceId, clusterId);
            // the following assertion fails but i don't know why yet-- the timestamps appear identical in the error message. it's not really a priority to hunt down the reason, however, because i have high confidence it is working well enough for the moment.
            /*Assert.Equal(expected.StartAt,  actual.StartAt); // "The newly inserted reminder table (sid={0}, did={1}) row did not contain the correct start time.", ServiceId, clusterId);*/
            Assert.False(string.IsNullOrWhiteSpace(actual.ETag), $"The newly inserted reminder table (sid={this.serviceId}, did={clusterId}) row contains an invalid etag.");
        }
コード例 #3
0
        public async Task Reminders_AzureTable_InsertRate()
        {
            var siloOptions = Options.Create(new SiloOptions { ClusterId = "TMSLocalTesting", ServiceId = this.ServiceId });
            IReminderTable table = new AzureBasedReminderTable(this.fixture.Services.GetRequiredService<IGrainReferenceConverter>(), this.loggerFactory, siloOptions);
            var config = new GlobalConfiguration()
            {
                DataConnectionString = TestDefaultConfiguration.DataConnectionString
            };
            await table.Init(config);

            await TestTableInsertRate(table, 10);
            await TestTableInsertRate(table, 500);
        }
コード例 #4
0
        public async Task Reminders_AzureTable_InsertRate()
        {
            IReminderTable table  = new AzureBasedReminderTable(this.fixture.Services.GetRequiredService <IGrainReferenceConverter>(), this.loggerFactory);
            var            config = new GlobalConfiguration()
            {
                ServiceId            = ServiceId,
                DeploymentId         = "TMSLocalTesting",
                DataConnectionString = TestDefaultConfiguration.DataConnectionString
            };
            await table.Init(config);

            await TestTableInsertRate(table, 10);
            await TestTableInsertRate(table, 500);
        }
コード例 #5
0
        public async Task Reminders_AzureTable_InsertRate()
        {
            IReminderTable table  = new AzureBasedReminderTable();
            var            config = new GlobalConfiguration()
            {
                ServiceId            = ServiceId,
                DeploymentId         = "TMSLocalTesting",
                DataConnectionString = TestDefaultConfiguration.DataConnectionString
            };
            await table.Init(config, log);

            await TestTableInsertRate(table, 10);
            await TestTableInsertRate(table, 500);
        }
コード例 #6
0
        public async Task Reminders_AzureTable_InsertRate()
        {
            var clusterOptions = Options.Create(new ClusterOptions {
                ClusterId = "TMSLocalTesting", ServiceId = this.serviceId
            });
            var storageOptions = Options.Create(new AzureTableReminderStorageOptions());

            storageOptions.Value.ConfigureTestDefaults();

            IReminderTable table = new AzureBasedReminderTable(this.fixture.Services.GetRequiredService <GrainReferenceKeyStringConverter>(), this.loggerFactory, clusterOptions, storageOptions);
            await table.Init();

            await TestTableInsertRate(table, 10);
            await TestTableInsertRate(table, 500);
        }
コード例 #7
0
        public async Task Reminders_AzureTable_InsertRate()
        {
            log.Info(TestContext.TestName);

            IReminderTable table  = new AzureBasedReminderTable();
            var            config = new GlobalConfiguration()
            {
                ServiceId            = ServiceId,
                DeploymentId         = "TMSLocalTesting",
                DataConnectionString = StorageTestConstants.DataConnectionString
            };
            await table.Init(config, log);

            await TestTableInsertRate(table, 10);
            await TestTableInsertRate(table, 500);
        }