diff --git a/jetty-gcloud/gcloud-session-manager/pom.xml b/jetty-gcloud/gcloud-session-manager/pom.xml
index 58445d47ee1..f83e49d5a0e 100644
--- a/jetty-gcloud/gcloud-session-manager/pom.xml
+++ b/jetty-gcloud/gcloud-session-manager/pom.xml
@@ -3,7 +3,7 @@
org.eclipse.jetty.gcloud
gcloud-parent
- 9.3.3-SNAPSHOT
+ 9.3.4-SNAPSHOT
4.0.0
diff --git a/jetty-gcloud/gcloud-session-manager/src/main/config/etc/jetty-gcloud-sessions.xml b/jetty-gcloud/gcloud-session-manager/src/main/config/etc/jetty-gcloud-sessions.xml
new file mode 100644
index 00000000000..ba6b760bb15
--- /dev/null
+++ b/jetty-gcloud/gcloud-session-manager/src/main/config/etc/jetty-gcloud-sessions.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ /
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jetty-gcloud/gcloud-session-manager/src/main/config/modules/gcloud-sessions.mod b/jetty-gcloud/gcloud-session-manager/src/main/config/modules/gcloud-sessions.mod
new file mode 100644
index 00000000000..6af9d61188b
--- /dev/null
+++ b/jetty-gcloud/gcloud-session-manager/src/main/config/modules/gcloud-sessions.mod
@@ -0,0 +1,75 @@
+#
+# Jetty GCloudDatastore Session Manager module
+#
+
+[depend]
+annotations
+webapp
+
+[files]
+
+maven://com.google.gcloud/gcloud-java-datastore/0.0.7|lib/gcloud/gcloud-java-datastore-0.0.7.jar
+maven://com.google.gcloud/gcloud-java-core/0.0.7|lib/gcloud/gcloud-java-core-0.0.7.jar
+maven://com.google.auth/google-auth-library-credentials/0.1.0|lib/gcloud/google-auth-library-credentials-0.1.0.jar
+maven://com.google.auth/google-auth-library-oauth2-http/0.1.0|lib/gcloud/google-auth-library-oauth2-http-0.1.0.jar
+maven://com.google.http-client/google-http-client-jackson2/1.19.0|lib/gcloud/google-http-client-jackson2-1.19.0.jar
+maven://com.fasterxml.jackson.core/jackson-core/2.1.3|lib/gcloud/jackson-core-2.1.3.jar
+maven://com.google.http-client/google-http-client/1.20.0|lib/gcloud/google-http-client-1.20.0.jar
+maven://com.google.code.findbugs/jsr305/1.3.9|lib/gcloud/jsr305-1.3.9.jar
+maven://org.apache.httpcomponents/httpclient/4.0.1|lib/gcloud/httpclient-4.0.1.jar
+maven://org.apache.httpcomponents/httpcore/4.0.1|lib/gcloud/httpcore-4.0.1.jar
+maven://commons-logging/commons-logging/1.1.1|lib/gcloud/commons-logging-1.1.1.jar
+maven://commons-codec/commons-codec/1.3|lib/gcloud/commons-codec-1.3.jar
+maven://com.google.oauth-client/google-oauth-client/1.20.0|lib/gcloud//google-oauth-client-1.20.0.jar
+maven://com.google.guava/guava/18.0|lib/gcloud/guava-18.0.jar
+maven://com.google.api-client/google-api-client-appengine/1.20.0|lib/gcloud/google-api-client-appengine-1.20.0.jar
+maven://com.google.oauth-client/google-oauth-client-appengine/1.20.0|lib/gcloud/google-oauth-client-appengine-1.20.0.jar
+maven://com.google.oauth-client/google-oauth-client-servlet/1.20.0|lib/gcloud/google-oauth-client-servlet-1.20.0.jar
+maven://com.google.http-client/google-http-client-jdo/1.20.0|lib/gcloud/google-http-client-jdo-1.20.0.jar
+maven://com.google.api-client/google-api-client-servlet/1.20.0|lib/gcloud/google-api-client-servlet-1.20.0.jar
+maven://javax.jdo/jdo2-api/2.3-eb|lib/gcloud/jdo2-api-2.3-eb.jar
+maven://javax.transaction/transaction-api/1.1|lib/gcloud/transaction-api-1.1.jar
+maven://com.google.http-client/google-http-client-appengine/1.20.0|lib/gcloud/google-http-client-appengine-1.20.0.jar
+maven://com.google.http-client/google-http-client-jackson/1.20.0|lib/gcloud/google-http-client-jackson-1.20.0.jar
+maven://org.codehaus.jackson/jackson-core-asl/1.9.11|lib/gcloud/jackson-core-asl-1.9.11.jar
+maven://joda-time/joda-time/RELEASE|lib/gcloud/joda-time-RELEASE.jar
+maven://org.json/json/20090211|lib/gcloud/json-20090211.jar
+maven://com.google.apis/google-api-services-datastore-protobuf/v1beta2-rev1-2.1.2|lib/gcloud/google-api-services-datastore-protobuf-v1beta2-rev1-2.1.2.jar
+maven://com.google.protobuf/protobuf-java/2.5.0|lib/gcloud/protobuf-java-2.5.0.jar
+maven://com.google.http-client/google-http-client-protobuf/1.15.0-rc|lib/gcloud/google-http-client-protobuf-1.15.0-rc.jar
+maven://com.google.api-client/google-api-client/1.15.0-rc|lib/gcloud/google-api-client-1.15.0-rc.jar
+maven://com.google.apis/google-api-services-datastore/v1beta2-rev23-1.19.0|lib/gcloud/google-api-services-datastore-v1beta2-rev23-1.19.0.jar
+
+[lib]
+lib/gcloud-session-manager-${jetty.version}.jar
+lib/gcloud/*.jar
+
+[xml]
+etc/jetty-gcloud-sessions.xml
+
+[license]
+GCloudDatastore is an open source project hosted on Github and released under the Apache 2.0 license.
+https://github.com/GoogleCloudPlatform/gcloud-java
+http://www.apache.org/licenses/LICENSE-2.0.html
+
+[ini-template]
+## GCloudDatastore Session config
+
+## Unique identifier for this node in the cluster
+# jetty.gcloudSession.workerName=node1
+
+## Name of properties files containing gcloud config
+#jetty.gcloudSession.configFilet=etc/gcloud.props
+
+##Alternative to properties file, individual properties
+## the gcloud projectId
+#jetty.gcloudSession.projectId=
+
+## the p12 file associated with the project
+#jetty.gcloudSession.p12File=
+
+## the serviceAccount for the Datastore
+#jetty.gcloudSession.serviceAccount=
+
+## the password (can be obfuscated)
+#jetty.gcloudSession.password=
diff --git a/jetty-gcloud/gcloud-session-manager/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionTester.java b/jetty-gcloud/gcloud-session-manager/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionTester.java
index 69997a004fc..fe596e24ba4 100644
--- a/jetty-gcloud/gcloud-session-manager/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionTester.java
+++ b/jetty-gcloud/gcloud-session-manager/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionTester.java
@@ -56,7 +56,7 @@ public class GCloudSessionTester
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
- webapp.setResourceBase("../../jetty-distribution/target/distribution/demo-base/webapps/test/");
+ webapp.setWar("../../jetty-distribution/target/distribution/demo-base/webapps/test.war");
webapp.addAliasCheck(new AllowSymLinkAliasChecker());
GCloudSessionManager mgr = new GCloudSessionManager();
mgr.setSessionIdManager(idmgr);
diff --git a/jetty-gcloud/pom.xml b/jetty-gcloud/pom.xml
index af0e5568513..87faac43d8b 100644
--- a/jetty-gcloud/pom.xml
+++ b/jetty-gcloud/pom.xml
@@ -3,7 +3,7 @@
jetty-project
org.eclipse.jetty
- 9.3.3-SNAPSHOT
+ 9.3.4-SNAPSHOT
4.0.0
@@ -13,7 +13,7 @@
Jetty :: GCloud
- 0.0.6
+ 0.0.7
diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml
index e566937086e..2853eec2057 100644
--- a/tests/test-sessions/pom.xml
+++ b/tests/test-sessions/pom.xml
@@ -35,5 +35,6 @@
test-jdbc-sessions
test-mongodb-sessions
test-infinispan-sessions
+ test-gcloud-sessions
diff --git a/tests/test-sessions/test-gcloud-sessions/pom.xml b/tests/test-sessions/test-gcloud-sessions/pom.xml
new file mode 100644
index 00000000000..1c487b7f3bc
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/pom.xml
@@ -0,0 +1,110 @@
+
+
+
+ 4.0.0
+
+ org.eclipse.jetty.tests
+ test-sessions-parent
+ 9.3.4-SNAPSHOT
+
+ test-gcloud-sessions
+ Jetty Tests :: Sessions :: GCloud
+ http://www.eclipse.org/jetty
+
+ ${project.groupId}.sessions.gcloud
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+
+
+
+ org.eclipse.jetty
+ jetty-server
+ ${project.version}
+
+
+ org.eclipse.jetty
+ jetty-webapp
+ ${project.version}
+
+
+ org.eclipse.jetty
+ jetty-client
+ ${project.version}
+
+
+ org.eclipse.jetty.tests
+ test-sessions-common
+ ${project.version}
+
+
+ org.eclipse.jetty.gcloud
+ gcloud-session-manager
+ ${project.version}
+
+
+ org.eclipse.jetty.toolchain
+ jetty-test-helper
+ test
+
+
+
+
+ gcloud
+
+
+ gcloud.enabled
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ false
+
+ jetty9-work
+ 8088
+
+
+
+
+
+
+
+
+
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClientCrossContextSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClientCrossContextSessionTest.java
new file mode 100644
index 00000000000..5d05a3f698e
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClientCrossContextSessionTest.java
@@ -0,0 +1,70 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.gcloud.session;
+
+import org.eclipse.jetty.server.session.AbstractClientCrossContextSessionTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * ClientCrossContextSessionTest
+ *
+ *
+ */
+public class ClientCrossContextSessionTest extends AbstractClientCrossContextSessionTest
+{
+ static GCloudSessionTestSupport _testSupport;
+
+ @BeforeClass
+ public static void setup () throws Exception
+ {
+ String projectId = System.getProperty("test.projectId", null);
+ String port = System.getProperty("test.port","0");
+ _testSupport = new GCloudSessionTestSupport(projectId,
+ Integer.parseInt(port),
+ null);
+ _testSupport.setUp();
+ }
+
+ @AfterClass
+ public static void teardown () throws Exception
+ {
+ _testSupport.tearDown();
+ }
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractClientCrossContextSessionTest#createServer(int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port)
+ {
+ return new GCloudTestServer(port, _testSupport.getConfiguration());
+ }
+
+ @Test
+ @Override
+ public void testCrossContextDispatch() throws Exception
+ {
+ super.testCrossContextDispatch();
+ }
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ForwardedSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ForwardedSessionTest.java
new file mode 100644
index 00000000000..20109ae51fe
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ForwardedSessionTest.java
@@ -0,0 +1,62 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.gcloud.session;
+
+import org.eclipse.jetty.server.session.AbstractForwardedSessionTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * ForwardedSessionTest
+ *
+ *
+ */
+public class ForwardedSessionTest extends AbstractForwardedSessionTest
+{
+ static GCloudSessionTestSupport _testSupport;
+
+ @BeforeClass
+ public static void setup () throws Exception
+ {
+ String projectId = System.getProperty("test.projectId", null);
+ String port = System.getProperty("test.port","0");
+ _testSupport = new GCloudSessionTestSupport(projectId,
+ Integer.parseInt(port),
+ null);
+ _testSupport.setUp();
+ }
+
+ @AfterClass
+ public static void teardown () throws Exception
+ {
+ _testSupport.tearDown();
+ }
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractForwardedSessionTest#createServer(int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port)
+ {
+ return new GCloudTestServer(port, _testSupport.getConfiguration());
+ }
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionTestSupport.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionTestSupport.java
new file mode 100644
index 00000000000..c5421d897c9
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionTestSupport.java
@@ -0,0 +1,290 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.gcloud.session;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Locale;
+
+import org.eclipse.jetty.util.IO;
+import org.eclipse.jetty.util.resource.JarResource;
+import org.eclipse.jetty.util.resource.Resource;
+
+import com.google.api.client.util.Strings;
+import com.google.gcloud.datastore.DatastoreOptions;
+
+/**
+ * GCloudSessionTestSupport
+ *
+ *
+ */
+public class GCloudSessionTestSupport
+{
+
+ /**
+ * GCloudTestConfiguration
+ *
+ * Specialization of GCloudConfiguration for gcd test environment
+ *
+ */
+ public class GCloudTestConfiguration extends GCloudConfiguration
+ {
+ int _port;
+
+ public GCloudTestConfiguration(String projectId, int port)
+ {
+ setProjectId(projectId);
+ _port = port;
+ }
+
+
+ @Override
+ public DatastoreOptions getDatastoreOptions() throws Exception
+ {
+ return DatastoreOptions.builder()
+ .projectId(_projectId)
+ .host("http://localhost:" + _port)
+ .build();
+ }
+ }
+
+
+ private static class ProcessOutputReader implements Runnable
+ {
+ private InputStream _is;
+ private String _startupSentinel;
+ private BufferedReader _reader;
+
+ public ProcessOutputReader (InputStream is, String startupSentinel)
+ throws Exception
+ {
+ _is = is;
+ _startupSentinel = startupSentinel;
+ _reader = new BufferedReader(new InputStreamReader(_is));
+ if (!Strings.isNullOrEmpty(_startupSentinel))
+ {
+ String line;
+ while ((line = _reader.readLine()) != (null) && !line.contains(_startupSentinel))
+ {
+ System.err.println(line);
+ }
+ }
+ System.err.println("SENTINEL FOUND");
+ }
+
+
+ public void run()
+ {
+ String line;
+ try
+ {
+ while ((line = _reader.readLine()) != (null))
+ {
+ }
+ }
+ catch (IOException ignore)
+ {
+ /* ignore */
+ }
+ finally
+ {
+ IO.close(_reader);
+ }
+ }
+ }
+
+
+ public static String DEFAULT_PROJECTID = "jetty9-work";
+ public static int DEFAULT_PORT = 8088;
+ public static String DEFAULT_GCD_ZIP = "gcd-v1beta2-rev1-2.1.2b.zip";
+ public static String DEFAULT_GCD_UNPACKED = "gcd-v1beta2-rev1-2.1.2b";
+ public static String DEFAULT_DOWNLOAD_URL = "http://storage.googleapis.com/gcd/tools/";
+
+ String _projectId;
+ int _port;
+ File _datastoreDir;
+ File _gcdInstallDir;
+ File _gcdUnpackedDir;
+
+ public GCloudSessionTestSupport (String projectId, int port, File gcdInstallDir)
+ {
+ _projectId = projectId;
+ if (_projectId == null)
+ _projectId = DEFAULT_PROJECTID;
+ _port = port;
+ if (_port <= 0)
+ _port = DEFAULT_PORT;
+
+ _gcdInstallDir = gcdInstallDir;
+ if (_gcdInstallDir == null)
+ _gcdInstallDir = new File (System.getProperty("java.io.tmpdir"));
+ }
+
+ public GCloudSessionTestSupport ()
+ {
+ this(null,0, null);
+ }
+
+ public GCloudConfiguration getConfiguration ()
+ {
+ return new GCloudTestConfiguration(_projectId, _port);
+ }
+
+
+ public void setUp()
+ throws Exception
+ {
+ downloadGCD();
+ createDatastore();
+ startDatastore();
+ }
+
+
+ public void downloadGCD()
+ throws Exception
+ {
+ File zipFile = new File (_gcdInstallDir, DEFAULT_GCD_ZIP);
+ _gcdUnpackedDir = new File (_gcdInstallDir, DEFAULT_GCD_UNPACKED);
+ File gcdSh = new File (_gcdUnpackedDir, "gcd.sh");
+ if (gcdSh.exists())
+ return;
+
+
+ if (_gcdInstallDir.exists() && !zipFile.exists())
+ {
+ //download it
+ ReadableByteChannel rbc = Channels.newChannel(new URL(DEFAULT_DOWNLOAD_URL+DEFAULT_GCD_ZIP).openStream());
+ try (FileOutputStream fos = new FileOutputStream(zipFile))
+ {
+ fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+ }
+ }
+
+ if (zipFile.exists())
+ {
+ //unpack it
+ Resource zipResource = JarResource.newJarResource(Resource.newResource(zipFile));
+ zipResource.copyTo(_gcdInstallDir);
+ }
+
+ System.err.println("GCD downloaded and unpacked");
+ }
+
+
+
+ public void createDatastore ()
+ throws Exception
+ {
+
+ _datastoreDir = Files.createTempDirectory("gcloud-sessions").toFile();
+ _datastoreDir.deleteOnExit();
+
+ ProcessBuilder processBuilder = new ProcessBuilder();
+ processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
+ processBuilder.directory(_datastoreDir);
+ if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows"))
+ {
+ processBuilder.command("cmd", "/C", new File(_gcdUnpackedDir, "gcd.cmd").getAbsolutePath(), "create", "-p", _projectId, _projectId);
+ processBuilder.redirectOutput(new File("NULL:"));
+ }
+ else
+ {
+ processBuilder.redirectOutput(new File("/tmp/run.out"));
+ processBuilder.command("bash", new File(_gcdUnpackedDir, "gcd.sh").getAbsolutePath(), "create", "-p",_projectId, _projectId);
+ }
+
+ for (String s:processBuilder.command())
+ System.err.println(s);
+
+ Process temp = processBuilder.start();
+ System.err.println("Create outcome: "+temp.waitFor());
+ }
+
+
+ public void startDatastore()
+ throws Exception
+ {
+ //start the datastore for the test
+ ProcessBuilder processBuilder = new ProcessBuilder();
+ processBuilder.directory(_datastoreDir);
+ processBuilder.redirectErrorStream(true);
+ if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows"))
+ {
+ processBuilder.command("cmd", "/C", new File(_gcdUnpackedDir, "gcd.cmd").getAbsolutePath(), "start", "--testing", "--allow_remote_shutdown","--port="+String.valueOf(_port), _projectId);
+ }
+ else
+ {
+ processBuilder.command("bash", new File(_gcdUnpackedDir, "gcd.sh").getAbsolutePath(), "start", "--testing", "--allow_remote_shutdown", "--port="+String.valueOf(_port), _projectId);
+ }
+
+ System.err.println("Starting datastore");
+ Process temp = processBuilder.start();
+ ProcessOutputReader reader = new ProcessOutputReader(temp.getInputStream(), "Dev App Server is now running");
+ Thread readerThread = new Thread(reader, "GCD reader");
+ readerThread.setDaemon(true);
+ readerThread.start();
+ }
+
+ public void stopDatastore()
+ throws Exception
+ {
+ //Send request to terminate test datastore
+ URL url = new URL("http", "localhost", _port, "/_ah/admin/quit");
+ HttpURLConnection con = (HttpURLConnection) url.openConnection();
+ con.setRequestMethod("POST");
+ con.setDoOutput(true);
+ con.setDoInput(true);
+ OutputStream out = con.getOutputStream();
+ out.write("".getBytes());
+ out.flush();
+ InputStream in = con.getInputStream();
+ while (in.read() != -1)
+ {
+ // consume input
+
+ }
+
+ System.err.println("Stop issued");
+ }
+
+
+ public void clearDatastore()
+ {
+ org.eclipse.jetty.util.IO.delete(_datastoreDir);
+ }
+
+ public void tearDown()
+ throws Exception
+ {
+ stopDatastore();
+ clearDatastore();
+ }
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudTestServer.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudTestServer.java
new file mode 100644
index 00000000000..aea6f39e075
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudTestServer.java
@@ -0,0 +1,93 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.gcloud.session;
+
+import org.eclipse.jetty.server.SessionIdManager;
+import org.eclipse.jetty.server.SessionManager;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.eclipse.jetty.server.session.SessionHandler;
+
+/**
+ * GCloudTestServer
+ *
+ *
+ */
+public class GCloudTestServer extends AbstractTestServer
+{
+ static int __workers=0;
+
+
+
+ /**
+ * @param port
+ * @param maxInactivePeriod
+ * @param scavengePeriod
+ * @param sessionIdMgrConfig
+ */
+ public GCloudTestServer(int port, int maxInactivePeriod, int scavengePeriod, GCloudConfiguration config)
+ {
+ super(port, maxInactivePeriod, scavengePeriod, config);
+ }
+
+ /**
+ * @param port
+ * @param configuration
+ */
+ public GCloudTestServer(int port, GCloudConfiguration configuration)
+ {
+ super(port, 30,10, configuration);
+ }
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractTestServer#newSessionIdManager(java.lang.Object)
+ */
+ @Override
+ public SessionIdManager newSessionIdManager(Object config)
+ {
+ GCloudSessionIdManager idManager = new GCloudSessionIdManager(getServer());
+ idManager.setWorkerName("w"+(__workers++));
+ idManager.setConfig((GCloudConfiguration)config);
+ return idManager;
+ }
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractTestServer#newSessionManager()
+ */
+ @Override
+ public SessionManager newSessionManager()
+ {
+ GCloudSessionManager sessionManager = new GCloudSessionManager();
+ sessionManager.setSessionIdManager((GCloudSessionIdManager)_sessionIdManager);
+ sessionManager.setStaleIntervalSec(1);
+ sessionManager.setScavengeInterval(_scavengePeriod);
+ return sessionManager;
+
+ }
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractTestServer#newSessionHandler(org.eclipse.jetty.server.SessionManager)
+ */
+ @Override
+ public SessionHandler newSessionHandler(SessionManager sessionManager)
+ {
+ return new SessionHandler(sessionManager);
+ }
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ImmortalSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ImmortalSessionTest.java
new file mode 100644
index 00000000000..84c3840d21e
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ImmortalSessionTest.java
@@ -0,0 +1,70 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.gcloud.session;
+
+import org.eclipse.jetty.server.session.AbstractImmortalSessionTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * ImmortalSessionTest
+ *
+ *
+ */
+public class ImmortalSessionTest extends AbstractImmortalSessionTest
+{
+ static GCloudSessionTestSupport _testSupport;
+
+ @BeforeClass
+ public static void setup () throws Exception
+ {
+ String projectId = System.getProperty("test.projectId", null);
+ String port = System.getProperty("test.port","0");
+ _testSupport = new GCloudSessionTestSupport(projectId,
+ Integer.parseInt(port),
+ null);
+ _testSupport.setUp();
+ }
+
+ @AfterClass
+ public static void teardown () throws Exception
+ {
+ _testSupport.tearDown();
+ }
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractImmortalSessionTest#createServer(int, int, int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs)
+ {
+ return new GCloudTestServer(port, port, scavengeMs, _testSupport.getConfiguration());
+ }
+
+ @Test
+ @Override
+ public void testImmortalSession() throws Exception
+ {
+ super.testImmortalSession();
+ }
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/InvalidationSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/InvalidationSessionTest.java
new file mode 100644
index 00000000000..3c05a69d89e
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/InvalidationSessionTest.java
@@ -0,0 +1,71 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.gcloud.session;
+
+import org.eclipse.jetty.server.session.AbstractInvalidationSessionTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * InvalidationSessionTest
+ *
+ *
+ */
+public class InvalidationSessionTest extends AbstractInvalidationSessionTest
+{
+ static GCloudSessionTestSupport _testSupport;
+
+ @BeforeClass
+ public static void setup () throws Exception
+ {
+ String projectId = System.getProperty("test.projectId", null);
+ String port = System.getProperty("test.port","0");
+ _testSupport = new GCloudSessionTestSupport(projectId,
+ Integer.parseInt(port),
+ null);
+ _testSupport.setUp();
+ }
+
+ @AfterClass
+ public static void teardown () throws Exception
+ {
+ _testSupport.tearDown();
+ }
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractInvalidationSessionTest#createServer(int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port)
+ {
+ return new GCloudTestServer(port, _testSupport.getConfiguration());
+ }
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractInvalidationSessionTest#pause()
+ */
+ @Override
+ public void pause()
+ {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/NewSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/NewSessionTest.java
new file mode 100644
index 00000000000..1dc256b74b1
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/NewSessionTest.java
@@ -0,0 +1,74 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.gcloud.session;
+
+import java.io.File;
+
+import org.eclipse.jetty.server.session.AbstractNewSessionTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * NewSessionTest
+ *
+ *
+ */
+public class NewSessionTest extends AbstractNewSessionTest
+{
+ GCloudSessionTestSupport _testSupport;
+
+ @Before
+ public void setup () throws Exception
+ {
+ String projectId = System.getProperty("test.projectId", null);
+ String port = System.getProperty("test.port","0");
+ _testSupport = new GCloudSessionTestSupport(projectId,
+ Integer.parseInt(port),
+ null);
+ _testSupport.setUp();
+ }
+
+ @After
+ public void teardown () throws Exception
+ {
+ _testSupport.tearDown();
+ }
+
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractNewSessionTest#createServer(int, int, int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port, int max, int scavenge)
+ {
+ return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
+ }
+
+ @Test
+ public void testNewSession() throws Exception
+ {
+ super.testNewSession();
+ }
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/RemoveSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/RemoveSessionTest.java
new file mode 100644
index 00000000000..ac47692bfd8
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/RemoveSessionTest.java
@@ -0,0 +1,76 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.gcloud.session;
+
+import org.eclipse.jetty.server.session.AbstractRemoveSessionTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * RemoveSessionTest
+ *
+ *
+ */
+public class RemoveSessionTest extends AbstractRemoveSessionTest
+{
+ static GCloudSessionTestSupport _testSupport;
+
+ @BeforeClass
+ public static void setup () throws Exception
+ {
+ String projectId = System.getProperty("test.projectId", null);
+ String port = System.getProperty("test.port","0");
+ _testSupport = new GCloudSessionTestSupport(projectId,
+ Integer.parseInt(port),
+ null);
+ _testSupport.setUp();
+ }
+
+ @AfterClass
+ public static void teardown () throws Exception
+ {
+ _testSupport.tearDown();
+ }
+
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractRemoveSessionTest#createServer(int, int, int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port, int max, int scavenge)
+ {
+ return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
+ }
+
+ @Test
+ @Override
+ public void testRemoveSession() throws Exception
+ {
+ // TODO Auto-generated method stub
+ super.testRemoveSession();
+ }
+
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionExpiryTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionExpiryTest.java
new file mode 100644
index 00000000000..dbdfc9e9d60
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionExpiryTest.java
@@ -0,0 +1,81 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.gcloud.session;
+
+import org.eclipse.jetty.server.session.AbstractSessionExpiryTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * SessionExpiryTest
+ *
+ *
+ */
+public class SessionExpiryTest extends AbstractSessionExpiryTest
+{
+
+ static GCloudSessionTestSupport _testSupport;
+
+ @BeforeClass
+ public static void setup () throws Exception
+ {
+ String projectId = System.getProperty("test.projectId", null);
+ String port = System.getProperty("test.port","0");
+ _testSupport = new GCloudSessionTestSupport(projectId,
+ Integer.parseInt(port),
+ null);
+ _testSupport.setUp();
+ }
+
+ @AfterClass
+ public static void teardown () throws Exception
+ {
+ _testSupport.tearDown();
+ }
+
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractSessionExpiryTest#createServer(int, int, int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port, int max, int scavenge)
+ {
+ return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
+ }
+
+ @Test
+ @Override
+ public void testSessionNotExpired() throws Exception
+ {
+ super.testSessionNotExpired();
+ }
+
+ @Test
+ @Override
+ public void testSessionExpiry() throws Exception
+ {
+ super.testSessionExpiry();
+ }
+
+}