From 01793bf2b016e410bda508034128e7172cdc07a8 Mon Sep 17 00:00:00 2001 From: Christopher Scott Date: Fri, 4 Dec 2020 12:28:11 -0600 Subject: [PATCH 1/3] fix sync batch method coverage --- sdk/tables/Azure.Data.Tables/src/TableRestClient.cs | 2 -- sdk/tables/Azure.Data.Tables/src/TableTransactionalBatch.cs | 6 +++--- sdk/tables/Azure.Data.Tables/tests/TableClientLiveTests.cs | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sdk/tables/Azure.Data.Tables/src/TableRestClient.cs b/sdk/tables/Azure.Data.Tables/src/TableRestClient.cs index ade0b513d9f93..53a1f9a5ef55c 100644 --- a/sdk/tables/Azure.Data.Tables/src/TableRestClient.cs +++ b/sdk/tables/Azure.Data.Tables/src/TableRestClient.cs @@ -5,9 +5,7 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; -using System.Text.Json; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; diff --git a/sdk/tables/Azure.Data.Tables/src/TableTransactionalBatch.cs b/sdk/tables/Azure.Data.Tables/src/TableTransactionalBatch.cs index b733dfb010a9f..da100d34b376a 100644 --- a/sdk/tables/Azure.Data.Tables/src/TableTransactionalBatch.cs +++ b/sdk/tables/Azure.Data.Tables/src/TableTransactionalBatch.cs @@ -61,7 +61,7 @@ protected TableTransactionalBatch() /// /// The batch boundary Guid. /// The changeset boundary Guid. - internal void SetBatchGuids(Guid batchGuid, Guid changesetGuid) + internal virtual void SetBatchGuids(Guid batchGuid, Guid changesetGuid) { _batchGuid = batchGuid; _changesetGuid = changesetGuid; @@ -256,7 +256,7 @@ internal async Task> SubmitBatchAsyncInternal(bool /// The exception thrown from or . /// If the return value is true, contains the that caused the batch operation to fail. /// true if the failed entity was retrieved from the exception, else false. - public bool TryGetFailedEntityFromException(RequestFailedException exception, out ITableEntity failedEntity) + public virtual bool TryGetFailedEntityFromException(RequestFailedException exception, out ITableEntity failedEntity) { failedEntity = null; @@ -300,7 +300,7 @@ private bool AddMessage(ITableEntity entity, HttpMessage message, RequestType re /// Builds an ordered list of s containing the batch sub-requests. /// /// - private List<(ITableEntity entity, HttpMessage HttpMessage)> BuildOrderedBatchRequests() + internal virtual List<(ITableEntity entity, HttpMessage HttpMessage)> BuildOrderedBatchRequests() { var orderedList = _requestMessages.ToList(); foreach (var item in orderedList) diff --git a/sdk/tables/Azure.Data.Tables/tests/TableClientLiveTests.cs b/sdk/tables/Azure.Data.Tables/tests/TableClientLiveTests.cs index a25b93051048e..e965f71b7e316 100644 --- a/sdk/tables/Azure.Data.Tables/tests/TableClientLiveTests.cs +++ b/sdk/tables/Azure.Data.Tables/tests/TableClientLiveTests.cs @@ -984,7 +984,7 @@ public async Task BatchInsert() var entitiesToCreate = CreateCustomTableEntities(PartitionKeyValue, 5); // Create the batch. - var batch = client.CreateTransactionalBatch(entitiesToCreate[0].PartitionKey); + var batch = InstrumentClient(client.CreateTransactionalBatch(entitiesToCreate[0].PartitionKey)); batch.SetBatchGuids(Recording.Random.NewGuid(), Recording.Random.NewGuid()); @@ -1022,7 +1022,7 @@ public async Task BatchInsertAndMergeAndDelete() await client.AddEntityAsync(entitiesToCreate[2]).ConfigureAwait(false); // Create the batch. - TableTransactionalBatch batch = client.CreateTransactionalBatch(entitiesToCreate[0].PartitionKey); + TableTransactionalBatch batch = InstrumentClient(client.CreateTransactionalBatch(entitiesToCreate[0].PartitionKey)); batch.SetBatchGuids(Recording.Random.NewGuid(), Recording.Random.NewGuid()); @@ -1079,7 +1079,7 @@ public async Task BatchError() var entitiesToCreate = CreateCustomTableEntities(PartitionKeyValue, 4); // Create the batch. - var batch = client.CreateTransactionalBatch(entitiesToCreate[0].PartitionKey); + var batch = InstrumentClient(client.CreateTransactionalBatch(entitiesToCreate[0].PartitionKey)); batch.SetBatchGuids(Recording.Random.NewGuid(), Recording.Random.NewGuid()); From 27ef8dd1107a20815747cb49c415e3d4ff44343a Mon Sep 17 00:00:00 2001 From: Christopher Scott Date: Fri, 4 Dec 2020 13:42:15 -0600 Subject: [PATCH 2/3] export api --- .../Azure.Data.Tables/api/Azure.Data.Tables.netstandard2.0.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tables/Azure.Data.Tables/api/Azure.Data.Tables.netstandard2.0.cs b/sdk/tables/Azure.Data.Tables/api/Azure.Data.Tables.netstandard2.0.cs index c74cfb978ad4a..c680eeae830e4 100644 --- a/sdk/tables/Azure.Data.Tables/api/Azure.Data.Tables.netstandard2.0.cs +++ b/sdk/tables/Azure.Data.Tables/api/Azure.Data.Tables.netstandard2.0.cs @@ -132,7 +132,7 @@ protected TableTransactionalBatch() { } public virtual void DeleteEntity(string partitionKey, string rowKey, Azure.ETag ifMatch = default(Azure.ETag)) { } public virtual Azure.Response SubmitBatch(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> SubmitBatchAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public bool TryGetFailedEntityFromException(Azure.RequestFailedException exception, out Azure.Data.Tables.ITableEntity failedEntity) { throw null; } + public virtual bool TryGetFailedEntityFromException(Azure.RequestFailedException exception, out Azure.Data.Tables.ITableEntity failedEntity) { throw null; } public virtual void UpdateEntity(T entity, Azure.ETag ifMatch, Azure.Data.Tables.TableUpdateMode mode = Azure.Data.Tables.TableUpdateMode.Merge) where T : class, Azure.Data.Tables.ITableEntity, new() { } public virtual void UpsertEntity(T entity, Azure.Data.Tables.TableUpdateMode mode = Azure.Data.Tables.TableUpdateMode.Merge) where T : class, Azure.Data.Tables.ITableEntity, new() { } } From e8c9e7651e90d4fa4fb5387435695c94ea8279b9 Mon Sep 17 00:00:00 2001 From: Christopher Scott Date: Fri, 4 Dec 2020 13:48:00 -0600 Subject: [PATCH 3/3] revert BuildOrderedBatchRequests change --- sdk/tables/Azure.Data.Tables/src/TableTransactionalBatch.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tables/Azure.Data.Tables/src/TableTransactionalBatch.cs b/sdk/tables/Azure.Data.Tables/src/TableTransactionalBatch.cs index da100d34b376a..b0a9ee4005c2f 100644 --- a/sdk/tables/Azure.Data.Tables/src/TableTransactionalBatch.cs +++ b/sdk/tables/Azure.Data.Tables/src/TableTransactionalBatch.cs @@ -300,7 +300,7 @@ private bool AddMessage(ITableEntity entity, HttpMessage message, RequestType re /// Builds an ordered list of s containing the batch sub-requests. /// /// - internal virtual List<(ITableEntity entity, HttpMessage HttpMessage)> BuildOrderedBatchRequests() + private List<(ITableEntity entity, HttpMessage HttpMessage)> BuildOrderedBatchRequests() { var orderedList = _requestMessages.ToList(); foreach (var item in orderedList)