Merge branch 'master' into epoll_changes

pull/6803/head
Sree Kuchibhotla 9 years ago
commit 05fd4fe043
  1. 8
      Makefile
  2. 1
      PYTHON-MANIFEST.in
  3. 2
      Rakefile
  4. 2
      build.yaml
  5. 4
      doc/PROTOCOL-HTTP2.md
  6. 111
      doc/compression.md
  7. 320
      doc/interop-test-descriptions.md
  8. 4
      examples/objective-c/auth_sample/AuthTestService.podspec
  9. 4
      examples/objective-c/helloworld/HelloWorld.podspec
  10. 4
      examples/objective-c/route_guide/RouteGuide.podspec
  11. 10
      src/core/ext/transport/chttp2/transport/chttp2_transport.c
  12. 14
      src/core/ext/transport/chttp2/transport/frame_rst_stream.c
  13. 5
      src/core/ext/transport/chttp2/transport/internal.h
  14. 11
      src/core/ext/transport/chttp2/transport/parsing.c
  15. 4
      src/core/ext/transport/chttp2/transport/writing.c
  16. 2
      src/core/lib/iomgr/tcp_server_windows.c
  17. 2
      src/csharp/.gitignore
  18. 1
      src/csharp/Grpc.Auth/Grpc.Auth.csproj
  19. 8
      src/csharp/Grpc.Auth/Grpc.Auth.project.json
  20. 18
      src/csharp/Grpc.Auth/Grpc.Auth.xproj
  21. 32
      src/csharp/Grpc.Auth/project.json
  22. 14
      src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs
  23. 26
      src/csharp/Grpc.Core.Tests/CompressionTest.cs
  24. 1
      src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj
  25. 8
      src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.project.json
  26. 18
      src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.xproj
  27. 2
      src/csharp/Grpc.Core.Tests/NUnitMain.cs
  28. 2
      src/csharp/Grpc.Core.Tests/NUnitVersionTest.cs
  29. 3
      src/csharp/Grpc.Core.Tests/SanityTest.cs
  30. 56
      src/csharp/Grpc.Core.Tests/project.json
  31. 3
      src/csharp/Grpc.Core/Grpc.Core.csproj
  32. 12
      src/csharp/Grpc.Core/Grpc.Core.nuspec
  33. 8
      src/csharp/Grpc.Core/Grpc.Core.project.json
  34. 18
      src/csharp/Grpc.Core/Grpc.Core.xproj
  35. 6
      src/csharp/Grpc.Core/GrpcEnvironment.cs
  36. 2
      src/csharp/Grpc.Core/Internal/DefaultSslRootsOverride.cs
  37. 6
      src/csharp/Grpc.Core/Internal/NativeExtension.cs
  38. 2
      src/csharp/Grpc.Core/Internal/PlatformApis.cs
  39. 2
      src/csharp/Grpc.Core/Internal/SafeHandleZeroIsInvalid.cs
  40. 7
      src/csharp/Grpc.Core/Metadata.cs
  41. 42
      src/csharp/Grpc.Core/project.json
  42. 100
      src/csharp/Grpc.Dotnet.sln
  43. 3
      src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj
  44. 8
      src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.project.json
  45. 18
      src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.xproj
  46. 53
      src/csharp/Grpc.Examples.MathClient/project.json
  47. 3
      src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj
  48. 8
      src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.project.json
  49. 18
      src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.xproj
  50. 53
      src/csharp/Grpc.Examples.MathServer/project.json
  51. 1
      src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj
  52. 8
      src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.project.json
  53. 18
      src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.xproj
  54. 8
      src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
  55. 2
      src/csharp/Grpc.Examples.Tests/NUnitMain.cs
  56. 55
      src/csharp/Grpc.Examples.Tests/project.json
  57. 1
      src/csharp/Grpc.Examples/Grpc.Examples.csproj
  58. 8
      src/csharp/Grpc.Examples/Grpc.Examples.project.json
  59. 18
      src/csharp/Grpc.Examples/Grpc.Examples.xproj
  60. 27
      src/csharp/Grpc.Examples/project.json
  61. 1
      src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj
  62. 8
      src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.project.json
  63. 18
      src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.xproj
  64. 2
      src/csharp/Grpc.HealthCheck.Tests/NUnitMain.cs
  65. 55
      src/csharp/Grpc.HealthCheck.Tests/project.json
  66. 1
      src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj
  67. 8
      src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.project.json
  68. 18
      src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.xproj
  69. 35
      src/csharp/Grpc.HealthCheck/project.json
  70. 1
      src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj
  71. 8
      src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.project.json
  72. 18
      src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.xproj
  73. 56
      src/csharp/Grpc.IntegrationTesting.Client/project.json
  74. 1
      src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj
  75. 8
      src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.project.json
  76. 18
      src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.xproj
  77. 56
      src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json
  78. 1
      src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj
  79. 8
      src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.project.json
  80. 18
      src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.xproj
  81. 56
      src/csharp/Grpc.IntegrationTesting.Server/project.json
  82. 5
      src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj
  83. 8
      src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.project.json
  84. 19
      src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.xproj
  85. 56
      src/csharp/Grpc.IntegrationTesting.StressClient/project.json
  86. 12
      src/csharp/Grpc.IntegrationTesting/GeneratedClientTest.cs
  87. 1
      src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs
  88. 1
      src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
  89. 8
      src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.project.json
  90. 18
      src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.xproj
  91. 163
      src/csharp/Grpc.IntegrationTesting/InteropClient.cs
  92. 414
      src/csharp/Grpc.IntegrationTesting/Messages.cs
  93. 21
      src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs
  94. 2
      src/csharp/Grpc.IntegrationTesting/NUnitMain.cs
  95. 2
      src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
  96. 72
      src/csharp/Grpc.IntegrationTesting/project.json
  97. 68
      src/csharp/README.md
  98. 12
      src/csharp/build_packages.bat
  99. 4
      src/csharp/ext/grpc_csharp_ext.c
  100. 27
      src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec
  101. Some files were not shown because too many files have changed in this diff Show More

