This repository contains a sample banking application built using Cloud Spanner.
NOTE: Requires bash, gcloud, mvn, grpc_cli installed.
-
Create a database locally using cloud-spanner-emulator and export spanner host for client libraries to work.
$ mvn clean install -Dmaven.test.skip=true $ bash run.sh emulator $ export SPANNER_EMULATOR_HOST="localhost:9010"
-
Bring up the FinAppServer hosting a grpc service.
$ bash run.sh server java \ --spanner_project_id=test-project --spanner_instance_id=test-instance \ --spanner_database_id=test-database
To run the application using the JDBC implementation, in the command above, substitute
java
withjdbc
.
-
Call RPCs using grpc_cli.
$ grpc_cli call localhost:8080 CreateCustomer \ "name: 'google' address: 'amphitheatre pkwy'" --channel_creds_type=insecure
-
Bring up the finapp server using steps described above.
-
In a separate terminal, bring up the workload using the following command:
$ bash run.sh workload \ --address-name localhost --port 8080 --num-accounts 200
- Set up the emulator as described in #1 above.
mvn integration-test
tests the Java client implementationmvn integration-test -DSPANNER_USE_JDBC=true
tests the JDBC implementation