README.md
1# Showcase Integration Testing
2
3[GAPIC Showcase](https://github.com/googleapis/gapic-showcase) is an API that demonstrates Generated
4API Client (GAPIC) features and common API patterns used by Google. It follows the [Cloud APIs
5design guide](https://cloud.google.com/apis/design/). `gapic-generator-java` generates a client for
6the Showcase API which can communicate with a local Showcase server to perform integration tests.
7
8## Requirements
9
10* Install [Go](https://go.dev) in your `PATH`.
11
12## Installing the Server
13
14Using the latest version of showcase is recommended, but backward compatibility between server
15versions is not guaranteed. If changing the version of the server, it may also be necessary to
16update to a compatible client version in `./WORKSPACE`.
17
18```shell
19$ GAPIC_SHOWCASE_VERSION=0.27.0
20$ go install github.com/googleapis/gapic-showcase/cmd/gapic-showcase@v"$GAPIC_SHOWCASE_VERSION"
21$ PATH=$PATH:`go env GOPATH`/bin
22$ gapic-showcase --help
23> Root command of gapic-showcase
24>
25> Usage:
26> gapic-showcase [command]
27>
28> Available Commands:
29> completion Emits bash a completion for gapic-showcase
30> compliance This service is used to test that GAPICs...
31> echo This service is used showcase the four main types...
32> help Help about any command
33> identity A simple identity service.
34> messaging A simple messaging service that implements chat...
35> run Runs the showcase server
36> sequence Sub-command for Service: Sequence
37> testing A service to facilitate running discrete sets of...
38>
39> Flags:
40> -h, --help help for gapic-showcase
41> -j, --json Print JSON output
42> -v, --verbose Print verbose output
43> --version version for gapic-showcase
44```
45
46## Running the Server
47
48Run the showcase server to allow requests to be sent to it. This opens port `:7469` to send and
49receive requests.
50
51```shell
52$ gapic-showcase run
53> 2022/11/21 16:22:15 Showcase listening on port: :7469
54> 2022/11/21 16:22:15 Starting endpoint 0: gRPC endpoint
55> 2022/11/21 16:22:15 Starting endpoint 1: HTTP/REST endpoint
56> 2022/11/21 16:22:15 Starting endpoint multiplexer
57> 2022/11/21 16:22:15 Listening for gRPC-fallback connections
58> 2022/11/21 16:22:15 Listening for gRPC connections
59> 2022/11/21 16:22:15 Listening for REST connections
60> 2022/11/21 16:22:15 Fallback server listening on port: :1337
61```
62
63## Running the Integration Tests
64
65Open a new terminal window in the root project directory.
66
67```shell
68$ cd showcase
69$ mvn verify -P enable-integration-tests -P enable-golden-tests
70```
71
72Note:
73
74* `-P enable-golden-tests` is optional. These tests do not require a local server.
75
76## Update the Golden Showcase Files
77
78Open a new terminal window in the root project directory.
79
80```shell
81$ cd showcase
82$ mvn compile -P update
83```
84