예제 #1
0
        public async Task GetTableServiceStatsReturnsStats()
        {
            // Get statistics
            TableServiceStatistics stats = await service.GetStatisticsAsync().ConfigureAwait(false);

            Assert.That(stats.GeoReplication.Status, Is.AnyOf(new TableGeoReplicationStatus("live"), new TableGeoReplicationStatus("unavailable")));
        }
        public async Task GetTableServiceStatsReturnsStats()
        {
            // Get statistics

            TableServiceStatistics stats = await service.GetStatisticsAsync().ConfigureAwait(false);

            // Test that the secondary location is live

            Assert.AreEqual(new TableGeoReplicationStatus("live"), stats.GeoReplication.Status);
        }
예제 #3
0
        public async Task GetTableServiceStatsReturnsStats()
        {
            if (_endpointType == TableEndpointType.CosmosTable)
            {
                Assert.Ignore("GetProperties is currently not supported by Cosmos endpoints.");
            }

            // Get statistics

            TableServiceStatistics stats = await service.GetStatisticsAsync().ConfigureAwait(false);

            // Test that the secondary location is live

            Assert.AreEqual(new TableGeoReplicationStatus("live"), stats.GeoReplication.Status);
        }
        public ResponseWithHeaders <TableServiceStatistics, ServiceGetStatisticsHeaders> GetStatistics(int?timeout = null, CancellationToken cancellationToken = default)
        {
            using var message = CreateGetStatisticsRequest(timeout);
            _pipeline.Send(message, cancellationToken);
            var headers = new ServiceGetStatisticsHeaders(message.Response);

            switch (message.Response.Status)
            {
            case 200:
            {
                TableServiceStatistics value = default;
                var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
                if (document.Element("StorageServiceStats") is XElement storageServiceStatsElement)
                {
                    value = TableServiceStatistics.DeserializeTableServiceStatistics(storageServiceStatsElement);
                }
                return(ResponseWithHeaders.FromValue(value, headers, message.Response));
            }

            default:
                throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }