Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Getting Started with Pub/Sub Lite Samples

Running samples and tests using Cloud Shell

Google Cloud Shell has application default credentials from its compute instance which will allow you to run an integration test without having to obtain GOOGLE_APPLICATION_CREDENTIALS.

However, tests require an additional environment variable GOOGLE_CLOUD_PROJECT_NUMBER to run. For instance,

In QuickStartIT.java:

private static final String GOOGLE_CLOUD_PROJECT_NUMBER =
       System.getenv("GOOGLE_CLOUD_PROJECT_NUMBER");

Here, the program needs you to provide your Google Cloud Project Number in an environment variable.

To run a sample's integration test in Cloud Shell:

  1. cd samples/ - all samples are located in java-pubsublite/samples/snippets directory.

  2. mvn clean -Dtest=QuickStartIT test - this runs the integration test for UpdateTopicExample.java.

To run a sample, update the developer's TODO section in the snippet, then:

  1. cd samples/snippets/ - all samples are located in java-pubsublite/samples/snippets directory.

  2. mvn compile exec:java -Dexec.mainClass=pubsublite.ListTopicsExample - this should list the topics in your project.