Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-sessions/test-gcloud-sessions/src/test')
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClientCrossContextSessionTest.java70
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ForwardedSessionTest.java62
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionTestSupport.java372
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudTestServer.java97
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ImmortalSessionTest.java70
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/InvalidationSessionTest.java82
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/LastAccessTimeTest.java70
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/LocalSessionScavengingTest.java71
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/NewSessionTest.java74
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/OrphanedSessionTest.java75
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ReentrantRequestSessionTest.java72
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/RemoveSessionTest.java75
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SameNodeLoadTest.java71
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ServerCrossContextSessionTest.java71
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionExpiryTest.java102
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionInvalidateAndCreateTest.java73
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionMigrationTest.java72
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionRenewTest.java71
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionValueSavingTest.java72
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/StopSessionManagerPreserveSessionTest.java99
20 files changed, 1821 insertions, 0 deletions
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 0000000000..5d05a3f698
--- /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 0000000000..20109ae51f
--- /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 0000000000..adfdf9b7a5
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionTestSupport.java
@@ -0,0 +1,372 @@
+//
+// ========================================================================
+// 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+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.util.ArrayList;
+import java.util.List;
+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.Key;
+import com.google.gcloud.datastore.Datastore;
+import com.google.gcloud.datastore.DatastoreFactory;
+import com.google.gcloud.datastore.DatastoreOptions;
+import com.google.gcloud.datastore.Entity;
+import com.google.gcloud.datastore.GqlQuery;
+import com.google.gcloud.datastore.ProjectionEntity;
+import com.google.gcloud.datastore.Query;
+import com.google.gcloud.datastore.Query.ResultType;
+import com.google.gcloud.datastore.QueryResults;
+import com.google.gcloud.datastore.StructuredQuery;
+import com.google.gcloud.datastore.StructuredQuery.Projection;
+
+/**
+ * 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);
+ }
+ }
+ }
+
+
+ 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;
+ Datastore _ds;
+
+ 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);
+ }
+
+ 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();
+ }
+
+ public void ensureDatastore()
+ throws Exception
+ {
+ if (_ds == null)
+ _ds = DatastoreFactory.instance().get(getConfiguration().getDatastoreOptions());
+ }
+ public void listSessions () throws Exception
+ {
+ ensureDatastore();
+ GqlQuery.Builder builder = Query.gqlQueryBuilder(ResultType.ENTITY, "select * from "+GCloudSessionManager.KIND);
+
+ Query<Entity> query = builder.build();
+
+ QueryResults<Entity> results = _ds.run(query);
+ assertNotNull(results);
+ System.err.println("SESSIONS::::::::");
+ while (results.hasNext())
+ {
+
+ Entity e = results.next();
+ System.err.println(e.getString("clusterId")+" expires at "+e.getLong("expiry"));
+ }
+ System.err.println("END OF SESSIONS::::::::");
+ }
+
+ public void assertSessions(int count) throws Exception
+ {
+ ensureDatastore();
+ StructuredQuery<ProjectionEntity> keyOnlyProjectionQuery = Query.projectionEntityQueryBuilder()
+ .kind(GCloudSessionManager.KIND)
+ .projection(Projection.property("__key__"))
+ .limit(100)
+ .build();
+ QueryResults<ProjectionEntity> results = _ds.run(keyOnlyProjectionQuery);
+ assertNotNull(results);
+ int actual = 0;
+ while (results.hasNext())
+ {
+ results.next();
+ ++actual;
+ }
+ assertEquals(count, actual);
+ }
+
+ public void deleteSessions () throws Exception
+ {
+ ensureDatastore();
+ StructuredQuery<ProjectionEntity> keyOnlyProjectionQuery = Query.projectionEntityQueryBuilder()
+ .kind(GCloudSessionManager.KIND)
+ .projection(Projection.property("__key__"))
+ .limit(100)
+ .build();
+ QueryResults<ProjectionEntity> results = _ds.run(keyOnlyProjectionQuery);
+ if (results != null)
+ {
+ List<Key> keys = new ArrayList<Key>();
+
+ while (results.hasNext())
+ {
+ ProjectionEntity pe = results.next();
+ keys.add(pe.key());
+ }
+
+ _ds.delete(keys.toArray(new Key[keys.size()]));
+ }
+
+ assertSessions(0);
+ }
+}
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 0000000000..11f2125f68
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudTestServer.java
@@ -0,0 +1,97 @@
+//
+// ========================================================================
+// 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;
+
+import com.google.gcloud.datastore.Datastore;
+import com.google.gcloud.datastore.DatastoreFactory;
+
+/**
+ * GCloudTestServer
+ *
+ *
+ */
+public class GCloudTestServer extends AbstractTestServer
+{
+ static int __workers=0;
+ public static int STALE_INTERVAL_SEC = 1;
+
+
+
+ /**
+ * @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(STALE_INTERVAL_SEC);
+ sessionManager.setScavengeIntervalSec(_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 0000000000..84c3840d21
--- /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 0000000000..6cc875cb71
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/InvalidationSessionTest.java
@@ -0,0 +1,82 @@
+//
+// ========================================================================
+// 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()
+ {
+ //This test moves around a session between 2 nodes. After it is invalidated on the 1st node,
+ //it will still be in the memory of the 2nd node. We need to wait until after the stale time
+ //has expired on node2 for it to reload the session and discover it has been deleted.
+ try
+ {
+ Thread.currentThread().sleep((2*GCloudTestServer.STALE_INTERVAL_SEC)*1000);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/LastAccessTimeTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/LastAccessTimeTest.java
new file mode 100644
index 0000000000..d4f42fe78d
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/LastAccessTimeTest.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.AbstractLastAccessTimeTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * LastAccessTimeTest
+ *
+ *
+ */
+public class LastAccessTimeTest extends AbstractLastAccessTimeTest
+{
+ 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.AbstractLastAccessTimeTest#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 testLastAccessTime() throws Exception
+ {
+ super.testLastAccessTime();
+ }
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/LocalSessionScavengingTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/LocalSessionScavengingTest.java
new file mode 100644
index 0000000000..ca39661a30
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/LocalSessionScavengingTest.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.AbstractLocalSessionScavengingTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * LocalSessionScavengingTest
+ *
+ *
+ */
+public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTest
+{
+ 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.AbstractLocalSessionScavengingTest#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 testLocalSessionsScavenging() throws Exception
+ {
+ super.testLocalSessionsScavenging();
+ }
+
+
+}
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 0000000000..1dc256b74b
--- /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/OrphanedSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/OrphanedSessionTest.java
new file mode 100644
index 0000000000..ffaaaec0da
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/OrphanedSessionTest.java
@@ -0,0 +1,75 @@
+//
+// ========================================================================
+// 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.AbstractOrphanedSessionTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * OrphanedSessionTest
+ *
+ *
+ */
+public class OrphanedSessionTest extends AbstractOrphanedSessionTest
+{
+ 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.AbstractOrphanedSessionTest#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 testOrphanedSession() throws Exception
+ {
+ super.testOrphanedSession();
+ _testSupport.assertSessions(0);
+ }
+
+
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ReentrantRequestSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ReentrantRequestSessionTest.java
new file mode 100644
index 0000000000..e8216187a5
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ReentrantRequestSessionTest.java
@@ -0,0 +1,72 @@
+//
+// ========================================================================
+// 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.AbstractReentrantRequestSessionTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * ReentrantRequestSessionTest
+ *
+ *
+ */
+public class ReentrantRequestSessionTest extends AbstractReentrantRequestSessionTest
+{
+ 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.AbstractReentrantRequestSessionTest#createServer(int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port)
+ {
+ return new GCloudTestServer(port, _testSupport.getConfiguration());
+ }
+
+ @Test
+ @Override
+ public void testReentrantRequestSession() throws Exception
+ {
+ super.testReentrantRequestSession();
+ }
+
+
+
+}
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 0000000000..5b7f99b3d9
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/RemoveSessionTest.java
@@ -0,0 +1,75 @@
+//
+// ========================================================================
+// 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
+ {
+ super.testRemoveSession();
+ }
+
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SameNodeLoadTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SameNodeLoadTest.java
new file mode 100644
index 0000000000..e230f43d67
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SameNodeLoadTest.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.AbstractSameNodeLoadTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * SameNodeLoadTest
+ *
+ *
+ */
+public class SameNodeLoadTest extends AbstractSameNodeLoadTest
+{
+ 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.AbstractSameNodeLoadTest#createServer(int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port)
+ {
+ return new GCloudTestServer(port, _testSupport.getConfiguration());
+ }
+
+ @Test
+ @Override
+ public void testLoad() throws Exception
+ {
+ super.testLoad();
+ }
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ServerCrossContextSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ServerCrossContextSessionTest.java
new file mode 100644
index 0000000000..59f366b6c7
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ServerCrossContextSessionTest.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.AbstractServerCrossContextSessionTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * ServerCrossContextSessionTest
+ *
+ *
+ */
+public class ServerCrossContextSessionTest extends AbstractServerCrossContextSessionTest
+{
+
+ 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.AbstractServerCrossContextSessionTest#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/SessionExpiryTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionExpiryTest.java
new file mode 100644
index 0000000000..785a2a19ec
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionExpiryTest.java
@@ -0,0 +1,102 @@
+//
+// ========================================================================
+// 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();
+ _testSupport.deleteSessions();
+ }
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractSessionExpiryTest#testSessionExpiry()
+ */
+ @Test
+ @Override
+ public void testSessionExpiry() throws Exception
+ {
+ super.testSessionExpiry();
+ _testSupport.assertSessions(0);
+ }
+
+ @Override
+ public void verifySessionCreated(TestHttpSessionListener listener, String sessionId)
+ {
+ super.verifySessionCreated(listener, sessionId);
+ try{ _testSupport.listSessions(); _testSupport.assertSessions(1);}catch(Exception e) {e.printStackTrace();}
+ }
+
+ @Override
+ public void verifySessionDestroyed(TestHttpSessionListener listener, String sessionId)
+ {
+ super.verifySessionDestroyed(listener, sessionId);
+ try{ _testSupport.listSessions(); _testSupport.assertSessions(0);}catch(Exception e) {e.printStackTrace();}
+ }
+
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionInvalidateAndCreateTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionInvalidateAndCreateTest.java
new file mode 100644
index 0000000000..b56a13ea54
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionInvalidateAndCreateTest.java
@@ -0,0 +1,73 @@
+//
+// ========================================================================
+// 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.AbstractSessionInvalidateAndCreateTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * SessionInvalidateAndCreateTest
+ *
+ *
+ */
+public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAndCreateTest
+{
+
+ 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.AbstractSessionInvalidateAndCreateTest#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 testSessionScavenge() throws Exception
+ {
+ super.testSessionScavenge();
+ }
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionMigrationTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionMigrationTest.java
new file mode 100644
index 0000000000..5ed5740746
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionMigrationTest.java
@@ -0,0 +1,72 @@
+//
+// ========================================================================
+// 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.AbstractSessionMigrationTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * SessionMigrationTest
+ *
+ *
+ */
+public class SessionMigrationTest extends AbstractSessionMigrationTest
+{
+ 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.AbstractSessionMigrationTest#createServer(int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port)
+ {
+ return new GCloudTestServer(port, _testSupport.getConfiguration());
+ }
+
+
+ @Test
+ @Override
+ public void testSessionMigration() throws Exception
+ {
+ super.testSessionMigration();
+ }
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionRenewTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionRenewTest.java
new file mode 100644
index 0000000000..c7b0c878bd
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionRenewTest.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.AbstractSessionRenewTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * SessionRenewTest
+ *
+ *
+ */
+public class SessionRenewTest extends AbstractSessionRenewTest
+{
+ 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.AbstractSessionRenewTest#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 testSessionRenewal() throws Exception
+ {
+ super.testSessionRenewal();
+ }
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionValueSavingTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionValueSavingTest.java
new file mode 100644
index 0000000000..54bf8ffac4
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionValueSavingTest.java
@@ -0,0 +1,72 @@
+//
+// ========================================================================
+// 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.AbstractSessionValueSavingTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * SessionValueSavingTest
+ *
+ *
+ */
+public class SessionValueSavingTest extends AbstractSessionValueSavingTest
+{
+
+ 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.AbstractSessionValueSavingTest#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 testSessionValueSaving() throws Exception
+ {
+ super.testSessionValueSaving();
+ }
+
+
+}
diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/StopSessionManagerPreserveSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/StopSessionManagerPreserveSessionTest.java
new file mode 100644
index 0000000000..97b656fbd2
--- /dev/null
+++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/StopSessionManagerPreserveSessionTest.java
@@ -0,0 +1,99 @@
+//
+// ========================================================================
+// 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 static org.junit.Assert.fail;
+import org.eclipse.jetty.server.session.AbstractStopSessionManagerPreserveSessionTest;
+import org.eclipse.jetty.server.session.AbstractTestServer;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * StopSessionManagerPreserveSessionTest
+ *
+ *
+ */
+public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionManagerPreserveSessionTest
+{
+ 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.AbstractStopSessionManagerPreserveSessionTest#checkSessionPersisted(boolean)
+ */
+ @Override
+ public void checkSessionPersisted(boolean expected)
+ {
+ try
+ {
+ _testSupport.assertSessions(1);
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ }
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractStopSessionManagerPreserveSessionTest#createServer(int)
+ */
+ @Override
+ public AbstractTestServer createServer(int port)
+ {
+ return new GCloudTestServer(port, _testSupport.getConfiguration());
+ }
+
+ /**
+ * @see org.eclipse.jetty.server.session.AbstractStopSessionManagerPreserveSessionTest#configureSessionManagement(org.eclipse.jetty.servlet.ServletContextHandler)
+ */
+ @Override
+ public void configureSessionManagement(ServletContextHandler context)
+ {
+
+ }
+
+ @Test
+ @Override
+ public void testStopSessionManagerPreserveSession() throws Exception
+ {
+ super.testStopSessionManagerPreserveSession();
+ }
+
+
+}

Back to the top