Skip to content

Commit

Permalink
docs: Update samples' README.md to ensure given (#3420)
Browse files Browse the repository at this point in the history
commands run samples.
  • Loading branch information
gagangupt16 authored Nov 7, 2024
1 parent 8b2e5ef commit 663a974
Showing 1 changed file with 11 additions and 17 deletions.
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

0 comments on commit 663a974

Please sign in to comment.