wiremock / wiremock-grpc-demos

Examples of how to use the WireMock gRPC extension in Java and standalone

Home Page:https://wiremock.org/docs/grpc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WireMock gRPC Demos

Java

This example requires at least Java 11 to be installed.

To generate all the necessary code and descriptors then run the tests, run the following command:

cd java
./gradlew check

Standalone

This example requires protoc and at least Java 11 to be installed. Optionally, grpcurl can be used for testing.

To generate the descriptor file from the .proto file and start the standalone server with gRPC enabled:

cd standalone
./run.sh

If you have grpcurl installed you can test the mock as follows:

grpcurl -d '{"name": "Tom" }' -plaintext \
  -proto ExampleServices.proto \
  localhost:8000 com.example.grpc.GreetingService/greeting

Docker

This example requires protoc and at least Java 11 to be installed. Optionally, grpcurl can be used for testing.

To generate the descriptor file from the .proto file and start WireMock in Docker with gRPC enabled:

cd docker
./run.sh

If you have grpcurl installed you can test the mock as follows:

grpcurl -d '{"name": "Tom" }' -plaintext \
  -proto ExampleServices.proto \
  localhost:8080 com.example.grpc.GreetingService/greeting

About

Examples of how to use the WireMock gRPC extension in Java and standalone

https://wiremock.org/docs/grpc/

License:Apache License 2.0


Languages

Language:Java 92.4%Language:Shell 7.6%