Skip to content

Commit f2a276f

Browse files
authored
Merge branch 'master' into monitoring-quickstart
2 parents 71dd194 + adc9d2a commit f2a276f

File tree

15 files changed

+72
-49
lines changed

15 files changed

+72
-49
lines changed

appengine/endpoints-frameworks-v2/discovery/jenkins.sh

100644100755
+4
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,27 @@ function TestEndpoints () {
2222
# Test getGreeting Endpoint (hello world!)
2323
curl -X GET \
2424
"https://${2}-dot-${1}.appspot.com/_ah/api/helloworld/v1/hellogreeting/0" | \
25+
tee "$ERROR_OUTPUT_DIR/response.json" | \
2526
grep "hello version-${2}"
2627

2728
# Test getGreeting Endpoint (goodbye world!)
2829
curl -X GET \
2930
"https://${2}-dot-${1}.appspot.com/_ah/api/helloworld/v1/hellogreeting/1" | \
31+
tee "$ERROR_OUTPUT_DIR/response.json" | \
3032
grep "goodbye world!"
3133

3234
# Test listGreeting Endpoint (hello world! and goodbye world!)
3335
curl -X GET \
3436
"https://${2}-dot-${1}.appspot.com/_ah/api/helloworld/v1/hellogreeting" | \
37+
tee "$ERROR_OUTPUT_DIR/response.json" | \
3538
grep "hello world!\|goodbye world!"
3639

3740
# Test multiply Endpoint (This is a greeting.)
3841
curl -X POST \
3942
-H "Content-Type: application/json" \
4043
--data "{'message':'This is a greeting from instance ${2}'}." \
4144
"https://${2}-dot-${1}.appspot.com/_ah/api/helloworld/v1/hellogreeting/1" | \
45+
tee "$ERROR_OUTPUT_DIR/response.json" | \
4246
grep "This is a greeting from instance ${2}."
4347
}
4448

