Skip to content

Commit 4e96717

Browse files
committed
refactor(Spanner): Delete now unused code
1 parent 2724533 commit 4e96717

File tree

9 files changed

+5
-2031
lines changed

9 files changed

+5
-2031
lines changed

apis/Google.Cloud.Spanner.Data/Google.Cloud.Spanner.Data.Tests/V1/SessionPoolTests.TargetedSessionPoolTests.cs

Lines changed: 0 additions & 961 deletions
This file was deleted.

apis/Google.Cloud.Spanner.Data/Google.Cloud.Spanner.Data.Tests/V1/SessionPoolTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
using System.Linq;
2424
using System.Threading.Tasks;
2525
using Xunit;
26-
using static Google.Cloud.Spanner.V1.SessionPool;
2726
using static Google.Cloud.Spanner.V1.TransactionOptions;
2827

2928
namespace Google.Cloud.Spanner.V1.Tests
@@ -35,7 +34,6 @@ public partial class SessionPoolTests
3534

3635
private static readonly DatabaseName s_sampleDatabaseName = new DatabaseName("project", "instance", "database");
3736
private static readonly DatabaseName s_sampleDatabaseName2 = new DatabaseName("project", "instance", "database2");
38-
private static readonly string s_databaseRole = "testrole";
3937
private static readonly SessionName s_sampleSessionName = new SessionName("project", "instance", "database", "session");
4038
private static readonly ByteString s_sampleTransactionId = ByteString.CopyFromUtf8("transaction-id");
4139

apis/Google.Cloud.Spanner.Data/Google.Cloud.Spanner.Data.Tests/V1/SpannerClientHelpers.cs

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
using Google.Api.Gax;
1615
using Google.Api.Gax.Grpc;
1716
using Google.Api.Gax.Grpc.Testing;
1817
using Google.Api.Gax.Testing;
@@ -21,18 +20,17 @@
2120
using Google.Protobuf;
2221
using Google.Protobuf.WellKnownTypes;
2322
using Google.Rpc;
24-
using Google.Rpc.Context;
2523
using Grpc.Core;
24+
using NSubstitute;
25+
using NSubstitute.Core;
26+
using NSubstitute.ExceptionExtensions;
27+
using NSubstitute.Extensions;
2628
using System;
2729
using System.Collections.Generic;
2830
using System.Linq;
2931
using System.Threading.Tasks;
30-
using Status = Grpc.Core.Status;
3132
using static Google.Cloud.Spanner.V1.SpannerClientImpl;
32-
using NSubstitute;
33-
using NSubstitute.Extensions;
34-
using NSubstitute.ExceptionExtensions;
35-
using NSubstitute.Core;
33+
using Status = Grpc.Core.Status;
3634

3735
namespace Google.Cloud.Spanner.V1.Tests
3836
{
@@ -65,31 +63,6 @@ internal static SpannerClient CreateMockClient(Logger logger)
6563
return mock;
6664
}
6765

68-
internal static SpannerClient SetupBatchCreateSessionsAsync(this SpannerClient spannerClientMock)
69-
{
70-
spannerClientMock.Configure()
71-
.BatchCreateSessionsAsync(Arg.Is<BatchCreateSessionsRequest>(x => x != null), Arg.Any<CallSettings>())
72-
.Returns(args =>
73-
{
74-
var request = (BatchCreateSessionsRequest) args[0];
75-
BatchCreateSessionsResponse response = new BatchCreateSessionsResponse();
76-
77-
for (int i = 0; i < request.SessionCount; i++)
78-
{
79-
var session = request.SessionTemplate.Clone();
80-
session.CreateTime = session.ApproximateLastUseTime = spannerClientMock.GetNowTimestamp();
81-
session.Expired = false;
82-
session.Name = Guid.NewGuid().ToString();
83-
session.SessionName = new SessionName(ProjectId, Instance, Database, session.Name);
84-
85-
response.Session.Add(session);
86-
}
87-
88-
return Task.FromResult(response);
89-
});
90-
return spannerClientMock;
91-
}
92-
9366
internal static SpannerClient SetupCreateSessionAsync(this SpannerClient spannerClientMock)
9467
{
9568
spannerClientMock.Configure()

apis/Google.Cloud.Spanner.V1/Google.Cloud.Spanner.V1/Internal/ExecuteHelper.cs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,45 +27,6 @@ public static class ExecuteHelper
2727
internal const string SessionResourceType = "type.googleapis.com/google.spanner.v1.Session";
2828
internal const string ResourceInfoMetadataKey = "google.rpc.resourceinfo-bin";
2929

30-
/// <summary>
31-
/// Waits for <paramref name="task"/> to complete, handling session expiry by marking the session appropriately.
32-
/// </summary>
33-
internal static async Task<T> WithSessionExpiryChecking<T>(this Task<T> task, Session session)
34-
{
35-
try
36-
{
37-
return await task.ConfigureAwait(false);
38-
}
39-
catch (RpcException ex) when (ex.CheckForSessionExpiredError(session))
40-
{
41-
throw;
42-
}
43-
}
44-
45-
/// <summary>
46-
/// Waits for <paramref name="task"/> to complete, handling session expiry by marking the session appropriately.
47-
/// </summary>
48-
internal static async Task WithSessionExpiryChecking(this Task task, Session session)
49-
{
50-
try
51-
{
52-
await task.ConfigureAwait(false);
53-
}
54-
catch (RpcException ex) when (ex.CheckForSessionExpiredError(session))
55-
{
56-
throw;
57-
}
58-
}
59-
60-
private static bool CheckForSessionExpiredError(this RpcException rpcException, Session session)
61-
{
62-
if (rpcException.IsSessionExpiredError())
63-
{
64-
session.Expired = true;
65-
}
66-
return false;
67-
}
68-
6930
/// <summary>
7031
/// Determines whether <paramref name="rpcException"/> is due to a session expiry.
7132
/// </summary>

apis/Google.Cloud.Spanner.V1/Google.Cloud.Spanner.V1/SessionPartial.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

apis/Google.Cloud.Spanner.V1/Google.Cloud.Spanner.V1/SessionPool.DetachedSessionPool.cs

Lines changed: 0 additions & 71 deletions
This file was deleted.

apis/Google.Cloud.Spanner.V1/Google.Cloud.Spanner.V1/SessionPool.ISessionPool.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

apis/Google.Cloud.Spanner.V1/Google.Cloud.Spanner.V1/SessionPool.SessionPoolBase.cs

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)