Commit Graph

151 Commits

Author SHA1 Message Date
Ruben de Vries e6c8534f10 docs: add note about directExecutor in example tests. 2019-05-15 10:42:33 -07:00
Eric Anderson 1b6c131056 Revert "Examples: Add a JWT authentication example (#5154)"
This reverts commit ac52e27b2a.

See #5665. Right now it is not any more informative than the header
example, and it encourages some practices I'd rather avoid. It will get
re-added later with improvements.
2019-05-07 17:27:44 -07:00
Kislay Kishore bd2f3c5b62 examples: Fix comment in RouteGuideServer.java (#5670) 2019-05-06 14:23:49 -07:00
ZHANG Dapeng a2cda8d15d
all: fix lint 2019-03-20 09:01:25 -07:00
Tim van der Lippe d35fbd7eee all: Update to Mockito 2
This is the public port of cl/238445847

Fixes #5319
2019-03-19 14:17:52 -07:00
Dan Torrey f155d60e75 examples: Add a missing space in comment (#5472)
Add a missing space in the comment before requestStream.setOnReadyHandler()
2019-03-13 10:27:15 -07:00
AmiDavidW 128409000a examples: add an example of server side compression support 2019-03-06 12:25:57 -08:00
Carl Mastrangelo 3a39b81cf5
all: remove java6 type args 2019-02-04 10:03:50 -08:00
Jihun Cho 9c796ac23d examples: fix the logger name to match actual class. This PR was originally made by chengsluo (#5159) 2019-01-30 10:42:19 -08:00
Carl Mastrangelo b6af40e510 examples,netty: fix lint errors 2019-01-02 15:30:31 -08:00
ZHANG Dapeng df21e40285
all: fix lint 2019-01-02 15:28:44 -08:00
sanjaypujare ac52e27b2a
Examples: Add a JWT authentication example (#5154) 2018-12-13 12:26:39 -08:00
ZHANG Dapeng 3202fcc7d9
examples: move TLS example to a separate project 2018-12-06 12:03:25 -08:00
ZHANG Dapeng f5b63d703c
examples: make corrections to document of helloworld tls example 2018-12-03 15:08:59 -08:00
ZHANG Dapeng c31f4f1ddf
examples: move alts example to a separate directory 2018-12-03 14:59:07 -08:00
Carl Mastrangelo b0f423295b
all: use Java7 brackets 2018-09-14 13:52:29 -07:00
Maxime Guerreiro 4df4d06f78 examples: Fix comment in HelloWorldClient
This client talks to HelloWorld server and not to the route guide one.
2018-06-20 08:58:53 -07:00
DmPanov 49d7e5fd0b examples: replace client certificate in trust store in 'Hello world example with TLS with mutual auth'
... with proper CA certificate to fix SSLV3_ALERT_HANDSHAKE_FAILURE in two host with different IPs setup, switch to required client auth to fail on incorrect configuration
2018-06-13 12:30:57 -07:00
Kun Zhang 68a462e447
noop: resolve lint warnings found at import. (#4496) 2018-05-23 11:58:19 -07:00
Carl Mastrangelo e3f8891f57
protobuf,examples: move json encoding to examples 2018-05-17 15:48:45 -07:00
ZHANG Dapeng 701c127f4c
examples: use GrpcCleanupRule for test examples 2018-05-14 11:30:38 -07:00
Carl Mastrangelo 60a0b0c471
all: normalize copyright header 2018-05-03 14:55:21 -07:00
Jorg Heymans 48f103c1ed examples: remove deprecated usage of usePlainText(boolean) (#4396)
Update examples (including android) to use non deprecated version of method.
2018-04-30 16:12:41 -07:00
Jan Tattermusch 92f95de3cb routeguide: reimplement distance calculation 2018-03-23 08:25:26 -07:00
Jiangtao Li e7f2f1dedd alts: add gRPC ALTS 2018-02-15 09:28:00 -08:00
Nicholas DiPiazza 14ed692974 examples: Add a "hello-world" with TLS configured 2018-02-06 17:33:32 -08:00
Eric Gribkoff 512e55444e
cronet,examples: remove unused imports 2018-02-05 15:45:52 -08:00
Eric Anderson ba8063e7b0 all: Prefer mock+delegatesTo() over Mockito.spy()
Spies are really magical and easily produce unexpected results. Using them in
tests can easily yield tests that don't do what you think they do. Delegation
is much safer when possible.

Delegation doesn't work when methods `return true`, final methods, and with
restricted visibility, though. So CensusModulesTest and
MaxConnectionIdleManagerTest are left as-is.
2018-01-11 09:32:54 -08:00
Carl Mastrangelo c9b02db276
all: add Status messages to all statuses 2017-12-04 19:00:16 -08:00
kenji yoshida 4db323c5c4 all: fix grammar typos in javadocs 2017-11-22 18:00:51 -08:00
Carl Mastrangelo 253a01461b
examples: remove deprecated stub field references 2017-11-01 14:57:24 -07:00
ZHANG Dapeng cbcab9b498 examples: fix Bazel build
Refactor the proto file `helloworld_streaming.proto` because Bazel and Gradle have incompatible base directory for proto imports. Bazel's proto import is relative to WORKSPACE, whereas Gradle proto plugin's is relative to `${sourceSet}/proto/`. In `helloworld_streaming.proto` file, `import helloworld.proto` does not work for Bazel. If `import src/main/proto/helloworld.proto`, that works for Bazel, but Gradle and Maven would fail. Some workarounds are very hacky, so use independent proto without imports instead to avoid this issue.
2017-09-29 13:14:19 -07:00
Ryan Michela 589da070f2 Manual flow-control and back-pressure demo 2017-09-26 10:01:42 -07:00
Carl Mastrangelo 84fce477c2 all: fix minor lint warnings 2017-07-17 17:21:07 -07:00
Carl Mastrangelo 6ea2b8aacb examples: fix errorprone warning about charset 2017-07-17 15:35:08 -07:00
Carl Mastrangelo 193fd057a5 stub: clean up client calls to avoid synthetic class 2017-07-14 13:38:04 -07:00
Carl Mastrangelo e6ad90e43e examples: don't use deprecated MethodDescriptor API 2017-07-14 12:36:18 -07:00
ZHANG Dapeng 4e31ccba4c examples: use the official error_details.proto
The `error_details.proto` file in `examples/src/main/proto/` was not originated from grpc-java. 
It was officially opensourced at https://github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto
2017-06-29 16:05:33 -07:00
zpencer 532450996a core: detect invalid states on server side (eg zero responses for unary) (#3068)
The current check in ServerCallImpl is theoretically unsafe (#3059). Move that check into the stub, and expand the unit tests to cover other interesting edge cases on the server side:

client sends one, but zero requests received at onHalfClose
client sends one, but > 1 requests received at onHalfClose
server sends one, but zero responses sent at onComplete
server sends one, but > 1 responses sent via onNext
fixes #2243
fixes #3059
2017-06-15 09:33:01 -07:00
ZHANG Dapeng 851065dd08 examples: migrate unittest examples to GrpcServerRule
migrated simple tests using `GrpcServerRule`.
Kept the low level in-process channel setup and tear down code for the RouteGuide example to show how users can use in-process directly to set more custom channel builder options when needed.

resolves #2490
2017-06-05 16:32:18 -07:00
Carl Mastrangelo 166108a943 all: fix licence whitespace 2017-06-01 14:28:37 -07:00
Carl Mastrangelo 3bfd630bff all: update to Apache 2 licence
Also, update the authors.
2017-05-31 13:29:01 -07:00
Eric Anderson 10cbd49dbf examples: Always pass an executor to Futures.addCallback()
The executor-less version is being removed, as having the executor
explicitly specified is less bug-prone.
2017-03-06 08:40:32 -08:00
Eric Anderson d7d0d73146 examples: Update imports to new-style 2017-03-03 11:48:46 -08:00
Kun Zhang 1aaf1a989c compiler: final bindService() in generated code. (#2553)
So that it won't be overridden by Mockito when it creates a mock for
the server interface.
2016-12-29 10:32:47 -08:00
Kun Zhang 325c965fdc example: really fix the loss of precision error (#2435) 2016-11-22 22:17:36 -08:00
Kun Zhang a05892a9fe examples: address ErrorProne and warnings. (#2433)
Discovered when importing grpc to internal repo:

1. ErrorProne: Compound assignments from floating point to integral
types hide dangerous casts.

2. found raw type: io.grpc.ManagedChannelBuilder missing type arguments
  for generic class io.grpc.ManagedChannelBuilder<T>
2016-11-22 15:17:44 -08:00
ZHANG Dapeng 7306df4266 examples: unit test examples for users
Demonstrate unit testing gRPC clients and servers with `InProcessTransport`.
2016-11-15 14:15:55 -08:00
Benjamin Ellenberger 8826bb5e3e Remove UTF-8 symbols in example to simplify compilation for most people. 2016-11-14 21:49:34 -08:00
ZHANG Dapeng 16c07ba434 examples: fix bound method not same as in service descriptor for HelloJsonServer
Fix the following issue.
HelloJsonServer fails to start:
````
Exception in thread "main" java.lang.IllegalStateException: Bound method for helloworld.Greeter/SayHello not same instance as method in service descriptor
    at io.grpc.ServerServiceDefinition$Builder.build(ServerServiceDefinition.java:156)
    at io.grpc.examples.advanced.HelloJsonServer.bindService(HelloJsonServer.java:131)
    at io.grpc.examples.advanced.HelloJsonServer.start(HelloJsonServer.java:70)
    at io.grpc.examples.advanced.HelloJsonServer.main(HelloJsonServer.java:105)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
````
2016-09-15 17:24:28 -07:00