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