@ -4384,7 +4384,7 @@ LIBINTEROP_SERVER_MAIN_SRC = \
$(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc \ $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc \
$(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc \ $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc \
$(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc \ $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc \
test/cpp/interop/server_main.cc \ test/cpp/interop/interop_server.cc \
PUBLIC_HEADERS_CXX += \ PUBLIC_HEADERS_CXX += \
@ -4430,7 +4430,7 @@ ifneq ($(NO_DEPS),true)
-include $(LIBINTEROP_SERVER_MAIN_OBJS:.o=.dep) -include $(LIBINTEROP_SERVER_MAIN_OBJS:.o=.dep)
endif endif
endif endif
$(OBJDIR)/$(CONFIG)/test/cpp/interop/server_main.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/interop/interop_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc
LIBQPS_SRC = \ LIBQPS_SRC = \
@ -6397,6 +6397,7 @@ LIBEND2END_TESTS_SRC = \
test/core/end2end/tests/simple_delayed_request.c \ test/core/end2end/tests/simple_delayed_request.c \
test/core/end2end/tests/simple_metadata.c \ test/core/end2end/tests/simple_metadata.c \
test/core/end2end/tests/simple_request.c \ test/core/end2end/tests/simple_request.c \
test/core/end2end/tests/streaming_error_response.c \
test/core/end2end/tests/trailing_metadata.c \ test/core/end2end/tests/trailing_metadata.c \
PUBLIC_HEADERS_C += \ PUBLIC_HEADERS_C += \
@ -6473,6 +6474,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \
test/core/end2end/tests/simple_delayed_request.c \ test/core/end2end/tests/simple_delayed_request.c \
test/core/end2end/tests/simple_metadata.c \ test/core/end2end/tests/simple_metadata.c \
test/core/end2end/tests/simple_request.c \ test/core/end2end/tests/simple_request.c \
test/core/end2end/tests/streaming_error_response.c \
test/core/end2end/tests/trailing_metadata.c \ test/core/end2end/tests/trailing_metadata.c \
PUBLIC_HEADERS_C += \ PUBLIC_HEADERS_C += \
@ -14977,8 +14979,8 @@ test/cpp/end2end/test_service_impl.cc: $(OPENSSL_DEP)
test/cpp/interop/client.cc: $(OPENSSL_DEP) test/cpp/interop/client.cc: $(OPENSSL_DEP)
test/cpp/interop/client_helper.cc: $(OPENSSL_DEP) test/cpp/interop/client_helper.cc: $(OPENSSL_DEP)
test/cpp/interop/interop_client.cc: $(OPENSSL_DEP) test/cpp/interop/interop_client.cc: $(OPENSSL_DEP)
test/cpp/interop/interop_server.cc: $(OPENSSL_DEP)
test/cpp/interop/server_helper.cc: $(OPENSSL_DEP) test/cpp/interop/server_helper.cc: $(OPENSSL_DEP)
test/cpp/interop/server_main.cc: $(OPENSSL_DEP)
test/cpp/qps/client_async.cc: $(OPENSSL_DEP) test/cpp/qps/client_async.cc: $(OPENSSL_DEP)
test/cpp/qps/client_sync.cc: $(OPENSSL_DEP) test/cpp/qps/client_sync.cc: $(OPENSSL_DEP)
test/cpp/qps/driver.cc: $(OPENSSL_DEP) test/cpp/qps/driver.cc: $(OPENSSL_DEP)

@ -1,6 +1,7 @@
recursive-include src/python/grpcio/grpc *.c *.h *.py *.pyx *.pxd *.pxi *.python *.pem recursive-include src/python/grpcio/grpc *.c *.h *.py *.pyx *.pxd *.pxi *.python *.pem
recursive-exclude src/python/grpcio/grpc/_cython *.so *.pyd recursive-exclude src/python/grpcio/grpc/_cython *.so *.pyd
graft src/python/grpcio/tests graft src/python/grpcio/tests
graft src/python/grpcio/grpcio.egg-info
graft src/core graft src/core
graft src/boringssl graft src/boringssl
graft include/grpc graft include/grpc

@ -77,7 +77,7 @@ task 'dlls' do
grpc_config = ENV['GRPC_CONFIG'] || 'opt' grpc_config = ENV['GRPC_CONFIG'] || 'opt'
verbose = ENV['V'] || '0' verbose = ENV['V'] || '0'
env = 'CPPFLAGS="-D_WIN32_WINNT=0x600 -DUNICODE -D_UNICODE" ' env = 'CPPFLAGS="-D_WIN32_WINNT=0x600 -DUNICODE -D_UNICODE -Wno-unused-variable -Wno-unused-result" '
env += 'LDFLAGS=-static ' env += 'LDFLAGS=-static '
env += 'SYSTEM=MINGW32 ' env += 'SYSTEM=MINGW32 '
env += 'EMBED_ZLIB=true ' env += 'EMBED_ZLIB=true '

@ -1119,7 +1119,7 @@ libs:
- src/proto/grpc/testing/empty.proto - src/proto/grpc/testing/empty.proto
- src/proto/grpc/testing/messages.proto - src/proto/grpc/testing/messages.proto
- src/proto/grpc/testing/test.proto - src/proto/grpc/testing/test.proto
- test/cpp/interop/server_main.cc - test/cpp/interop/interop_server.cc
deps: deps:
- interop_server_helper - interop_server_helper
- grpc++_test_util - grpc++_test_util

@ -38,7 +38,7 @@ Request-Headers are delivered as HTTP2 headers in HEADERS + CONTINUATION frames.
* **Nanosecond** → "n" * **Nanosecond** → "n"
* **Content-Type** → "content-type" "application/grpc" [("+proto" / "+json" / {_custom_})] * **Content-Type** → "content-type" "application/grpc" [("+proto" / "+json" / {_custom_})]
* **Content-Coding** → "identity" / "gzip" / "deflate" / "snappy" / {_custom_} * **Content-Coding** → "identity" / "gzip" / "deflate" / "snappy" / {_custom_}
* **Message-Encoding** → "grpc-encoding" Content-Coding * <a name="message-encoding"></a>**Message-Encoding** → "grpc-encoding" Content-Coding
* **Message-Accept-Encoding** → "grpc-accept-encoding" Content-Coding \*("," Content-Coding) * **Message-Accept-Encoding** → "grpc-accept-encoding" Content-Coding \*("," Content-Coding)
* **User-Agent** → "user-agent" {_structured user-agent string_} * **User-Agent** → "user-agent" {_structured user-agent string_}
* **Message-Type** → "grpc-message-type" {_type name for message schema_} * **Message-Type** → "grpc-message-type" {_type name for message schema_}
@ -83,7 +83,7 @@ binary values' lengths being post-Base64.
The repeated sequence of **Length-Prefixed-Message** items is delivered in DATA frames The repeated sequence of **Length-Prefixed-Message** items is delivered in DATA frames
* **Length-Prefixed-Message** → Compressed-Flag Message-Length Message * **Length-Prefixed-Message** → Compressed-Flag Message-Length Message
* **Compressed-Flag** → 0 / 1 # encoded as 1 byte unsigned integer * <a name="compressed-flag"></a>**Compressed-Flag** → 0 / 1 # encoded as 1 byte unsigned integer
* **Message-Length** → {_length of Message_} # encoded as 4 byte unsigned integer * **Message-Length** → {_length of Message_} # encoded as 4 byte unsigned integer
* **Message** → \*{binary octet} * **Message** → \*{binary octet}

@ -0,0 +1,111 @@
## **gRPC Compression**
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt).
### Intent
Compression is used to reduce the amount of bandwidth used between peers. The
compression supported by gRPC acts _at the individual message level_, taking
_message_ [as defined in the wire format
document](PROTOCOL-HTTP2.md).
The implementation supports different compression algorithms. A _default
compression level_, to be used in the absence of message-specific settings, MAY
be specified for during channel creation.
The ability to control compression settings per call and to enable/disable
compression on a per message basis MAY be used to prevent CRIME/BEAST attacks.
It also allows for asymmetric compression communication, whereby a response MAY
be compressed differently, if at all.
### Specification
Compression MAY be configured by the Client Application by calling the
appropriate API method. There are two scenarios where compression MAY be
configured:
+ At channel creation time, which sets the channel default compression and
therefore the compression that SHALL be used in the absence of per-RPC
compression configuration.
+ At response time, via:
+ For unary RPCs, the {Client,Server}Context instance.
+ For streaming RPCs, the {Client,Server}Writer instance. In this case,
configuration is reduced to disabling compression altogether.
### Compression Method Asymmetry Between Peers
A gRPC peer MAY choose to respond using a different compression method to that
of the request, including not performing any compression, regardless of channel
and RPC settings (for example, if compression would result in small or negative
gains).
When a message from a client compressed with an unsupported algorithm is
processed by a server, it WILL result in an INVALID\_ARGUMENT error on the
server. The server will then include in its response a `grpc-accept-encoding`
header specifying the algorithms it does accept. If an INTERNAL error is
returned from the server despite having used one of the algorithms from the
`grpc-accept-encoding` header, the cause MUST NOT be related to compression.
Data sent from a server compressed with an algorithm not supported by the client
WILL result in an INTERNAL error on the client side.
Note that a peer MAY choose to not disclose all the encodings it supports.
However, if it receives a message compressed in an undisclosed but supported
encoding, it MUST include said encoding in the response's `grpc-accept-encoding
h`eader.
For every message a server is requested to compress using an algorithm it knows
the client doesn't support (as indicated by the last `grpc-accept-encoding`
header received from the client), it SHALL send the message uncompressed.
### Specific Disabling of Compression
If the user (through the previously described mechanisms) requests to disable
compression the next message MUST be sent uncompressed. This is instrumental in
preventing BEAST/CRIME attacks. This applies to both the the unary and streaming
cases.
### Compression Levels and Algorithms
The set of supported algorithm is implementation dependent. In order to simplify
the public API and to operate seamlessly across implementations (both in terms
of languages but also different version of the same one), we introduce the idea
of _compression levels_ (such as "low", "medium", "high").
Levels map to concrete algorithms and/or their settings (such as "low" mapping
to "gzip -3" and "high" mapping to "gzip -9") automatically depending on what a
peer is known to support. A server is always aware of what its clients support,
as clients disclose it in their Message-Accept-Encoding header as part of their
initial call. A client doesn't a priori (presently) know which algorithms a
server supports. This issue can be addressed with an initial negotiation of
capabilities or an automatic retry mechanism. These features will be implemented
in the future. Currently however, compression levels are only supported at the
server side, which is aware of the client's capabilities through the incoming
Message-Accept-Encoding header.
### Propagation to child RPCs
The inheritance of the compression configuration by child RPCs is left up to the
implementation. Note that in the absence of changes to the parent channel, its
configuration will be used.
### Test cases
1. When a compression level is not specified for either the channel or the
message, the default channel level _none_ is considered: data MUST NOT be
compressed.
1. When per-RPC compression configuration isn't present for a message, the
channel compression configuration MUST be used.
1. When a compression method (including no compression) is specified for an
outgoing message, the message MUST be compressed accordingly.
1. A message compressed in a way not supported by its endpoint MUST fail with
INVALID\_ARGUMENT status, its associated description indicating the unsupported
condition as well as the supported ones. The returned `grpc-accept-encoding`
header MUST NOT contain the compression method (encoding) used.
1. An ill-constructed message with its [Compressed-Flag
bit](PROTOCOL-HTTP2.md#compressed-flag)
set but lacking a
"[grpc-encoding](PROTOCOL-HTTP2.md#message-encoding)"
entry different from _identity_ in its metadata MUST fail with INTERNAL status,
its associated description indicating the invalid Compressed-Flag condition.

@ -68,14 +68,12 @@ control (even if compression is enabled on the channel).
Server features: Server features:
* [UnaryCall][] * [UnaryCall][]
* [Compressable Payload][]
Procedure: Procedure:
1. Client calls UnaryCall with: 1. Client calls UnaryCall with:
``` ```
{ {
response_type: COMPRESSABLE
response_size: 314159 response_size: 314159
payload:{ payload:{
body: 271828 bytes of zeros body: 271828 bytes of zeros
@ -85,56 +83,106 @@ Procedure:
Client asserts: Client asserts:
* call was successful * call was successful
* response payload type is COMPRESSABLE
* response payload body is 314159 bytes in size * response payload body is 314159 bytes in size
* clients are free to assert that the response payload body contents are zero * clients are free to assert that the response payload body contents are zero
and comparing the entire response message against a golden response and comparing the entire response message against a golden response
### large_compressed_unary ### client_compressed_unary
This test verifies compressed unary calls succeed in sending messages. It
sends one unary request for every payload type, with and without requesting a
compressed response from the server.
In all scenarios, whether compression was actually performed is determined by
the compression bit in the response's message flags.
This test verifies the client can compress unary messages by sending two unary
calls, for compressed and uncompressed payloads. It also sends an initial
probing request to verify whether the server supports the [CompressedRequest][]
feature by checking if the probing call fails with an `INVALID_ARGUMENT` status.
Server features: Server features:
* [UnaryCall][] * [UnaryCall][]
* [Compressable Payload][] * [CompressedRequest][]
* [Uncompressable Payload][]
Procedure: Procedure:
1. Client calls UnaryCall with: 1. Client calls UnaryCall with the feature probe, an *uncompressed* message:
```
{
expect_compressed:{
value: true
}
response_size: 314159
payload:{
body: 271828 bytes of zeros
}
}
```
1. Client calls UnaryCall with the *compressed* message:
```
{
expect_compressed:{
value: true
}
response_size: 314159
payload:{
body: 271828 bytes of zeros
}
}
```
1. Client calls UnaryCall with the *uncompressed* message:
``` ```
{ {
request_compressed_response: bool expect_compressed:{
response_type: COMPRESSABLE value: false
}
response_size: 314159 response_size: 314159
payload:{ payload:{
body: 271828 bytes of zeros body: 271828 bytes of zeros
} }
} }
``` ```
Client asserts: Client asserts:
* call was successful * First call failed with `INVALID_ARGUMENT` status.
* response payload type is COMPRESSABLE * Subsequent calls were successful.
* if `request_compressed_response` is false, the response MUST NOT have the * Response payload body is 314159 bytes in size.
compressed message flag set. * Clients are free to assert that the response payload body contents are
* if `request_compressed_response` is true, the response MUST have the zeros and comparing the entire response message against a golden response.
compressed message flag set.
* response payload body is 314159 bytes in size
* clients are free to assert that the response payload body contents are
zero and comparing the entire response message against a golden response
2. Client calls UnaryCall with: ### server_compressed_unary
This test verifies the server can compress unary messages. It sends two unary
requests, expecting the server's response to be compressed or not according to
the `response_compressed` boolean.
Whether compression was actually performed is determined by the compression bit
in the response's message flags. *Note that some languages may not have access
to the message flags*.
Server features:
* [UnaryCall][]
* [CompressedResponse][]
Procedure:
1. Client calls UnaryCall with `SimpleRequest`:
```
{
response_compressed:{
value: true
}
response_size: 314159
payload:{
body: 271828 bytes of zeros
}
}
```
``` ```
{ {
request_compressed_response: bool response_compressed:{
response_type: UNCOMPRESSABLE value: false
}
response_size: 314159 response_size: 314159
payload:{ payload:{
body: 271828 bytes of zeros body: 271828 bytes of zeros
@ -143,11 +191,13 @@ Procedure:
``` ```
Client asserts: Client asserts:
* call was successful * call was successful
* response payload type is UNCOMPRESSABLE * when `response_compressed` is true, the response MUST have the
* the response MAY have the compressed message flag set. Some compressed message flag set.
implementations will choose to compress the payload even when the output * when `response_compressed` is false, the response MUST NOT have
size if larger than the input. the compressed message flag set.
* response payload body is 314159 bytes in size * response payload body is 314159 bytes in size in both cases.
* clients are free to assert that the response payload body contents are
zero and comparing the entire response message against a golden response
### client_streaming ### client_streaming
@ -156,7 +206,6 @@ This test verifies that client-only streaming succeeds.
Server features: Server features:
* [StreamingInputCall][] * [StreamingInputCall][]
* [Compressable Payload][]
Procedure: Procedure:
1. Client calls StreamingInputCall 1. Client calls StreamingInputCall
@ -206,25 +255,81 @@ Client asserts:
* call was successful * call was successful
* response aggregated_payload_size is 74922 * response aggregated_payload_size is 74922
### client_compressed_streaming
This test verifies the client can compress requests on per-message basis by
performing a two-request streaming call. It also sends an initial probing
request to verify whether the server supports the [CompressedRequest][] feature
by checking if the probing call fails with an `INVALID_ARGUMENT` status.
Procedure:
1. Client calls `StreamingInputCall` and sends the following feature-probing
*uncompressed* `StreamingInputCallRequest` message
```
{
expect_compressed:{
value: true
}
payload:{
body: 27182 bytes of zeros
}
}
```
If the call fails with `INVALID_ARGUMENT`, the test fails. Otherwise, we
continue.
1. Client calls `StreamingInputCall` again, sending the *compressed* message
```
{
expect_compressed:{
value: true
}
payload:{
body: 27182 bytes of zeros
}
}
```
1. And finally, the *uncompressed* message
```
{
expect_compressed:{
value: false
}
payload:{
body: 45904 bytes of zeros
}
}
```
1. Client half-closes
Client asserts:
* First call fails with `INVALID_ARGUMENT`.
* Next calls succeeds.
* Response aggregated payload size is 73086.
### server_streaming ### server_streaming
This test verifies that server-only streaming succeeds. This test verifies that server-only streaming succeeds.
Server features: Server features:
* [StreamingOutputCall][] * [StreamingOutputCall][]
* [Compressable Payload][]
Procedure: Procedure:
1. Client calls StreamingOutputCall with: 1. Client calls StreamingOutputCall with `StreamingOutputCallRequest`:
``` ```
{ {
response_type:COMPRESSABLE
response_parameters:{ response_parameters:{
size: 31415 size: 31415
} }
response_parameters:{ response_parameters:{
size: 59 size: 9
} }
response_parameters:{ response_parameters:{
size: 2653 size: 2653
@ -238,103 +343,64 @@ Procedure:
Client asserts: Client asserts:
* call was successful * call was successful
* exactly four responses * exactly four responses
* response payloads are COMPRESSABLE
* response payload bodies are sized (in order): 31415, 9, 2653, 58979 * response payload bodies are sized (in order): 31415, 9, 2653, 58979
* clients are free to assert that the response payload body contents are zero * clients are free to assert that the response payload body contents are zero
and comparing the entire response messages against golden responses and comparing the entire response messages against golden responses
### server_compressed_streaming ### server_compressed_streaming
This test verifies that server-only compressed streaming succeeds. This test verifies that the server can compress streaming messages and disable
compression on individual messages.
Server features: Server features:
* [StreamingOutputCall][] * [StreamingOutputCall][]
* [Compressable Payload][] * [CompressedResponse][]
* [Uncompressable Payload][]
Procedure: Procedure:
1. Client calls StreamingOutputCall with: 1. Client calls StreamingOutputCall with `StreamingOutputCallRequest`:
``` ```
{ {
request_compressed_response: bool
response_type:COMPRESSABLE
response_parameters:{ response_parameters:{
compressed: {
value: true
}
size: 31415 size: 31415
} }
response_parameters:{ response_parameters:{
size: 59 compressed: {
} value: false
response_parameters:{ }
size: 2653 size: 92653
}
response_parameters:{
size: 58979
} }
} }
``` ```
Client asserts: Client asserts:
* call was successful * call was successful
* exactly four responses * exactly two responses
* response payloads are COMPRESSABLE * when `response_compressed` is false, the response's messages MUST
* if `request_compressed_response` is false, the response's messages MUST
NOT have the compressed message flag set. NOT have the compressed message flag set.
* if `request_compressed_response` is true, the response's messages MUST * when `response_compressed` is true, the response's messages MUST
have the compressed message flag set. have the compressed message flag set.
* response payload bodies are sized (in order): 31415, 59, 2653, 58979 * response payload bodies are sized (in order): 31415, 92653
* clients are free to assert that the response payload body contents are * clients are free to assert that the response payload body contents are
zero and comparing the entire response messages against golden responses zero and comparing the entire response messages against golden responses
2. Client calls StreamingOutputCall with:
```
{
request_compressed_response: bool
response_type:UNCOMPRESSABLE
response_parameters:{
size: 31415
}
response_parameters:{
size: 59
}
response_parameters:{
size: 2653
}
response_parameters:{
size: 58979
}
}
```
Client asserts:
* call was successful
* exactly four responses
* response payloads are UNCOMPRESSABLE
* the response MAY have the compressed message flag set. Some
implementations will choose to compress the payload even when the output
size if larger than the input.
* response payload bodies are sized (in order): 31415, 59, 2653, 58979
* clients are free to assert that the body of the responses are identical to
the golden uncompressable data at `test/cpp/interop/rnd.dat`.
### ping_pong ### ping_pong
This test verifies that full duplex bidi is supported. This test verifies that full duplex bidi is supported.
Server features: Server features:
* [FullDuplexCall][] * [FullDuplexCall][]
* [Compressable Payload][]
Procedure: Procedure:
1. Client calls FullDuplexCall with: 1. Client calls FullDuplexCall with:
``` ```
{ {
response_type: COMPRESSABLE
response_parameters:{ response_parameters:{
size: 31415 size: 31415
} }
@ -348,9 +414,8 @@ Procedure:
``` ```
{ {
response_type: COMPRESSABLE
response_parameters:{ response_parameters:{
size: 59 size: 9
} }
payload:{ payload:{
body: 8 bytes of zeros body: 8 bytes of zeros
@ -362,7 +427,6 @@ Procedure:
``` ```
{ {
response_type: COMPRESSABLE
response_parameters:{ response_parameters:{
size: 2653 size: 2653
} }
@ -376,7 +440,6 @@ Procedure:
``` ```
{ {
response_type: COMPRESSABLE
response_parameters:{ response_parameters:{
size: 58979 size: 58979
} }
@ -391,7 +454,6 @@ Procedure:
Client asserts: Client asserts:
* call was successful * call was successful
* exactly four responses * exactly four responses
* response payloads are COMPRESSABLE
* response payload bodies are sized (in order): 31415, 9, 2653, 58979 * response payload bodies are sized (in order): 31415, 9, 2653, 58979
* clients are free to assert that the response payload body contents are zero * clients are free to assert that the response payload body contents are zero
and comparing the entire response messages against golden responses and comparing the entire response messages against golden responses
@ -421,12 +483,12 @@ with desired oauth scope.
The test uses `--default_service_account` with GCE service account email and The test uses `--default_service_account` with GCE service account email and
`--oauth_scope` with the OAuth scope to use. For testing against `--oauth_scope` with the OAuth scope to use. For testing against
grpc-test.sandbox.googleapis.com, "https://www.googleapis.com/auth/xapi.zoo" should grpc-test.sandbox.googleapis.com, "https://www.googleapis.com/auth/xapi.zoo"
should
be passed in as `--oauth_scope`. be passed in as `--oauth_scope`.
Server features: Server features:
* [UnaryCall][] * [UnaryCall][]
* [Compressable Payload][]
* [Echo Authenticated Username][] * [Echo Authenticated Username][]
* [Echo OAuth Scope][] * [Echo OAuth Scope][]
@ -436,7 +498,6 @@ Procedure:
``` ```
{ {
response_type: COMPRESSABLE
response_size: 314159 response_size: 314159
payload:{ payload:{
body: 271828 bytes of zeros body: 271828 bytes of zeros
@ -448,7 +509,8 @@ Procedure:
Client asserts: Client asserts:
* call was successful * call was successful
* received SimpleResponse.username equals the value of `--default_service_account` flag * received SimpleResponse.username equals the value of
`--default_service_account` flag
* received SimpleResponse.oauth_scope is in `--oauth_scope` * received SimpleResponse.oauth_scope is in `--oauth_scope`
* response payload body is 314159 bytes in size * response payload body is 314159 bytes in size
* clients are free to assert that the response payload body contents are zero * clients are free to assert that the response payload body contents are zero
@ -469,7 +531,6 @@ variable GOOGLE_APPLICATION_CREDENTIALS.
Server features: Server features:
* [UnaryCall][] * [UnaryCall][]
* [Compressable Payload][]
* [Echo Authenticated Username][] * [Echo Authenticated Username][]
* [Echo OAuth Scope][] * [Echo OAuth Scope][]
@ -479,7 +540,6 @@ Procedure:
``` ```
{ {
response_type: COMPRESSABLE
response_size: 314159 response_size: 314159
payload:{ payload:{
body: 271828 bytes of zeros body: 271828 bytes of zeros
@ -492,7 +552,8 @@ Client asserts:
* call was successful * call was successful
* received SimpleResponse.username is not empty and is in the json key file used * received SimpleResponse.username is not empty and is in the json key file used
by the auth library. The client can optionally check the username matches the by the auth library. The client can optionally check the username matches the
email address in the key file or equals the value of `--default_service_account` flag. email address in the key file or equals the value of `--default_service_account`
flag.
* response payload body is 314159 bytes in size * response payload body is 314159 bytes in size
* clients are free to assert that the response payload body contents are zero * clients are free to assert that the response payload body contents are zero
and comparing the entire response message against a golden response and comparing the entire response message against a golden response
@ -518,18 +579,18 @@ variable GOOGLE_APPLICATION_CREDENTIALS, *OR* if GCE credentials is used to
fetch the token, `--default_service_account` can be used to pass in GCE service fetch the token, `--default_service_account` can be used to pass in GCE service
account email. account email.
- uses the flag `--oauth_scope` for the oauth scope. For testing against - uses the flag `--oauth_scope` for the oauth scope. For testing against
grpc-test.sandbox.googleapis.com, "https://www.googleapis.com/auth/xapi.zoo" should grpc-test.sandbox.googleapis.com, "https://www.googleapis.com/auth/xapi.zoo"
be passed as the `--oauth_scope`. should be passed as the `--oauth_scope`.
Server features: Server features:
* [UnaryCall][] * [UnaryCall][]
* [Compressable Payload][]
* [Echo Authenticated Username][] * [Echo Authenticated Username][]
* [Echo OAuth Scope][] * [Echo OAuth Scope][]
Procedure: Procedure:
1. Client uses the auth library to obtain an authorization token 1. Client uses the auth library to obtain an authorization token
2. Client configures the channel to use AccessTokenCredentials with the access token obtained in step 1 2. Client configures the channel to use AccessTokenCredentials with the access
token obtained in step 1
3. Client calls UnaryCall with the following message 3. Client calls UnaryCall with the following message
``` ```
@ -550,22 +611,21 @@ json key file or GCE default service account email.
Similar to the other auth tests, this test is only for cloud-to-prod path. Similar to the other auth tests, this test is only for cloud-to-prod path.
This test verifies unary calls succeed in sending messages using a JWT or a service account This test verifies unary calls succeed in sending messages using a JWT or a
credentials set on the RPC. service account credentials set on the RPC.
The test The test
- uses the flag `--service_account_key_file` with the path to a json key file - uses the flag `--service_account_key_file` with the path to a json key file
downloaded from https://console.developers.google.com. Alternately, if using a downloaded from https://console.developers.google.com. Alternately, if using a
usable auth implementation, it may specify the file location in the environment usable auth implementation, it may specify the file location in the environment
variable GOOGLE_APPLICATION_CREDENTIALS variable GOOGLE_APPLICATION_CREDENTIALS
- optionally uses the flag `--oauth_scope` for the oauth scope if implementator - optionally uses the flag `--oauth_scope` for the oauth scope if implementator
wishes to use service account credential instead of JWT credential. For testing wishes to use service account credential instead of JWT credential. For testing
against grpc-test.sandbox.googleapis.com, oauth scope against grpc-test.sandbox.googleapis.com, oauth scope
"https://www.googleapis.com/auth/xapi.zoo" should be used. "https://www.googleapis.com/auth/xapi.zoo" should be used.
Server features: Server features:
* [UnaryCall][] * [UnaryCall][]
* [Compressable Payload][]
* [Echo Authenticated Username][] * [Echo Authenticated Username][]
* [Echo OAuth Scope][] * [Echo OAuth Scope][]
@ -596,7 +656,6 @@ by the server.
Server features: Server features:
* [UnaryCall][] * [UnaryCall][]
* [FullDuplexCall][] * [FullDuplexCall][]
* [Compressable Payload][]
* [Echo Metadata][] * [Echo Metadata][]
Procedure: Procedure:
@ -611,7 +670,6 @@ Procedure:
``` ```
{ {
response_type: COMPRESSABLE
response_size: 314159 response_size: 314159
payload:{ payload:{
body: 271828 bytes of zeros body: 271828 bytes of zeros
@ -630,7 +688,6 @@ Procedure:
``` ```
{ {
response_type: COMPRESSABLE
response_size: 314159 response_size: 314159
payload:{ payload:{
body: 271828 bytes of zeros body: 271828 bytes of zeros
@ -736,14 +793,12 @@ from the server.
Server features: Server features:
* [FullDuplexCall][] * [FullDuplexCall][]
* [Compressable Payload][]
Procedure: Procedure:
1. Client starts FullDuplexCall with 1. Client starts FullDuplexCall with
``` ```
{ {
response_type: COMPRESSABLE
response_parameters:{ response_parameters:{
size: 31415 size: 31415
} }
@ -887,6 +942,21 @@ payload body of size `SimpleRequest.response_size` bytes and type as appropriate
for the `SimpleRequest.response_type`. If the server does not support the for the `SimpleRequest.response_type`. If the server does not support the
`response_type`, then it should fail the RPC with `INVALID_ARGUMENT`. `response_type`, then it should fail the RPC with `INVALID_ARGUMENT`.
### CompressedResponse
[CompressedResponse]: #compressedresponse
When the client sets `response_compressed` to true, the server's response is
sent back compressed. Note that `response_compressed` is present on both
`SimpleRequest` (unary) and `StreamingOutputCallRequest` (streaming).
### CompressedRequest
[CompressedRequest]: #compressedrequest
When the client sets `expect_compressed` to true, the server expects the client
request to be compressed. If it's not, it fails the RPC with `INVALID_ARGUMENT`.
Note that `response_compressed` is present on both `SimpleRequest` (unary) and
`StreamingOutputCallRequest` (streaming).
### StreamingInputCall ### StreamingInputCall
[StreamingInputCall]: #streaminginputcall [StreamingInputCall]: #streaminginputcall
@ -913,20 +983,6 @@ payload body of size ResponseParameters.size bytes, as specified by its
respective ResponseParameters. After receiving half close and sending all respective ResponseParameters. After receiving half close and sending all
responses, it closes with OK. responses, it closes with OK.
### Compressable Payload
[Compressable Payload]: #compressable-payload
When the client requests COMPRESSABLE payload, the response includes a payload
of the size requested containing all zeros and the payload type is
COMPRESSABLE.
### Uncompressable Payload
[Uncompressable Payload]: #uncompressable-payload
When the client requests UNCOMPRESSABLE payload, the response includes a payload
of the size requested containing uncompressable data and the payload type is
UNCOMPRESSABLE.
### Echo Status ### Echo Status
[Echo Status]: #echo-status [Echo Status]: #echo-status
When the client sends a response_status in the request payload, the server closes When the client sends a response_status in the request payload, the server closes

@ -2,6 +2,10 @@ Pod::Spec.new do |s|
s.name = "AuthTestService" s.name = "AuthTestService"
s.version = "0.0.1" s.version = "0.0.1"
s.license = "New BSD" s.license = "New BSD"
s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' }
s.homepage = "http://www.grpc.io/"
s.summary = "AuthTestService example"
s.source = { :git => 'https://github.com/grpc/grpc.git' }
s.ios.deployment_target = "7.1" s.ios.deployment_target = "7.1"
s.osx.deployment_target = "10.9" s.osx.deployment_target = "10.9"

@ -2,6 +2,10 @@ Pod::Spec.new do |s|
s.name = "HelloWorld" s.name = "HelloWorld"
s.version = "0.0.1" s.version = "0.0.1"
s.license = "New BSD" s.license = "New BSD"
s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' }
s.homepage = "http://www.grpc.io/"
s.summary = "HelloWorld example"
s.source = { :git => 'https://github.com/grpc/grpc.git' }
s.ios.deployment_target = "7.1" s.ios.deployment_target = "7.1"
s.osx.deployment_target = "10.9" s.osx.deployment_target = "10.9"

@ -2,6 +2,10 @@ Pod::Spec.new do |s|
s.name = "RouteGuide" s.name = "RouteGuide"
s.version = "0.0.1" s.version = "0.0.1"
s.license = "New BSD" s.license = "New BSD"
s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' }
s.homepage = "http://www.grpc.io/"
s.summary = "RouteGuide example"
s.source = { :git => 'https://github.com/grpc/grpc.git' }
s.ios.deployment_target = "7.1" s.ios.deployment_target = "7.1"
s.osx.deployment_target = "10.9" s.osx.deployment_target = "10.9"

@ -264,6 +264,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
t->parsing.is_client = is_client; t->parsing.is_client = is_client;
t->parsing.deframe_state = t->parsing.deframe_state =
is_client ? GRPC_DTS_FH_0 : GRPC_DTS_CLIENT_PREFIX_0; is_client ? GRPC_DTS_FH_0 : GRPC_DTS_CLIENT_PREFIX_0;
t->parsing.is_first_frame = true;
t->writing.is_client = is_client; t->writing.is_client = is_client;
t->optional_drop_message = gpr_empty_slice(); t->optional_drop_message = gpr_empty_slice();
grpc_connectivity_state_init( grpc_connectivity_state_init(
@ -643,8 +644,7 @@ static void finish_global_actions(grpc_exec_ctx *exec_ctx,
for (;;) { for (;;) {
if (!t->executor.writing_active && !t->closed && if (!t->executor.writing_active && !t->closed &&
grpc_chttp2_unlocking_check_writes(exec_ctx, &t->global, &t->writing, grpc_chttp2_unlocking_check_writes(exec_ctx, &t->global, &t->writing)) {
t->executor.parsing_active)) {
t->executor.writing_active = 1; t->executor.writing_active = 1;
REF_TRANSPORT(t, "writing"); REF_TRANSPORT(t, "writing");
prevent_endpoint_shutdown(t); prevent_endpoint_shutdown(t);
@ -1093,6 +1093,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx,
stream_global->recv_trailing_metadata_finished = stream_global->recv_trailing_metadata_finished =
add_closure_barrier(on_complete); add_closure_barrier(on_complete);
stream_global->recv_trailing_metadata = op->recv_trailing_metadata; stream_global->recv_trailing_metadata = op->recv_trailing_metadata;
stream_global->final_metadata_requested = true;
grpc_chttp2_list_add_check_read_ops(transport_global, stream_global); grpc_chttp2_list_add_check_read_ops(transport_global, stream_global);
} }
@ -1246,7 +1247,8 @@ static void check_read_ops(grpc_exec_ctx *exec_ctx,
stream_global->recv_initial_metadata_ready = NULL; stream_global->recv_initial_metadata_ready = NULL;
} }
if (stream_global->recv_message_ready != NULL) { if (stream_global->recv_message_ready != NULL) {
while (stream_global->seen_error && while (stream_global->final_metadata_requested &&
stream_global->seen_error &&
(bs = grpc_chttp2_incoming_frame_queue_pop( (bs = grpc_chttp2_incoming_frame_queue_pop(
&stream_global->incoming_frames)) != NULL) { &stream_global->incoming_frames)) != NULL) {
incoming_byte_stream_destroy_locked(exec_ctx, NULL, NULL, bs); incoming_byte_stream_destroy_locked(exec_ctx, NULL, NULL, bs);
@ -1805,7 +1807,7 @@ static void post_reading_action_locked(grpc_exec_ctx *exec_ctx,
UNREF_TRANSPORT(exec_ctx, t, "reading_action"); UNREF_TRANSPORT(exec_ctx, t, "reading_action");
} }
GRPC_ERROR_UNREF(error); GRPC_LOG_IF_ERROR("close_transport", error);
} }
/******************************************************************************* /*******************************************************************************

@ -102,12 +102,14 @@ grpc_error *grpc_chttp2_rst_stream_parser_parse(
if (p->byte == 4) { if (p->byte == 4) {
GPR_ASSERT(is_last); GPR_ASSERT(is_last);
stream_parsing->received_close = 1; stream_parsing->received_close = 1;
stream_parsing->forced_close_error = grpc_error_set_int( if (stream_parsing->forced_close_error == GRPC_ERROR_NONE) {
GRPC_ERROR_CREATE("RST_STREAM"), GRPC_ERROR_INT_HTTP2_ERROR, stream_parsing->forced_close_error = grpc_error_set_int(
(intptr_t)((((uint32_t)p->reason_bytes[0]) << 24) | GRPC_ERROR_CREATE("RST_STREAM"), GRPC_ERROR_INT_HTTP2_ERROR,
(((uint32_t)p->reason_bytes[1]) << 16) | (intptr_t)((((uint32_t)p->reason_bytes[0]) << 24) |
(((uint32_t)p->reason_bytes[2]) << 8) | (((uint32_t)p->reason_bytes[1]) << 16) |
(((uint32_t)p->reason_bytes[3])))); (((uint32_t)p->reason_bytes[2]) << 8) |
(((uint32_t)p->reason_bytes[3]))));
}
} }
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;

@ -265,6 +265,7 @@ struct grpc_chttp2_transport_parsing {
uint8_t incoming_frame_type; uint8_t incoming_frame_type;
uint8_t incoming_frame_flags; uint8_t incoming_frame_flags;
uint8_t header_eof; uint8_t header_eof;
bool is_first_frame;
uint32_t expect_continuation_stream_id; uint32_t expect_continuation_stream_id;
uint32_t incoming_frame_size; uint32_t incoming_frame_size;
uint32_t incoming_stream_id; uint32_t incoming_stream_id;
@ -440,6 +441,7 @@ typedef struct {
bool published_initial_metadata; bool published_initial_metadata;
bool published_trailing_metadata; bool published_trailing_metadata;
bool final_metadata_requested;
grpc_chttp2_incoming_metadata_buffer received_initial_metadata; grpc_chttp2_incoming_metadata_buffer received_initial_metadata;
grpc_chttp2_incoming_metadata_buffer received_trailing_metadata; grpc_chttp2_incoming_metadata_buffer received_trailing_metadata;
@ -524,8 +526,7 @@ struct grpc_chttp2_stream {
are required, and schedule them if so */ are required, and schedule them if so */
int grpc_chttp2_unlocking_check_writes(grpc_exec_ctx *exec_ctx, int grpc_chttp2_unlocking_check_writes(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport_global *global, grpc_chttp2_transport_global *global,
grpc_chttp2_transport_writing *writing, grpc_chttp2_transport_writing *writing);
int is_parsing);
void grpc_chttp2_perform_writes( void grpc_chttp2_perform_writes(
grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_writing *transport_writing, grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_writing *transport_writing,
grpc_endpoint *endpoint); grpc_endpoint *endpoint);

@ -468,6 +468,17 @@ grpc_error *grpc_chttp2_perform_read(
static grpc_error *init_frame_parser( static grpc_error *init_frame_parser(
grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_parsing *transport_parsing) { grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_parsing *transport_parsing) {
if (transport_parsing->is_first_frame &&
transport_parsing->incoming_frame_type != GRPC_CHTTP2_FRAME_SETTINGS) {
char *msg;
gpr_asprintf(
&msg, "Expected SETTINGS frame as the first frame, got frame type %d",
transport_parsing->incoming_frame_type);
grpc_error *err = GRPC_ERROR_CREATE(msg);
gpr_free(msg);
return err;
}
transport_parsing->is_first_frame = false;
if (transport_parsing->expect_continuation_stream_id != 0) { if (transport_parsing->expect_continuation_stream_id != 0) {
if (transport_parsing->incoming_frame_type != if (transport_parsing->incoming_frame_type !=
GRPC_CHTTP2_FRAME_CONTINUATION) { GRPC_CHTTP2_FRAME_CONTINUATION) {

@ -45,7 +45,7 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx,
int grpc_chttp2_unlocking_check_writes( int grpc_chttp2_unlocking_check_writes(
grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global, grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global,
grpc_chttp2_transport_writing *transport_writing, int is_parsing) { grpc_chttp2_transport_writing *transport_writing) {
grpc_chttp2_stream_global *stream_global; grpc_chttp2_stream_global *stream_global;
grpc_chttp2_stream_writing *stream_writing; grpc_chttp2_stream_writing *stream_writing;
@ -61,7 +61,7 @@ int grpc_chttp2_unlocking_check_writes(
[GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]); [GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]);
if (transport_global->dirtied_local_settings && if (transport_global->dirtied_local_settings &&
!transport_global->sent_local_settings && !is_parsing) { !transport_global->sent_local_settings) {
gpr_slice_buffer_add( gpr_slice_buffer_add(
&transport_writing->outbuf, &transport_writing->outbuf,
grpc_chttp2_settings_create( grpc_chttp2_settings_create(

@ -396,7 +396,7 @@ static grpc_error *add_socket_to_server(grpc_tcp_server *s, SOCKET sock,
size_t addr_len, unsigned port_index, size_t addr_len, unsigned port_index,
grpc_tcp_listener **listener) { grpc_tcp_listener **listener) {
grpc_tcp_listener *sp = NULL; grpc_tcp_listener *sp = NULL;
int port; int port = -1;
int status; int status;
GUID guid = WSAID_ACCEPTEX; GUID guid = WSAID_ACCEPTEX;
DWORD ioctl_num_bytes; DWORD ioctl_num_bytes;

@ -1,5 +1,7 @@
*.xproj.user
*.userprefs *.userprefs
*.csproj.user *.csproj.user
*.lock.json
StyleCop.Cache StyleCop.Cache
test-results test-results
packages packages

@ -81,6 +81,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Grpc.Auth.nuspec" /> <None Include="Grpc.Auth.nuspec" />
<None Include="Grpc.Auth.project.json" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>c82631ed-06d1-4458-87bc-8257d12307a8</ProjectGuid>
<RootNamespace>Grpc.Auth</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\Grpc.Core\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -0,0 +1,32 @@
{
"version": "0.15.0-dev",
"title": "gRPC C# Auth",
"authors": [ "Google Inc." ],
"copyright": "Copyright 2015, Google Inc.",
"packOptions": {
"summary": "Auth library for C# implementation of gRPC - an RPC library and framework",
"description": "Auth library for C# implementation of gRPC - an RPC library and framework. See project site for more info.",
"owners": [ "grpc-packages" ],
"licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE",
"projectUrl": "https://github.com/grpc/grpc",
"requireLicenseAcceptance": false,
"tags": [ "gRPC RPC Protocol HTTP/2 Auth OAuth2" ],
},
"dependencies": {
"Grpc.Core": "0.15.0-dev",
"Google.Apis.Auth": "1.11.1"
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"net45"
],
"dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027",
"NETStandard.Library": "1.5.0-rc2-24027",
"System.Threading.Tasks": "4.0.11-rc2-24027"
}
}
}
}

@ -32,13 +32,7 @@
#endregion #endregion
using System; using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Grpc.Core;
using Grpc.Core.Internal;
using Grpc.Core.Utils; using Grpc.Core.Utils;
using NUnit.Framework; using NUnit.Framework;
@ -46,6 +40,13 @@ namespace Grpc.Core.Tests
{ {
public class AppDomainUnloadTest public class AppDomainUnloadTest
{ {
#if NETSTANDARD1_5
[Test]
[Ignore("Not supported for CoreCLR")]
public void AppDomainUnloadHookCanCleanupAbandonedCall()
{
}
#else
[Test] [Test]
public void AppDomainUnloadHookCanCleanupAbandonedCall() public void AppDomainUnloadHookCanCleanupAbandonedCall()
{ {
@ -86,5 +87,6 @@ namespace Grpc.Core.Tests
readyToShutdown.Task.Wait(); // make sure handler is running readyToShutdown.Task.Wait(); // make sure handler is running
} }
} }
#endif
} }
} }

@ -34,6 +34,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Grpc.Core; using Grpc.Core;
@ -118,5 +119,30 @@ namespace Grpc.Core.Tests
await call.ResponseStream.ToListAsync(); await call.ResponseStream.ToListAsync();
} }
[Test]
public void CanReadCompressedMessages()
{
var compressionMetadata = new Metadata
{
{ new Metadata.Entry(Metadata.CompressionRequestAlgorithmMetadataKey, "gzip") }
};
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (req, context) =>
{
await context.WriteResponseHeadersAsync(compressionMetadata);
return req;
});
var stringBuilder = new StringBuilder();
for (int i = 0; i < 200000; i++)
{
stringBuilder.Append('a');
}
var request = stringBuilder.ToString();
var response = Calls.BlockingUnaryCall(helper.CreateUnaryCall(new CallOptions(compressionMetadata)), request);
Assert.AreEqual(request, response);
}
} }
} }

@ -99,6 +99,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Grpc.Core.Tests.project.json" />
<None Include="packages.config"> <None Include="packages.config">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>759e23b2-fc04-4695-902d-b073cded3599</ProjectGuid>
<RootNamespace>Grpc.Core.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -49,7 +49,7 @@ namespace Grpc.Core.Tests
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if DOTNET5_4 #if NETSTANDARD1_5
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);

@ -56,7 +56,7 @@ namespace Grpc.Core.Tests
Console.Error.WriteLine("You are using and old version of NUnit that doesn't support async tests and skips them instead. " + Console.Error.WriteLine("You are using and old version of NUnit that doesn't support async tests and skips them instead. " +
"This test has failed to indicate that."); "This test has failed to indicate that.");
Console.Error.Flush(); Console.Error.Flush();
Environment.Exit(1); throw new Exception("NUnitVersionTest has failed.");
} }
} }

@ -45,6 +45,8 @@ namespace Grpc.Core.Tests
{ {
public class SanityTest public class SanityTest
{ {
// TODO: make sanity test work for CoreCLR as well
#if !NETSTANDARD1_5
/// <summary> /// <summary>
/// Because we depend on a native library, sometimes when things go wrong, the /// Because we depend on a native library, sometimes when things go wrong, the
/// entire NUnit test process crashes. To be able to track down problems better, /// entire NUnit test process crashes. To be able to track down problems better,
@ -121,5 +123,6 @@ namespace Grpc.Core.Tests
} }
return result; return result;
} }
#endif
} }
} }

@ -0,0 +1,56 @@
{
"buildOptions": {
"emitEntryPoint": true
},
"configurations": {
"Debug": {
"buildOptions": {
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/dbg/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib"
}
}
}
},
"Release": {
"buildOptions": {
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/opt/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib"
}
}
}
}
},
"runtimes": {
"win7-x64": { },
"debian.8-x64": { },
"osx.10.11-x64": { }
},
"dependencies": {
"Grpc.Core": {
"target": "project"
},
"Newtonsoft.Json": "8.0.3",
"NUnit": "3.2.0",
"NUnitLite": "3.2.0-*"
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"portable-net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
},
}

@ -141,6 +141,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Grpc.Core.nuspec" /> <None Include="Grpc.Core.nuspec" />
<None Include="Grpc.Core.project.json" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="NativeDeps.targets" /> <Import Project="NativeDeps.targets" />
@ -148,7 +149,7 @@
<ItemGroup /> <ItemGroup />
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="..\..\..\etc\roots.pem"> <EmbeddedResource Include="..\..\..\etc\roots.pem">
<Link>Resources\roots.pem</Link> <Link>roots.pem</Link>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -24,11 +24,11 @@
<file src="bin/ReleaseSigned/Grpc.Core.xml" target="lib/net45" /> <file src="bin/ReleaseSigned/Grpc.Core.xml" target="lib/net45" />
<file src="**\*.cs" target="src" /> <file src="**\*.cs" target="src" />
<file src="Grpc.Core.targets" target="\build\net45\Grpc.Core.targets" /> <file src="Grpc.Core.targets" target="\build\net45\Grpc.Core.targets" />
<file src="windows_x86/grpc_csharp_ext.dll" target="/build/native/bin/windows_x86/grpc_csharp_ext.dll" /> <file src="../nativelibs/windows_x86/grpc_csharp_ext.dll" target="/build/native/bin/windows_x86/grpc_csharp_ext.dll" />
<file src="windows_x64/grpc_csharp_ext.dll" target="/build/native/bin/windows_x64/grpc_csharp_ext.dll" /> <file src="../nativelibs/windows_x64/grpc_csharp_ext.dll" target="/build/native/bin/windows_x64/grpc_csharp_ext.dll" />
<file src="linux_x86/libgrpc_csharp_ext.so" target="/build/native/bin/linux_x86/libgrpc_csharp_ext.so" /> <file src="../nativelibs/linux_x86/libgrpc_csharp_ext.so" target="/build/native/bin/linux_x86/libgrpc_csharp_ext.so" />
<file src="linux_x64/libgrpc_csharp_ext.so" target="/build/native/bin/linux_x64/libgrpc_csharp_ext.so" /> <file src="../nativelibs/linux_x64/libgrpc_csharp_ext.so" target="/build/native/bin/linux_x64/libgrpc_csharp_ext.so" />
<file src="macosx_x86/libgrpc_csharp_ext.dylib" target="/build/native/bin/macosx_x86/libgrpc_csharp_ext.dylib" /> <file src="../nativelibs/macosx_x86/libgrpc_csharp_ext.dylib" target="/build/native/bin/macosx_x86/libgrpc_csharp_ext.dylib" />
<file src="macosx_x64/libgrpc_csharp_ext.dylib" target="/build/native/bin/macosx_x64/libgrpc_csharp_ext.dylib" /> <file src="../nativelibs/macosx_x64/libgrpc_csharp_ext.dylib" target="/build/native/bin/macosx_x64/libgrpc_csharp_ext.dylib" />
</files> </files>
</package> </package>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>dc9908b6-f291-4fc8-a46d-2ea2551790ec</ProjectGuid>
<RootNamespace>Grpc.Core</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -105,7 +105,7 @@ namespace Grpc.Core
if (instanceToShutdown != null) if (instanceToShutdown != null)
{ {
await instanceToShutdown.ShutdownAsync(); await instanceToShutdown.ShutdownAsync().ConfigureAwait(false);
} }
} }
@ -352,8 +352,12 @@ namespace Grpc.Core
{ {
if (!hooksRegistered) if (!hooksRegistered)
{ {
// TODO(jtattermusch): register shutdownhooks for CoreCLR as well
#if !NETSTANDARD1_5
AppDomain.CurrentDomain.ProcessExit += ShutdownHookHandler; AppDomain.CurrentDomain.ProcessExit += ShutdownHookHandler;
AppDomain.CurrentDomain.DomainUnload += ShutdownHookHandler; AppDomain.CurrentDomain.DomainUnload += ShutdownHookHandler;
#endif
} }
hooksRegistered = true; hooksRegistered = true;
} }

@ -46,7 +46,7 @@ namespace Grpc.Core.Internal
/// </summary> /// </summary>
internal static class DefaultSslRootsOverride internal static class DefaultSslRootsOverride
{ {
const string RootsPemResourceName = "Grpc.Core.Resources.roots.pem"; const string RootsPemResourceName = "Grpc.Core.roots.pem";
static object staticLock = new object(); static object staticLock = new object();
/// <summary> /// <summary>

@ -117,8 +117,8 @@ namespace Grpc.Core.Internal
private static string GetAssemblyPath() private static string GetAssemblyPath()
{ {
var assembly = typeof(NativeExtension).GetTypeInfo().Assembly; var assembly = typeof(NativeExtension).GetTypeInfo().Assembly;
#if DOTNET5_4 #if NETSTANDARD1_5
// Assembly.EscapedCodeBase does not exit under CoreCLR, but assemblies imported from a nuget package // Assembly.EscapedCodeBase does not exist under CoreCLR, but assemblies imported from a nuget package
// don't seem to be shadowed by DNX-based projects at all. // don't seem to be shadowed by DNX-based projects at all.
return assembly.Location; return assembly.Location;
#else #else
@ -136,7 +136,7 @@ namespace Grpc.Core.Internal
#endif #endif
} }
#if !DOTNET5_4 #if !NETSTANDARD1_5
private static bool IsFileUri(string uri) private static bool IsFileUri(string uri)
{ {
return uri.ToLowerInvariant().StartsWith(Uri.UriSchemeFile); return uri.ToLowerInvariant().StartsWith(Uri.UriSchemeFile);

@ -53,7 +53,7 @@ namespace Grpc.Core.Internal
static PlatformApis() static PlatformApis()
{ {
#if DNXCORE50 #if NETSTANDARD1_5
isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
isMacOSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); isMacOSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

@ -39,7 +39,7 @@ namespace Grpc.Core.Internal
/// <summary> /// <summary>
/// Safe handle to wrap native objects. /// Safe handle to wrap native objects.
/// </summary> /// </summary>
internal abstract class SafeHandleZeroIsInvalid : SafeHandle internal abstract class SafeHandleZeroIsInvalid : System.Runtime.InteropServices.SafeHandle
{ {
public SafeHandleZeroIsInvalid() : base(IntPtr.Zero, true) public SafeHandleZeroIsInvalid() : base(IntPtr.Zero, true)
{ {

@ -63,6 +63,13 @@ namespace Grpc.Core
/// </summary> /// </summary>
public static readonly Metadata Empty = new Metadata().Freeze(); public static readonly Metadata Empty = new Metadata().Freeze();
/// <summary>
/// To be used in initial metadata to request specific compression algorithm
/// for given call. Direct selection of compression algorithms is an internal
/// feature and is not part of public API.
/// </summary>
internal const string CompressionRequestAlgorithmMetadataKey = "grpc-internal-encoding-request";
readonly List<Entry> entries; readonly List<Entry> entries;
bool readOnly; bool readOnly;

@ -0,0 +1,42 @@
{
"version": "0.15.0-dev",
"title": "gRPC C# Core",
"authors": [ "Google Inc." ],
"copyright": "Copyright 2015, Google Inc.",
"packOptions": {
"summary": "Core C# implementation of gRPC - an RPC library and framework",
"description": "Core C# implementation of gRPC - an RPC library and framework. See project site for more info.",
"owners": [ "grpc-packages" ],
"licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE",
"projectUrl": "https://github.com/grpc/grpc",
"requireLicenseAcceptance": false,
"tags": [ "gRPC RPC Protocol HTTP/2" ],
"files": {
"build/net45/": "Grpc.Core.targets",
"build/native/bin/windows_x86/": "../nativelibs/windows_x86/grpc_csharp_ext.dll",
"build/native/bin/windows_x64/": "../nativelibs/windows_x64/grpc_csharp_ext.dll",
"build/native/bin/linux_x86/": "../nativelibs/linux_x86/libgrpc_csharp_ext.so",
"build/native/bin/linux_x64/": "../nativelibs/linux_x64/libgrpc_csharp_ext.so",
"build/native/bin/macosx_x86/": "../nativelibs/macosx_x86/libgrpc_csharp_ext.dylib",
"build/native/bin/macosx_x64/": "../nativelibs/macosx_x64/libgrpc_csharp_ext.dylib"
}
},
"buildOptions": {
"embed": [ "../../../etc/roots.pem" ]
},
"dependencies": {
"Ix-Async": "1.2.5"
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"portable-net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"System.Threading.Thread": "4.0.0-rc2-24027"
}
}
}
}

@ -0,0 +1,100 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Core", "Grpc.Core\Grpc.Core.xproj", "{DC9908B6-F291-4FC8-A46D-2EA2551790EC}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Auth", "Grpc.Auth\Grpc.Auth.xproj", "{C82631ED-06D1-4458-87BC-8257D12307A8}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Core.Tests", "Grpc.Core.Tests\Grpc.Core.Tests.xproj", "{759E23B2-FC04-4695-902D-B073CDED3599}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Examples", "Grpc.Examples\Grpc.Examples.xproj", "{C77B792D-FC78-4CE2-9522-B40B0803C636}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Examples.MathClient", "Grpc.Examples.MathClient\Grpc.Examples.MathClient.xproj", "{FD48DECA-1622-4173-B1D9-2101CF5E7C5F}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Examples.MathServer", "Grpc.Examples.MathServer\Grpc.Examples.MathServer.xproj", "{58579368-5372-4E67-ACD6-9B59CB9FA698}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Examples.Tests", "Grpc.Examples.Tests\Grpc.Examples.Tests.xproj", "{C61714A6-F633-44FB-97F4-C91F425C1D15}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.HealthCheck", "Grpc.HealthCheck\Grpc.HealthCheck.xproj", "{3BE4AD0B-2BF0-4D68-B625-F6018EF0DCFA}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.HealthCheck.Tests", "Grpc.HealthCheck.Tests\Grpc.HealthCheck.Tests.xproj", "{43DAFAC6-5343-4621-960E-A8A977EA3F0B}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.IntegrationTesting", "Grpc.IntegrationTesting\Grpc.IntegrationTesting.xproj", "{20354386-3E71-4046-A269-3BC2A06F3EC8}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.IntegrationTesting.Client", "Grpc.IntegrationTesting.Client\Grpc.IntegrationTesting.Client.xproj", "{48EA5BBE-70E2-4198-869D-D7E59C45F30D}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.IntegrationTesting.QpsWorker", "Grpc.IntegrationTesting.QpsWorker\Grpc.IntegrationTesting.QpsWorker.xproj", "{661B70D7-F56A-46E0-9B81-6227B591B5E7}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.IntegrationTesting.Server", "Grpc.IntegrationTesting.Server\Grpc.IntegrationTesting.Server.xproj", "{881F7AD1-A84E-47A2-9402-115C63C4031E}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.IntegrationTesting.StressClient", "Grpc.IntegrationTesting.StressClient\Grpc.IntegrationTesting.StressClient.xproj", "{0EBC910B-8867-4D3E-8686-91F34183D839}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DC9908B6-F291-4FC8-A46D-2EA2551790EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC9908B6-F291-4FC8-A46D-2EA2551790EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC9908B6-F291-4FC8-A46D-2EA2551790EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC9908B6-F291-4FC8-A46D-2EA2551790EC}.Release|Any CPU.Build.0 = Release|Any CPU
{C82631ED-06D1-4458-87BC-8257D12307A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C82631ED-06D1-4458-87BC-8257D12307A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C82631ED-06D1-4458-87BC-8257D12307A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C82631ED-06D1-4458-87BC-8257D12307A8}.Release|Any CPU.Build.0 = Release|Any CPU
{759E23B2-FC04-4695-902D-B073CDED3599}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{759E23B2-FC04-4695-902D-B073CDED3599}.Debug|Any CPU.Build.0 = Debug|Any CPU
{759E23B2-FC04-4695-902D-B073CDED3599}.Release|Any CPU.ActiveCfg = Release|Any CPU
{759E23B2-FC04-4695-902D-B073CDED3599}.Release|Any CPU.Build.0 = Release|Any CPU
{C77B792D-FC78-4CE2-9522-B40B0803C636}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C77B792D-FC78-4CE2-9522-B40B0803C636}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C77B792D-FC78-4CE2-9522-B40B0803C636}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C77B792D-FC78-4CE2-9522-B40B0803C636}.Release|Any CPU.Build.0 = Release|Any CPU
{FD48DECA-1622-4173-B1D9-2101CF5E7C5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FD48DECA-1622-4173-B1D9-2101CF5E7C5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD48DECA-1622-4173-B1D9-2101CF5E7C5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD48DECA-1622-4173-B1D9-2101CF5E7C5F}.Release|Any CPU.Build.0 = Release|Any CPU
{58579368-5372-4E67-ACD6-9B59CB9FA698}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58579368-5372-4E67-ACD6-9B59CB9FA698}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58579368-5372-4E67-ACD6-9B59CB9FA698}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58579368-5372-4E67-ACD6-9B59CB9FA698}.Release|Any CPU.Build.0 = Release|Any CPU
{C61714A6-F633-44FB-97F4-C91F425C1D15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C61714A6-F633-44FB-97F4-C91F425C1D15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C61714A6-F633-44FB-97F4-C91F425C1D15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C61714A6-F633-44FB-97F4-C91F425C1D15}.Release|Any CPU.Build.0 = Release|Any CPU
{3BE4AD0B-2BF0-4D68-B625-F6018EF0DCFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BE4AD0B-2BF0-4D68-B625-F6018EF0DCFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BE4AD0B-2BF0-4D68-B625-F6018EF0DCFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3BE4AD0B-2BF0-4D68-B625-F6018EF0DCFA}.Release|Any CPU.Build.0 = Release|Any CPU
{43DAFAC6-5343-4621-960E-A8A977EA3F0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43DAFAC6-5343-4621-960E-A8A977EA3F0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43DAFAC6-5343-4621-960E-A8A977EA3F0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43DAFAC6-5343-4621-960E-A8A977EA3F0B}.Release|Any CPU.Build.0 = Release|Any CPU
{20354386-3E71-4046-A269-3BC2A06F3EC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20354386-3E71-4046-A269-3BC2A06F3EC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20354386-3E71-4046-A269-3BC2A06F3EC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20354386-3E71-4046-A269-3BC2A06F3EC8}.Release|Any CPU.Build.0 = Release|Any CPU
{48EA5BBE-70E2-4198-869D-D7E59C45F30D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48EA5BBE-70E2-4198-869D-D7E59C45F30D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48EA5BBE-70E2-4198-869D-D7E59C45F30D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48EA5BBE-70E2-4198-869D-D7E59C45F30D}.Release|Any CPU.Build.0 = Release|Any CPU
{661B70D7-F56A-46E0-9B81-6227B591B5E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{661B70D7-F56A-46E0-9B81-6227B591B5E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{661B70D7-F56A-46E0-9B81-6227B591B5E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{661B70D7-F56A-46E0-9B81-6227B591B5E7}.Release|Any CPU.Build.0 = Release|Any CPU
{881F7AD1-A84E-47A2-9402-115C63C4031E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{881F7AD1-A84E-47A2-9402-115C63C4031E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{881F7AD1-A84E-47A2-9402-115C63C4031E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{881F7AD1-A84E-47A2-9402-115C63C4031E}.Release|Any CPU.Build.0 = Release|Any CPU
{0EBC910B-8867-4D3E-8686-91F34183D839}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0EBC910B-8867-4D3E-8686-91F34183D839}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EBC910B-8867-4D3E-8686-91F34183D839}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EBC910B-8867-4D3E-8686-91F34183D839}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

@ -57,4 +57,7 @@
<Name>Grpc.Examples</Name> <Name>Grpc.Examples</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Grpc.Examples.MathClient.project.json" />
</ItemGroup>
</Project> </Project>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>fd48deca-1622-4173-b1d9-2101cf5e7c5f</ProjectGuid>
<RootNamespace>Grpc.Examples.MathClient</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -0,0 +1,53 @@
{
"buildOptions": {
"emitEntryPoint": true
},
"configurations": {
"Debug": {
"buildOptions": {
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/dbg/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib"
}
}
}
},
"Release": {
"buildOptions": {
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/opt/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib"
}
}
}
}
},
"runtimes": {
"win7-x64": { },
"debian.8-x64": { },
"osx.10.11-x64": { }
},
"dependencies": {
"Grpc.Examples": {
"target": "project"
}
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"portable-net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
}
}

@ -57,4 +57,7 @@
<Name>Grpc.Examples</Name> <Name>Grpc.Examples</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Grpc.Examples.MathServer.project.json" />
</ItemGroup>
</Project> </Project>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>58579368-5372-4e67-acd6-9b59cb9fa698</ProjectGuid>
<RootNamespace>Grpc.Examples.MathServer</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -0,0 +1,53 @@
{
"buildOptions": {
"emitEntryPoint": true
},
"configurations": {
"Debug": {
"buildOptions": {
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/dbg/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib"
}
}
}
},
"Release": {
"buildOptions": {
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/opt/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib"
}
}
}
}
},
"runtimes": {
"win7-x64": { },
"debian.8-x64": { },
"osx.10.11-x64": { }
},
"dependencies": {
"Grpc.Examples": {
"target": "project"
}
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"portable-net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
}
}

@ -69,6 +69,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Grpc.Examples.Tests.project.json" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>c61714a6-f633-44fb-97f4-c91f425c1d15</ProjectGuid>
<RootNamespace>Grpc.Examples.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -110,7 +110,7 @@ namespace Math.Tests
{ {
var responses = await call.ResponseStream.ToListAsync(); var responses = await call.ResponseStream.ToListAsync();
CollectionAssert.AreEqual(new List<long> { 1, 1, 2, 3, 5, 8 }, CollectionAssert.AreEqual(new List<long> { 1, 1, 2, 3, 5, 8 },
responses.ConvertAll((n) => n.Num_)); responses.Select((n) => n.Num_));
} }
} }
@ -162,7 +162,7 @@ namespace Math.Tests
{ {
using (var call = client.Sum()) using (var call = client.Sum())
{ {
var numbers = new List<long> { 10, 20, 30 }.ConvertAll(n => new Num { Num_ = n }); var numbers = new List<long> { 10, 20, 30 }.Select(n => new Num { Num_ = n });
await call.RequestStream.WriteAllAsync(numbers); await call.RequestStream.WriteAllAsync(numbers);
var result = await call.ResponseAsync; var result = await call.ResponseAsync;
@ -185,8 +185,8 @@ namespace Math.Tests
await call.RequestStream.WriteAllAsync(divArgsList); await call.RequestStream.WriteAllAsync(divArgsList);
var result = await call.ResponseStream.ToListAsync(); var result = await call.ResponseStream.ToListAsync();
CollectionAssert.AreEqual(new long[] { 3, 4, 3 }, result.ConvertAll((divReply) => divReply.Quotient)); CollectionAssert.AreEqual(new long[] { 3, 4, 3 }, result.Select((divReply) => divReply.Quotient));
CollectionAssert.AreEqual(new long[] { 1, 16, 1 }, result.ConvertAll((divReply) => divReply.Remainder)); CollectionAssert.AreEqual(new long[] { 1, 16, 1 }, result.Select((divReply) => divReply.Remainder));
} }
} }
} }

@ -49,7 +49,7 @@ namespace Grpc.Examples.Tests
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if DOTNET5_4 #if NETSTANDARD1_5
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);

@ -0,0 +1,55 @@
{
"buildOptions": {
"emitEntryPoint": true
},
"configurations": {
"Debug": {
"buildOptions": {
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/dbg/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib"
}
}
}
},
"Release": {
"buildOptions": {
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/opt/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib"
}
}
}
}
},
"runtimes": {
"win7-x64": { },
"debian.8-x64": { },
"osx.10.11-x64": { }
},
"dependencies": {
"Grpc.Examples": {
"target": "project"
},
"NUnit": "3.2.0",
"NUnitLite": "3.2.0-*"
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"portable-net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
}
}

@ -69,6 +69,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Grpc.Examples.project.json" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>c77b792d-fc78-4ce2-9522-b40b0803c636</ProjectGuid>
<RootNamespace>Grpc.Examples</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -0,0 +1,27 @@
{
"buildOptions": {
},
"dependencies": {
"Grpc.Core": {
"target": "project"
},
"Google.Protobuf": "3.0.0-beta3"
},
"frameworks": {
"net45": {
"frameworkAssemblies": {
"System.Runtime": "",
"System.IO": ""
}
},
"netstandard1.5": {
"imports": [
"portable-net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
}
}

@ -74,6 +74,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Grpc.HealthCheck.Tests.project.json" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>43dafac6-5343-4621-960e-a8a977ea3f0b</ProjectGuid>
<RootNamespace>Grpc.HealthCheck.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -49,7 +49,7 @@ namespace Grpc.HealthCheck.Tests
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if DOTNET5_4 #if NETSTANDARD1_5
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);

@ -0,0 +1,55 @@
{
"buildOptions": {
"emitEntryPoint": true
},
"configurations": {
"Debug": {
"buildOptions": {
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/dbg/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib"
}
}
}
},
"Release": {
"buildOptions": {
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/opt/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib"
}
}
}
}
},
"runtimes": {
"win7-x64": { },
"debian.8-x64": { },
"osx.10.11-x64": { }
},
"dependencies": {
"Grpc.HealthCheck": {
"target": "project"
},
"NUnit": "3.2.0",
"NUnitLite": "3.2.0-*"
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"portable-net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
}
}

@ -65,6 +65,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Grpc.HealthCheck.nuspec" /> <None Include="Grpc.HealthCheck.nuspec" />
<None Include="Grpc.HealthCheck.project.json" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>3be4ad0b-2bf0-4d68-b625-f6018ef0dcfa</ProjectGuid>
<RootNamespace>Grpc.HealthCheck</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -0,0 +1,35 @@
{
"version": "0.15.0-dev",
"title": "gRPC C# Healthchecking",
"authors": [ "Google Inc." ],
"copyright": "Copyright 2015, Google Inc.",
"packOptions": {
"summary": "Implementation of gRPC health service",
"description": "Example implementation of grpc.health.v1 service that can be used for health-checking.",
"owners": [ "grpc-packages" ],
"licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE",
"projectUrl": "https://github.com/grpc/grpc",
"requireLicenseAcceptance": false,
"tags": [ "gRPC health check" ]
},
"dependencies": {
"Grpc.Core": "0.15.0-dev",
"Google.Protobuf": "3.0.0-beta3"
},
"frameworks": {
"net45": {
"frameworkAssemblies": {
"System.Runtime": "",
"System.IO": ""
}
},
"netstandard1.5": {
"imports": [
"portable-net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
}
}

@ -83,6 +83,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Grpc.IntegrationTesting.Client.project.json" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>48ea5bbe-70e2-4198-869d-d7e59c45f30d</ProjectGuid>
<RootNamespace>Grpc.IntegrationTesting.Client</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -0,0 +1,56 @@
{
"buildOptions": {
"emitEntryPoint": true
},
"configurations": {
"Debug": {
"buildOptions": {
"copyToOutput": {
"include": "data/*",
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/dbg/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib"
}
}
}
},
"Release": {
"buildOptions": {
"copyToOutput": {
"include": "data/*",
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/opt/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib"
}
}
}
}
},
"runtimes": {
"win7-x64": { },
"debian.8-x64": { },
"osx.10.11-x64": { }
},
"dependencies": {
"Grpc.IntegrationTesting": {
"target": "project"
}
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"portable-net45",
"net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
}
}

@ -59,5 +59,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <None Include="app.config" />
<None Include="Grpc.IntegrationTesting.QpsWorker.project.json" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>661b70d7-f56a-46e0-9b81-6227b591b5e7</ProjectGuid>
<RootNamespace>Grpc.IntegrationTesting.QpsWorker</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -0,0 +1,56 @@
{
"buildOptions": {
"emitEntryPoint": true
},
"configurations": {
"Debug": {
"buildOptions": {
"copyToOutput": {
"include": "data/*",
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/dbg/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib"
}
}
}
},
"Release": {
"buildOptions": {
"copyToOutput": {
"include": "data/*",
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/opt/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib"
}
}
}
}
},
"runtimes": {
"win7-x64": { },
"debian.8-x64": { },
"osx.10.11-x64": { }
},
"dependencies": {
"Grpc.IntegrationTesting": {
"target": "project"
}
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"portable-net45",
"net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
}
}

@ -83,6 +83,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Grpc.IntegrationTesting.Server.project.json" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>881f7ad1-a84e-47a2-9402-115c63c4031e</ProjectGuid>
<RootNamespace>Grpc.IntegrationTesting.Server</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -0,0 +1,56 @@
{
"buildOptions": {
"emitEntryPoint": true
},
"configurations": {
"Debug": {
"buildOptions": {
"copyToOutput": {
"include": "data/*",
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/dbg/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib"
}
}
}
},
"Release": {
"buildOptions": {
"copyToOutput": {
"include": "data/*",
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/opt/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib"
}
}
}
}
},
"runtimes": {
"win7-x64": { },
"debian.8-x64": { },
"osx.10.11-x64": { }
},
"dependencies": {
"Grpc.IntegrationTesting": {
"target": "project"
}
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"portable-net45",
"net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
}
}

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -57,4 +57,7 @@
<Name>Grpc.IntegrationTesting</Name> <Name>Grpc.IntegrationTesting</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Grpc.IntegrationTesting.StressClient.project.json" />
</ItemGroup>
</Project> </Project>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>0ebc910b-8867-4d3e-8686-91f34183d839</ProjectGuid>
<RootNamespace>Grpc.IntegrationTesting.StressClient</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -0,0 +1,56 @@
{
"buildOptions": {
"emitEntryPoint": true
},
"configurations": {
"Debug": {
"buildOptions": {
"copyToOutput": {
"include": "data/*",
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/dbg/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib"
}
}
}
},
"Release": {
"buildOptions": {
"copyToOutput": {
"include": "data/*",
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/opt/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib"
}
}
}
}
},
"runtimes": {
"win7-x64": { },
"debian.8-x64": { },
"osx.10.11-x64": { }
},
"dependencies": {
"Grpc.IntegrationTesting": {
"target": "project"
}
},
"frameworks": {
"net45": { },
"netstandard1.5": {
"imports": [
"portable-net45",
"net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
}
}
}
}

@ -40,7 +40,6 @@ using System.Threading.Tasks;
using Grpc.Core; using Grpc.Core;
using Grpc.Core.Utils; using Grpc.Core.Utils;
using Grpc.Testing; using Grpc.Testing;
using Moq;
using NUnit.Framework; using NUnit.Framework;
namespace Grpc.IntegrationTesting namespace Grpc.IntegrationTesting
@ -49,14 +48,16 @@ namespace Grpc.IntegrationTesting
{ {
TestService.TestServiceClient unimplementedClient = new UnimplementedTestServiceClient(); TestService.TestServiceClient unimplementedClient = new UnimplementedTestServiceClient();
// TODO: replace Moq by some mocking library with CoreCLR support.
#if !NETSTANDARD1_5
[Test] [Test]
public void ExpandedParamOverloadCanBeMocked() public void ExpandedParamOverloadCanBeMocked()
{ {
var expected = new SimpleResponse(); var expected = new SimpleResponse();
var mockClient = new Mock<TestService.TestServiceClient>(); var mockClient = new Moq.Mock<TestService.TestServiceClient>();
// mocking is relatively clumsy because one needs to specify value for all the optional params. // mocking is relatively clumsy because one needs to specify value for all the optional params.
mockClient.Setup(m => m.UnaryCall(It.IsAny<SimpleRequest>(), null, null, CancellationToken.None)).Returns(expected); mockClient.Setup(m => m.UnaryCall(Moq.It.IsAny<SimpleRequest>(), null, null, CancellationToken.None)).Returns(expected);
Assert.AreSame(expected, mockClient.Object.UnaryCall(new SimpleRequest())); Assert.AreSame(expected, mockClient.Object.UnaryCall(new SimpleRequest()));
} }
@ -66,11 +67,12 @@ namespace Grpc.IntegrationTesting
{ {
var expected = new SimpleResponse(); var expected = new SimpleResponse();
var mockClient = new Mock<TestService.TestServiceClient>(); var mockClient = new Moq.Mock<TestService.TestServiceClient>();
mockClient.Setup(m => m.UnaryCall(It.IsAny<SimpleRequest>(), It.IsAny<CallOptions>())).Returns(expected); mockClient.Setup(m => m.UnaryCall(Moq.It.IsAny<SimpleRequest>(), Moq.It.IsAny<CallOptions>())).Returns(expected);
Assert.AreSame(expected, mockClient.Object.UnaryCall(new SimpleRequest(), new CallOptions())); Assert.AreSame(expected, mockClient.Object.UnaryCall(new SimpleRequest(), new CallOptions()));
} }
#endif
[Test] [Test]
public void DefaultMethodStubThrows_UnaryCall() public void DefaultMethodStubThrows_UnaryCall()

@ -40,7 +40,6 @@ using System.Threading.Tasks;
using Grpc.Core; using Grpc.Core;
using Grpc.Core.Utils; using Grpc.Core.Utils;
using Grpc.Testing; using Grpc.Testing;
using Moq;
using NUnit.Framework; using NUnit.Framework;
namespace Grpc.IntegrationTesting namespace Grpc.IntegrationTesting

@ -129,6 +129,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Grpc.IntegrationTesting.project.json" />
<None Include="packages.config"> <None Include="packages.config">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>

@ -0,0 +1,8 @@
{
"frameworks": {
"net45": { }
},
"runtimes": {
"win": { }
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>20354386-3e71-4046-a269-3bc2a06f3ec8</ProjectGuid>
<RootNamespace>Grpc.IntegrationTesting</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -145,16 +145,26 @@ namespace Grpc.IntegrationTesting
if (options.TestCase == "jwt_token_creds") if (options.TestCase == "jwt_token_creds")
{ {
#if !NETSTANDARD1_5
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); var googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
Assert.IsTrue(googleCredential.IsCreateScopedRequired); Assert.IsTrue(googleCredential.IsCreateScopedRequired);
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials());
#else
// TODO(jtattermusch): implement this
throw new NotImplementedException("Not supported on CoreCLR yet");
#endif
} }
if (options.TestCase == "compute_engine_creds") if (options.TestCase == "compute_engine_creds")
{ {
#if !NETSTANDARD1_5
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); var googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
Assert.IsFalse(googleCredential.IsCreateScopedRequired); Assert.IsFalse(googleCredential.IsCreateScopedRequired);
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials());
#else
// TODO(jtattermusch): implement this
throw new NotImplementedException("Not supported on CoreCLR yet");
#endif
} }
return credentials; return credentials;
} }
@ -212,6 +222,12 @@ namespace Grpc.IntegrationTesting
case "unimplemented_method": case "unimplemented_method":
RunUnimplementedMethod(new UnimplementedService.UnimplementedServiceClient(channel)); RunUnimplementedMethod(new UnimplementedService.UnimplementedServiceClient(channel));
break; break;
case "client_compressed_unary":
RunClientCompressedUnary(client);
break;
case "client_compressed_streaming":
await RunClientCompressedStreamingAsync(client);
break;
default: default:
throw new ArgumentException("Unknown test case " + options.TestCase); throw new ArgumentException("Unknown test case " + options.TestCase);
} }
@ -230,13 +246,11 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("running large_unary"); Console.WriteLine("running large_unary");
var request = new SimpleRequest var request = new SimpleRequest
{ {
ResponseType = PayloadType.Compressable,
ResponseSize = 314159, ResponseSize = 314159,
Payload = CreateZerosPayload(271828) Payload = CreateZerosPayload(271828)
}; };
var response = client.UnaryCall(request); var response = client.UnaryCall(request);
Assert.AreEqual(PayloadType.Compressable, response.Payload.Type);
Assert.AreEqual(314159, response.Payload.Body.Length); Assert.AreEqual(314159, response.Payload.Body.Length);
Console.WriteLine("Passed!"); Console.WriteLine("Passed!");
} }
@ -245,7 +259,7 @@ namespace Grpc.IntegrationTesting
{ {
Console.WriteLine("running client_streaming"); Console.WriteLine("running client_streaming");
var bodySizes = new List<int> { 27182, 8, 1828, 45904 }.ConvertAll((size) => new StreamingInputCallRequest { Payload = CreateZerosPayload(size) }); var bodySizes = new List<int> { 27182, 8, 1828, 45904 }.Select((size) => new StreamingInputCallRequest { Payload = CreateZerosPayload(size) });
using (var call = client.StreamingInputCall()) using (var call = client.StreamingInputCall())
{ {
@ -265,18 +279,13 @@ namespace Grpc.IntegrationTesting
var request = new StreamingOutputCallRequest var request = new StreamingOutputCallRequest
{ {
ResponseType = PayloadType.Compressable, ResponseParameters = { bodySizes.Select((size) => new ResponseParameters { Size = size }) }
ResponseParameters = { bodySizes.ConvertAll((size) => new ResponseParameters { Size = size }) }
}; };
using (var call = client.StreamingOutputCall(request)) using (var call = client.StreamingOutputCall(request))
{ {
var responseList = await call.ResponseStream.ToListAsync(); var responseList = await call.ResponseStream.ToListAsync();
foreach (var res in responseList) CollectionAssert.AreEqual(bodySizes, responseList.Select((item) => item.Payload.Body.Length));
{
Assert.AreEqual(PayloadType.Compressable, res.Payload.Type);
}
CollectionAssert.AreEqual(bodySizes, responseList.ConvertAll((item) => item.Payload.Body.Length));
} }
Console.WriteLine("Passed!"); Console.WriteLine("Passed!");
} }
@ -289,46 +298,38 @@ namespace Grpc.IntegrationTesting
{ {
await call.RequestStream.WriteAsync(new StreamingOutputCallRequest await call.RequestStream.WriteAsync(new StreamingOutputCallRequest
{ {
ResponseType = PayloadType.Compressable,
ResponseParameters = { new ResponseParameters { Size = 31415 } }, ResponseParameters = { new ResponseParameters { Size = 31415 } },
Payload = CreateZerosPayload(27182) Payload = CreateZerosPayload(27182)
}); });
Assert.IsTrue(await call.ResponseStream.MoveNext()); Assert.IsTrue(await call.ResponseStream.MoveNext());
Assert.AreEqual(PayloadType.Compressable, call.ResponseStream.Current.Payload.Type);
Assert.AreEqual(31415, call.ResponseStream.Current.Payload.Body.Length); Assert.AreEqual(31415, call.ResponseStream.Current.Payload.Body.Length);
await call.RequestStream.WriteAsync(new StreamingOutputCallRequest await call.RequestStream.WriteAsync(new StreamingOutputCallRequest
{ {
ResponseType = PayloadType.Compressable,
ResponseParameters = { new ResponseParameters { Size = 9 } }, ResponseParameters = { new ResponseParameters { Size = 9 } },
Payload = CreateZerosPayload(8) Payload = CreateZerosPayload(8)
}); });
Assert.IsTrue(await call.ResponseStream.MoveNext()); Assert.IsTrue(await call.ResponseStream.MoveNext());
Assert.AreEqual(PayloadType.Compressable, call.ResponseStream.Current.Payload.Type);
Assert.AreEqual(9, call.ResponseStream.Current.Payload.Body.Length); Assert.AreEqual(9, call.ResponseStream.Current.Payload.Body.Length);
await call.RequestStream.WriteAsync(new StreamingOutputCallRequest await call.RequestStream.WriteAsync(new StreamingOutputCallRequest
{ {
ResponseType = PayloadType.Compressable,
ResponseParameters = { new ResponseParameters { Size = 2653 } }, ResponseParameters = { new ResponseParameters { Size = 2653 } },
Payload = CreateZerosPayload(1828) Payload = CreateZerosPayload(1828)
}); });
Assert.IsTrue(await call.ResponseStream.MoveNext()); Assert.IsTrue(await call.ResponseStream.MoveNext());
Assert.AreEqual(PayloadType.Compressable, call.ResponseStream.Current.Payload.Type);
Assert.AreEqual(2653, call.ResponseStream.Current.Payload.Body.Length); Assert.AreEqual(2653, call.ResponseStream.Current.Payload.Body.Length);
await call.RequestStream.WriteAsync(new StreamingOutputCallRequest await call.RequestStream.WriteAsync(new StreamingOutputCallRequest
{ {
ResponseType = PayloadType.Compressable,
ResponseParameters = { new ResponseParameters { Size = 58979 } }, ResponseParameters = { new ResponseParameters { Size = 58979 } },
Payload = CreateZerosPayload(45904) Payload = CreateZerosPayload(45904)
}); });
Assert.IsTrue(await call.ResponseStream.MoveNext()); Assert.IsTrue(await call.ResponseStream.MoveNext());
Assert.AreEqual(PayloadType.Compressable, call.ResponseStream.Current.Payload.Type);
Assert.AreEqual(58979, call.ResponseStream.Current.Payload.Body.Length); Assert.AreEqual(58979, call.ResponseStream.Current.Payload.Body.Length);
await call.RequestStream.CompleteAsync(); await call.RequestStream.CompleteAsync();
@ -357,7 +358,6 @@ namespace Grpc.IntegrationTesting
var request = new SimpleRequest var request = new SimpleRequest
{ {
ResponseType = PayloadType.Compressable,
ResponseSize = 314159, ResponseSize = 314159,
Payload = CreateZerosPayload(271828), Payload = CreateZerosPayload(271828),
FillUsername = true, FillUsername = true,
@ -367,7 +367,6 @@ namespace Grpc.IntegrationTesting
// not setting credentials here because they were set on channel already // not setting credentials here because they were set on channel already
var response = client.UnaryCall(request); var response = client.UnaryCall(request);
Assert.AreEqual(PayloadType.Compressable, response.Payload.Type);
Assert.AreEqual(314159, response.Payload.Body.Length); Assert.AreEqual(314159, response.Payload.Body.Length);
Assert.False(string.IsNullOrEmpty(response.OauthScope)); Assert.False(string.IsNullOrEmpty(response.OauthScope));
Assert.True(oauthScope.Contains(response.OauthScope)); Assert.True(oauthScope.Contains(response.OauthScope));
@ -381,7 +380,6 @@ namespace Grpc.IntegrationTesting
var request = new SimpleRequest var request = new SimpleRequest
{ {
ResponseType = PayloadType.Compressable,
ResponseSize = 314159, ResponseSize = 314159,
Payload = CreateZerosPayload(271828), Payload = CreateZerosPayload(271828),
FillUsername = true, FillUsername = true,
@ -390,7 +388,6 @@ namespace Grpc.IntegrationTesting
// not setting credentials here because they were set on channel already // not setting credentials here because they were set on channel already
var response = client.UnaryCall(request); var response = client.UnaryCall(request);
Assert.AreEqual(PayloadType.Compressable, response.Payload.Type);
Assert.AreEqual(314159, response.Payload.Body.Length); Assert.AreEqual(314159, response.Payload.Body.Length);
Assert.AreEqual(GetEmailFromServiceAccountFile(), response.Username); Assert.AreEqual(GetEmailFromServiceAccountFile(), response.Username);
Console.WriteLine("Passed!"); Console.WriteLine("Passed!");
@ -398,6 +395,7 @@ namespace Grpc.IntegrationTesting
public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope) public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope)
{ {
#if !NETSTANDARD1_5
Console.WriteLine("running oauth2_auth_token"); Console.WriteLine("running oauth2_auth_token");
ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope }); ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope });
string oauth2Token = await credential.GetAccessTokenForRequestAsync(); string oauth2Token = await credential.GetAccessTokenForRequestAsync();
@ -415,10 +413,15 @@ namespace Grpc.IntegrationTesting
Assert.True(oauthScope.Contains(response.OauthScope)); Assert.True(oauthScope.Contains(response.OauthScope));
Assert.AreEqual(GetEmailFromServiceAccountFile(), response.Username); Assert.AreEqual(GetEmailFromServiceAccountFile(), response.Username);
Console.WriteLine("Passed!"); Console.WriteLine("Passed!");
#else
// TODO(jtattermusch): implement this
throw new NotImplementedException("Not supported on CoreCLR yet");
#endif
} }
public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope) public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope)
{ {
#if !NETSTANDARD1_5
Console.WriteLine("running per_rpc_creds"); Console.WriteLine("running per_rpc_creds");
ITokenAccess googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); ITokenAccess googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
@ -432,6 +435,10 @@ namespace Grpc.IntegrationTesting
Assert.AreEqual(GetEmailFromServiceAccountFile(), response.Username); Assert.AreEqual(GetEmailFromServiceAccountFile(), response.Username);
Console.WriteLine("Passed!"); Console.WriteLine("Passed!");
#else
// TODO(jtattermusch): implement this
throw new NotImplementedException("Not supported on CoreCLR yet");
#endif
} }
public static async Task RunCancelAfterBeginAsync(TestService.TestServiceClient client) public static async Task RunCancelAfterBeginAsync(TestService.TestServiceClient client)
@ -460,13 +467,11 @@ namespace Grpc.IntegrationTesting
{ {
await call.RequestStream.WriteAsync(new StreamingOutputCallRequest await call.RequestStream.WriteAsync(new StreamingOutputCallRequest
{ {
ResponseType = PayloadType.Compressable,
ResponseParameters = { new ResponseParameters { Size = 31415 } }, ResponseParameters = { new ResponseParameters { Size = 31415 } },
Payload = CreateZerosPayload(27182) Payload = CreateZerosPayload(27182)
}); });
Assert.IsTrue(await call.ResponseStream.MoveNext()); Assert.IsTrue(await call.ResponseStream.MoveNext());
Assert.AreEqual(PayloadType.Compressable, call.ResponseStream.Current.Payload.Type);
Assert.AreEqual(31415, call.ResponseStream.Current.Payload.Body.Length); Assert.AreEqual(31415, call.ResponseStream.Current.Payload.Body.Length);
cts.Cancel(); cts.Cancel();
@ -526,7 +531,6 @@ namespace Grpc.IntegrationTesting
// step 1: test unary call // step 1: test unary call
var request = new SimpleRequest var request = new SimpleRequest
{ {
ResponseType = PayloadType.Compressable,
ResponseSize = 314159, ResponseSize = 314159,
Payload = CreateZerosPayload(271828) Payload = CreateZerosPayload(271828)
}; };
@ -545,7 +549,6 @@ namespace Grpc.IntegrationTesting
// step 2: test full duplex call // step 2: test full duplex call
var request = new StreamingOutputCallRequest var request = new StreamingOutputCallRequest
{ {
ResponseType = PayloadType.Compressable,
ResponseParameters = { new ResponseParameters { Size = 31415 } }, ResponseParameters = { new ResponseParameters { Size = 31415 } },
Payload = CreateZerosPayload(27182) Payload = CreateZerosPayload(27182)
}; };
@ -618,21 +621,127 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!"); Console.WriteLine("Passed!");
} }
public static void RunClientCompressedUnary(TestService.TestServiceClient client)
{
Console.WriteLine("running client_compressed_unary");
var probeRequest = new SimpleRequest
{
ExpectCompressed = new BoolValue
{
Value = true // lie about compression
},
ResponseSize = 314159,
Payload = CreateZerosPayload(271828)
};
var e = Assert.Throws<RpcException>(() => client.UnaryCall(probeRequest, CreateClientCompressionMetadata(false)));
Assert.AreEqual(StatusCode.InvalidArgument, e.Status.StatusCode);
var compressedRequest = new SimpleRequest
{
ExpectCompressed = new BoolValue
{
Value = true
},
ResponseSize = 314159,
Payload = CreateZerosPayload(271828)
};
var response1 = client.UnaryCall(compressedRequest, CreateClientCompressionMetadata(true));
Assert.AreEqual(314159, response1.Payload.Body.Length);
var uncompressedRequest = new SimpleRequest
{
ExpectCompressed = new BoolValue
{
Value = false
},
ResponseSize = 314159,
Payload = CreateZerosPayload(271828)
};
var response2 = client.UnaryCall(uncompressedRequest, CreateClientCompressionMetadata(false));
Assert.AreEqual(314159, response2.Payload.Body.Length);
Console.WriteLine("Passed!");
}
public static async Task RunClientCompressedStreamingAsync(TestService.TestServiceClient client)
{
Console.WriteLine("running client_compressed_streaming");
try
{
var probeCall = client.StreamingInputCall(CreateClientCompressionMetadata(false));
await probeCall.RequestStream.WriteAsync(new StreamingInputCallRequest
{
ExpectCompressed = new BoolValue
{
Value = true
},
Payload = CreateZerosPayload(27182)
});
// cannot use Assert.ThrowsAsync because it uses Task.Wait and would deadlock.
await probeCall;
Assert.Fail();
}
catch (RpcException e)
{
Assert.AreEqual(StatusCode.InvalidArgument, e.Status.StatusCode);
}
var call = client.StreamingInputCall(CreateClientCompressionMetadata(true));
await call.RequestStream.WriteAsync(new StreamingInputCallRequest
{
ExpectCompressed = new BoolValue
{
Value = true
},
Payload = CreateZerosPayload(27182)
});
call.RequestStream.WriteOptions = new WriteOptions(WriteFlags.NoCompress);
await call.RequestStream.WriteAsync(new StreamingInputCallRequest
{
ExpectCompressed = new BoolValue
{
Value = false
},
Payload = CreateZerosPayload(45904)
});
await call.RequestStream.CompleteAsync();
var response = await call.ResponseAsync;
Assert.AreEqual(73086, response.AggregatedPayloadSize);
Console.WriteLine("Passed!");
}
private static Payload CreateZerosPayload(int size) private static Payload CreateZerosPayload(int size)
{ {
return new Payload { Body = ByteString.CopyFrom(new byte[size]) }; return new Payload { Body = ByteString.CopyFrom(new byte[size]) };
} }
private static Metadata CreateClientCompressionMetadata(bool compressed)
{
var algorithmName = compressed ? "gzip" : "identity";
return new Metadata
{
{ new Metadata.Entry(Metadata.CompressionRequestAlgorithmMetadataKey, algorithmName) }
};
}
// extracts the client_email field from service account file used for auth test cases // extracts the client_email field from service account file used for auth test cases
private static string GetEmailFromServiceAccountFile() private static string GetEmailFromServiceAccountFile()
{ {
#if !NETSTANDARD1_5
string keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS"); string keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS");
Assert.IsNotNull(keyFile); Assert.IsNotNull(keyFile);
var jobject = JObject.Parse(File.ReadAllText(keyFile)); var jobject = JObject.Parse(File.ReadAllText(keyFile));
string email = jobject.GetValue("client_email").Value<string>(); string email = jobject.GetValue("client_email").Value<string>();
Assert.IsTrue(email.Length > 0); // spec requires nonempty client email. Assert.IsTrue(email.Length > 0); // spec requires nonempty client email.
return email; return email;
#else
// TODO(jtattermusch): implement this
throw new NotImplementedException("Not supported on CoreCLR yet");
#endif
} }
private static Metadata CreateTestMetadata() private static Metadata CreateTestMetadata()

@ -24,46 +24,48 @@ namespace Grpc.Testing {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"CiVzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL21lc3NhZ2VzLnByb3RvEgxncnBj", "CiVzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL21lc3NhZ2VzLnByb3RvEgxncnBj",
"LnRlc3RpbmciQAoHUGF5bG9hZBInCgR0eXBlGAEgASgOMhkuZ3JwYy50ZXN0", "LnRlc3RpbmciGgoJQm9vbFZhbHVlEg0KBXZhbHVlGAEgASgIIkAKB1BheWxv",
"aW5nLlBheWxvYWRUeXBlEgwKBGJvZHkYAiABKAwiKwoKRWNob1N0YXR1cxIM", "YWQSJwoEdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlwZRIM",
"CgRjb2RlGAEgASgFEg8KB21lc3NhZ2UYAiABKAkioQIKDVNpbXBsZVJlcXVl", "CgRib2R5GAIgASgMIisKCkVjaG9TdGF0dXMSDAoEY29kZRgBIAEoBRIPCgdt",
"c3QSMAoNcmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXls", "ZXNzYWdlGAIgASgJIs4CCg1TaW1wbGVSZXF1ZXN0EjAKDXJlc3BvbnNlX3R5",
"b2FkVHlwZRIVCg1yZXNwb25zZV9zaXplGAIgASgFEiYKB3BheWxvYWQYAyAB", "cGUYASABKA4yGS5ncnBjLnRlc3RpbmcuUGF5bG9hZFR5cGUSFQoNcmVzcG9u",
"KAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9hZBIVCg1maWxsX3VzZXJuYW1lGAQg", "c2Vfc2l6ZRgCIAEoBRImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50ZXN0aW5n",
"ASgIEhgKEGZpbGxfb2F1dGhfc2NvcGUYBSABKAgSOwoUcmVzcG9uc2VfY29t", "LlBheWxvYWQSFQoNZmlsbF91c2VybmFtZRgEIAEoCBIYChBmaWxsX29hdXRo",
"cHJlc3Npb24YBiABKA4yHS5ncnBjLnRlc3RpbmcuQ29tcHJlc3Npb25UeXBl", "X3Njb3BlGAUgASgIEjQKE3Jlc3BvbnNlX2NvbXByZXNzZWQYBiABKAsyFy5n",
"EjEKD3Jlc3BvbnNlX3N0YXR1cxgHIAEoCzIYLmdycGMudGVzdGluZy5FY2hv", "cnBjLnRlc3RpbmcuQm9vbFZhbHVlEjEKD3Jlc3BvbnNlX3N0YXR1cxgHIAEo",
"U3RhdHVzIl8KDlNpbXBsZVJlc3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5n", "CzIYLmdycGMudGVzdGluZy5FY2hvU3RhdHVzEjIKEWV4cGVjdF9jb21wcmVz",
"cnBjLnRlc3RpbmcuUGF5bG9hZBIQCgh1c2VybmFtZRgCIAEoCRITCgtvYXV0", "c2VkGAggASgLMhcuZ3JwYy50ZXN0aW5nLkJvb2xWYWx1ZSJfCg5TaW1wbGVS",
"aF9zY29wZRgDIAEoCSJDChlTdHJlYW1pbmdJbnB1dENhbGxSZXF1ZXN0EiYK", "ZXNwb25zZRImCgdwYXlsb2FkGAEgASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxv",
"B3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9hZCI9ChpTdHJl", "YWQSEAoIdXNlcm5hbWUYAiABKAkSEwoLb2F1dGhfc2NvcGUYAyABKAkidwoZ",
"YW1pbmdJbnB1dENhbGxSZXNwb25zZRIfChdhZ2dyZWdhdGVkX3BheWxvYWRf", "U3RyZWFtaW5nSW5wdXRDYWxsUmVxdWVzdBImCgdwYXlsb2FkGAEgASgLMhUu",
"c2l6ZRgBIAEoBSI3ChJSZXNwb25zZVBhcmFtZXRlcnMSDAoEc2l6ZRgBIAEo", "Z3JwYy50ZXN0aW5nLlBheWxvYWQSMgoRZXhwZWN0X2NvbXByZXNzZWQYAiAB",
"BRITCgtpbnRlcnZhbF91cxgCIAEoBSKlAgoaU3RyZWFtaW5nT3V0cHV0Q2Fs", "KAsyFy5ncnBjLnRlc3RpbmcuQm9vbFZhbHVlIj0KGlN0cmVhbWluZ0lucHV0",
"bFJlcXVlc3QSMAoNcmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGlu", "Q2FsbFJlc3BvbnNlEh8KF2FnZ3JlZ2F0ZWRfcGF5bG9hZF9zaXplGAEgASgF",
"Zy5QYXlsb2FkVHlwZRI9ChNyZXNwb25zZV9wYXJhbWV0ZXJzGAIgAygLMiAu", "ImQKElJlc3BvbnNlUGFyYW1ldGVycxIMCgRzaXplGAEgASgFEhMKC2ludGVy",
"Z3JwYy50ZXN0aW5nLlJlc3BvbnNlUGFyYW1ldGVycxImCgdwYXlsb2FkGAMg", "dmFsX3VzGAIgASgFEisKCmNvbXByZXNzZWQYAyABKAsyFy5ncnBjLnRlc3Rp",
"ASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxvYWQSOwoUcmVzcG9uc2VfY29tcHJl", "bmcuQm9vbFZhbHVlIugBChpTdHJlYW1pbmdPdXRwdXRDYWxsUmVxdWVzdBIw",
"c3Npb24YBiABKA4yHS5ncnBjLnRlc3RpbmcuQ29tcHJlc3Npb25UeXBlEjEK", "Cg1yZXNwb25zZV90eXBlGAEgASgOMhkuZ3JwYy50ZXN0aW5nLlBheWxvYWRU",
"D3Jlc3BvbnNlX3N0YXR1cxgHIAEoCzIYLmdycGMudGVzdGluZy5FY2hvU3Rh", "eXBlEj0KE3Jlc3BvbnNlX3BhcmFtZXRlcnMYAiADKAsyIC5ncnBjLnRlc3Rp",
"dHVzIkUKG1N0cmVhbWluZ091dHB1dENhbGxSZXNwb25zZRImCgdwYXlsb2Fk", "bmcuUmVzcG9uc2VQYXJhbWV0ZXJzEiYKB3BheWxvYWQYAyABKAsyFS5ncnBj",
"GAEgASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxvYWQiMwoPUmVjb25uZWN0UGFy", "LnRlc3RpbmcuUGF5bG9hZBIxCg9yZXNwb25zZV9zdGF0dXMYByABKAsyGC5n",
"YW1zEiAKGG1heF9yZWNvbm5lY3RfYmFja29mZl9tcxgBIAEoBSIzCg1SZWNv", "cnBjLnRlc3RpbmcuRWNob1N0YXR1cyJFChtTdHJlYW1pbmdPdXRwdXRDYWxs",
"bm5lY3RJbmZvEg4KBnBhc3NlZBgBIAEoCBISCgpiYWNrb2ZmX21zGAIgAygF", "UmVzcG9uc2USJgoHcGF5bG9hZBgBIAEoCzIVLmdycGMudGVzdGluZy5QYXls",
"Kj8KC1BheWxvYWRUeXBlEhAKDENPTVBSRVNTQUJMRRAAEhIKDlVOQ09NUFJF", "b2FkIjMKD1JlY29ubmVjdFBhcmFtcxIgChhtYXhfcmVjb25uZWN0X2JhY2tv",
"U1NBQkxFEAESCgoGUkFORE9NEAIqMgoPQ29tcHJlc3Npb25UeXBlEggKBE5P", "ZmZfbXMYASABKAUiMwoNUmVjb25uZWN0SW5mbxIOCgZwYXNzZWQYASABKAgS",
"TkUQABIICgRHWklQEAESCwoHREVGTEFURRACYgZwcm90bzM=")); "EgoKYmFja29mZl9tcxgCIAMoBSofCgtQYXlsb2FkVHlwZRIQCgxDT01QUkVT",
"U0FCTEUQAGIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.PayloadType), typeof(global::Grpc.Testing.CompressionType), }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.PayloadType), }, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.BoolValue), global::Grpc.Testing.BoolValue.Parser, new[]{ "Value" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Payload), global::Grpc.Testing.Payload.Parser, new[]{ "Type", "Body" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Payload), global::Grpc.Testing.Payload.Parser, new[]{ "Type", "Body" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.EchoStatus), global::Grpc.Testing.EchoStatus.Parser, new[]{ "Code", "Message" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.EchoStatus), global::Grpc.Testing.EchoStatus.Parser, new[]{ "Code", "Message" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleRequest), global::Grpc.Testing.SimpleRequest.Parser, new[]{ "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", "ResponseCompression", "ResponseStatus" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleRequest), global::Grpc.Testing.SimpleRequest.Parser, new[]{ "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", "ResponseCompressed", "ResponseStatus", "ExpectCompressed" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleResponse), global::Grpc.Testing.SimpleResponse.Parser, new[]{ "Payload", "Username", "OauthScope" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleResponse), global::Grpc.Testing.SimpleResponse.Parser, new[]{ "Payload", "Username", "OauthScope" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingInputCallRequest), global::Grpc.Testing.StreamingInputCallRequest.Parser, new[]{ "Payload" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingInputCallRequest), global::Grpc.Testing.StreamingInputCallRequest.Parser, new[]{ "Payload", "ExpectCompressed" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingInputCallResponse), global::Grpc.Testing.StreamingInputCallResponse.Parser, new[]{ "AggregatedPayloadSize" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingInputCallResponse), global::Grpc.Testing.StreamingInputCallResponse.Parser, new[]{ "AggregatedPayloadSize" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ResponseParameters), global::Grpc.Testing.ResponseParameters.Parser, new[]{ "Size", "IntervalUs" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ResponseParameters), global::Grpc.Testing.ResponseParameters.Parser, new[]{ "Size", "IntervalUs", "Compressed" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingOutputCallRequest), global::Grpc.Testing.StreamingOutputCallRequest.Parser, new[]{ "ResponseType", "ResponseParameters", "Payload", "ResponseCompression", "ResponseStatus" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingOutputCallRequest), global::Grpc.Testing.StreamingOutputCallRequest.Parser, new[]{ "ResponseType", "ResponseParameters", "Payload", "ResponseStatus" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingOutputCallResponse), global::Grpc.Testing.StreamingOutputCallResponse.Parser, new[]{ "Payload" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingOutputCallResponse), global::Grpc.Testing.StreamingOutputCallResponse.Parser, new[]{ "Payload" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ReconnectParams), global::Grpc.Testing.ReconnectParams.Parser, new[]{ "MaxReconnectBackoffMs" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ReconnectParams), global::Grpc.Testing.ReconnectParams.Parser, new[]{ "MaxReconnectBackoffMs" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ReconnectInfo), global::Grpc.Testing.ReconnectInfo.Parser, new[]{ "Passed", "BackoffMs" }, null, null, null) new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ReconnectInfo), global::Grpc.Testing.ReconnectInfo.Parser, new[]{ "Passed", "BackoffMs" }, null, null, null)
@ -74,6 +76,7 @@ namespace Grpc.Testing {
} }
#region Enums #region Enums
/// <summary> /// <summary>
/// DEPRECATED, don't use. To be removed shortly.
/// The type of payload that should be returned. /// The type of payload that should be returned.
/// </summary> /// </summary>
public enum PayloadType { public enum PayloadType {
@ -81,31 +84,122 @@ namespace Grpc.Testing {
/// Compressable text format. /// Compressable text format.
/// </summary> /// </summary>
[pbr::OriginalName("COMPRESSABLE")] Compressable = 0, [pbr::OriginalName("COMPRESSABLE")] Compressable = 0,
/// <summary>
/// Uncompressable binary format.
/// </summary>
[pbr::OriginalName("UNCOMPRESSABLE")] Uncompressable = 1,
/// <summary>
/// Randomly chosen from all other formats defined in this enum.
/// </summary>
[pbr::OriginalName("RANDOM")] Random = 2,
} }
#endregion
#region Messages
/// <summary> /// <summary>
/// Compression algorithms /// TODO(dgq): Go back to using well-known types once
/// https://github.com/grpc/grpc/issues/6980 has been fixed.
/// import "google/protobuf/wrappers.proto";
/// </summary> /// </summary>
public enum CompressionType { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class BoolValue : pb::IMessage<BoolValue> {
private static readonly pb::MessageParser<BoolValue> _parser = new pb::MessageParser<BoolValue>(() => new BoolValue());
public static pb::MessageParser<BoolValue> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[0]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
public BoolValue() {
OnConstruction();
}
partial void OnConstruction();
public BoolValue(BoolValue other) : this() {
value_ = other.value_;
}
public BoolValue Clone() {
return new BoolValue(this);
}
/// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private bool value_;
/// <summary> /// <summary>
/// No compression /// The bool value.
/// </summary> /// </summary>
[pbr::OriginalName("NONE")] None = 0, public bool Value {
[pbr::OriginalName("GZIP")] Gzip = 1, get { return value_; }
[pbr::OriginalName("DEFLATE")] Deflate = 2, set {
} value_ = value;
}
}
#endregion public override bool Equals(object other) {
return Equals(other as BoolValue);
}
public bool Equals(BoolValue other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Value != other.Value) return false;
return true;
}
public override int GetHashCode() {
int hash = 1;
if (Value != false) hash ^= Value.GetHashCode();
return hash;
}
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
if (Value != false) {
output.WriteRawTag(8);
output.WriteBool(Value);
}
}
public int CalculateSize() {
int size = 0;
if (Value != false) {
size += 1 + 1;
}
return size;
}
public void MergeFrom(BoolValue other) {
if (other == null) {
return;
}
if (other.Value != false) {
Value = other.Value;
}
}
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
case 8: {
Value = input.ReadBool();
break;
}
}
}
}
}
#region Messages
/// <summary> /// <summary>
/// A block of data, to simply increase gRPC message size. /// A block of data, to simply increase gRPC message size.
/// </summary> /// </summary>
@ -115,7 +209,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<Payload> Parser { get { return _parser; } } public static pb::MessageParser<Payload> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[0]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[1]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
@ -141,6 +235,7 @@ namespace Grpc.Testing {
public const int TypeFieldNumber = 1; public const int TypeFieldNumber = 1;
private global::Grpc.Testing.PayloadType type_ = 0; private global::Grpc.Testing.PayloadType type_ = 0;
/// <summary> /// <summary>
/// DEPRECATED, don't use. To be removed shortly.
/// The type of data in body. /// The type of data in body.
/// </summary> /// </summary>
public global::Grpc.Testing.PayloadType Type { public global::Grpc.Testing.PayloadType Type {
@ -255,7 +350,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<EchoStatus> Parser { get { return _parser; } } public static pb::MessageParser<EchoStatus> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[1]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[2]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
@ -388,7 +483,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<SimpleRequest> Parser { get { return _parser; } } public static pb::MessageParser<SimpleRequest> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[2]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[3]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
@ -407,8 +502,9 @@ namespace Grpc.Testing {
Payload = other.payload_ != null ? other.Payload.Clone() : null; Payload = other.payload_ != null ? other.Payload.Clone() : null;
fillUsername_ = other.fillUsername_; fillUsername_ = other.fillUsername_;
fillOauthScope_ = other.fillOauthScope_; fillOauthScope_ = other.fillOauthScope_;
responseCompression_ = other.responseCompression_; ResponseCompressed = other.responseCompressed_ != null ? other.ResponseCompressed.Clone() : null;
ResponseStatus = other.responseStatus_ != null ? other.ResponseStatus.Clone() : null; ResponseStatus = other.responseStatus_ != null ? other.ResponseStatus.Clone() : null;
ExpectCompressed = other.expectCompressed_ != null ? other.ExpectCompressed.Clone() : null;
} }
public SimpleRequest Clone() { public SimpleRequest Clone() {
@ -419,6 +515,7 @@ namespace Grpc.Testing {
public const int ResponseTypeFieldNumber = 1; public const int ResponseTypeFieldNumber = 1;
private global::Grpc.Testing.PayloadType responseType_ = 0; private global::Grpc.Testing.PayloadType responseType_ = 0;
/// <summary> /// <summary>
/// DEPRECATED, don't use. To be removed shortly.
/// Desired payload type in the response from the server. /// Desired payload type in the response from the server.
/// If response_type is RANDOM, server randomly chooses one from other formats. /// If response_type is RANDOM, server randomly chooses one from other formats.
/// </summary> /// </summary>
@ -434,7 +531,6 @@ namespace Grpc.Testing {
private int responseSize_; private int responseSize_;
/// <summary> /// <summary>
/// Desired payload size in the response from the server. /// Desired payload size in the response from the server.
/// If response_type is COMPRESSABLE, this denotes the size before compression.
/// </summary> /// </summary>
public int ResponseSize { public int ResponseSize {
get { return responseSize_; } get { return responseSize_; }
@ -482,16 +578,19 @@ namespace Grpc.Testing {
} }
} }
/// <summary>Field number for the "response_compression" field.</summary> /// <summary>Field number for the "response_compressed" field.</summary>
public const int ResponseCompressionFieldNumber = 6; public const int ResponseCompressedFieldNumber = 6;
private global::Grpc.Testing.CompressionType responseCompression_ = 0; private global::Grpc.Testing.BoolValue responseCompressed_;
/// <summary> /// <summary>
/// Compression algorithm to be used by the server for the response (stream) /// Whether to request the server to compress the response. This field is
/// "nullable" in order to interoperate seamlessly with clients not able to
/// implement the full compression tests by introspecting the call to verify
/// the response's compression status.
/// </summary> /// </summary>
public global::Grpc.Testing.CompressionType ResponseCompression { public global::Grpc.Testing.BoolValue ResponseCompressed {
get { return responseCompression_; } get { return responseCompressed_; }
set { set {
responseCompression_ = value; responseCompressed_ = value;
} }
} }
@ -508,6 +607,19 @@ namespace Grpc.Testing {
} }
} }
/// <summary>Field number for the "expect_compressed" field.</summary>
public const int ExpectCompressedFieldNumber = 8;
private global::Grpc.Testing.BoolValue expectCompressed_;
/// <summary>
/// Whether the server should expect this request to be compressed.
/// </summary>
public global::Grpc.Testing.BoolValue ExpectCompressed {
get { return expectCompressed_; }
set {
expectCompressed_ = value;
}
}
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as SimpleRequest); return Equals(other as SimpleRequest);
} }
@ -524,8 +636,9 @@ namespace Grpc.Testing {
if (!object.Equals(Payload, other.Payload)) return false; if (!object.Equals(Payload, other.Payload)) return false;
if (FillUsername != other.FillUsername) return false; if (FillUsername != other.FillUsername) return false;
if (FillOauthScope != other.FillOauthScope) return false; if (FillOauthScope != other.FillOauthScope) return false;
if (ResponseCompression != other.ResponseCompression) return false; if (!object.Equals(ResponseCompressed, other.ResponseCompressed)) return false;
if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false;
if (!object.Equals(ExpectCompressed, other.ExpectCompressed)) return false;
return true; return true;
} }
@ -536,8 +649,9 @@ namespace Grpc.Testing {
if (payload_ != null) hash ^= Payload.GetHashCode(); if (payload_ != null) hash ^= Payload.GetHashCode();
if (FillUsername != false) hash ^= FillUsername.GetHashCode(); if (FillUsername != false) hash ^= FillUsername.GetHashCode();
if (FillOauthScope != false) hash ^= FillOauthScope.GetHashCode(); if (FillOauthScope != false) hash ^= FillOauthScope.GetHashCode();
if (ResponseCompression != 0) hash ^= ResponseCompression.GetHashCode(); if (responseCompressed_ != null) hash ^= ResponseCompressed.GetHashCode();
if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode();
if (expectCompressed_ != null) hash ^= ExpectCompressed.GetHashCode();
return hash; return hash;
} }
@ -566,14 +680,18 @@ namespace Grpc.Testing {
output.WriteRawTag(40); output.WriteRawTag(40);
output.WriteBool(FillOauthScope); output.WriteBool(FillOauthScope);
} }
if (ResponseCompression != 0) { if (responseCompressed_ != null) {
output.WriteRawTag(48); output.WriteRawTag(50);
output.WriteEnum((int) ResponseCompression); output.WriteMessage(ResponseCompressed);
} }
if (responseStatus_ != null) { if (responseStatus_ != null) {
output.WriteRawTag(58); output.WriteRawTag(58);
output.WriteMessage(ResponseStatus); output.WriteMessage(ResponseStatus);
} }
if (expectCompressed_ != null) {
output.WriteRawTag(66);
output.WriteMessage(ExpectCompressed);
}
} }
public int CalculateSize() { public int CalculateSize() {
@ -593,12 +711,15 @@ namespace Grpc.Testing {
if (FillOauthScope != false) { if (FillOauthScope != false) {
size += 1 + 1; size += 1 + 1;
} }
if (ResponseCompression != 0) { if (responseCompressed_ != null) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ResponseCompression); size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseCompressed);
} }
if (responseStatus_ != null) { if (responseStatus_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus);
} }
if (expectCompressed_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExpectCompressed);
}
return size; return size;
} }
@ -624,8 +745,11 @@ namespace Grpc.Testing {
if (other.FillOauthScope != false) { if (other.FillOauthScope != false) {
FillOauthScope = other.FillOauthScope; FillOauthScope = other.FillOauthScope;
} }
if (other.ResponseCompression != 0) { if (other.responseCompressed_ != null) {
ResponseCompression = other.ResponseCompression; if (responseCompressed_ == null) {
responseCompressed_ = new global::Grpc.Testing.BoolValue();
}
ResponseCompressed.MergeFrom(other.ResponseCompressed);
} }
if (other.responseStatus_ != null) { if (other.responseStatus_ != null) {
if (responseStatus_ == null) { if (responseStatus_ == null) {
@ -633,6 +757,12 @@ namespace Grpc.Testing {
} }
ResponseStatus.MergeFrom(other.ResponseStatus); ResponseStatus.MergeFrom(other.ResponseStatus);
} }
if (other.expectCompressed_ != null) {
if (expectCompressed_ == null) {
expectCompressed_ = new global::Grpc.Testing.BoolValue();
}
ExpectCompressed.MergeFrom(other.ExpectCompressed);
}
} }
public void MergeFrom(pb::CodedInputStream input) { public void MergeFrom(pb::CodedInputStream input) {
@ -665,8 +795,11 @@ namespace Grpc.Testing {
FillOauthScope = input.ReadBool(); FillOauthScope = input.ReadBool();
break; break;
} }
case 48: { case 50: {
responseCompression_ = (global::Grpc.Testing.CompressionType) input.ReadEnum(); if (responseCompressed_ == null) {
responseCompressed_ = new global::Grpc.Testing.BoolValue();
}
input.ReadMessage(responseCompressed_);
break; break;
} }
case 58: { case 58: {
@ -676,6 +809,13 @@ namespace Grpc.Testing {
input.ReadMessage(responseStatus_); input.ReadMessage(responseStatus_);
break; break;
} }
case 66: {
if (expectCompressed_ == null) {
expectCompressed_ = new global::Grpc.Testing.BoolValue();
}
input.ReadMessage(expectCompressed_);
break;
}
} }
} }
} }
@ -691,7 +831,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<SimpleResponse> Parser { get { return _parser; } } public static pb::MessageParser<SimpleResponse> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[3]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[4]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
@ -867,7 +1007,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<StreamingInputCallRequest> Parser { get { return _parser; } } public static pb::MessageParser<StreamingInputCallRequest> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[4]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[5]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
@ -882,6 +1022,7 @@ namespace Grpc.Testing {
public StreamingInputCallRequest(StreamingInputCallRequest other) : this() { public StreamingInputCallRequest(StreamingInputCallRequest other) : this() {
Payload = other.payload_ != null ? other.Payload.Clone() : null; Payload = other.payload_ != null ? other.Payload.Clone() : null;
ExpectCompressed = other.expectCompressed_ != null ? other.ExpectCompressed.Clone() : null;
} }
public StreamingInputCallRequest Clone() { public StreamingInputCallRequest Clone() {
@ -901,6 +1042,22 @@ namespace Grpc.Testing {
} }
} }
/// <summary>Field number for the "expect_compressed" field.</summary>
public const int ExpectCompressedFieldNumber = 2;
private global::Grpc.Testing.BoolValue expectCompressed_;
/// <summary>
/// Whether the server should expect this request to be compressed. This field
/// is "nullable" in order to interoperate seamlessly with servers not able to
/// implement the full compression tests by introspecting the call to verify
/// the request's compression status.
/// </summary>
public global::Grpc.Testing.BoolValue ExpectCompressed {
get { return expectCompressed_; }
set {
expectCompressed_ = value;
}
}
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as StreamingInputCallRequest); return Equals(other as StreamingInputCallRequest);
} }
@ -913,12 +1070,14 @@ namespace Grpc.Testing {
return true; return true;
} }
if (!object.Equals(Payload, other.Payload)) return false; if (!object.Equals(Payload, other.Payload)) return false;
if (!object.Equals(ExpectCompressed, other.ExpectCompressed)) return false;
return true; return true;
} }
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (payload_ != null) hash ^= Payload.GetHashCode(); if (payload_ != null) hash ^= Payload.GetHashCode();
if (expectCompressed_ != null) hash ^= ExpectCompressed.GetHashCode();
return hash; return hash;
} }
@ -931,6 +1090,10 @@ namespace Grpc.Testing {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteMessage(Payload); output.WriteMessage(Payload);
} }
if (expectCompressed_ != null) {
output.WriteRawTag(18);
output.WriteMessage(ExpectCompressed);
}
} }
public int CalculateSize() { public int CalculateSize() {
@ -938,6 +1101,9 @@ namespace Grpc.Testing {
if (payload_ != null) { if (payload_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload); size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload);
} }
if (expectCompressed_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExpectCompressed);
}
return size; return size;
} }
@ -951,6 +1117,12 @@ namespace Grpc.Testing {
} }
Payload.MergeFrom(other.Payload); Payload.MergeFrom(other.Payload);
} }
if (other.expectCompressed_ != null) {
if (expectCompressed_ == null) {
expectCompressed_ = new global::Grpc.Testing.BoolValue();
}
ExpectCompressed.MergeFrom(other.ExpectCompressed);
}
} }
public void MergeFrom(pb::CodedInputStream input) { public void MergeFrom(pb::CodedInputStream input) {
@ -967,6 +1139,13 @@ namespace Grpc.Testing {
input.ReadMessage(payload_); input.ReadMessage(payload_);
break; break;
} }
case 18: {
if (expectCompressed_ == null) {
expectCompressed_ = new global::Grpc.Testing.BoolValue();
}
input.ReadMessage(expectCompressed_);
break;
}
} }
} }
} }
@ -982,7 +1161,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<StreamingInputCallResponse> Parser { get { return _parser; } } public static pb::MessageParser<StreamingInputCallResponse> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[5]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[6]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
@ -1091,7 +1270,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ResponseParameters> Parser { get { return _parser; } } public static pb::MessageParser<ResponseParameters> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[6]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[7]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
@ -1107,6 +1286,7 @@ namespace Grpc.Testing {
public ResponseParameters(ResponseParameters other) : this() { public ResponseParameters(ResponseParameters other) : this() {
size_ = other.size_; size_ = other.size_;
intervalUs_ = other.intervalUs_; intervalUs_ = other.intervalUs_;
Compressed = other.compressed_ != null ? other.Compressed.Clone() : null;
} }
public ResponseParameters Clone() { public ResponseParameters Clone() {
@ -1118,7 +1298,6 @@ namespace Grpc.Testing {
private int size_; private int size_;
/// <summary> /// <summary>
/// Desired payload sizes in responses from the server. /// Desired payload sizes in responses from the server.
/// If response_type is COMPRESSABLE, this denotes the size before compression.
/// </summary> /// </summary>
public int Size { public int Size {
get { return size_; } get { return size_; }
@ -1141,6 +1320,22 @@ namespace Grpc.Testing {
} }
} }
/// <summary>Field number for the "compressed" field.</summary>
public const int CompressedFieldNumber = 3;
private global::Grpc.Testing.BoolValue compressed_;
/// <summary>
/// Whether to request the server to compress the response. This field is
/// "nullable" in order to interoperate seamlessly with clients not able to
/// implement the full compression tests by introspecting the call to verify
/// the response's compression status.
/// </summary>
public global::Grpc.Testing.BoolValue Compressed {
get { return compressed_; }
set {
compressed_ = value;
}
}
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as ResponseParameters); return Equals(other as ResponseParameters);
} }
@ -1154,6 +1349,7 @@ namespace Grpc.Testing {
} }
if (Size != other.Size) return false; if (Size != other.Size) return false;
if (IntervalUs != other.IntervalUs) return false; if (IntervalUs != other.IntervalUs) return false;
if (!object.Equals(Compressed, other.Compressed)) return false;
return true; return true;
} }
@ -1161,6 +1357,7 @@ namespace Grpc.Testing {
int hash = 1; int hash = 1;
if (Size != 0) hash ^= Size.GetHashCode(); if (Size != 0) hash ^= Size.GetHashCode();
if (IntervalUs != 0) hash ^= IntervalUs.GetHashCode(); if (IntervalUs != 0) hash ^= IntervalUs.GetHashCode();
if (compressed_ != null) hash ^= Compressed.GetHashCode();
return hash; return hash;
} }
@ -1177,6 +1374,10 @@ namespace Grpc.Testing {
output.WriteRawTag(16); output.WriteRawTag(16);
output.WriteInt32(IntervalUs); output.WriteInt32(IntervalUs);
} }
if (compressed_ != null) {
output.WriteRawTag(26);
output.WriteMessage(Compressed);
}
} }
public int CalculateSize() { public int CalculateSize() {
@ -1187,6 +1388,9 @@ namespace Grpc.Testing {
if (IntervalUs != 0) { if (IntervalUs != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(IntervalUs); size += 1 + pb::CodedOutputStream.ComputeInt32Size(IntervalUs);
} }
if (compressed_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Compressed);
}
return size; return size;
} }
@ -1200,6 +1404,12 @@ namespace Grpc.Testing {
if (other.IntervalUs != 0) { if (other.IntervalUs != 0) {
IntervalUs = other.IntervalUs; IntervalUs = other.IntervalUs;
} }
if (other.compressed_ != null) {
if (compressed_ == null) {
compressed_ = new global::Grpc.Testing.BoolValue();
}
Compressed.MergeFrom(other.Compressed);
}
} }
public void MergeFrom(pb::CodedInputStream input) { public void MergeFrom(pb::CodedInputStream input) {
@ -1217,6 +1427,13 @@ namespace Grpc.Testing {
IntervalUs = input.ReadInt32(); IntervalUs = input.ReadInt32();
break; break;
} }
case 26: {
if (compressed_ == null) {
compressed_ = new global::Grpc.Testing.BoolValue();
}
input.ReadMessage(compressed_);
break;
}
} }
} }
} }
@ -1232,7 +1449,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<StreamingOutputCallRequest> Parser { get { return _parser; } } public static pb::MessageParser<StreamingOutputCallRequest> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[7]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[8]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
@ -1249,7 +1466,6 @@ namespace Grpc.Testing {
responseType_ = other.responseType_; responseType_ = other.responseType_;
responseParameters_ = other.responseParameters_.Clone(); responseParameters_ = other.responseParameters_.Clone();
Payload = other.payload_ != null ? other.Payload.Clone() : null; Payload = other.payload_ != null ? other.Payload.Clone() : null;
responseCompression_ = other.responseCompression_;
ResponseStatus = other.responseStatus_ != null ? other.ResponseStatus.Clone() : null; ResponseStatus = other.responseStatus_ != null ? other.ResponseStatus.Clone() : null;
} }
@ -1261,6 +1477,7 @@ namespace Grpc.Testing {
public const int ResponseTypeFieldNumber = 1; public const int ResponseTypeFieldNumber = 1;
private global::Grpc.Testing.PayloadType responseType_ = 0; private global::Grpc.Testing.PayloadType responseType_ = 0;
/// <summary> /// <summary>
/// DEPRECATED, don't use. To be removed shortly.
/// Desired payload type in the response from the server. /// Desired payload type in the response from the server.
/// If response_type is RANDOM, the payload from each response in the stream /// If response_type is RANDOM, the payload from each response in the stream
/// might be of different types. This is to simulate a mixed type of payload /// might be of different types. This is to simulate a mixed type of payload
@ -1298,19 +1515,6 @@ namespace Grpc.Testing {
} }
} }
/// <summary>Field number for the "response_compression" field.</summary>
public const int ResponseCompressionFieldNumber = 6;
private global::Grpc.Testing.CompressionType responseCompression_ = 0;
/// <summary>
/// Compression algorithm to be used by the server for the response (stream)
/// </summary>
public global::Grpc.Testing.CompressionType ResponseCompression {
get { return responseCompression_; }
set {
responseCompression_ = value;
}
}
/// <summary>Field number for the "response_status" field.</summary> /// <summary>Field number for the "response_status" field.</summary>
public const int ResponseStatusFieldNumber = 7; public const int ResponseStatusFieldNumber = 7;
private global::Grpc.Testing.EchoStatus responseStatus_; private global::Grpc.Testing.EchoStatus responseStatus_;
@ -1338,7 +1542,6 @@ namespace Grpc.Testing {
if (ResponseType != other.ResponseType) return false; if (ResponseType != other.ResponseType) return false;
if(!responseParameters_.Equals(other.responseParameters_)) return false; if(!responseParameters_.Equals(other.responseParameters_)) return false;
if (!object.Equals(Payload, other.Payload)) return false; if (!object.Equals(Payload, other.Payload)) return false;
if (ResponseCompression != other.ResponseCompression) return false;
if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false;
return true; return true;
} }
@ -1348,7 +1551,6 @@ namespace Grpc.Testing {
if (ResponseType != 0) hash ^= ResponseType.GetHashCode(); if (ResponseType != 0) hash ^= ResponseType.GetHashCode();
hash ^= responseParameters_.GetHashCode(); hash ^= responseParameters_.GetHashCode();
if (payload_ != null) hash ^= Payload.GetHashCode(); if (payload_ != null) hash ^= Payload.GetHashCode();
if (ResponseCompression != 0) hash ^= ResponseCompression.GetHashCode();
if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode();
return hash; return hash;
} }
@ -1367,10 +1569,6 @@ namespace Grpc.Testing {
output.WriteRawTag(26); output.WriteRawTag(26);
output.WriteMessage(Payload); output.WriteMessage(Payload);
} }
if (ResponseCompression != 0) {
output.WriteRawTag(48);
output.WriteEnum((int) ResponseCompression);
}
if (responseStatus_ != null) { if (responseStatus_ != null) {
output.WriteRawTag(58); output.WriteRawTag(58);
output.WriteMessage(ResponseStatus); output.WriteMessage(ResponseStatus);
@ -1386,9 +1584,6 @@ namespace Grpc.Testing {
if (payload_ != null) { if (payload_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload); size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload);
} }
if (ResponseCompression != 0) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ResponseCompression);
}
if (responseStatus_ != null) { if (responseStatus_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus); size += 1 + pb::CodedOutputStream.ComputeMessageSize(ResponseStatus);
} }
@ -1409,9 +1604,6 @@ namespace Grpc.Testing {
} }
Payload.MergeFrom(other.Payload); Payload.MergeFrom(other.Payload);
} }
if (other.ResponseCompression != 0) {
ResponseCompression = other.ResponseCompression;
}
if (other.responseStatus_ != null) { if (other.responseStatus_ != null) {
if (responseStatus_ == null) { if (responseStatus_ == null) {
responseStatus_ = new global::Grpc.Testing.EchoStatus(); responseStatus_ = new global::Grpc.Testing.EchoStatus();
@ -1442,10 +1634,6 @@ namespace Grpc.Testing {
input.ReadMessage(payload_); input.ReadMessage(payload_);
break; break;
} }
case 48: {
responseCompression_ = (global::Grpc.Testing.CompressionType) input.ReadEnum();
break;
}
case 58: { case 58: {
if (responseStatus_ == null) { if (responseStatus_ == null) {
responseStatus_ = new global::Grpc.Testing.EchoStatus(); responseStatus_ = new global::Grpc.Testing.EchoStatus();
@ -1468,7 +1656,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<StreamingOutputCallResponse> Parser { get { return _parser; } } public static pb::MessageParser<StreamingOutputCallResponse> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[8]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[9]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
@ -1584,7 +1772,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ReconnectParams> Parser { get { return _parser; } } public static pb::MessageParser<ReconnectParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[9]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[10]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
@ -1692,7 +1880,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ReconnectInfo> Parser { get { return _parser; } } public static pb::MessageParser<ReconnectInfo> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[10]; } get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[11]; }
} }
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {

@ -40,7 +40,6 @@ using System.Threading.Tasks;
using Grpc.Core; using Grpc.Core;
using Grpc.Core.Utils; using Grpc.Core.Utils;
using Grpc.Testing; using Grpc.Testing;
using Moq;
using NUnit.Framework; using NUnit.Framework;
namespace Grpc.IntegrationTesting namespace Grpc.IntegrationTesting
@ -52,19 +51,14 @@ namespace Grpc.IntegrationTesting
Channel channel; Channel channel;
TestService.TestServiceClient client; TestService.TestServiceClient client;
List<ChannelOption> options; List<ChannelOption> options;
Mock<TestService.TestServiceBase> serviceMock;
AsyncAuthInterceptor asyncAuthInterceptor; AsyncAuthInterceptor asyncAuthInterceptor;
[SetUp] [SetUp]
public void Init() public void Init()
{ {
serviceMock = new Mock<TestService.TestServiceBase>();
serviceMock.Setup(m => m.UnaryCall(It.IsAny<SimpleRequest>(), It.IsAny<ServerCallContext>()))
.Returns(new Func<SimpleRequest, ServerCallContext, Task<SimpleResponse>>(UnaryCallHandler));
server = new Server server = new Server
{ {
Services = { TestService.BindService(serviceMock.Object) }, Services = { TestService.BindService(new FakeTestService()) },
Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateSslServerCredentials() } } Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateSslServerCredentials() } }
}; };
server.Start(); server.Start();
@ -96,7 +90,7 @@ namespace Grpc.IntegrationTesting
channel = new Channel(Host, server.Ports.Single().BoundPort, channelCredentials, options); channel = new Channel(Host, server.Ports.Single().BoundPort, channelCredentials, options);
client = TestService.NewClient(channel); client = TestService.NewClient(channel);
client.UnaryCall(new SimpleRequest {}); client.UnaryCall(new SimpleRequest { });
} }
[Test] [Test]
@ -109,11 +103,14 @@ namespace Grpc.IntegrationTesting
client.UnaryCall(new SimpleRequest { }, new CallOptions(credentials: callCredentials)); client.UnaryCall(new SimpleRequest { }, new CallOptions(credentials: callCredentials));
} }
private Task<SimpleResponse> UnaryCallHandler(SimpleRequest request, ServerCallContext context) private class FakeTestService : TestService.TestServiceBase
{ {
var authToken = context.RequestHeaders.First((entry) => entry.Key == "authorization").Value; public override Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
Assert.AreEqual("SECRET_TOKEN", authToken); {
return Task.FromResult(new SimpleResponse()); var authToken = context.RequestHeaders.First((entry) => entry.Key == "authorization").Value;
Assert.AreEqual("SECRET_TOKEN", authToken);
return Task.FromResult(new SimpleResponse());
}
} }
} }
} }

@ -49,7 +49,7 @@ namespace Grpc.IntegrationTesting
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if DOTNET5_4 #if NETSTANDARD1_5
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);

@ -90,7 +90,7 @@ namespace Grpc.IntegrationTesting
private static string GetPath(string relativePath) private static string GetPath(string relativePath)
{ {
var assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var assemblyDir = Path.GetDirectoryName(typeof(TestCredentials).GetTypeInfo().Assembly.Location);
return Path.Combine(assemblyDir, relativePath); return Path.Combine(assemblyDir, relativePath);
} }
} }

@ -0,0 +1,72 @@
{
"buildOptions": {
"emitEntryPoint": true
},
"configurations": {
"Debug": {
"buildOptions": {
"copyToOutput": {
"include": "data/*",
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/dbg/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib"
}
}
}
},
"Release": {
"buildOptions": {
"copyToOutput": {
"include": "data/*",
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
"nativelibs/windows_x86/grpc_csharp_ext.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll",
"nativelibs/linux_x64/libgrpc_csharp_ext.so": "../../../libs/opt/libgrpc_csharp_ext.so",
"nativelibs/macosx_x64/libgrpc_csharp_ext.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib"
}
}
}
}
},
"runtimes": {
"win7-x64": { },
"debian.8-x64": { },
"osx.10.11-x64": { }
},
"dependencies": {
"Grpc.Auth": {
"target": "project"
},
"Grpc.Core": {
"target": "project"
},
"Google.Protobuf": "3.0.0-beta3",
"CommandLineParser": "1.9.71",
"NUnit": "3.2.0",
"NUnitLite": "3.2.0-*"
},
"frameworks": {
"net45": {
"dependencies": {
"Moq": "4.2.1510.2205"
},
"frameworkAssemblies": {
"System.Runtime": "",
"System.IO": ""
}
},
"netstandard1.5": {
"imports": [
"portable-net45",
"net45"
],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"System.Linq.Expressions": "4.0.11-rc2-24027"
}
}
}
}

@ -19,33 +19,13 @@ PREREQUISITES
HOW TO USE HOW TO USE
-------------- --------------
**Windows** **Windows, Linux, Mac OS X**
- Open Visual Studio and start a new project/solution. - Open Visual Studio / MonoDevelop / Xamarin Studio and start a new project/solution.
- Add NuGet package `Grpc` as a dependency (Project options -> Manage NuGet Packages). - Add NuGet package `Grpc` as a dependency (Project options -> Manage NuGet Packages).
That will also pull all the transitive dependencies (including the gRPC native library that
gRPC C# is using internally).
**Linux (Debian)**
- Open MonoDevelop and start a new project/solution.
- Add NuGet package `Grpc` as a dependency (Project -> Add NuGet packages).
That will also pull all the transitive dependencies (including the gRPC native library that
gRPC C# is using internally).
- NOTE: gRPC C# doesn't have a good story yet for shipping precompiled Linux version of Protocol Buffers compiler (_protoc_) and the gRPC _protoc_ plugin. You can install them using [gRPC Linuxbrew instructions][].
**Mac OS X** - To be able to generate code from Protocol Buffer (`.proto`) file definitions, add NuGet package `Grpc.Tools` that contains Protocol Buffers compiler (_protoc_) and the gRPC _protoc_ plugin.
- Open Xamarin Studio and start a new project/solution.
- Add NuGet package `Grpc` as a dependency (Project -> Add NuGet packages).
That will also pull all the transitive dependencies (including the gRPC native library that
gRPC C# is using internally).
- NOTE: gRPC C# doesn't have a good story yet for shipping precompiled Mac OS X version of Protocol Buffers compiler (_protoc_) and the gRPC _protoc_ plugin. You can install them using [gRPC Homebrew instructions][].
BUILD FROM SOURCE BUILD FROM SOURCE
----------------- -----------------
@ -61,26 +41,15 @@ If you are a user of gRPC C#, go to Usage section above.
- Open `src\csharp\Grpc.sln` (path is relative to gRPC repository root) - Open `src\csharp\Grpc.sln` (path is relative to gRPC repository root)
using Visual Studio using Visual Studio
**Linux** **Linux and Mac OS X**
- The grpc_csharp_ext native library needs to be built so you can build the gRPC C# solution: - The grpc_csharp_ext native library needs to be built so you can build the gRPC C# solution:
```sh
# from the gRPC repository root
$ make CONFIG=dbg grpc_csharp_ext
```
- Use MonoDevelop to open the solution Grpc.sln
**Mac OS X**
- The grpc_csharp_ext native library needs to be built so you can build the gRPC C# solution.
```sh ```sh
# from the gRPC repository root # from the gRPC repository root
$ tools/run_tests/run_tests.py -c dbg -l csharp --build_only $ tools/run_tests/run_tests.py -c dbg -l csharp --build_only
``` ```
- Use Xamarin Studio to open the solution Grpc.sln - Use MonoDevelop / Xamarin Studio to open the solution Grpc.sln
RUNNING TESTS RUNNING TESTS
------------- -------------
@ -100,10 +69,17 @@ different languages.
tools/run_tests/run_tests.py -l csharp tools/run_tests/run_tests.py -l csharp
``` ```
ON .NET CORE SUPPORT
------------------
We are committed to providing full support for [.NET Core](https://dotnet.github.io/) in near future,
but currently, the support is for .NET Core is experimental/work-in-progress.
DOCUMENTATION DOCUMENTATION
------------- -------------
- the gRPC C# reference documentation is available online at [grpc.io][] - [API Reference][]
- [Helloworld example][] - [Helloworld Example][]
- [RouteGuide Tutorial][]
CONTENTS CONTENTS
-------- --------
@ -111,15 +87,15 @@ CONTENTS
- ext: - ext:
The extension library that wraps C API to be more digestible by C#. The extension library that wraps C API to be more digestible by C#.
- Grpc.Auth: - Grpc.Auth:
gRPC OAuth2 support. gRPC OAuth2/JWT support.
- Grpc.Core: - Grpc.Core:
The main gRPC C# library. The main gRPC C# library.
- Grpc.Examples: - Grpc.Examples:
API examples for math.proto API examples for math.proto
- Grpc.Examples.MathClient: - Grpc.Examples.MathClient:
An example client that sends some requests to math server. An example client that sends requests to math server.
- Grpc.Examples.MathServer: - Grpc.Examples.MathServer:
An example client that sends some requests to math server. An example server that implements a simple math service.
- Grpc.IntegrationTesting: - Grpc.IntegrationTesting:
Cross-language gRPC implementation testing (interop testing). Cross-language gRPC implementation testing (interop testing).
@ -130,10 +106,6 @@ Internally, gRPC C# uses a native library written in C (gRPC C core) and invokes
Prior to version 0.13, installing `grpc_csharp_ext` was required to make gRPC work on Linux and MacOS. Starting with version 0.13, we have improved the packaging story significantly and precompiled versions of the native library for all supported platforms are now shipped with the NuGet package. Just installing the `Grpc` NuGet package should be the only step needed to use gRPC C#, regardless of your platform (Windows, Linux or Mac) and the bitness (32 or 64bit). Prior to version 0.13, installing `grpc_csharp_ext` was required to make gRPC work on Linux and MacOS. Starting with version 0.13, we have improved the packaging story significantly and precompiled versions of the native library for all supported platforms are now shipped with the NuGet package. Just installing the `Grpc` NuGet package should be the only step needed to use gRPC C#, regardless of your platform (Windows, Linux or Mac) and the bitness (32 or 64bit).
[gRPC Linuxbrew instructions]:https://github.com/grpc/homebrew-grpc#quick-install-linux [API Reference]: http://www.grpc.io/grpc/csharp/
[gRPC Homebrew instructions]:https://github.com/grpc/homebrew-grpc#quick-install-linux [Helloworld Example]: ../../examples/csharp/helloworld
[homebrew]:http://brew.sh [RouteGuide Tutorial]: http://www.grpc.io/docs/tutorials/basic/csharp.html
[gRPC install script]:https://raw.githubusercontent.com/grpc/homebrew-grpc/master/scripts/install
[grpc.io]: http://www.grpc.io/docs/installation/csharp.html
[Debian jessie-backports]:http://backports.debian.org/Instructions/
[Helloworld example]:../../examples/csharp/helloworld

@ -41,12 +41,12 @@ set NUGET=C:\nuget\nuget.exe
@rem Collect the artifacts built by the previous build step if running on Jenkins @rem Collect the artifacts built by the previous build step if running on Jenkins
@rem TODO(jtattermusch): is there a better way to do this? @rem TODO(jtattermusch): is there a better way to do this?
xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=windows\artifacts\* Grpc.Core\windows_x86\ xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=windows\artifacts\* nativelibs\windows_x86\
xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=windows\artifacts\* Grpc.Core\windows_x64\ xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=windows\artifacts\* nativelibs\windows_x64\
xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=linux\artifacts\* Grpc.Core\linux_x86\ xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=linux\artifacts\* nativelibs\linux_x86\
xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=linux\artifacts\* Grpc.Core\linux_x64\ xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=linux\artifacts\* nativelibs\linux_x64\
xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=macos\artifacts\* Grpc.Core\macosx_x86\ xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=macos\artifacts\* nativelibs\macosx_x86\
xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=macos\artifacts\* Grpc.Core\macosx_x64\ xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=macos\artifacts\* nativelibs\macosx_x64\
@rem Collect protoc artifacts built by the previous build step @rem Collect protoc artifacts built by the previous build step
xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x86\ xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x86\

@ -249,10 +249,12 @@ grpcsharp_batch_context_recv_initial_metadata(
GPR_EXPORT intptr_t GPR_CALLTYPE grpcsharp_batch_context_recv_message_length( GPR_EXPORT intptr_t GPR_CALLTYPE grpcsharp_batch_context_recv_message_length(
const grpcsharp_batch_context *ctx) { const grpcsharp_batch_context *ctx) {
grpc_byte_buffer_reader reader;
if (!ctx->recv_message) { if (!ctx->recv_message) {
return -1; return -1;
} }
return (intptr_t)grpc_byte_buffer_length(ctx->recv_message); grpc_byte_buffer_reader_init(&reader, ctx->recv_message);
return (intptr_t)grpc_byte_buffer_length(reader.buffer_out);
} }
/* /*

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>grpc.native.csharp</id>
<version>$version$</version>
<authors>Google Inc.</authors>
<owners>grpc-packages</owners>
<licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl>
<projectUrl>http://github.com/grpc/grpc</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Native extension needed by gRPC C# library. This is not the package you are looking for, it is only meant to be used as a dependency.</description>
<releaseNotes>Release of gRPC C core $version$ libraries.</releaseNotes>
<copyright>Copyright 2015</copyright>
<title>gRPC C# Native Extension</title>
<summary>Native library required by gRPC C#</summary>
<tags>gRPC native</tags>
</metadata>
<files>
<file src="grpc.native.csharp.targets" target="\build\portable-net45+netcore45+wpa81+wp8\grpc.native.csharp.targets" />
<file src="windows_x86/grpc_csharp_ext.dll" target="/build/native/bin/windows_x86/grpc_csharp_ext.dll" />
<file src="windows_x64/grpc_csharp_ext.dll" target="/build/native/bin/windows_x64/grpc_csharp_ext.dll" />
<file src="linux_x86/libgrpc_csharp_ext.so" target="/build/native/bin/linux_x86/libgrpc_csharp_ext.so" />
<file src="linux_x64/libgrpc_csharp_ext.so" target="/build/native/bin/linux_x64/libgrpc_csharp_ext.so" />
<file src="macosx_x86/libgrpc_csharp_ext.dylib" target="/build/native/bin/macosx_x86/libgrpc_csharp_ext.dylib" />
<file src="macosx_x64/libgrpc_csharp_ext.dylib" target="/build/native/bin/macosx_x64/libgrpc_csharp_ext.dylib" />
</files>
</package>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save