Skip to content

Commit

Permalink
Preparing GAE Java8 Standard doc samples. (#494)
Browse files Browse the repository at this point in the history
* Preparing GAE Java8 Standard doc samples.

* Remove snapshot dependency, and fix formatting.

* Remove snapshot dependency, and fix formatting.

* Fix formatting.
  • Loading branch information
ludoch authored and dpebot committed Jan 28, 2017
1 parent 120d40c commit bac40f1
Show file tree
Hide file tree
Showing 48 changed files with 164 additions and 145 deletions.
18 changes: 13 additions & 5 deletions java8-appengine/analytics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>com.example.appengine</groupId>
<artifactId>appengine-analytics</artifactId>
<artifactId>appengine-analytics-java8</artifactId>

<parent>
<artifactId>doc-samples</artifactId>
Expand All @@ -29,8 +29,8 @@
<!-- Parent POM defines ${appengine.sdk.version} (updates frequently). -->

<properties>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>

<dependencies>
Expand All @@ -45,8 +45,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Expand All @@ -61,6 +61,14 @@
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.sdk.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
import java.net.URL;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

// [START example]
@SuppressWarnings("serial")
@WebServlet(name = "analytics", urlPatterns = {"/"})
public class AnalyticsServlet extends HttpServlet {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>YOUR-PROJECT-ID</application>
<version>YOUR-VERSION-ID</version>
<runtime>java8</runtime>
<threadsafe>true</threadsafe>
<env-variables>
<env-var name="GA_TRACKING_ID" value="YOUR-GA-TRACKING-ID" />
Expand Down
29 changes: 0 additions & 29 deletions java8-appengine/analytics/src/main/webapp/WEB-INF/web.xml

This file was deleted.

18 changes: 13 additions & 5 deletions java8-appengine/appidentity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>com.example.appengine</groupId>
<artifactId>appengine-appidentity</artifactId>
<artifactId>appengine-appidentity-java8</artifactId>

<parent>
<groupId>com.google.cloud</groupId>
Expand All @@ -44,8 +44,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Expand Down Expand Up @@ -99,8 +99,16 @@
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>${gcloud-maven-plugin-version}</version>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.sdk.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
20 changes: 14 additions & 6 deletions java8-appengine/channel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>com.example.appengine</groupId>
<artifactId>appengine-channel</artifactId>
<artifactId>appengine-channel-java8</artifactId>
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>doc-samples</artifactId>
Expand All @@ -40,11 +40,11 @@
<version>${appengine.sdk.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<type>jar</type>
<scope>provided</scope>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
Expand Down Expand Up @@ -106,6 +106,14 @@
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.sdk.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
10 changes: 5 additions & 5 deletions java8-appengine/cloudsql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>com.example.appengine</groupId>
<artifactId>appengine-cloudsql</artifactId>
<artifactId>appengine-cloudsql-java8</artifactId>

<parent>
<artifactId>doc-samples</artifactId>
Expand All @@ -41,16 +41,16 @@

<!-- [START_EXCLUDE] -->
<appengine.maven.plugin>1.0.0</appengine.maven.plugin>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<!-- [END_EXCLUDE] -->
</properties>
<!-- [END properties] -->
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>YOUR-PROJECT-ID</application>
<version>YOUR-VERSION-ID</version>
<runtime>java8</runtime>
<threadsafe>true</threadsafe>
</appengine-web-app>
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>YOUR-PROJECT-ID</application>
<version>YOUR-VERSION-ID</version>
<runtime>java8</runtime>
<threadsafe>true</threadsafe>
</appengine-web-app>
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>YOUR-PROJECT-ID</application>
<version>YOUR-VERSION-ID</version>
<runtime>java8</runtime>
<threadsafe>true</threadsafe>
</appengine-web-app>
6 changes: 3 additions & 3 deletions java8-appengine/datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>com.example.appengine</groupId>
<artifactId>appengine-datastore</artifactId>
<artifactId>appengine-datastore-java8</artifactId>

<parent>
<groupId>com.google.cloud</groupId>
Expand All @@ -36,8 +36,8 @@

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>YOUR-PROJECT-ID</application>
<version>YOUR-VERSION-ID</version>
<runtime>java8</runtime>
<threadsafe>true</threadsafe>
</appengine-web-app>
6 changes: 3 additions & 3 deletions java8-appengine/firebase-tictactoe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>com.example.appengine</groupId>
<artifactId>appengine-firebase-tictactoe</artifactId>
<artifactId>appengine-firebase-tictactoe-java8</artifactId>
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>doc-samples</artifactId>
Expand Down Expand Up @@ -49,8 +49,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Expand Down
8 changes: 4 additions & 4 deletions java8-appengine/guestbook-cloud-datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>1.0-SNAPSHOT</version>

<groupId>com.example.appengine</groupId>
<artifactId>appengine-guestbook-cloud-datastore</artifactId>
<artifactId>appengine-guestbook-cloud-datastore-java8</artifactId>
<properties>
<guava.version>19.0</guava.version>
</properties>
Expand All @@ -34,8 +34,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -47,7 +47,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud</artifactId>
<version>0.4.0</version>
<version>0.8.0</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import com.google.cloud.datastore.QueryResults;
import com.google.cloud.datastore.testing.LocalDatastoreHelper;
import com.google.common.collect.Lists;
import org.joda.time.Duration;

import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.TimeoutException;

public class TestUtils {
static LocalDatastoreHelper datastore = LocalDatastoreHelper.create();
Expand All @@ -26,9 +28,9 @@ public static void startDatastore() {

public static void stopDatastore() {
try {
datastore.stop();
datastore.stop(Duration.millis(10000));
Persistence.setDatastore(null);
} catch (IOException | InterruptedException e) {
} catch (IOException | InterruptedException | TimeoutException e) {
throw new RuntimeException(e);
}
}
Expand Down
10 changes: 5 additions & 5 deletions java8-appengine/guestbook-objectify/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<version>1.0-SNAPSHOT</version>

<groupId>com.example.appengine</groupId>
<artifactId>appengine-guestbook-objectify</artifactId>
<artifactId>appengine-guestbook-objectify-java8</artifactId>
<properties>
<objectify.version>5.1.14</objectify.version>
<guava.version>20.0</guava.version>
Expand All @@ -32,10 +32,10 @@
<version>${appengine.sdk.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
Expand Down
12 changes: 6 additions & 6 deletions java8-appengine/helloworld-new-plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ Copyright 2015 Google Inc. All Rights Reserved.
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>com.example.appengine</groupId>
<artifactId>appengine-helloworld-newplugins</artifactId>
<artifactId>appengine-helloworld-java8-newplugins</artifactId>

<!-- [START compiler] -->
<properties> <!-- App Engine Standard currently requires Java 7 -->
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<!-- [END compiler] -->

Expand All @@ -38,8 +38,8 @@ Copyright 2015 Google Inc. All Rights Reserved.
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Expand Down
Loading

0 comments on commit bac40f1

Please sign in to comment.