Skip to content

Commit 1d046f9

Browse files
authored
Merge pull request GoogleCloudPlatform#11 from GoogleCloudPlatform/tswast-push-java-repo-tools
Update java-repo-tools from getting-started-java.
2 parents 6ee0542 + 3686a49 commit 1d046f9

File tree

3 files changed

+97
-64
lines changed

3 files changed

+97
-64
lines changed

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,9 @@ The first time using the `subtree` command, we may need to use the `--rejoin`
135135
argument.
136136

137137
```
138-
git subtree split --prefix=java-repo-tools -b java-repo-tools-update-from-java-docs-samples
139-
git checkout java-repo-tools-update-from-java-docs-samples
140-
git push java-repo-tools java-repo-tools-update-from-java-docs-samples
141-
```
142-
143-
After you have committed all the changes you want to your `java-repo-tools`
144-
branch, you can push to the upstream `java-repo-tools` repository with the
145-
following command. (Replace `name-for-remote-branch` with the name you'd like to
146-
give the branch on the `java-repo-tools` repository.)
147-
148-
```
149-
git push java-repo-tools java-repo-tools:name-for-remote-branch
138+
git subtree split --prefix=java-repo-tools -b ${USER}-push-java-repo-tools
139+
git checkout ${USER}-push-java-repo-tools
140+
git push java-repo-tools ${USER}-push-java-repo-tools
150141
```
151142

152143
Then, you can send a pull request to the `java-repo-tools` repository.

scripts/test-localhost.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2016 Google Inc. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Usage:
17+
# test-localhost.sh deployment-type path/to/project -- [maven arguments]
18+
#
19+
# This script runs a localhost server Maven plugin and verifies that a request
20+
# to http://localhost:8080/ does not return an error code.
21+
22+
print_usage () {
23+
echo "Usage:" >&2
24+
echo " $0 server-type path/to/project [-- maven arguments]" >&2
25+
echo >&2
26+
echo "server-type can be any of the following:" >&2
27+
echo " appengine" >&2
28+
echo " jetty" >&2
29+
echo " spring-boot" >&2
30+
}
31+
32+
if [[ -z "$1" ]]; then
33+
echo "Missing server-type parameter." >&2
34+
print_usage
35+
exit 1
36+
fi
37+
case $1 in
38+
appengine)
39+
mvn_plugin="appengine:devserver"
40+
server_started_message="localhost:8080"
41+
;;
42+
jetty)
43+
mvn_plugin="jetty:run-exploded"
44+
server_started_message="Started Jetty Server"
45+
;;
46+
spring-boot)
47+
mvn_plugin="spring-boot:run"
48+
server_started_message="Tomcat started on port(s): 8080 (http)"
49+
;;
50+
*)
51+
print_usage
52+
exit 1
53+
;;
54+
esac
55+
56+
if [[ -z "$2" ]]; then
57+
echo "Missing directory parameter." >&2
58+
print_usage
59+
exit 1
60+
fi
61+
code_path=$2
62+
63+
mvn_command="mvn --batch-mode clean ${mvn_plugin} -DskipTests"
64+
if [[ "$3" == "--" ]]; then
65+
shift 3
66+
for mvn_arg in "${@}"; do
67+
mvn_command="${mvn_command} ${mvn_arg}"
68+
done
69+
elif [[ -n "$3" ]]; then
70+
echo "Got unexpected third argument" >&2
71+
print_usage
72+
exit 1
73+
fi
74+
75+
set -e
76+
set -x
77+
78+
(
79+
cd "$code_path"
80+
expect -c "
81+
spawn ${mvn_command}
82+
set timeout 600
83+
expect \"${server_started_message}\"
84+
"'sleep 10
85+
spawn curl --silent --output /dev/stderr --write-out "%{http_code}" http://localhost:8080/
86+
expect {
87+
"200" {
88+
exit
89+
}
90+
}
91+
exit 1
92+
'
93+
)
94+

test-devserver.sh

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)