Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update samples' README.md to ensure given commands run samples. #3420

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,23 @@ Install [Maven](http://maven.apache.org/).
Build your project from the root directory (`java-spanner`):

mvn clean package -DskipTests
cd samples/snippets
mvn package

Every subsequent command here should be run from a subdirectory (`cd samples/snippets`).
Every subsequent command here should be run from a subdirectory `samples/snippets`.

You can run a given `ClassName` via:
### Running samples

mvn exec:java -Dexec.mainClass=com.example.spanner.ClassName \
-DpropertyName=propertyValue \
-Dexec.args="any arguments to the app"
Usage:

### Running a simple query (using the quickstart sample)
java -jar target/spanner-snippets/spanner-google-cloud-samples.jar operation my-instance my-database

mvn exec:java -Dexec.mainClass=com.example.spanner.QuickstartSample -Dexec.args="my-instance my-database"
#### Examples

## Tutorial
Create Database:

### Running the tutorial
mvn exec:java -Dexec.mainClass=com.example.spanner.admin.archived.SpannerSample -Dexec.args="<command> my-instance my-database"
java -jar target/spanner-google-cloud-samples-jar-with-dependencies.jar my-instance my-database

## Tracing sample
`TracingSample.java` demonstrates how to export traces generated by client library to StackDriver and to /tracez page.
Listing database operations:

### Running the tracing sample
mvn exec:java -Dexec.mainClass=com.example.spanner.TracingSample -Dexec.args="my-instance my-database"

## Test
mvn verify -Dspanner.test.instance=<instance id> -Dspanner.sample.database=<new database id> -Dspanner.quickstart.database=<existing database id>
java -jar target/spanner-snippets/spanner-google-cloud-samples.jar listdatabaseoperations my-instance my-database
Loading