parent
0ca191edff
commit
67f8a96eee
|
@ -3,7 +3,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.jetty.gcloud</groupId>
|
||||
<artifactId>gcloud-parent</artifactId>
|
||||
<version>9.3.10-SNAPSHOT</version>
|
||||
<version>9.3.11-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
import com.google.gcloud.datastore.Key;
|
||||
|
||||
import net.rubyeye.xmemcached.MemcachedClient;
|
||||
import net.rubyeye.xmemcached.XMemcachedClient;
|
||||
import net.rubyeye.xmemcached.XMemcachedClientBuilder;
|
||||
import net.rubyeye.xmemcached.transcoders.SerializingTranscoder;
|
||||
|
||||
|
@ -156,7 +157,7 @@ public class GCloudMemcachedSessionManager extends GCloudSessionManager
|
|||
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws IOException
|
||||
{
|
||||
{
|
||||
out.writeUTF(clusterId); //session id
|
||||
out.writeUTF(contextPath); //context path
|
||||
out.writeUTF(vhost); //first vhost
|
||||
|
@ -217,8 +218,9 @@ public class GCloudMemcachedSessionManager extends GCloudSessionManager
|
|||
if (StringUtil.isBlank(_host) || StringUtil.isBlank(_port))
|
||||
throw new IllegalStateException("Memcached host and/or port not configured");
|
||||
|
||||
XMemcachedClientBuilder builder = new XMemcachedClientBuilder(_host+":"+_port);
|
||||
XMemcachedClientBuilder builder = new XMemcachedClientBuilder(_host+":"+_port);
|
||||
_client = builder.build();
|
||||
|
||||
_client.setTranscoder(new ContextClassloaderSerializingTranscoder());
|
||||
super.doStart();
|
||||
}
|
||||
|
@ -226,8 +228,9 @@ public class GCloudMemcachedSessionManager extends GCloudSessionManager
|
|||
@Override
|
||||
public void doStop() throws Exception
|
||||
{
|
||||
_client.shutdown();
|
||||
super.doStop();
|
||||
_client.shutdown();
|
||||
_client = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -337,6 +340,8 @@ public class GCloudMemcachedSessionManager extends GCloudSessionManager
|
|||
{
|
||||
return _port;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param port the port of the memcached server
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
<modules>
|
||||
<module>jetty-gcloud-session-manager</module>
|
||||
<module>jetty-gcloud-memcached-session-manager</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.jetty.tests</groupId>
|
||||
<artifactId>test-sessions-parent</artifactId>
|
||||
<version>9.3.10-SNAPSHOT</version>
|
||||
<version>9.3.11-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>test-gcloud-memcached-sessions</artifactId>
|
||||
<name>Jetty Tests :: Sessions :: GCloud with Memcached</name>
|
||||
|
@ -44,6 +44,7 @@
|
|||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
<test>GCloudMemcachedTestSuite</test>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -59,18 +60,18 @@
|
|||
<artifactId>jetty-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.tests</groupId>
|
||||
<artifactId>test-sessions-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.gcloud</groupId>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.tests</groupId>
|
||||
<artifactId>test-sessions-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.gcloud</groupId>
|
||||
<artifactId>jetty-gcloud-memcached-session-manager</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
@ -79,6 +80,12 @@
|
|||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.9</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.eclipse.jetty.gcloud.memcached.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;
|
||||
|
||||
/**
|
||||
|
@ -32,19 +31,12 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ClientCrossContextSessionTest extends AbstractClientCrossContextSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +45,7 @@ public class ClientCrossContextSessionTest extends AbstractClientCrossContextSes
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -31,19 +31,12 @@ import org.junit.BeforeClass;
|
|||
*/
|
||||
public class ForwardedSessionTest extends AbstractForwardedSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,7 +45,7 @@ public class ForwardedSessionTest extends AbstractForwardedSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,34 +57,35 @@ import com.google.gcloud.datastore.QueryResults;
|
|||
import com.google.gcloud.datastore.StructuredQuery;
|
||||
import com.google.gcloud.datastore.StructuredQuery.Projection;
|
||||
|
||||
|
||||
|
||||
|
||||
import net.rubyeye.xmemcached.MemcachedClient;
|
||||
import net.rubyeye.xmemcached.XMemcachedClientBuilder;
|
||||
|
||||
/**
|
||||
* GCloudSessionTestSupport
|
||||
* GCloudMemcachedSessionTestSupport
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class GCloudSessionTestSupport
|
||||
public class GCloudMemcachedSessionTestSupport
|
||||
{
|
||||
|
||||
public static class MemcacheFlusher
|
||||
/**
|
||||
* MemcachedFlusher
|
||||
*
|
||||
*
|
||||
*/
|
||||
public static class MemcachedFlusher
|
||||
{
|
||||
protected XMemcachedClientBuilder _builder;
|
||||
protected MemcachedClient _client;
|
||||
|
||||
|
||||
public MemcacheFlusher()
|
||||
public MemcachedFlusher() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
_builder = new XMemcachedClientBuilder("localhost:11211");
|
||||
_client = _builder.build();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void flush () throws Exception
|
||||
|
@ -93,6 +94,8 @@ public class GCloudSessionTestSupport
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class ProcessOutputReader implements Runnable
|
||||
{
|
||||
private InputStream _is;
|
||||
|
@ -144,8 +147,7 @@ public class GCloudSessionTestSupport
|
|||
public static String DEFAULT_GCD_UNPACKED = "gcd-v1beta2-rev1-2.1.2b";
|
||||
public static String DEFAULT_DOWNLOAD_URL = "http://storage.googleapis.com/gcd/tools/";
|
||||
|
||||
static MemcacheFlusher _flusher = new MemcacheFlusher();
|
||||
|
||||
|
||||
String _projectId;
|
||||
String _testServerUrl;
|
||||
String _testPort;
|
||||
|
@ -153,8 +155,11 @@ public class GCloudSessionTestSupport
|
|||
File _gcdInstallDir;
|
||||
File _gcdUnpackedDir;
|
||||
Datastore _ds;
|
||||
MemcachedFlusher _flusher;
|
||||
|
||||
|
||||
public GCloudSessionTestSupport (File gcdInstallDir)
|
||||
|
||||
public GCloudMemcachedSessionTestSupport (File gcdInstallDir)
|
||||
{
|
||||
_gcdInstallDir = gcdInstallDir;
|
||||
if (_gcdInstallDir == null)
|
||||
|
@ -180,7 +185,7 @@ public class GCloudSessionTestSupport
|
|||
}
|
||||
}
|
||||
|
||||
public GCloudSessionTestSupport ()
|
||||
public GCloudMemcachedSessionTestSupport ()
|
||||
{
|
||||
this(null);
|
||||
}
|
||||
|
@ -315,7 +320,6 @@ public class GCloudSessionTestSupport
|
|||
{
|
||||
stopDatastore();
|
||||
clearDatastore();
|
||||
_flusher.flush();
|
||||
}
|
||||
|
||||
public void ensureDatastore()
|
||||
|
@ -361,10 +365,11 @@ public class GCloudSessionTestSupport
|
|||
}
|
||||
assertEquals(count, actual);
|
||||
}
|
||||
|
||||
|
||||
public void deleteSessions () throws Exception
|
||||
{
|
||||
ensureDatastore();
|
||||
deleteMemcachedSessions();
|
||||
ensureDatastore();
|
||||
StructuredQuery<ProjectionEntity> keyOnlyProjectionQuery = Query.projectionEntityQueryBuilder()
|
||||
.kind(GCloudSessionManager.KIND)
|
||||
.projection(Projection.property("__key__"))
|
||||
|
@ -374,16 +379,27 @@ public class GCloudSessionTestSupport
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void deleteMemcachedSessions () throws Exception
|
||||
{
|
||||
if (_flusher == null)
|
||||
_flusher = new MemcachedFlusher();
|
||||
|
||||
_flusher.flush();
|
||||
}
|
||||
}
|
|
@ -19,9 +19,6 @@
|
|||
|
||||
package org.eclipse.jetty.gcloud.memcached.session;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jetty.gcloud.session.GCloudConfiguration;
|
||||
import org.eclipse.jetty.gcloud.session.GCloudSessionIdManager;
|
||||
import org.eclipse.jetty.server.SessionIdManager;
|
||||
|
@ -29,15 +26,12 @@ 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
|
||||
* GCloudMemachedTestServer
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class GCloudTestServer extends AbstractTestServer
|
||||
public class GCloudMemcachedTestServer extends AbstractTestServer
|
||||
{
|
||||
static int __workers=0;
|
||||
public static int STALE_INTERVAL_SEC = 1;
|
||||
|
@ -50,7 +44,7 @@ public class GCloudTestServer extends AbstractTestServer
|
|||
* @param scavengePeriod
|
||||
* @param sessionIdMgrConfig
|
||||
*/
|
||||
public GCloudTestServer(int port, int maxInactivePeriod, int scavengePeriod, GCloudConfiguration config)
|
||||
public GCloudMemcachedTestServer(int port, int maxInactivePeriod, int scavengePeriod, GCloudConfiguration config)
|
||||
{
|
||||
super(port, maxInactivePeriod, scavengePeriod, config);
|
||||
}
|
||||
|
@ -59,7 +53,7 @@ public class GCloudTestServer extends AbstractTestServer
|
|||
* @param port
|
||||
* @param configuration
|
||||
*/
|
||||
public GCloudTestServer(int port, GCloudConfiguration configuration)
|
||||
public GCloudMemcachedTestServer(int port, GCloudConfiguration configuration)
|
||||
{
|
||||
super(port, 30,10, configuration);
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2016 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.memcached.session;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
/**
|
||||
* GCloudMemcachedTestSuite
|
||||
*
|
||||
* Sets up the gcloud emulator once before running all tests.
|
||||
*
|
||||
*/
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
ClientCrossContextSessionTest.class,
|
||||
ForwardedSessionTest.class,
|
||||
ImmortalSessionTest.class,
|
||||
InvalidationSessionTest.class,
|
||||
LastAccessTimeTest.class,
|
||||
LocalSessionScavengingTest.class,
|
||||
NewSessionTest.class,
|
||||
OrphanedSessionTest.class,
|
||||
ReentrantRequestSessionTest.class,
|
||||
RemoveSessionTest.class,
|
||||
SameNodeLoadTest.class,
|
||||
ServerCrossContextSessionTest.class,
|
||||
SessionExpiryTest.class,
|
||||
SessionInvalidateAndCreateTest.class,
|
||||
SessionMigrationTest.class,
|
||||
SessionRenewTest.class,
|
||||
SessionValueSavingTest.class,
|
||||
StopSessionManagerPreserveSessionTest.class
|
||||
})
|
||||
|
||||
|
||||
public class GCloudMemcachedTestSuite
|
||||
{
|
||||
public static GCloudMemcachedSessionTestSupport __testSupport;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp () throws Exception
|
||||
{
|
||||
__testSupport = new GCloudMemcachedSessionTestSupport();
|
||||
__testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDown () throws Exception
|
||||
{
|
||||
__testSupport.tearDown();
|
||||
}
|
||||
}
|
|
@ -32,22 +32,12 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ImmortalSessionTest extends AbstractImmortalSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractImmortalSessionTest#createServer(int, int, int)
|
||||
|
@ -55,7 +45,7 @@ public class ImmortalSessionTest extends AbstractImmortalSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs)
|
||||
{
|
||||
return new GCloudTestServer(port, port, scavengeMs, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, port, scavengeMs, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -31,19 +31,11 @@ import org.junit.BeforeClass;
|
|||
*/
|
||||
public class InvalidationSessionTest extends AbstractInvalidationSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,7 +44,7 @@ public class InvalidationSessionTest extends AbstractInvalidationSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +58,7 @@ public class InvalidationSessionTest extends AbstractInvalidationSessionTest
|
|||
//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);
|
||||
Thread.currentThread().sleep((2*GCloudMemcachedTestServer.STALE_INTERVAL_SEC)*1000);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -32,19 +32,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class LastAccessTimeTest extends AbstractLastAccessTimeTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractLastAccessTimeTest#createServer(int, int, int)
|
||||
|
@ -52,7 +44,7 @@ public class LastAccessTimeTest extends AbstractLastAccessTimeTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, max, scavenge, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,19 +32,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +45,7 @@ public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTe
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, max, scavenge, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -37,20 +37,12 @@ import org.junit.Test;
|
|||
*/
|
||||
public class NewSessionTest extends AbstractNewSessionTest
|
||||
{
|
||||
GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@Before
|
||||
public void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +52,7 @@ public class NewSessionTest extends AbstractNewSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, max, scavenge, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,19 +32,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +46,7 @@ public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, max, scavenge, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -62,7 +54,7 @@ public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
|||
public void testOrphanedSession() throws Exception
|
||||
{
|
||||
super.testOrphanedSession();
|
||||
_testSupport.assertSessions(0);
|
||||
GCloudMemcachedTestSuite.__testSupport.assertSessions(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,19 +32,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ReentrantRequestSessionTest extends AbstractReentrantRequestSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +45,7 @@ public class ReentrantRequestSessionTest extends AbstractReentrantRequestSession
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -34,19 +34,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class RemoveSessionTest extends AbstractRemoveSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,7 +48,7 @@ public class RemoveSessionTest extends AbstractRemoveSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, max, scavenge, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,19 +32,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class SameNodeLoadTest extends AbstractSameNodeLoadTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +44,7 @@ public class SameNodeLoadTest extends AbstractSameNodeLoadTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,20 +32,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ServerCrossContextSessionTest extends AbstractServerCrossContextSessionTest
|
||||
{
|
||||
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractServerCrossContextSessionTest#createServer(int)
|
||||
|
@ -53,7 +43,7 @@ public class ServerCrossContextSessionTest extends AbstractServerCrossContextSes
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -21,7 +21,9 @@ package org.eclipse.jetty.gcloud.memcached.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;
|
||||
|
||||
|
@ -33,19 +35,10 @@ import org.junit.Test;
|
|||
public class SessionExpiryTest extends AbstractSessionExpiryTest
|
||||
{
|
||||
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,7 +48,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, max, scavenge, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -63,7 +56,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
|
|||
public void testSessionNotExpired() throws Exception
|
||||
{
|
||||
super.testSessionNotExpired();
|
||||
_testSupport.deleteSessions();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,34 +67,23 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
|
|||
public void testSessionExpiry() throws Exception
|
||||
{
|
||||
super.testSessionExpiry();
|
||||
_testSupport.assertSessions(0);
|
||||
GCloudMemcachedTestSuite.__testSupport.assertSessions(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verifySessionCreated(TestHttpSessionListener listener, String sessionId)
|
||||
{
|
||||
super.verifySessionCreated(listener, sessionId);
|
||||
try
|
||||
{
|
||||
_testSupport.assertSessions(1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try{ GCloudMemcachedTestSuite.__testSupport.listSessions(); GCloudMemcachedTestSuite.__testSupport.assertSessions(1);}catch(Exception e) {e.printStackTrace();}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verifySessionDestroyed(TestHttpSessionListener listener, String sessionId)
|
||||
{
|
||||
super.verifySessionDestroyed(listener, sessionId);
|
||||
try
|
||||
{
|
||||
_testSupport.assertSessions(0);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try{ GCloudMemcachedTestSuite.__testSupport.listSessions(); GCloudMemcachedTestSuite.__testSupport.assertSessions(0);}catch(Exception e) {e.printStackTrace();}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -32,20 +32,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAndCreateTest
|
||||
{
|
||||
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,7 +45,7 @@ public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAnd
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, max, scavenge, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,28 +32,19 @@ import org.junit.Test;
|
|||
*/
|
||||
public class SessionMigrationTest extends AbstractSessionMigrationTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionMigrationTest#createServer(int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,6 +54,4 @@ public class SessionMigrationTest extends AbstractSessionMigrationTest
|
|||
{
|
||||
super.testSessionMigration();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -32,19 +32,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class SessionRenewTest extends AbstractSessionRenewTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +44,7 @@ public class SessionRenewTest extends AbstractSessionRenewTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port,max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port,max, scavenge, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,20 +32,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class SessionValueSavingTest extends AbstractSessionValueSavingTest
|
||||
{
|
||||
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +44,7 @@ public class SessionValueSavingTest extends AbstractSessionValueSavingTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, max, scavenge, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -34,19 +34,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionManagerPreserveSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudMemcachedTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +49,7 @@ public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionMa
|
|||
{
|
||||
try
|
||||
{
|
||||
_testSupport.assertSessions(1);
|
||||
GCloudMemcachedTestSuite.__testSupport.assertSessions(1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -72,7 +64,7 @@ public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionMa
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudMemcachedTestServer(port, GCloudMemcachedTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
<test>GCloudTestSuite</test>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -32,19 +32,12 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ClientCrossContextSessionTest extends AbstractClientCrossContextSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +46,7 @@ public class ClientCrossContextSessionTest extends AbstractClientCrossContextSes
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -31,19 +31,12 @@ import org.junit.BeforeClass;
|
|||
*/
|
||||
public class ForwardedSessionTest extends AbstractForwardedSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,7 +45,7 @@ public class ForwardedSessionTest extends AbstractForwardedSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2016 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.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
/**
|
||||
* GCloudTestSuite
|
||||
*
|
||||
* Sets up the gcloud emulator once before running all tests.
|
||||
*
|
||||
*/
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
ClientCrossContextSessionTest.class,
|
||||
ForwardedSessionTest.class,
|
||||
ImmortalSessionTest.class,
|
||||
InvalidationSessionTest.class,
|
||||
LastAccessTimeTest.class,
|
||||
LocalSessionScavengingTest.class,
|
||||
NewSessionTest.class,
|
||||
OrphanedSessionTest.class,
|
||||
ReentrantRequestSessionTest.class,
|
||||
RemoveSessionTest.class,
|
||||
SameNodeLoadTest.class,
|
||||
ServerCrossContextSessionTest.class,
|
||||
SessionExpiryTest.class,
|
||||
SessionInvalidateAndCreateTest.class,
|
||||
SessionMigrationTest.class,
|
||||
SessionRenewTest.class,
|
||||
SessionValueSavingTest.class,
|
||||
StopSessionManagerPreserveSessionTest.class
|
||||
})
|
||||
|
||||
|
||||
public class GCloudTestSuite
|
||||
{
|
||||
public static GCloudSessionTestSupport __testSupport;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp () throws Exception
|
||||
{
|
||||
__testSupport = new GCloudSessionTestSupport();
|
||||
__testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDown () throws Exception
|
||||
{
|
||||
__testSupport.tearDown();
|
||||
}
|
||||
}
|
|
@ -32,22 +32,12 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ImmortalSessionTest extends AbstractImmortalSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractImmortalSessionTest#createServer(int, int, int)
|
||||
|
@ -55,7 +45,7 @@ public class ImmortalSessionTest extends AbstractImmortalSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs)
|
||||
{
|
||||
return new GCloudTestServer(port, port, scavengeMs, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, port, scavengeMs, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -31,19 +31,11 @@ import org.junit.BeforeClass;
|
|||
*/
|
||||
public class InvalidationSessionTest extends AbstractInvalidationSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,7 +44,7 @@ public class InvalidationSessionTest extends AbstractInvalidationSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,19 +32,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class LastAccessTimeTest extends AbstractLastAccessTimeTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractLastAccessTimeTest#createServer(int, int, int)
|
||||
|
@ -52,7 +44,7 @@ public class LastAccessTimeTest extends AbstractLastAccessTimeTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, max, scavenge, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,19 +32,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +45,7 @@ public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTe
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, max, scavenge, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -37,19 +37,12 @@ import org.junit.Test;
|
|||
*/
|
||||
public class NewSessionTest extends AbstractNewSessionTest
|
||||
{
|
||||
GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@Before
|
||||
public void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,7 +52,7 @@ public class NewSessionTest extends AbstractNewSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, max, scavenge, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,19 +32,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +46,7 @@ public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, max, scavenge, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -62,7 +54,7 @@ public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
|||
public void testOrphanedSession() throws Exception
|
||||
{
|
||||
super.testOrphanedSession();
|
||||
_testSupport.assertSessions(0);
|
||||
GCloudTestSuite.__testSupport.assertSessions(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,19 +32,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ReentrantRequestSessionTest extends AbstractReentrantRequestSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +45,7 @@ public class ReentrantRequestSessionTest extends AbstractReentrantRequestSession
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -34,19 +34,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class RemoveSessionTest extends AbstractRemoveSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,7 +48,7 @@ public class RemoveSessionTest extends AbstractRemoveSessionTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, max, scavenge, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,19 +32,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class SameNodeLoadTest extends AbstractSameNodeLoadTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +44,7 @@ public class SameNodeLoadTest extends AbstractSameNodeLoadTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,20 +32,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ServerCrossContextSessionTest extends AbstractServerCrossContextSessionTest
|
||||
{
|
||||
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractServerCrossContextSessionTest#createServer(int)
|
||||
|
@ -53,7 +43,7 @@ public class ServerCrossContextSessionTest extends AbstractServerCrossContextSes
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -35,19 +35,10 @@ import org.junit.Test;
|
|||
public class SessionExpiryTest extends AbstractSessionExpiryTest
|
||||
{
|
||||
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +48,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, max, scavenge, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -65,7 +56,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
|
|||
public void testSessionNotExpired() throws Exception
|
||||
{
|
||||
super.testSessionNotExpired();
|
||||
_testSupport.deleteSessions();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,21 +67,21 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
|
|||
public void testSessionExpiry() throws Exception
|
||||
{
|
||||
super.testSessionExpiry();
|
||||
_testSupport.assertSessions(0);
|
||||
GCloudTestSuite.__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();}
|
||||
try{ GCloudTestSuite.__testSupport.listSessions(); GCloudTestSuite.__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();}
|
||||
try{ GCloudTestSuite.__testSupport.listSessions(); GCloudTestSuite.__testSupport.assertSessions(0);}catch(Exception e) {e.printStackTrace();}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,20 +32,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAndCreateTest
|
||||
{
|
||||
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,7 +45,7 @@ public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAnd
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, max, scavenge, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,28 +32,19 @@ import org.junit.Test;
|
|||
*/
|
||||
public class SessionMigrationTest extends AbstractSessionMigrationTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionMigrationTest#createServer(int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,6 +54,4 @@ public class SessionMigrationTest extends AbstractSessionMigrationTest
|
|||
{
|
||||
super.testSessionMigration();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -32,19 +32,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class SessionRenewTest extends AbstractSessionRenewTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +44,7 @@ public class SessionRenewTest extends AbstractSessionRenewTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port,max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port,max, scavenge, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,20 +32,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class SessionValueSavingTest extends AbstractSessionValueSavingTest
|
||||
{
|
||||
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +44,7 @@ public class SessionValueSavingTest extends AbstractSessionValueSavingTest
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, max, scavenge, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -34,19 +34,11 @@ import org.junit.Test;
|
|||
*/
|
||||
public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionManagerPreserveSessionTest
|
||||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
_testSupport.tearDown();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +49,7 @@ public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionMa
|
|||
{
|
||||
try
|
||||
{
|
||||
_testSupport.assertSessions(1);
|
||||
GCloudTestSuite.__testSupport.assertSessions(1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -72,7 +64,7 @@ public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionMa
|
|||
@Override
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new GCloudTestServer(port, _testSupport.getConfiguration());
|
||||
return new GCloudTestServer(port, GCloudTestSuite.__testSupport.getConfiguration());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue