diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2016-06-06 12:41:55 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2016-06-06 12:41:55 -0700 |
commit | 7a952ad8e46b93c38862bdfd7bb6f2ee4f08c772 (patch) | |
tree | c8d96a1e1ddd5bf1b372dcb982b2c28b5b275552 | |
parent | 37e26d922fc443b67df50abd8b11288eba2920cd (diff) | |
parent | fcc8d971ff8b46bf88e0231fda713b274597af99 (diff) |
Merge pull request #6801 from jtattermusch/csharp_server_service_definition
Cleanup in C# generated code
-rw-r--r-- | src/compiler/csharp_generator.cc | 116 | ||||
-rw-r--r-- | src/csharp/Grpc.Core.Tests/MockServiceHelper.cs | 2 | ||||
-rw-r--r-- | src/csharp/Grpc.Core.Tests/ServerTest.cs | 2 | ||||
-rw-r--r-- | src/csharp/Grpc.Core/AsyncClientStreamingCall.cs | 4 | ||||
-rw-r--r-- | src/csharp/Grpc.Core/ServerServiceDefinition.cs | 10 | ||||
-rw-r--r-- | src/csharp/Grpc.Examples/MathGrpc.cs | 111 | ||||
-rw-r--r-- | src/csharp/Grpc.HealthCheck/HealthGrpc.cs | 34 | ||||
-rw-r--r-- | src/csharp/Grpc.IntegrationTesting/GenericService.cs | 2 | ||||
-rw-r--r-- | src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs | 65 | ||||
-rw-r--r-- | src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs | 196 | ||||
-rw-r--r-- | src/csharp/Grpc.IntegrationTesting/TestGrpc.cs | 232 |
11 files changed, 33 insertions, 741 deletions
diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index 484fa3cdcc..fc8feaf0fc 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -119,18 +119,10 @@ std::string GetServiceClassName(const ServiceDescriptor* service) { return service->name(); } -std::string GetClientInterfaceName(const ServiceDescriptor* service) { - return "I" + service->name() + "Client"; -} - std::string GetClientClassName(const ServiceDescriptor* service) { return service->name() + "Client"; } -std::string GetServerInterfaceName(const ServiceDescriptor* service) { - return "I" + service->name(); -} - std::string GetServerClassName(const ServiceDescriptor* service) { return service->name() + "Base"; } @@ -302,86 +294,6 @@ void GenerateServiceDescriptorProperty(Printer* out, const ServiceDescriptor *se out->Print("\n"); } -void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) { - out->Print("/// <summary>Client for $servicename$</summary>\n", - "servicename", GetServiceClassName(service)); - out->Print("[System.Obsolete(\"Client side interfaced will be removed " - "in the next release. Use client class directly.\")]\n"); - out->Print("public interface $name$\n", "name", - GetClientInterfaceName(service)); - out->Print("{\n"); - out->Indent(); - for (int i = 0; i < service->method_count(); i++) { - const MethodDescriptor *method = service->method(i); - MethodType method_type = GetMethodType(method); - - if (method_type == METHODTYPE_NO_STREAMING) { - // unary calls have an extra synchronous stub method - GenerateDocCommentBody(out, method); - out->Print( - "$response$ $methodname$($request$ request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));\n", - "methodname", method->name(), "request", - GetClassName(method->input_type()), "response", - GetClassName(method->output_type())); - - // overload taking CallOptions as a param - GenerateDocCommentBody(out, method); - out->Print( - "$response$ $methodname$($request$ request, CallOptions options);\n", - "methodname", method->name(), "request", - GetClassName(method->input_type()), "response", - GetClassName(method->output_type())); - } - - std::string method_name = method->name(); - if (method_type == METHODTYPE_NO_STREAMING) { - method_name += "Async"; // prevent name clash with synchronous method. - } - GenerateDocCommentBody(out, method); - out->Print( - "$returntype$ $methodname$($request_maybe$Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));\n", - "methodname", method_name, "request_maybe", - GetMethodRequestParamMaybe(method), "returntype", - GetMethodReturnTypeClient(method)); - - // overload taking CallOptions as a param - GenerateDocCommentBody(out, method); - out->Print( - "$returntype$ $methodname$($request_maybe$CallOptions options);\n", - "methodname", method_name, "request_maybe", - GetMethodRequestParamMaybe(method), "returntype", - GetMethodReturnTypeClient(method)); - } - out->Outdent(); - out->Print("}\n"); - out->Print("\n"); -} - -void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) { - out->Print("/// <summary>Interface of server-side implementations of $servicename$</summary>\n", - "servicename", GetServiceClassName(service)); - out->Print("[System.Obsolete(\"Service implementations should inherit" - " from the generated abstract base class instead.\")]\n"); - out->Print("public interface $name$\n", "name", - GetServerInterfaceName(service)); - out->Print("{\n"); - out->Indent(); - for (int i = 0; i < service->method_count(); i++) { - const MethodDescriptor *method = service->method(i); - GenerateDocCommentBody(out, method); - out->Print( - "$returntype$ $methodname$($request$$response_stream_maybe$, " - "ServerCallContext context);\n", - "methodname", method->name(), "returntype", - GetMethodReturnTypeServer(method), "request", - GetMethodRequestParamServer(method), "response_stream_maybe", - GetMethodResponseStreamMaybe(method)); - } - out->Outdent(); - out->Print("}\n"); - out->Print("\n"); -} - void GenerateServerClass(Printer* out, const ServiceDescriptor *service) { out->Print("/// <summary>Base class for server-side implementations of $servicename$</summary>\n", "servicename", GetServiceClassName(service)); @@ -414,12 +326,9 @@ void GenerateServerClass(Printer* out, const ServiceDescriptor *service) { void GenerateClientStub(Printer* out, const ServiceDescriptor *service) { out->Print("/// <summary>Client for $servicename$</summary>\n", "servicename", GetServiceClassName(service)); - out->Print("#pragma warning disable 0618\n"); out->Print( - "public class $name$ : ClientBase<$name$>, $interface$\n", - "name", GetClientClassName(service), - "interface", GetClientInterfaceName(service)); - out->Print("#pragma warning restore 0618\n"); + "public class $name$ : ClientBase<$name$>\n", + "name", GetClientClassName(service)); out->Print("{\n"); out->Indent(); @@ -546,22 +455,16 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) { out->Print("\n"); } -void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service, - bool use_server_class) { +void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service) { out->Print( "/// <summary>Creates service definition that can be registered with a server</summary>\n"); - out->Print("#pragma warning disable 0618\n"); out->Print( - "public static ServerServiceDefinition BindService($interface$ serviceImpl)\n", - "interface", use_server_class ? GetServerClassName(service) : - GetServerInterfaceName(service)); - out->Print("#pragma warning restore 0618\n"); + "public static ServerServiceDefinition BindService($implclass$ serviceImpl)\n", + "implclass", GetServerClassName(service)); out->Print("{\n"); out->Indent(); - out->Print( - "return ServerServiceDefinition.CreateBuilder($servicenamefield$)\n", - "servicenamefield", GetServiceNameFieldName()); + out->Print("return ServerServiceDefinition.CreateBuilder()\n"); out->Indent(); out->Indent(); for (int i = 0; i < service->method_count(); i++) { @@ -616,11 +519,7 @@ void GenerateService(Printer* out, const ServiceDescriptor *service, } GenerateServiceDescriptorProperty(out, service); - if (generate_client) { - GenerateClientInterface(out, service); - } if (generate_server) { - GenerateServerInterface(out, service); GenerateServerClass(out, service); } if (generate_client) { @@ -628,8 +527,7 @@ void GenerateService(Printer* out, const ServiceDescriptor *service, GenerateNewStubMethods(out, service); } if (generate_server) { - GenerateBindServiceMethod(out, service, false); - GenerateBindServiceMethod(out, service, true); + GenerateBindServiceMethod(out, service); } out->Outdent(); diff --git a/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs b/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs index 3047314345..4d90470056 100644 --- a/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs +++ b/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs @@ -102,7 +102,7 @@ namespace Grpc.Core.Tests marshaller, marshaller); - serviceDefinition = ServerServiceDefinition.CreateBuilder(ServiceName) + serviceDefinition = ServerServiceDefinition.CreateBuilder() .AddMethod(unaryMethod, (request, context) => unaryHandler(request, context)) .AddMethod(clientStreamingMethod, (requestStream, context) => clientStreamingHandler(requestStream, context)) .AddMethod(serverStreamingMethod, (request, responseStream, context) => serverStreamingHandler(request, responseStream, context)) diff --git a/src/csharp/Grpc.Core.Tests/ServerTest.cs b/src/csharp/Grpc.Core.Tests/ServerTest.cs index b40508accc..fa693162ad 100644 --- a/src/csharp/Grpc.Core.Tests/ServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ServerTest.cs @@ -89,7 +89,7 @@ namespace Grpc.Core.Tests }; server.Start(); Assert.Throws(typeof(InvalidOperationException), () => server.Ports.Add("localhost", 9999, ServerCredentials.Insecure)); - Assert.Throws(typeof(InvalidOperationException), () => server.Services.Add(ServerServiceDefinition.CreateBuilder("serviceName").Build())); + Assert.Throws(typeof(InvalidOperationException), () => server.Services.Add(ServerServiceDefinition.CreateBuilder().Build())); server.ShutdownAsync().Wait(); } diff --git a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs index 5646fed3d9..02b08d2a10 100644 --- a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs @@ -127,6 +127,10 @@ namespace Grpc.Core /// Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. /// As a result, all resources being used by the call should be released eventually. /// </summary> + /// <remarks> + /// Normally, there is no need for you to dispose the call unless you want to utilize the + /// "Cancel" semantics of invoking <c>Dispose</c>. + /// </remarks> public void Dispose() { disposeAction.Invoke(); diff --git a/src/csharp/Grpc.Core/ServerServiceDefinition.cs b/src/csharp/Grpc.Core/ServerServiceDefinition.cs index deb1431ca3..ac08c04bf6 100644 --- a/src/csharp/Grpc.Core/ServerServiceDefinition.cs +++ b/src/csharp/Grpc.Core/ServerServiceDefinition.cs @@ -63,11 +63,10 @@ namespace Grpc.Core /// <summary> /// Creates a new builder object for <c>ServerServiceDefinition</c>. /// </summary> - /// <param name="serviceName">The service name.</param> /// <returns>The builder object.</returns> - public static Builder CreateBuilder(string serviceName) + public static Builder CreateBuilder() { - return new Builder(serviceName); + return new Builder(); } /// <summary> @@ -75,16 +74,13 @@ namespace Grpc.Core /// </summary> public class Builder { - readonly string serviceName; readonly Dictionary<string, IServerCallHandler> callHandlers = new Dictionary<string, IServerCallHandler>(); /// <summary> /// Creates a new instance of builder. /// </summary> - /// <param name="serviceName">The service name.</param> - public Builder(string serviceName) + public Builder() { - this.serviceName = serviceName; } /// <summary> diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index d700a18778..9319e311ee 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -81,97 +81,6 @@ namespace Math { get { return global::Math.MathReflection.Descriptor.Services[0]; } } - /// <summary>Client for Math</summary> - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IMathClient - { - /// <summary> - /// Div divides args.dividend by args.divisor and returns the quotient and - /// remainder. - /// </summary> - global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Div divides args.dividend by args.divisor and returns the quotient and - /// remainder. - /// </summary> - global::Math.DivReply Div(global::Math.DivArgs request, CallOptions options); - /// <summary> - /// Div divides args.dividend by args.divisor and returns the quotient and - /// remainder. - /// </summary> - AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Div divides args.dividend by args.divisor and returns the quotient and - /// remainder. - /// </summary> - AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, CallOptions options); - /// <summary> - /// DivMany accepts an arbitrary number of division args from the client stream - /// and sends back the results in the reply stream. The stream continues until - /// the client closes its end; the server does the same after sending all the - /// replies. The stream ends immediately if either end aborts. - /// </summary> - AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// DivMany accepts an arbitrary number of division args from the client stream - /// and sends back the results in the reply stream. The stream continues until - /// the client closes its end; the server does the same after sending all the - /// replies. The stream ends immediately if either end aborts. - /// </summary> - AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(CallOptions options); - /// <summary> - /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib - /// generates up to limit numbers; otherwise it continues until the call is - /// canceled. Unlike Fib above, Fib has no final FibReply. - /// </summary> - AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib - /// generates up to limit numbers; otherwise it continues until the call is - /// canceled. Unlike Fib above, Fib has no final FibReply. - /// </summary> - AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, CallOptions options); - /// <summary> - /// Sum sums a stream of numbers, returning the final result once the stream - /// is closed. - /// </summary> - AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Sum sums a stream of numbers, returning the final result once the stream - /// is closed. - /// </summary> - AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(CallOptions options); - } - - /// <summary>Interface of server-side implementations of Math</summary> - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IMath - { - /// <summary> - /// Div divides args.dividend by args.divisor and returns the quotient and - /// remainder. - /// </summary> - global::System.Threading.Tasks.Task<global::Math.DivReply> Div(global::Math.DivArgs request, ServerCallContext context); - /// <summary> - /// DivMany accepts an arbitrary number of division args from the client stream - /// and sends back the results in the reply stream. The stream continues until - /// the client closes its end; the server does the same after sending all the - /// replies. The stream ends immediately if either end aborts. - /// </summary> - global::System.Threading.Tasks.Task DivMany(IAsyncStreamReader<global::Math.DivArgs> requestStream, IServerStreamWriter<global::Math.DivReply> responseStream, ServerCallContext context); - /// <summary> - /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib - /// generates up to limit numbers; otherwise it continues until the call is - /// canceled. Unlike Fib above, Fib has no final FibReply. - /// </summary> - global::System.Threading.Tasks.Task Fib(global::Math.FibArgs request, IServerStreamWriter<global::Math.Num> responseStream, ServerCallContext context); - /// <summary> - /// Sum sums a stream of numbers, returning the final result once the stream - /// is closed. - /// </summary> - global::System.Threading.Tasks.Task<global::Math.Num> Sum(IAsyncStreamReader<global::Math.Num> requestStream, ServerCallContext context); - } - /// <summary>Base class for server-side implementations of Math</summary> public abstract class MathBase { @@ -217,9 +126,7 @@ namespace Math { } /// <summary>Client for Math</summary> - #pragma warning disable 0618 - public class MathClient : ClientBase<MathClient>, IMathClient - #pragma warning restore 0618 + public class MathClient : ClientBase<MathClient> { public MathClient(Channel channel) : base(channel) { @@ -335,23 +242,9 @@ namespace Math { } /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IMath serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder(__ServiceName) - .AddMethod(__Method_Div, serviceImpl.Div) - .AddMethod(__Method_DivMany, serviceImpl.DivMany) - .AddMethod(__Method_Fib, serviceImpl.Fib) - .AddMethod(__Method_Sum, serviceImpl.Sum).Build(); - } - - /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 public static ServerServiceDefinition BindService(MathBase serviceImpl) - #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Div, serviceImpl.Div) .AddMethod(__Method_DivMany, serviceImpl.DivMany) .AddMethod(__Method_Fib, serviceImpl.Fib) diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index 51c6a39b1d..d0ade7d02b 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -58,23 +58,6 @@ namespace Grpc.Health.V1 { get { return global::Grpc.Health.V1.HealthReflection.Descriptor.Services[0]; } } - /// <summary>Client for Health</summary> - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IHealthClient - { - global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options); - AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options); - } - - /// <summary>Interface of server-side implementations of Health</summary> - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IHealth - { - global::System.Threading.Tasks.Task<global::Grpc.Health.V1.HealthCheckResponse> Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context); - } - /// <summary>Base class for server-side implementations of Health</summary> public abstract class HealthBase { @@ -86,9 +69,7 @@ namespace Grpc.Health.V1 { } /// <summary>Client for Health</summary> - #pragma warning disable 0618 - public class HealthClient : ClientBase<HealthClient>, IHealthClient - #pragma warning restore 0618 + public class HealthClient : ClientBase<HealthClient> { public HealthClient(Channel channel) : base(channel) { @@ -134,20 +115,9 @@ namespace Grpc.Health.V1 { } /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IHealth serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder(__ServiceName) - .AddMethod(__Method_Check, serviceImpl.Check).Build(); - } - - /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 public static ServerServiceDefinition BindService(HealthBase serviceImpl) - #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Check, serviceImpl.Check).Build(); } diff --git a/src/csharp/Grpc.IntegrationTesting/GenericService.cs b/src/csharp/Grpc.IntegrationTesting/GenericService.cs index c6128264ac..53fa1ee5f6 100644 --- a/src/csharp/Grpc.IntegrationTesting/GenericService.cs +++ b/src/csharp/Grpc.IntegrationTesting/GenericService.cs @@ -64,7 +64,7 @@ namespace Grpc.IntegrationTesting public static ServerServiceDefinition BindHandler(DuplexStreamingServerMethod<byte[], byte[]> handler) { - return ServerServiceDefinition.CreateBuilder(StreamingCallMethod.ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(StreamingCallMethod, handler).Build(); } } diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index 9d31d1c514..22bd27ec0a 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -72,53 +72,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.MetricsReflection.Descriptor.Services[0]; } } - /// <summary>Client for MetricsService</summary> - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IMetricsServiceClient - { - /// <summary> - /// Returns the values of all the gauges that are currently being maintained by - /// the service - /// </summary> - AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Returns the values of all the gauges that are currently being maintained by - /// the service - /// </summary> - AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options); - /// <summary> - /// Returns the value of one gauge - /// </summary> - global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Returns the value of one gauge - /// </summary> - global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options); - /// <summary> - /// Returns the value of one gauge - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Returns the value of one gauge - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options); - } - - /// <summary>Interface of server-side implementations of MetricsService</summary> - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IMetricsService - { - /// <summary> - /// Returns the values of all the gauges that are currently being maintained by - /// the service - /// </summary> - global::System.Threading.Tasks.Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter<global::Grpc.Testing.GaugeResponse> responseStream, ServerCallContext context); - /// <summary> - /// Returns the value of one gauge - /// </summary> - global::System.Threading.Tasks.Task<global::Grpc.Testing.GaugeResponse> GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context); - } - /// <summary>Base class for server-side implementations of MetricsService</summary> public abstract class MetricsServiceBase { @@ -142,9 +95,7 @@ namespace Grpc.Testing { } /// <summary>Client for MetricsService</summary> - #pragma warning disable 0618 - public class MetricsServiceClient : ClientBase<MetricsServiceClient>, IMetricsServiceClient - #pragma warning restore 0618 + public class MetricsServiceClient : ClientBase<MetricsServiceClient> { public MetricsServiceClient(Channel channel) : base(channel) { @@ -218,21 +169,9 @@ namespace Grpc.Testing { } /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IMetricsService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder(__ServiceName) - .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) - .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); - } - - /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl) - #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); } diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs index f7071ebf6b..9c99296115 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs @@ -67,58 +67,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[0]; } } - /// <summary>Client for BenchmarkService</summary> - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IBenchmarkServiceClient - { - /// <summary> - /// One request followed by one response. - /// The server returns the client payload as-is. - /// </summary> - global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// One request followed by one response. - /// The server returns the client payload as-is. - /// </summary> - global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options); - /// <summary> - /// One request followed by one response. - /// The server returns the client payload as-is. - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// One request followed by one response. - /// The server returns the client payload as-is. - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options); - /// <summary> - /// One request followed by one response. - /// The server returns the client payload as-is. - /// </summary> - AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// One request followed by one response. - /// The server returns the client payload as-is. - /// </summary> - AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(CallOptions options); - } - - /// <summary>Interface of server-side implementations of BenchmarkService</summary> - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IBenchmarkService - { - /// <summary> - /// One request followed by one response. - /// The server returns the client payload as-is. - /// </summary> - global::System.Threading.Tasks.Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context); - /// <summary> - /// One request followed by one response. - /// The server returns the client payload as-is. - /// </summary> - global::System.Threading.Tasks.Task StreamingCall(IAsyncStreamReader<global::Grpc.Testing.SimpleRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.SimpleResponse> responseStream, ServerCallContext context); - } - /// <summary>Base class for server-side implementations of BenchmarkService</summary> public abstract class BenchmarkServiceBase { @@ -143,9 +91,7 @@ namespace Grpc.Testing { } /// <summary>Client for BenchmarkService</summary> - #pragma warning disable 0618 - public class BenchmarkServiceClient : ClientBase<BenchmarkServiceClient>, IBenchmarkServiceClient - #pragma warning restore 0618 + public class BenchmarkServiceClient : ClientBase<BenchmarkServiceClient> { public BenchmarkServiceClient(Channel channel) : base(channel) { @@ -223,21 +169,9 @@ namespace Grpc.Testing { } /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IBenchmarkService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder(__ServiceName) - .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) - .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build(); - } - - /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 public static ServerServiceDefinition BindService(BenchmarkServiceBase serviceImpl) - #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build(); } @@ -289,112 +223,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[1]; } } - /// <summary>Client for WorkerService</summary> - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IWorkerServiceClient - { - /// <summary> - /// Start server with specified workload. - /// First request sent specifies the ServerConfig followed by ServerStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test server - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// </summary> - AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Start server with specified workload. - /// First request sent specifies the ServerConfig followed by ServerStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test server - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// </summary> - AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(CallOptions options); - /// <summary> - /// Start client with specified workload. - /// First request sent specifies the ClientConfig followed by ClientStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test client - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// </summary> - AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Start client with specified workload. - /// First request sent specifies the ClientConfig followed by ClientStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test client - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// </summary> - AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(CallOptions options); - /// <summary> - /// Just return the core count - unary call - /// </summary> - global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Just return the core count - unary call - /// </summary> - global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options); - /// <summary> - /// Just return the core count - unary call - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Just return the core count - unary call - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options); - /// <summary> - /// Quit this worker - /// </summary> - global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Quit this worker - /// </summary> - global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options); - /// <summary> - /// Quit this worker - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Quit this worker - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options); - } - - /// <summary>Interface of server-side implementations of WorkerService</summary> - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IWorkerService - { - /// <summary> - /// Start server with specified workload. - /// First request sent specifies the ServerConfig followed by ServerStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test server - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// </summary> - global::System.Threading.Tasks.Task RunServer(IAsyncStreamReader<global::Grpc.Testing.ServerArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ServerStatus> responseStream, ServerCallContext context); - /// <summary> - /// Start client with specified workload. - /// First request sent specifies the ClientConfig followed by ClientStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test client - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// </summary> - global::System.Threading.Tasks.Task RunClient(IAsyncStreamReader<global::Grpc.Testing.ClientArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ClientStatus> responseStream, ServerCallContext context); - /// <summary> - /// Just return the core count - unary call - /// </summary> - global::System.Threading.Tasks.Task<global::Grpc.Testing.CoreResponse> CoreCount(global::Grpc.Testing.CoreRequest request, ServerCallContext context); - /// <summary> - /// Quit this worker - /// </summary> - global::System.Threading.Tasks.Task<global::Grpc.Testing.Void> QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context); - } - /// <summary>Base class for server-side implementations of WorkerService</summary> public abstract class WorkerServiceBase { @@ -443,9 +271,7 @@ namespace Grpc.Testing { } /// <summary>Client for WorkerService</summary> - #pragma warning disable 0618 - public class WorkerServiceClient : ClientBase<WorkerServiceClient>, IWorkerServiceClient - #pragma warning restore 0618 + public class WorkerServiceClient : ClientBase<WorkerServiceClient> { public WorkerServiceClient(Channel channel) : base(channel) { @@ -579,23 +405,9 @@ namespace Grpc.Testing { } /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IWorkerService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder(__ServiceName) - .AddMethod(__Method_RunServer, serviceImpl.RunServer) - .AddMethod(__Method_RunClient, serviceImpl.RunClient) - .AddMethod(__Method_CoreCount, serviceImpl.CoreCount) - .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build(); - } - - /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 public static ServerServiceDefinition BindService(WorkerServiceBase serviceImpl) - #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_RunServer, serviceImpl.RunServer) .AddMethod(__Method_RunClient, serviceImpl.RunClient) .AddMethod(__Method_CoreCount, serviceImpl.CoreCount) diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index cf43a77118..6c252013f8 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -105,127 +105,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.TestReflection.Descriptor.Services[0]; } } - /// <summary>Client for TestService</summary> - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface ITestServiceClient - { - /// <summary> - /// One empty request followed by one empty response. - /// </summary> - global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// One empty request followed by one empty response. - /// </summary> - global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, CallOptions options); - /// <summary> - /// One empty request followed by one empty response. - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// One empty request followed by one empty response. - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, CallOptions options); - /// <summary> - /// One request followed by one response. - /// </summary> - global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// One request followed by one response. - /// </summary> - global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options); - /// <summary> - /// One request followed by one response. - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// One request followed by one response. - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options); - /// <summary> - /// One request followed by a sequence of responses (streamed download). - /// The server returns the payload with client desired type and sizes. - /// </summary> - AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// One request followed by a sequence of responses (streamed download). - /// The server returns the payload with client desired type and sizes. - /// </summary> - AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, CallOptions options); - /// <summary> - /// A sequence of requests followed by one response (streamed upload). - /// The server returns the aggregated size of client payload as the result. - /// </summary> - AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// A sequence of requests followed by one response (streamed upload). - /// The server returns the aggregated size of client payload as the result. - /// </summary> - AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(CallOptions options); - /// <summary> - /// A sequence of requests with each request served by the server immediately. - /// As one request could lead to multiple responses, this interface - /// demonstrates the idea of full duplexing. - /// </summary> - AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// A sequence of requests with each request served by the server immediately. - /// As one request could lead to multiple responses, this interface - /// demonstrates the idea of full duplexing. - /// </summary> - AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(CallOptions options); - /// <summary> - /// A sequence of requests followed by a sequence of responses. - /// The server buffers all the client requests and then serves them in order. A - /// stream of responses are returned to the client when the server starts with - /// first request. - /// </summary> - AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// A sequence of requests followed by a sequence of responses. - /// The server buffers all the client requests and then serves them in order. A - /// stream of responses are returned to the client when the server starts with - /// first request. - /// </summary> - AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(CallOptions options); - } - - /// <summary>Interface of server-side implementations of TestService</summary> - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface ITestService - { - /// <summary> - /// One empty request followed by one empty response. - /// </summary> - global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> EmptyCall(global::Grpc.Testing.Empty request, ServerCallContext context); - /// <summary> - /// One request followed by one response. - /// </summary> - global::System.Threading.Tasks.Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context); - /// <summary> - /// One request followed by a sequence of responses (streamed download). - /// The server returns the payload with client desired type and sizes. - /// </summary> - global::System.Threading.Tasks.Task StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context); - /// <summary> - /// A sequence of requests followed by one response (streamed upload). - /// The server returns the aggregated size of client payload as the result. - /// </summary> - global::System.Threading.Tasks.Task<global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<global::Grpc.Testing.StreamingInputCallRequest> requestStream, ServerCallContext context); - /// <summary> - /// A sequence of requests with each request served by the server immediately. - /// As one request could lead to multiple responses, this interface - /// demonstrates the idea of full duplexing. - /// </summary> - global::System.Threading.Tasks.Task FullDuplexCall(IAsyncStreamReader<global::Grpc.Testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context); - /// <summary> - /// A sequence of requests followed by a sequence of responses. - /// The server buffers all the client requests and then serves them in order. A - /// stream of responses are returned to the client when the server starts with - /// first request. - /// </summary> - global::System.Threading.Tasks.Task HalfDuplexCall(IAsyncStreamReader<global::Grpc.Testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context); - } - /// <summary>Base class for server-side implementations of TestService</summary> public abstract class TestServiceBase { @@ -287,9 +166,7 @@ namespace Grpc.Testing { } /// <summary>Client for TestService</summary> - #pragma warning disable 0618 - public class TestServiceClient : ClientBase<TestServiceClient>, ITestServiceClient - #pragma warning restore 0618 + public class TestServiceClient : ClientBase<TestServiceClient> { public TestServiceClient(Channel channel) : base(channel) { @@ -445,25 +322,9 @@ namespace Grpc.Testing { } /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(ITestService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder(__ServiceName) - .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall) - .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) - .AddMethod(__Method_StreamingOutputCall, serviceImpl.StreamingOutputCall) - .AddMethod(__Method_StreamingInputCall, serviceImpl.StreamingInputCall) - .AddMethod(__Method_FullDuplexCall, serviceImpl.FullDuplexCall) - .AddMethod(__Method_HalfDuplexCall, serviceImpl.HalfDuplexCall).Build(); - } - - /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 public static ServerServiceDefinition BindService(TestServiceBase serviceImpl) - #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall) .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) .AddMethod(__Method_StreamingOutputCall, serviceImpl.StreamingOutputCall) @@ -496,38 +357,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.TestReflection.Descriptor.Services[1]; } } - /// <summary>Client for UnimplementedService</summary> - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IUnimplementedServiceClient - { - /// <summary> - /// A call that no server should implement - /// </summary> - global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// A call that no server should implement - /// </summary> - global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options); - /// <summary> - /// A call that no server should implement - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// A call that no server should implement - /// </summary> - AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options); - } - - /// <summary>Interface of server-side implementations of UnimplementedService</summary> - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IUnimplementedService - { - /// <summary> - /// A call that no server should implement - /// </summary> - global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context); - } - /// <summary>Base class for server-side implementations of UnimplementedService</summary> public abstract class UnimplementedServiceBase { @@ -542,9 +371,7 @@ namespace Grpc.Testing { } /// <summary>Client for UnimplementedService</summary> - #pragma warning disable 0618 - public class UnimplementedServiceClient : ClientBase<UnimplementedServiceClient>, IUnimplementedServiceClient - #pragma warning restore 0618 + public class UnimplementedServiceClient : ClientBase<UnimplementedServiceClient> { public UnimplementedServiceClient(Channel channel) : base(channel) { @@ -602,20 +429,9 @@ namespace Grpc.Testing { } /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IUnimplementedService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder(__ServiceName) - .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); - } - - /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 public static ServerServiceDefinition BindService(UnimplementedServiceBase serviceImpl) - #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } @@ -651,28 +467,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.TestReflection.Descriptor.Services[2]; } } - /// <summary>Client for ReconnectService</summary> - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IReconnectServiceClient - { - global::Grpc.Testing.Empty Start(global::Grpc.Testing.ReconnectParams request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - global::Grpc.Testing.Empty Start(global::Grpc.Testing.ReconnectParams request, CallOptions options); - AsyncUnaryCall<global::Grpc.Testing.Empty> StartAsync(global::Grpc.Testing.ReconnectParams request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - AsyncUnaryCall<global::Grpc.Testing.Empty> StartAsync(global::Grpc.Testing.ReconnectParams request, CallOptions options); - global::Grpc.Testing.ReconnectInfo Stop(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - global::Grpc.Testing.ReconnectInfo Stop(global::Grpc.Testing.Empty request, CallOptions options); - AsyncUnaryCall<global::Grpc.Testing.ReconnectInfo> StopAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - AsyncUnaryCall<global::Grpc.Testing.ReconnectInfo> StopAsync(global::Grpc.Testing.Empty request, CallOptions options); - } - - /// <summary>Interface of server-side implementations of ReconnectService</summary> - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IReconnectService - { - global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> Start(global::Grpc.Testing.ReconnectParams request, ServerCallContext context); - global::System.Threading.Tasks.Task<global::Grpc.Testing.ReconnectInfo> Stop(global::Grpc.Testing.Empty request, ServerCallContext context); - } - /// <summary>Base class for server-side implementations of ReconnectService</summary> public abstract class ReconnectServiceBase { @@ -689,9 +483,7 @@ namespace Grpc.Testing { } /// <summary>Client for ReconnectService</summary> - #pragma warning disable 0618 - public class ReconnectServiceClient : ClientBase<ReconnectServiceClient>, IReconnectServiceClient - #pragma warning restore 0618 + public class ReconnectServiceClient : ClientBase<ReconnectServiceClient> { public ReconnectServiceClient(Channel channel) : base(channel) { @@ -753,21 +545,9 @@ namespace Grpc.Testing { } /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IReconnectService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder(__ServiceName) - .AddMethod(__Method_Start, serviceImpl.Start) - .AddMethod(__Method_Stop, serviceImpl.Stop).Build(); - } - - /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 public static ServerServiceDefinition BindService(ReconnectServiceBase serviceImpl) - #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Start, serviceImpl.Start) .AddMethod(__Method_Stop, serviceImpl.Stop).Build(); } |