Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Bartel2015-09-18 05:53:52 +0000
committerJan Bartel2015-09-30 23:41:07 +0000
commite5b5bea2599419cfc1d560b26e4028ed39edba3a (patch)
tree79f170de6d97b39c25a9817fb522eb47b089b28c /tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud
parentdd2268dd67863c5ebabde06b1b2ddcdb720c43b5 (diff)
downloadorg.eclipse.jetty.project-e5b5bea2599419cfc1d560b26e4028ed39edba3a.tar.gz
org.eclipse.jetty.project-e5b5bea2599419cfc1d560b26e4028ed39edba3a.tar.xz
org.eclipse.jetty.project-e5b5bea2599419cfc1d560b26e4028ed39edba3a.zip
Create module and being gcloud datastore session tests
Diffstat (limited to 'tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud')
-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.java290
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudTestServer.java93
-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.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/RemoveSessionTest.java76
-rw-r--r--tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/SessionExpiryTest.java81
9 files changed, 887 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..c5421d897c
--- /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 0000000000..aea6f39e07
--- /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 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..3c05a69d89
--- /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 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/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..ac47692bfd
--- /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 0000000000..dbdfc9e9d6
--- /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();
+ }
+
+}

Back to the top