313205 - Unable to run tests on /test/test-sessions/test-jdbc-sessions
* Removed testng in favor of junit 4.x (so that MavenTestingUtils utility class could be used) * Made derby in test-jdbc-sessions use test specific maven target directory location as derby.system.home to eliminate /tmp/sessions bogus locked and read-only errors. git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1856 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
67e095e204
commit
15c5e54628
|
@ -1,5 +1,6 @@
|
|||
jetty-7.1.3-SNAPSHOT
|
||||
+ 305898 Websocket handles query string in URI
|
||||
+ 313205 Unable to run test-jdbc-sessions tests
|
||||
|
||||
jetty-7.1.2.v20100523
|
||||
+ 308866 Update test suite to JUnit4 - Module jetty-util
|
||||
|
|
|
@ -34,13 +34,6 @@
|
|||
<target>1.5</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<groups>hash-all</groups>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
|
@ -65,10 +58,9 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>5.8</version>
|
||||
<classifier>jdk15</classifier>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit4-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -13,10 +13,7 @@
|
|||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ClientCrossContextSessionTest extends AbstractClientCrossContextSessionTest
|
||||
{
|
||||
|
@ -25,7 +22,7 @@ public class ClientCrossContextSessionTest extends AbstractClientCrossContextSes
|
|||
return new HashTestServer(port);
|
||||
}
|
||||
|
||||
@Test(groups={"hash-all"})
|
||||
@Test
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
|
|
|
@ -12,13 +12,11 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* LightLoadTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public class LightLoadTest extends AbstractLightLoadTest
|
||||
{
|
||||
|
||||
|
@ -27,7 +25,7 @@ public class LightLoadTest extends AbstractLightLoadTest
|
|||
return new HashTestServer(port);
|
||||
}
|
||||
|
||||
@Test(groups={"hash-all"})
|
||||
@Test
|
||||
public void testLightLoad() throws Exception
|
||||
{
|
||||
super.testLightLoad();
|
||||
|
|
|
@ -12,14 +12,11 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* NewSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public class NewSessionTest extends AbstractNewSessionTest
|
||||
{
|
||||
|
||||
|
@ -28,10 +25,9 @@ public class NewSessionTest extends AbstractNewSessionTest
|
|||
return new HashTestServer(port,max,scavenge);
|
||||
}
|
||||
|
||||
@Test(groups={"hash-all"})
|
||||
@Test
|
||||
public void testNewSession() throws Exception
|
||||
{
|
||||
super.testNewSession();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,25 +12,21 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* OrphanedSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
||||
{
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new HashTestServer(port,max,scavenge);
|
||||
}
|
||||
|
||||
@Test(groups={"hash-all"})
|
||||
@Test
|
||||
public void testOrphanedSession() throws Exception
|
||||
{
|
||||
super.testOrphanedSession();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ReentrantRequestSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ReentrantRequestSessionTest extends AbstractReentrantRequestSessionTest
|
||||
{
|
||||
|
@ -26,7 +24,7 @@ public class ReentrantRequestSessionTest extends AbstractReentrantRequestSession
|
|||
return new HashTestServer(port);
|
||||
}
|
||||
|
||||
@Test(groups={"hash-all"})
|
||||
@Test
|
||||
public void testReentrantRequestSession() throws Exception
|
||||
{
|
||||
super.testReentrantRequestSession();
|
||||
|
|
|
@ -13,22 +13,18 @@
|
|||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ServerCrossContextSessionTest extends AbstractServerCrossContextSessionTest
|
||||
{
|
||||
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new HashTestServer(port);
|
||||
}
|
||||
|
||||
@Test(groups={"hash-all"})
|
||||
@Test
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,10 +77,9 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>5.8</version>
|
||||
<classifier>jdk15</classifier>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit4-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ClientCrossContextSessionTest
|
||||
|
@ -22,19 +22,14 @@ import org.testng.annotations.Test;
|
|||
|
||||
public class ClientCrossContextSessionTest extends AbstractClientCrossContextSessionTest
|
||||
{
|
||||
|
||||
|
||||
public AbstractTestServer createServer(int port)
|
||||
{
|
||||
return new JdbcTestServer(port);
|
||||
}
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ImmortalSessionTest
|
||||
|
@ -22,18 +22,14 @@ import org.testng.annotations.Test;
|
|||
|
||||
public class ImmortalSessionTest extends AbstractImmortalSessionTest
|
||||
{
|
||||
|
||||
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs)
|
||||
{
|
||||
return new JdbcTestServer(port, maxInactiveMs, scavengeMs);
|
||||
}
|
||||
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testImmortalSession() throws Exception
|
||||
{
|
||||
super.testImmortalSession();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,14 +12,11 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* InvalidationSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public class InvalidationSessionTest extends AbstractInvalidationSessionTest
|
||||
{
|
||||
public AbstractTestServer createServer(int port)
|
||||
|
@ -43,10 +40,9 @@ public class InvalidationSessionTest extends AbstractInvalidationSessionTest
|
|||
}
|
||||
}
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testInvalidation() throws Exception
|
||||
{
|
||||
super.testInvalidation();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,11 +14,10 @@ package org.eclipse.jetty.server.session;
|
|||
|
||||
import org.eclipse.jetty.server.SessionIdManager;
|
||||
import org.eclipse.jetty.server.SessionManager;
|
||||
import org.eclipse.jetty.server.session.test.MavenTestingUtils;
|
||||
|
||||
/**
|
||||
* JdbcTestServer
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class JdbcTestServer extends AbstractTestServer
|
||||
{
|
||||
|
@ -29,7 +28,7 @@ public class JdbcTestServer extends AbstractTestServer
|
|||
|
||||
static
|
||||
{
|
||||
System.setProperty("derby.system.home", System.getProperty("java.io.tmpdir"));
|
||||
System.setProperty("derby.system.home", MavenTestingUtils.getTargetTestingDir().getAbsolutePath());
|
||||
}
|
||||
|
||||
public JdbcTestServer(int port)
|
||||
|
|
|
@ -12,27 +12,21 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* LastAccessTimeTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public class LastAccessTimeTest extends AbstractLastAccessTimeTest
|
||||
{
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new JdbcTestServer(port,max,scavenge);
|
||||
}
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testLastAccessTime() throws Exception
|
||||
{
|
||||
super.testLastAccessTime();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,14 +12,11 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* LocalSessionScavengingTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTest
|
||||
{
|
||||
public void pause (int scavenge)
|
||||
|
@ -44,7 +41,7 @@ public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTe
|
|||
return new JdbcTestServer(port,max,scavenge);
|
||||
}
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testLocalSessionsScavenging() throws Exception
|
||||
{
|
||||
super.testLocalSessionsScavenging();
|
||||
|
|
|
@ -12,16 +12,13 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* NewSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class NewSessionTest extends AbstractNewSessionTest
|
||||
{
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractNewSessionTest#createServer(int, int, int)
|
||||
*/
|
||||
|
@ -30,7 +27,7 @@ public class NewSessionTest extends AbstractNewSessionTest
|
|||
return new JdbcTestServer(port,max,scavenge);
|
||||
}
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testNewSession() throws Exception
|
||||
{
|
||||
super.testNewSession();
|
||||
|
|
|
@ -12,27 +12,21 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* OrphanedSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
||||
{
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge)
|
||||
{
|
||||
return new JdbcTestServer(port,max,scavenge);
|
||||
}
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testOrphanedSession() throws Exception
|
||||
{
|
||||
super.testOrphanedSession();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,12 +12,11 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* ReentrantRequestSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ReentrantRequestSessionTest extends AbstractReentrantRequestSessionTest
|
||||
{
|
||||
|
@ -27,11 +26,9 @@ public class ReentrantRequestSessionTest extends AbstractReentrantRequestSession
|
|||
return new JdbcTestServer(port);
|
||||
}
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testReentrantRequestSession() throws Exception
|
||||
{
|
||||
super.testReentrantRequestSession();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ServerCrossContextSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ServerCrossContextSessionTest extends AbstractServerCrossContextSessionTest
|
||||
{
|
||||
|
@ -27,12 +25,9 @@ public class ServerCrossContextSessionTest extends AbstractServerCrossContextSes
|
|||
return new JdbcTestServer(port);
|
||||
}
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//========================================================================
|
||||
//$Id$
|
||||
//Copyright 2010 Mort Bay Consulting Pty. Ltd.
|
||||
// Copyright 2010 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
|
||||
|
@ -13,11 +12,10 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* SessionMigrationTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SessionMigrationTest extends AbstractSessionMigrationTest
|
||||
{
|
||||
|
@ -27,12 +25,9 @@ public class SessionMigrationTest extends AbstractSessionMigrationTest
|
|||
return new JdbcTestServer(port);
|
||||
}
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testSessionMigration() throws Exception
|
||||
{
|
||||
super.testSessionMigration();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* WebAppObjectInSessionTest
|
||||
*
|
||||
|
@ -26,11 +27,9 @@ public class WebAppObjectInSessionTest extends AbstractWebAppObjectInSessionTest
|
|||
return new JdbcTestServer(port);
|
||||
}
|
||||
|
||||
@Test(groups={"jdbc-all"})
|
||||
@Test
|
||||
public void testWebappObjectInSession() throws Exception
|
||||
{
|
||||
super.testWebappObjectInSession();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -44,10 +44,9 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>5.8</version>
|
||||
<classifier>jdk15</classifier>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit4-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -22,19 +22,16 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* AbstractClientCrossContextSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractClientCrossContextSessionTest
|
||||
{
|
||||
|
||||
|
|
|
@ -23,18 +23,15 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* AbstractImmortalSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractImmortalSessionTest
|
||||
{
|
||||
public abstract AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs);
|
||||
|
|
|
@ -22,19 +22,16 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* AbstractInvalidationSessionTest
|
||||
* Goal of the test is to be sure that invalidating a session on one node
|
||||
* result in the session being unavailable in the other node also.
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractInvalidationSessionTest
|
||||
{
|
||||
public abstract AbstractTestServer createServer(int port);
|
||||
|
|
|
@ -21,17 +21,14 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* AbstractLastAccessTimeTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractLastAccessTimeTest
|
||||
{
|
||||
public abstract AbstractTestServer createServer(int port, int max, int scavenge);
|
||||
|
|
|
@ -27,18 +27,15 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* AbstractLightLoadTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractLightLoadTest
|
||||
{
|
||||
protected boolean _stress = Boolean.getBoolean( "STRESS" );
|
||||
|
|
|
@ -21,20 +21,16 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.SessionManager;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* AbstractLocalSessionScavengingTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractLocalSessionScavengingTest
|
||||
{
|
||||
public abstract AbstractTestServer createServer(int port, int max, int scavenge);
|
||||
|
|
|
@ -21,18 +21,15 @@ import javax.servlet.http.HttpServlet;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* AbstractNewSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractNewSessionTest
|
||||
{
|
||||
public abstract AbstractTestServer createServer(int port, int max, int scavenge);
|
||||
|
@ -48,6 +45,7 @@ public abstract class AbstractNewSessionTest
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNewSession() throws Exception
|
||||
{
|
||||
|
|
|
@ -23,17 +23,14 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* AbstractOrphanedSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractOrphanedSessionTest
|
||||
{
|
||||
|
||||
|
|
|
@ -22,18 +22,15 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* AbstractReentrantRequestSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractReentrantRequestSessionTest
|
||||
{
|
||||
public abstract AbstractTestServer createServer(int port);
|
||||
|
|
|
@ -25,18 +25,15 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* AbstractServerCrossContextSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractServerCrossContextSessionTest
|
||||
{
|
||||
|
||||
|
|
|
@ -23,17 +23,14 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.testng.annotations.Test;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* AbstractSessionMigrationTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractSessionMigrationTest
|
||||
{
|
||||
public abstract AbstractTestServer createServer (int port);
|
||||
|
|
|
@ -21,13 +21,12 @@ import java.util.Random;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* AbstractWebAppObjectInSessionTest
|
||||
|
@ -37,9 +36,7 @@ import org.testng.annotations.Test;
|
|||
* the same webapp on nodeB is able to load that object from the session.
|
||||
*
|
||||
* This test is only appropriate for clustered session managers.
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class AbstractWebAppObjectInSessionTest
|
||||
{
|
||||
public abstract AbstractTestServer createServer(int port);
|
||||
|
|
|
@ -0,0 +1,221 @@
|
|||
// ========================================================================
|
||||
// Copyright (c) Webtide LLC
|
||||
// ------------------------------------------------------------------------
|
||||
// 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.apache.org/licenses/LICENSE-2.0.txt
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session.test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.jetty.util.IO;
|
||||
|
||||
/**
|
||||
* Common utility methods for working with JUnit tests cases in a maven friendly way.
|
||||
*/
|
||||
public class MavenTestingUtils
|
||||
{
|
||||
private static File basedir;
|
||||
private static File testResourcesDir;
|
||||
private static File targetDir;
|
||||
|
||||
// private static Boolean surefireRunning;
|
||||
|
||||
public static File getBasedir()
|
||||
{
|
||||
if (basedir == null)
|
||||
{
|
||||
String cwd = System.getProperty("basedir");
|
||||
|
||||
if (cwd == null)
|
||||
{
|
||||
cwd = System.getProperty("user.dir");
|
||||
}
|
||||
|
||||
basedir = new File(cwd);
|
||||
}
|
||||
|
||||
return basedir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the directory to the /target directory for this project.
|
||||
*
|
||||
* @return the directory path to the target directory.
|
||||
*/
|
||||
public static File getTargetDir()
|
||||
{
|
||||
if (targetDir == null)
|
||||
{
|
||||
targetDir = new File(getBasedir(),"target");
|
||||
PathAssert.assertDirExists("Target Dir",targetDir);
|
||||
}
|
||||
return targetDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link File} object for a path in the /target directory.
|
||||
*
|
||||
* @param path
|
||||
* the path desired, no validation of existence is performed.
|
||||
* @return the File to the path.
|
||||
*/
|
||||
public static File getTargetFile(String path)
|
||||
{
|
||||
return new File(getTargetDir(),path.replace("/",File.separator));
|
||||
}
|
||||
|
||||
public static File getTargetTestingDir()
|
||||
{
|
||||
File dir = new File(getTargetDir(),"testing");
|
||||
if (!dir.exists())
|
||||
{
|
||||
dir.mkdirs();
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a dir in /target/ that uses the JUnit 3.x {@link TestCase#getName()} to make itself unique.
|
||||
*
|
||||
* @param test
|
||||
* the junit 3.x testcase to base this new directory on.
|
||||
* @return the File path to the testcase specific testing directory underneath the
|
||||
* <code>${basedir}/target</code> sub directory
|
||||
*/
|
||||
public static File getTargetTestingDir(TestCase test)
|
||||
{
|
||||
return getTargetTestingDir(test.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a dir in /target/ that uses the an arbitrary name.
|
||||
*
|
||||
* @param testname
|
||||
* the testname to create directory against.
|
||||
* @return the File path to the testname sepecific testing directory underneath the
|
||||
* <code>${basedir}/target</code> sub directory
|
||||
*/
|
||||
public static File getTargetTestingDir(String testname)
|
||||
{
|
||||
File dir = new File(getTargetDir(),"test-" + testname);
|
||||
return dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a dir from the src/test/resource directory.
|
||||
*
|
||||
* @param name
|
||||
* the name of the path to get (it must exist as a dir)
|
||||
* @return the dir in src/test/resource
|
||||
*/
|
||||
public static File getTestResourceDir(String name)
|
||||
{
|
||||
File dir = new File(getTestResourcesDir(),name);
|
||||
PathAssert.assertDirExists("Test Resource Dir",dir);
|
||||
return dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a file from the src/test/resource directory.
|
||||
*
|
||||
* @param name
|
||||
* the name of the path to get (it must exist as a file)
|
||||
* @return the file in src/test/resource
|
||||
*/
|
||||
public static File getTestResourceFile(String name)
|
||||
{
|
||||
File file = new File(getTestResourcesDir(),name);
|
||||
PathAssert.assertFileExists("Test Resource File",file);
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a path resource (File or Dir) from the src/test/resource directory.
|
||||
*
|
||||
* @param name
|
||||
* the name of the path to get (it must exist)
|
||||
* @return the path in src/test/resource
|
||||
*/
|
||||
public static File getTestResourcePath(String name)
|
||||
{
|
||||
File path = new File(getTestResourcesDir(),name);
|
||||
PathAssert.assertExists("Test Resource Path",path);
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the directory to the src/test/resource directory
|
||||
*
|
||||
* @return the directory {@link File} to the src/test/resources directory
|
||||
*/
|
||||
public static File getTestResourcesDir()
|
||||
{
|
||||
if (testResourcesDir == null)
|
||||
{
|
||||
testResourcesDir = new File(basedir,"src/test/resources".replace("/",File.separator));
|
||||
PathAssert.assertDirExists("Test Resources Dir",testResourcesDir);
|
||||
}
|
||||
return testResourcesDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the contents of a file into a String and return it.
|
||||
*
|
||||
* @param file
|
||||
* the file to read.
|
||||
* @return the contents of the file.
|
||||
* @throws IOException
|
||||
* if unable to read the file.
|
||||
*/
|
||||
public static String readToString(File file) throws IOException
|
||||
{
|
||||
FileReader reader = null;
|
||||
try
|
||||
{
|
||||
reader = new FileReader(file);
|
||||
return IO.toString(reader);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IO.close(reader);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getTestID()
|
||||
{
|
||||
StackTraceElement stacked[] = new Throwable().getStackTrace();
|
||||
|
||||
String name = null;
|
||||
|
||||
for(StackTraceElement stack: stacked) {
|
||||
if(stack.getClassName().endsWith("Test"))
|
||||
{
|
||||
name = stack.getClassName();
|
||||
if (stack.getMethodName().startsWith("test"))
|
||||
{
|
||||
return stack.getClassName() + "#" + stack.getMethodName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(name == null)
|
||||
{
|
||||
return "Unidentified_Test";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
// ========================================================================
|
||||
// Copyright (c) Webtide LLC
|
||||
// ------------------------------------------------------------------------
|
||||
// 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.apache.org/licenses/LICENSE-2.0.txt
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
package org.eclipse.jetty.server.session.test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
public class PathAssert
|
||||
{
|
||||
public static void assertDirExists(String msg, File path)
|
||||
{
|
||||
assertExists(msg,path);
|
||||
Assert.assertTrue(msg + " path should be a Dir : " + path.getAbsolutePath(),path.isDirectory());
|
||||
}
|
||||
|
||||
public static void assertFileExists(String msg, File path)
|
||||
{
|
||||
assertExists(msg,path);
|
||||
Assert.assertTrue(msg + " path should be a File : " + path.getAbsolutePath(),path.isFile());
|
||||
}
|
||||
|
||||
public static void assertExists(String msg, File path)
|
||||
{
|
||||
Assert.assertTrue(msg + " path should exist: " + path.getAbsolutePath(),path.exists());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue