~ubuntu-branches/ubuntu/wily/grpc/wily

« back to all changes in this revision

Viewing changes to src/csharp/Grpc.IntegrationTesting/TestGrpc.cs

  • Committer: Package Import Robot
  • Author(s): Andrew Pollock
  • Date: 2015-05-07 13:28:11 UTC
  • Revision ID: package-import@ubuntu.com-20150507132811-ybm4hfq73tnvvd2e
Tags: upstream-0.10.0
ImportĀ upstreamĀ versionĀ 0.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Generated by the protocol buffer compiler.  DO NOT EDIT!
 
2
// source: test.proto
 
3
#region Designer generated code
 
4
 
 
5
using System;
 
6
using System.Threading;
 
7
using System.Threading.Tasks;
 
8
using Grpc.Core;
 
9
 
 
10
namespace grpc.testing {
 
11
  public static class TestService
 
12
  {
 
13
    static readonly string __ServiceName = "grpc.testing.TestService";
 
14
 
 
15
    static readonly Marshaller<global::grpc.testing.Empty> __Marshaller_Empty = Marshallers.Create((arg) => arg.ToByteArray(), global::grpc.testing.Empty.ParseFrom);
 
16
    static readonly Marshaller<global::grpc.testing.SimpleRequest> __Marshaller_SimpleRequest = Marshallers.Create((arg) => arg.ToByteArray(), global::grpc.testing.SimpleRequest.ParseFrom);
 
17
    static readonly Marshaller<global::grpc.testing.SimpleResponse> __Marshaller_SimpleResponse = Marshallers.Create((arg) => arg.ToByteArray(), global::grpc.testing.SimpleResponse.ParseFrom);
 
18
    static readonly Marshaller<global::grpc.testing.StreamingOutputCallRequest> __Marshaller_StreamingOutputCallRequest = Marshallers.Create((arg) => arg.ToByteArray(), global::grpc.testing.StreamingOutputCallRequest.ParseFrom);
 
19
    static readonly Marshaller<global::grpc.testing.StreamingOutputCallResponse> __Marshaller_StreamingOutputCallResponse = Marshallers.Create((arg) => arg.ToByteArray(), global::grpc.testing.StreamingOutputCallResponse.ParseFrom);
 
20
    static readonly Marshaller<global::grpc.testing.StreamingInputCallRequest> __Marshaller_StreamingInputCallRequest = Marshallers.Create((arg) => arg.ToByteArray(), global::grpc.testing.StreamingInputCallRequest.ParseFrom);
 
21
    static readonly Marshaller<global::grpc.testing.StreamingInputCallResponse> __Marshaller_StreamingInputCallResponse = Marshallers.Create((arg) => arg.ToByteArray(), global::grpc.testing.StreamingInputCallResponse.ParseFrom);
 
22
 
 
23
    static readonly Method<global::grpc.testing.Empty, global::grpc.testing.Empty> __Method_EmptyCall = new Method<global::grpc.testing.Empty, global::grpc.testing.Empty>(
 
24
        MethodType.Unary,
 
25
        "EmptyCall",
 
26
        __Marshaller_Empty,
 
27
        __Marshaller_Empty);
 
28
 
 
29
    static readonly Method<global::grpc.testing.SimpleRequest, global::grpc.testing.SimpleResponse> __Method_UnaryCall = new Method<global::grpc.testing.SimpleRequest, global::grpc.testing.SimpleResponse>(
 
30
        MethodType.Unary,
 
31
        "UnaryCall",
 
32
        __Marshaller_SimpleRequest,
 
33
        __Marshaller_SimpleResponse);
 
34
 
 
35
    static readonly Method<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallResponse> __Method_StreamingOutputCall = new Method<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallResponse>(
 
36
        MethodType.ServerStreaming,
 
37
        "StreamingOutputCall",
 
38
        __Marshaller_StreamingOutputCallRequest,
 
39
        __Marshaller_StreamingOutputCallResponse);
 
40
 
 
41
    static readonly Method<global::grpc.testing.StreamingInputCallRequest, global::grpc.testing.StreamingInputCallResponse> __Method_StreamingInputCall = new Method<global::grpc.testing.StreamingInputCallRequest, global::grpc.testing.StreamingInputCallResponse>(
 
42
        MethodType.ClientStreaming,
 
43
        "StreamingInputCall",
 
44
        __Marshaller_StreamingInputCallRequest,
 
45
        __Marshaller_StreamingInputCallResponse);
 
46
 
 
47
    static readonly Method<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallResponse> __Method_FullDuplexCall = new Method<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallResponse>(
 
48
        MethodType.DuplexStreaming,
 
49
        "FullDuplexCall",
 
50
        __Marshaller_StreamingOutputCallRequest,
 
51
        __Marshaller_StreamingOutputCallResponse);
 
52
 
 
53
    static readonly Method<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallResponse> __Method_HalfDuplexCall = new Method<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallResponse>(
 
54
        MethodType.DuplexStreaming,
 
55
        "HalfDuplexCall",
 
56
        __Marshaller_StreamingOutputCallRequest,
 
57
        __Marshaller_StreamingOutputCallResponse);
 
58
 
 
59
    // client-side stub interface
 
60
    public interface ITestServiceClient
 
61
    {
 
62
      global::grpc.testing.Empty EmptyCall(global::grpc.testing.Empty request, CancellationToken token = default(CancellationToken));
 
63
      Task<global::grpc.testing.Empty> EmptyCallAsync(global::grpc.testing.Empty request, CancellationToken token = default(CancellationToken));
 
64
      global::grpc.testing.SimpleResponse UnaryCall(global::grpc.testing.SimpleRequest request, CancellationToken token = default(CancellationToken));
 
65
      Task<global::grpc.testing.SimpleResponse> UnaryCallAsync(global::grpc.testing.SimpleRequest request, CancellationToken token = default(CancellationToken));
 
66
      AsyncServerStreamingCall<global::grpc.testing.StreamingOutputCallResponse> StreamingOutputCall(global::grpc.testing.StreamingOutputCallRequest request, CancellationToken token = default(CancellationToken));
 
67
      AsyncClientStreamingCall<global::grpc.testing.StreamingInputCallRequest, global::grpc.testing.StreamingInputCallResponse> StreamingInputCall(CancellationToken token = default(CancellationToken));
 
68
      AsyncDuplexStreamingCall<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallResponse> FullDuplexCall(CancellationToken token = default(CancellationToken));
 
69
      AsyncDuplexStreamingCall<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallResponse> HalfDuplexCall(CancellationToken token = default(CancellationToken));
 
70
    }
 
71
 
 
72
    // server-side interface
 
73
    public interface ITestService
 
74
    {
 
75
      Task<global::grpc.testing.Empty> EmptyCall(ServerCallContext context, global::grpc.testing.Empty request);
 
76
      Task<global::grpc.testing.SimpleResponse> UnaryCall(ServerCallContext context, global::grpc.testing.SimpleRequest request);
 
77
      Task StreamingOutputCall(ServerCallContext context, global::grpc.testing.StreamingOutputCallRequest request, IServerStreamWriter<global::grpc.testing.StreamingOutputCallResponse> responseStream);
 
78
      Task<global::grpc.testing.StreamingInputCallResponse> StreamingInputCall(ServerCallContext context, IAsyncStreamReader<global::grpc.testing.StreamingInputCallRequest> requestStream);
 
79
      Task FullDuplexCall(ServerCallContext context, IAsyncStreamReader<global::grpc.testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::grpc.testing.StreamingOutputCallResponse> responseStream);
 
80
      Task HalfDuplexCall(ServerCallContext context, IAsyncStreamReader<global::grpc.testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::grpc.testing.StreamingOutputCallResponse> responseStream);
 
81
    }
 
82
 
 
83
    // client stub
 
84
    public class TestServiceClient : AbstractStub<TestServiceClient, StubConfiguration>, ITestServiceClient
 
85
    {
 
86
      public TestServiceClient(Channel channel) : this(channel, StubConfiguration.Default)
 
87
      {
 
88
      }
 
89
      public TestServiceClient(Channel channel, StubConfiguration config) : base(channel, config)
 
90
      {
 
91
      }
 
92
      public global::grpc.testing.Empty EmptyCall(global::grpc.testing.Empty request, CancellationToken token = default(CancellationToken))
 
93
      {
 
94
        var call = CreateCall(__ServiceName, __Method_EmptyCall);
 
95
        return Calls.BlockingUnaryCall(call, request, token);
 
96
      }
 
97
      public Task<global::grpc.testing.Empty> EmptyCallAsync(global::grpc.testing.Empty request, CancellationToken token = default(CancellationToken))
 
98
      {
 
99
        var call = CreateCall(__ServiceName, __Method_EmptyCall);
 
100
        return Calls.AsyncUnaryCall(call, request, token);
 
101
      }
 
102
      public global::grpc.testing.SimpleResponse UnaryCall(global::grpc.testing.SimpleRequest request, CancellationToken token = default(CancellationToken))
 
103
      {
 
104
        var call = CreateCall(__ServiceName, __Method_UnaryCall);
 
105
        return Calls.BlockingUnaryCall(call, request, token);
 
106
      }
 
107
      public Task<global::grpc.testing.SimpleResponse> UnaryCallAsync(global::grpc.testing.SimpleRequest request, CancellationToken token = default(CancellationToken))
 
108
      {
 
109
        var call = CreateCall(__ServiceName, __Method_UnaryCall);
 
110
        return Calls.AsyncUnaryCall(call, request, token);
 
111
      }
 
112
      public AsyncServerStreamingCall<global::grpc.testing.StreamingOutputCallResponse> StreamingOutputCall(global::grpc.testing.StreamingOutputCallRequest request, CancellationToken token = default(CancellationToken))
 
113
      {
 
114
        var call = CreateCall(__ServiceName, __Method_StreamingOutputCall);
 
115
        return Calls.AsyncServerStreamingCall(call, request, token);
 
116
      }
 
117
      public AsyncClientStreamingCall<global::grpc.testing.StreamingInputCallRequest, global::grpc.testing.StreamingInputCallResponse> StreamingInputCall(CancellationToken token = default(CancellationToken))
 
118
      {
 
119
        var call = CreateCall(__ServiceName, __Method_StreamingInputCall);
 
120
        return Calls.AsyncClientStreamingCall(call, token);
 
121
      }
 
122
      public AsyncDuplexStreamingCall<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallResponse> FullDuplexCall(CancellationToken token = default(CancellationToken))
 
123
      {
 
124
        var call = CreateCall(__ServiceName, __Method_FullDuplexCall);
 
125
        return Calls.AsyncDuplexStreamingCall(call, token);
 
126
      }
 
127
      public AsyncDuplexStreamingCall<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallResponse> HalfDuplexCall(CancellationToken token = default(CancellationToken))
 
128
      {
 
129
        var call = CreateCall(__ServiceName, __Method_HalfDuplexCall);
 
130
        return Calls.AsyncDuplexStreamingCall(call, token);
 
131
      }
 
132
    }
 
133
 
 
134
    // creates service definition that can be registered with a server
 
135
    public static ServerServiceDefinition BindService(ITestService serviceImpl)
 
136
    {
 
137
      return ServerServiceDefinition.CreateBuilder(__ServiceName)
 
138
          .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall)
 
139
          .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall)
 
140
          .AddMethod(__Method_StreamingOutputCall, serviceImpl.StreamingOutputCall)
 
141
          .AddMethod(__Method_StreamingInputCall, serviceImpl.StreamingInputCall)
 
142
          .AddMethod(__Method_FullDuplexCall, serviceImpl.FullDuplexCall)
 
143
          .AddMethod(__Method_HalfDuplexCall, serviceImpl.HalfDuplexCall).Build();
 
144
    }
 
145
 
 
146
    // creates a new client stub
 
147
    public static ITestServiceClient NewStub(Channel channel)
 
148
    {
 
149
      return new TestServiceClient(channel);
 
150
    }
 
151
 
 
152
    // creates a new client stub
 
153
    public static ITestServiceClient NewStub(Channel channel, StubConfiguration config)
 
154
    {
 
155
      return new TestServiceClient(channel, config);
 
156
    }
 
157
  }
 
158
}
 
159
#endregion