Merge remote-tracking branch 'origin/jetty-9.3.x' into jetty-9.4.x

This commit is contained in:
Jan Bartel 2016-06-23 12:03:08 +10:00
commit 26310f1167
21 changed files with 129 additions and 221 deletions

View File

@ -27,6 +27,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
<test>GCloudTestSuite</test>
</configuration>
</plugin>
</plugins>

View File

@ -32,25 +32,18 @@ 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();
}
@Override
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs,int evictionPolicy)
{
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -31,25 +31,18 @@ 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();
}
@Override
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs,int evictionPolicy)
{
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
}

View File

@ -0,0 +1,73 @@
//
// ========================================================================
// 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,
ImmediateSaveTest.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();
}
}

View File

@ -37,33 +37,18 @@ import org.junit.BeforeClass;
public class ImmediateSaveTest extends AbstractImmediateSaveTest
{
static GCloudSessionTestSupport _testSupport;
@BeforeClass
public static void setup () throws Exception
{
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}
@After
public void deleteSessions () throws Exception
{
_testSupport.deleteSessions();
GCloudTestSuite.__testSupport.deleteSessions();
}
@AfterClass
public static void teardown () throws Exception
{
_testSupport.tearDown();
}
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy)
{
return new GCloudTestServer(port, max, scavenge, evictionPolicy,_testSupport.getConfiguration())
return new GCloudTestServer(port, max, scavenge, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration())
{
public SessionHandler newSessionHandler()
{

View File

@ -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,int evictionPolicy)
{
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -34,20 +34,11 @@ import org.junit.Ignore;
*/
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();
}
/**
@ -56,7 +47,7 @@ public class InvalidationSessionTest extends AbstractInvalidationSessionTest
@Override
public AbstractTestServer createServer(int port, int maxInactive, int scavengeInterval, int evictionPolicy)
{
GCloudTestServer server = new GCloudTestServer(port, maxInactive, scavengeInterval, evictionPolicy, _testSupport.getConfiguration())
GCloudTestServer server = new GCloudTestServer(port, maxInactive, scavengeInterval, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration())
{
/**
* @see org.eclipse.jetty.gcloud.session.GCloudTestServer#newSessionManager()

View File

@ -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,int evictionPolicy)
{
return new GCloudTestServer(port, max, scavenge, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, max, scavenge, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -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,int evictionPolicy)
{
return new GCloudTestServer(port, max, scavenge, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, max, scavenge, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -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,int evictionPolicy)
{
return new GCloudTestServer(port, max, scavenge, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, max, scavenge, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -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,int evictionPolicy)
{
return new GCloudTestServer(port, max, scavenge, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, max, scavenge, evictionPolicy, 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);
}

View File

@ -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,int max, int scavengePeriod,int evictionPolicy)
{
return new GCloudTestServer(port, max, scavengePeriod, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, max, scavengePeriod, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -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,int evictionPolicy)
{
return new GCloudTestServer(port, max, scavenge, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, max, scavenge, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -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();
}
@ -55,7 +46,7 @@ public class SameNodeLoadTest extends AbstractSameNodeLoadTest
@Override
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy)
{
return new GCloudTestServer(port, max, scavenge, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, max, scavenge, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -32,26 +32,16 @@ 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();
}
@Override
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs,int evictionPolicy)
{
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -37,19 +37,10 @@ import org.junit.Assert;
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();
}
@ -59,7 +50,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
@Override
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy)
{
return new GCloudTestServer(port, max, scavenge, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, max, scavenge, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test
@ -67,7 +58,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
public void testSessionNotExpired() throws Exception
{
super.testSessionNotExpired();
_testSupport.deleteSessions();
GCloudTestSuite.__testSupport.deleteSessions();
}
/**
@ -78,20 +69,22 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
public void testSessionExpiry() throws Exception
{
super.testSessionExpiry();
_testSupport.deleteSessions();
GCloudTestSuite.__testSupport.deleteSessions();
}
@Override
public void verifySessionCreated(TestHttpSessionListener listener, String sessionId)
{
super.verifySessionCreated(listener, sessionId);
try {_testSupport.assertSessions(1);}catch(Exception e){ Assert.fail(e.getMessage());}
try {GCloudTestSuite.__testSupport.assertSessions(1);}catch(Exception e){ Assert.fail(e.getMessage());}
}
@Override
public void verifySessionDestroyed(TestHttpSessionListener listener, String sessionId)
{
super.verifySessionDestroyed(listener, sessionId);
//try{GCloudTestSuite.__testSupport.assertSessions(0);}catch(Exception e) {Assert.fail(e.getMessage());}
}

View File

@ -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, int evictionPolicy)
{
return new GCloudTestServer(port, max, scavenge, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, max, scavenge, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -32,26 +32,20 @@ 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, int maxInactiveMs, int scavengeMs,int evictionPolicy)
{
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test
@ -60,6 +54,4 @@ public class SessionMigrationTest extends AbstractSessionMigrationTest
{
super.testSessionMigration();
}
}

View File

@ -37,19 +37,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();
}
/**
@ -58,7 +49,7 @@ public class SessionRenewTest extends AbstractSessionRenewTest
@Override
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy)
{
return new GCloudTestServer(port,max, scavenge, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port,max, scavenge, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test
@ -76,7 +67,7 @@ public class SessionRenewTest extends AbstractSessionRenewTest
{
try
{
Set<String> ids = _testSupport.getSessionIds();
Set<String> ids = GCloudTestSuite.__testSupport.getSessionIds();
return (!ids.contains(oldSessionId) && ids.contains(newSessionId));
}
catch (Exception e)

View File

@ -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, int evictionPolicy)
{
return new GCloudTestServer(port, max, scavenge, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, max, scavenge, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
@Test

View File

@ -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)
{
@ -70,7 +62,7 @@ public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionMa
@Override
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs,int evictionPolicy)
{
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, _testSupport.getConfiguration());
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy, GCloudTestSuite.__testSupport.getConfiguration());
}
/**
* @see org.eclipse.jetty.server.session.AbstractStopSessionManagerPreserveSessionTest#configureSessionManagement(org.eclipse.jetty.servlet.ServletContextHandler)