appengine/endpoints-frameworks-v2/discovery/src/main/java/com/example/helloendpoints/Greetings.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class Greetings {
4343
public static ArrayList<HelloGreeting> greetings = new ArrayList<HelloGreeting>();
4444

4545
static {
46-
greetings.add(new HelloGreeting("hello version-jerjou-test!"));
46+
greetings.add(new HelloGreeting("hello world!"));
4747
greetings.add(new HelloGreeting("goodbye world!"));
4848
}
4949
//[END api_def]

appengine/helloworld-new-plugins/pom.xml

+1-5
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,13 @@ Copyright 2015 Google Inc.
5757
<configuration>
5858
<!-- dev appserver configuration (standard environment only) -->
5959
<!--
60-
<devserver.host>127.0.0.1</devserver.port>
60+
<devserver.host>127.0.0.1</devserver.host>
6161
<devserver.port>8080</devserver.port>
6262
-->
6363
<!-- staging configuration (standard/flex-compat environment only) -->
6464
<!--
6565
<stage.enableJarSplitting>true</stage.enableJarSplitting>
6666
-->
67-
<!-- staging configuration (flexible environment only) -->
68-
<!--
69-
<stage.artifact>target/some-customer-artifact.jar</stage.artifact>
70-
-->
7167
<!-- deploy configuration -->
7268
<deploy.promote>true</deploy.promote>
7369
<deploy.stopPreviousVersion>true</deploy.stopPreviousVersion>

datastore/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This directory contains sample code used in Google Cloud Datastore documentation
66

77
1. Ensure that you have:
88
* Created a Google Developers Console project with the Datastore API enabled. Follow [these instructions](https://cloud.google.com/docs/authentication#preparation) to get your project set up.
9-
* Installed the Google Cloud SDK and run the following commands in command line: `gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`.
9+
* Installed the Google Cloud SDK and run the following commands in command line: `gcloud auth application-default login` and `gcloud config set project [YOUR PROJECT ID]`.
1010
* Installed [Maven](https://maven.apache.org/) and Java 7 (or above).
1111

1212
2. Compile the program by typing `mvn clean compile` in command line.

datastore/src/main/java/com/google/datastore/snippets/TaskList.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ private void assertArgsLength(String[] args, int expectedLength) {
202202
* Exercises the methods defined in this class.
203203
*
204204
* <p>Assumes that you are authenticated using the Google Cloud SDK (using
205-
* {@code gcloud auth login}).
205+
* {@code gcloud auth application-default login}).
206206
*/
207207
public static void main(String[] args) throws Exception {
208208
TaskList taskList = new TaskList();

flexible/async-rest/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ First, complete the following steps:
1414
- Obtain an app key for the Google Places WebService API.
1515
- Download and install [the Beta build of the Google Cloud SDK](https://developers.google.com/cloud/sdk/#Quick_Start).
1616
- Install the Cloud SDK `app-engine-java` component.
17-
- Authenticate wth the gcloud SDK: gcloud auth login.
17+
- Authenticate wth the gcloud SDK: gcloud auth application-default login.
1818
- Install [Maven](http://maven.apache.org/download.cgi) if you haven't already.
1919

2020

flexible/sparkjava/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Setup
2424

2525
2. Set up the local development environment by [installing the Google Cloud
2626
SDK](https://cloud.google.com/sdk/) and running the following commands in
27-
command line: `gcloud auth login` and `gcloud config set project [YOUR
27+
command line: `gcloud auth application-default login` and `gcloud config set project [YOUR
2828
PROJECT ID]`.
2929

3030
3. Ensure that you have Maven installed and configured to use Java 8. See

flexible/sparkjava/jenkins.sh

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ set -xe
2121
function runtests () {
2222
curl -X GET \
2323
"https://${2}-dot-${1}.appspot.com/api/users" | \
24+
tee "$ERROR_OUTPUT_DIR/response.json" | \
2425
grep "^\\["
2526
}
2627

jenkins.sh

+27-12
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,58 @@ shopt -s globstar
1919
# We spin up some subprocesses. Don't kill them on hangup
2020
trap '' HUP
2121

22-
app_version=""
22+
# Temporary directory to store any output to display on error
23+
export ERROR_OUTPUT_DIR
24+
ERROR_OUTPUT_DIR="$(mktemp -d)"
25+
trap 'rm -r "${ERROR_OUTPUT_DIR}"' EXIT
2326

24-
# shellcheck disable=SC2120
2527
delete_app_version() {
2628
yes | gcloud --project="${GOOGLE_PROJECT_ID}" \
2729
app versions delete "${1}"
2830
}
31+
2932
handle_error() {
3033
errcode=$? # Remember the error code so we can exit with it after cleanup
3134

32-
# Clean up
33-
delete_app_version "$@"
35+
# Clean up remote app version
36+
delete_app_version "${1}" &
37+
38+
# Display any errors
39+
if [ -n "$(find "${2}" -mindepth 1 -print -quit)" ]; then
40+
cat "${2:?}"/* 1>&2
41+
fi
42+
43+
wait
3444

3545
exit ${errcode}
3646
}
3747

48+
cleanup() {
49+
delete_app_version "${GOOGLE_VERSION_ID}" &
50+
rm -r "${ERROR_OUTPUT_DIR:?}/"*
51+
}
52+
3853
# First, style-check the shell scripts
3954
shellcheck ./**/*.sh
4055

4156
# Find all jenkins.sh's and run them.
4257
find . -mindepth 2 -maxdepth 5 -name jenkins.sh -type f | while read -r path; do
4358
dir="${path%/jenkins.sh}"
44-
# Use just the first letter of each subdir in version name
59+
# Need different app versions because flex can't deploy over an existing
60+
# version. Use just the first letter of each subdir in version name
61+
export GOOGLE_VERSION_ID
4562
# shellcheck disable=SC2001
46-
app_version="jenkins-$(echo "${dir#./}" | sed 's#\([a-z]\)[^/]*/#\1-#g')"
63+
GOOGLE_VERSION_ID="jenkins-$(echo "${dir#./}" | sed 's#\([a-z]\)[^/]*/#\1-#g')"
4764

48-
trap 'handle_error $app_version' ERR
65+
trap 'handle_error "${GOOGLE_VERSION_ID}" "${ERROR_OUTPUT_DIR}"' ERR
4966
(
5067
# If there's an error, clean up
5168

5269
pushd "${dir}"
53-
# Need different app versions because flex can't deploy over an existing
54-
# version
55-
GOOGLE_VERSION_ID="${app_version}" /bin/bash ./jenkins.sh
70+
/bin/bash ./jenkins.sh
5671

57-
# Clean up the app version in the background
58-
delete_app_version "${app_version}" &
72+
# Clean up the app version
73+
cleanup
5974
)
6075
# Clear the trap
6176
trap - ERR

pubsub/cloud-client/README.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,33 @@
22

33
[Google Cloud Pub/Sub][pubsub] is a fully-managed real-time messaging service that allows you to
44
send and receive messages between independent applications.
5-
These sample Java applications demonstrate how to access the Pub/Sub API using
5+
This sample Java application demonstrates how to access the Pub/Sub API using
66
the [Google Cloud Client Library for Java][google-cloud-java].
77

88
[pubsub]: https://cloud.google.com/pubsub/
99
[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java
1010

1111
## Quickstart
1212

13-
Install [Maven](http://maven.apache.org/).
13+
#### Setup
14+
- Install [Maven](http://maven.apache.org/) <p>
15+
- Install the [Google Cloud SDK](https://cloud.google.com/sdk/) and run :
1416

15-
Build your project with:
1617

17-
mvn clean package -DskipTests
18+
gcloud config set project [YOUR PROJECT ID]
1819

19-
## Testing
2020

21-
To run the tests for this sample, first set the `GOOGLE_CLOUD_PROJECT`
22-
environment variable.
21+
- Build your project with:
2322

24-
export GOOGLE_CLOUD_PROJECT=my-project
2523

26-
Then run the tests with Maven.
24+
mvn clean package -DskipTests
25+
26+
#### Testing
27+
28+
Run the tests with Maven.
2729

2830
mvn clean verify
2931

30-
### Creating a new topic (using the quickstart sample)
32+
#### Creating a new topic (using the quickstart sample)
3133

3234
mvn exec:java -Dexec.mainClass=com.example.pubsub.QuickstartSample

pubsub/cloud-client/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<dependency>
3838
<groupId>com.google.cloud</groupId>
3939
<artifactId>google-cloud-pubsub</artifactId>
40-
<version>0.9.2-alpha</version>
40+
<version>0.9.4-alpha</version>
4141
</dependency>
4242

4343
<!-- Test dependencies -->

pubsub/cloud-client/src/main/java/com/example/pubsub/QuickstartSample.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,22 @@
1919
// [START pubsub_quickstart]
2020
// Imports the Google Cloud client library
2121

22+
import com.google.cloud.ServiceOptions;
2223
import com.google.cloud.pubsub.spi.v1.PublisherClient;
2324
import com.google.pubsub.v1.TopicName;
2425

2526
public class QuickstartSample {
2627

2728
public static void main(String... args) throws Exception {
2829

30+
// Your Google Cloud Platform project ID
31+
String projectId = ServiceOptions.getDefaultProjectId();
32+
33+
// Your topic ID
34+
String topicId = "my-new-topic";
35+
2936
// Create a new topic
30-
String projectId = args[0];
31-
TopicName topic = TopicName.create(projectId, "my-new-topic");
37+
TopicName topic = TopicName.create(projectId, topicId);
3238
try (PublisherClient publisherClient = PublisherClient.create()) {
3339
publisherClient.createTopic(topic);
3440
}

pubsub/cloud-client/src/test/java/com/example/pubsub/QuickstartSampleIT.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import static com.google.common.truth.Truth.assertThat;
2020

21+
import com.google.cloud.ServiceOptions;
2122
import com.google.cloud.pubsub.spi.v1.PublisherClient;
2223
import com.google.pubsub.v1.TopicName;
2324

@@ -40,11 +41,11 @@ public class QuickstartSampleIT {
4041

4142
private ByteArrayOutputStream bout;
4243
private PrintStream out;
43-
private String projectId;
4444

45-
private void deleteTestTopic(String projectId) throws Exception {
45+
private void deleteTestTopic() throws Exception {
4646
try (PublisherClient publisherClient = PublisherClient.create()) {
47-
publisherClient.deleteTopic(TopicName.create(projectId, "my-new-topic"));
47+
publisherClient.deleteTopic(
48+
TopicName.create(ServiceOptions.getDefaultProjectId(), "my-new-topic"));
4849
} catch (IOException e) {
4950
System.err.println("Error deleting topic " + e.getMessage());
5051
}
@@ -55,10 +56,8 @@ public void setUp() {
5556
bout = new ByteArrayOutputStream();
5657
out = new PrintStream(bout);
5758
System.setOut(out);
58-
projectId = System.getenv("GOOGLE_CLOUD_PROJECT");
59-
assertThat(projectId).isNotNull();
6059
try {
61-
deleteTestTopic(projectId);
60+
deleteTestTopic();
6261
} catch (Exception e) {
6362
//empty catch block
6463
}
@@ -67,12 +66,12 @@ public void setUp() {
6766
@After
6867
public void tearDown() throws Exception {
6968
System.setOut(null);
70-
deleteTestTopic(projectId);
69+
deleteTestTopic();
7170
}
7271

7372
@Test
7473
public void testQuickstart() throws Exception {
75-
QuickstartSample.main(projectId);
74+
QuickstartSample.main();
7675
String got = bout.toString();
7776
assertThat(got).contains("my-new-topic created.");
7877
}

speech/grpc/pom.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ limitations under the License.
4949
<properties>
5050
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5151
<codehaus-versions-maven-plugin-version>2.3</codehaus-versions-maven-plugin-version>
52-
<grpc-protobuf-version>1.1.2</grpc-protobuf-version>
52+
<grpc-version>1.0.3</grpc-version> <!-- 1.1.2 doesn't work - DO NOT UPGRADE -->
5353
<maven-compiler-plugin-version>3.6.0</maven-compiler-plugin-version>
5454
<xolstice-protobuf-maven-plugin-version>0.5.0</xolstice-protobuf-maven-plugin-version>
5555

@@ -113,22 +113,22 @@ limitations under the License.
113113
<dependency>
114114
<groupId>io.grpc</groupId>
115115
<artifactId>grpc-auth</artifactId>
116-
<version>1.1.2</version>
116+
<version>${grpc-version}</version>
117117
</dependency>
118118
<dependency>
119119
<groupId>io.grpc</groupId>
120120
<artifactId>grpc-netty</artifactId>
121-
<version>1.1.2</version>
121+
<version>${grpc-version}</version>
122122
</dependency>
123123
<dependency>
124124
<groupId>io.grpc</groupId>
125125
<artifactId>grpc-protobuf</artifactId>
126-
<version>${grpc-protobuf-version}</version>
126+
<version>${grpc-version}</version>
127127
</dependency>
128128
<dependency>
129129
<groupId>io.grpc</groupId>
130130
<artifactId>grpc-stub</artifactId>
131-
<version>1.1.2</version>
131+
<version>${grpc-version}</version>
132132
</dependency>
133133
<dependency>
134134
<groupId>log4j</groupId>

storage/json-api/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Google Cloud Storage Service features a REST-based API that allows developers to
3636
Note that if it's been a while, you may need to login with gcloud.
3737

3838
```
39-
gcloud auth login
39+
gcloud auth application-default login
4040
```
4141

4242
## Products

0 commit comments

Comments
 (0)