Skip to content

Commit e3a391c

Browse files
authored
1 parent f3bfff5 commit e3a391c

File tree

16 files changed

+1036
-0
lines changed

16 files changed

+1036
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pom.xml
2+
src/*
3+
web/*
4+
Dockerfile
5+
app.yaml

appengine-java8/bigtable/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Bigtable-hello-j8
2+
=================
3+
4+
Moves the Bigtable Hello World application to Google App Engine Standard for Java 8.
5+
6+
7+
* [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
8+
* [Maven](https://maven.apache.org/download.cgi) (at least 3.3.9)
9+
* [Gradle](https://gradle.org)
10+
* [Google Cloud SDK](https://cloud.google.com/sdk/) (aka gcloud)
11+
12+
Initialize the Google Cloud SDK using:
13+
14+
gcloud init
15+
16+
gcloud auth application-default login
17+
18+
Then you need to [Create a Cloud Bigtable Instance](https://cloud.google.com/bigtable/docs/creating-instance)
19+
20+
21+
## Using Maven
22+
23+
### Run Locally
24+
25+
mvn -Dbigtable.projectID=PROJECTID -Dbigtable.instanceID=INSTANCEID appengine:run
26+
27+
### Deploy to App Engine Standard for Java 8
28+
29+
mvn -Dbigtable.projectID=PROJECTID -Dbigtable.instanceID=INSTANCEID appengine:deploy
30+
31+
### Run Integration Tests
32+
33+
mvn -Dbigtable.projectID=PROJECTID -Dbigtable.instanceID=INSTANCEID verify
34+
35+
## Using Gradle
36+
37+
### Run Locally
38+
39+
gradle -Dbigtable.projectID=PROJECTID -Dbigtable.instanceID=INSTANCEID appengineRun
40+
41+
### Integration Tests & Deploy to App Engine Standard for Java 8
42+
43+
gradle -Dbigtable.projectID=PROJECTID -Dbigtable.instanceID=INSTANCEID appengineDeploy
44+
45+
As you add / modify the source code (`src/main/java/...`) it's very useful to add
46+
[unit testing](https://cloud.google.com/appengine/docs/java/tools/localunittesting)
47+
to (`src/main/test/...`). The following resources are quite useful:
48+
49+
* [JUnit4](http://junit.org/junit4/)
50+
* [Mockito](http://mockito.org/)
51+
* [Truth](http://google.github.io/truth/)
52+
53+
### When done
54+
55+
Cloud Bigtable Instances should be [deleted](https://cloud.google.com/bigtable/docs/deleting-instance)
56+
when they are no longer being used as they use significant resources.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Copyright 2017 Google Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
// [START gradle]
15+
buildscript { // Configuration for building
16+
repositories {
17+
jcenter() // Bintray's repository - a fast Maven Central mirror & more
18+
mavenCentral()
19+
}
20+
dependencies {
21+
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.1'
22+
}
23+
}
24+
25+
apply plugin: 'java'
26+
apply plugin: 'war'
27+
apply plugin: 'com.google.cloud.tools.appengine'
28+
29+
group = 'com.example.google.cloud.bigtable'
30+
version = '0.1-SNAPSHOT'
31+
32+
sourceCompatibility = 1.8
33+
targetCompatibility = 1.8
34+
35+
tasks.withType(JavaCompile) {
36+
options.encoding = 'UTF-8'
37+
}
38+
39+
repositories {
40+
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
41+
jcenter()
42+
mavenCentral()
43+
}
44+
45+
dependencies {
46+
compile group: 'com.google.cloud.bigtable', name: 'bigtable-hbase-1.2', version:'0.9.6.2'
47+
compile group: 'org.apache.hbase', name: 'hbase-client', version:'1.2.4'
48+
compile group: 'io.netty', name: 'netty-tcnative-boringssl-static', version:'1.1.33.Fork26'
49+
compile group: 'jstl', name: 'jstl', version:'1.2'
50+
51+
providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'
52+
53+
testCompile group: 'com.google.truth', name: 'truth', version:'0.30'
54+
testCompile group: 'junit', name: 'junit', version:'4.12'
55+
testCompile group: 'org.mockito', name: 'mockito-all', version:'1.10.19'
56+
}
57+
58+
// Always run unit tests
59+
appengineDeploy.dependsOn test
60+
61+
// [START model]
62+
appengine {
63+
run {
64+
65+
}
66+
deploy { // deploy configuration
67+
stopPreviousVersion = true // default - stop the current version
68+
promote = true // default - & make this the current version
69+
}
70+
}
71+
72+
test {
73+
useJUnit()
74+
testLogging.showStandardStreams = true
75+
76+
systemProperty 'BIGTABLE_PROJECT', System.getProperty("bigtable.projectID")
77+
systemProperty 'BIGTABLE_INSTANCE',System.getProperty("bigtable.instanceID")
78+
79+
beforeTest { descriptor ->
80+
logger.lifecycle("test: " + descriptor + " Running")
81+
}
82+
83+
onOutput { descriptor, event ->
84+
logger.lifecycle("test: " + descriptor + ": " + event.message )
85+
}
86+
afterTest { descriptor, result ->
87+
logger.lifecycle("test: " + descriptor + ": " + result )
88+
}
89+
}
90+
// [END model]
91+
// [END gradle]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Mon Apr 03 21:11:48 PDT 2017
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-bin.zip

appengine-java8/bigtable/gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)