Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2010-05-24 17:40:31 -0400
committerJoakim Erdfelt2010-05-24 17:40:31 -0400
commit15c5e54628dba8cb99483e06e29ed2f4ec780ab7 (patch)
tree013e9291bdd0686d88c699c527f57bd6ebd66ab5
parent67e095e2047d9661d922d03f5e64da495c9a91bd (diff)
downloadorg.eclipse.jetty.project-15c5e54628dba8cb99483e06e29ed2f4ec780ab7.tar.gz
org.eclipse.jetty.project-15c5e54628dba8cb99483e06e29ed2f4ec780ab7.tar.xz
org.eclipse.jetty.project-15c5e54628dba8cb99483e06e29ed2f4ec780ab7.zip
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
-rw-r--r--VERSION.txt1
-rw-r--r--tests/test-sessions/test-hash-sessions/pom.xml14
-rw-r--r--tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ClientCrossContextSessionTest.java7
-rw-r--r--tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/LightLoadTest.java8
-rw-r--r--tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/NewSessionTest.java8
-rw-r--r--tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/OrphanedSessionTest.java8
-rw-r--r--tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ReentrantRequestSessionTest.java6
-rw-r--r--tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ServerCrossContextSessionTest.java8
-rw-r--r--tests/test-sessions/test-jdbc-sessions/pom.xml7
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClientCrossContextSessionTest.java9
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ImmortalSessionTest.java8
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/InvalidationSessionTest.java8
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestServer.java5
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/LastAccessTimeTest.java10
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/LocalSessionScavengingTest.java7
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/NewSessionTest.java7
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/OrphanedSessionTest.java10
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ReentrantRequestSessionTest.java9
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ServerCrossContextSessionTest.java9
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionMigrationTest.java13
-rw-r--r--tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java7
-rw-r--r--tests/test-sessions/test-sessions-common/pom.xml7
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractClientCrossContextSessionTest.java9
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractImmortalSessionTest.java7
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractInvalidationSessionTest.java7
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java7
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLightLoadTest.java7
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLocalSessionScavengingTest.java10
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractNewSessionTest.java10
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractOrphanedSessionTest.java7
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractReentrantRequestSessionTest.java7
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractServerCrossContextSessionTest.java9
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java7
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractWebAppObjectInSessionTest.java9
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/test/MavenTestingUtils.java221
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/test/PathAssert.java40
36 files changed, 342 insertions, 191 deletions
diff --git a/VERSION.txt b/VERSION.txt
index 760357146d..b89b85c093 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -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
diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml
index cdda466d9f..55d178816c 100644
--- a/tests/test-sessions/test-hash-sessions/pom.xml
+++ b/tests/test-sessions/test-hash-sessions/pom.xml
@@ -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>
diff --git a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ClientCrossContextSessionTest.java b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ClientCrossContextSessionTest.java
index f5da28ceed..5069ae462d 100644
--- a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ClientCrossContextSessionTest.java
+++ b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ClientCrossContextSessionTest.java
@@ -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();
diff --git a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/LightLoadTest.java b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/LightLoadTest.java
index 5de13caaf2..839e266f42 100644
--- a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/LightLoadTest.java
+++ b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/LightLoadTest.java
@@ -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();
diff --git a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/NewSessionTest.java b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/NewSessionTest.java
index d06df8ee8c..3d58bc72f2 100644
--- a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/NewSessionTest.java
+++ b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/NewSessionTest.java
@@ -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();
}
-
}
diff --git a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/OrphanedSessionTest.java b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/OrphanedSessionTest.java
index dd6312b8c8..5be9208c1e 100644
--- a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/OrphanedSessionTest.java
+++ b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/OrphanedSessionTest.java
@@ -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();
}
-
}
diff --git a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ReentrantRequestSessionTest.java b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ReentrantRequestSessionTest.java
index ef29ba1764..35a9c2bb27 100644
--- a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ReentrantRequestSessionTest.java
+++ b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ReentrantRequestSessionTest.java
@@ -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();
diff --git a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ServerCrossContextSessionTest.java b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ServerCrossContextSessionTest.java
index 15a6a93bc2..c95f8dd81c 100644
--- a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ServerCrossContextSessionTest.java
+++ b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/ServerCrossContextSessionTest.java
@@ -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();
}
-
}
diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml
index 94092b597d..977b636e1b 100644
--- a/tests/test-sessions/test-jdbc-sessions/pom.xml
+++ b/tests/test-sessions/test-jdbc-sessions/pom.xml
@@ -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>
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClientCrossContextSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClientCrossContextSessionTest.java
index 8bfaf60916..4195058cad 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClientCrossContextSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClientCrossContextSessionTest.java
@@ -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();
}
-
-
-
}
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ImmortalSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ImmortalSessionTest.java
index 538419db9f..2d7ac694ac 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ImmortalSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ImmortalSessionTest.java
@@ -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();
}
-
}
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/InvalidationSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/InvalidationSessionTest.java
index 6babe36161..124486363a 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/InvalidationSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/InvalidationSessionTest.java
@@ -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();
}
-
}
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestServer.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestServer.java
index d3c805a0ad..1e900108b2 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestServer.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestServer.java
@@ -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)
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/LastAccessTimeTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/LastAccessTimeTest.java
index 82e89ef0dd..77c96a7afb 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/LastAccessTimeTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/LastAccessTimeTest.java
@@ -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();
}
-
-
}
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/LocalSessionScavengingTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/LocalSessionScavengingTest.java
index 773e5df07b..535ceec460 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/LocalSessionScavengingTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/LocalSessionScavengingTest.java
@@ -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();
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/NewSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/NewSessionTest.java
index 5fd1d18873..7264696269 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/NewSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/NewSessionTest.java
@@ -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();
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/OrphanedSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/OrphanedSessionTest.java
index 5b565bf941..b5e415dce6 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/OrphanedSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/OrphanedSessionTest.java
@@ -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();
}
-
-
-
}
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ReentrantRequestSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ReentrantRequestSessionTest.java
index 407ccc4352..5bab446e04 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ReentrantRequestSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ReentrantRequestSessionTest.java
@@ -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();
}
-
-
}
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ServerCrossContextSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ServerCrossContextSessionTest.java
index d7d4a6038d..c6732c34a5 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ServerCrossContextSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ServerCrossContextSessionTest.java
@@ -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();
}
-
-
-
}
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionMigrationTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionMigrationTest.java
index d0a3995de3..3400628007 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionMigrationTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionMigrationTest.java
@@ -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();
}
-
-
-
}
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java
index 43b1ddabf9..4389143b8b 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java
@@ -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();
}
-
-
}
diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml
index 958700496c..89eeda0d5e 100644
--- a/tests/test-sessions/test-sessions-common/pom.xml
+++ b/tests/test-sessions/test-sessions-common/pom.xml
@@ -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>
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractClientCrossContextSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractClientCrossContextSessionTest.java
index e79ed1bcc9..0674120620 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractClientCrossContextSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractClientCrossContextSessionTest.java
@@ -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
{
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractImmortalSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractImmortalSessionTest.java
index 54506a5de8..89f16737b3 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractImmortalSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractImmortalSessionTest.java
@@ -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);
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractInvalidationSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractInvalidationSessionTest.java
index aee0b40297..ecf1008985 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractInvalidationSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractInvalidationSessionTest.java
@@ -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);
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java
index cac47f0e61..379f6b3b45 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java
@@ -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);
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLightLoadTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLightLoadTest.java
index 0df0f27e9a..588ed2b6c8 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLightLoadTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLightLoadTest.java
@@ -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" );
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLocalSessionScavengingTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLocalSessionScavengingTest.java
index 386c14d8aa..03f8db0c97 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLocalSessionScavengingTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLocalSessionScavengingTest.java
@@ -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);
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractNewSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractNewSessionTest.java
index fa5f53f3c9..4c3867344c 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractNewSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractNewSessionTest.java
@@ -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
{
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractOrphanedSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractOrphanedSessionTest.java
index db8918e687..29be97b5f2 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractOrphanedSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractOrphanedSessionTest.java
@@ -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
{
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractReentrantRequestSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractReentrantRequestSessionTest.java
index ad776a332d..d8d5064172 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractReentrantRequestSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractReentrantRequestSessionTest.java
@@ -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);
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractServerCrossContextSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractServerCrossContextSessionTest.java
index fe07c05da0..e91fffd402 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractServerCrossContextSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractServerCrossContextSessionTest.java
@@ -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
{
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java
index 511efbe161..b4584fd5ae 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java
@@ -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);
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractWebAppObjectInSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractWebAppObjectInSessionTest.java
index aaaa3c19c3..3679dc9d42 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractWebAppObjectInSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractWebAppObjectInSessionTest.java
@@ -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);
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/test/MavenTestingUtils.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/test/MavenTestingUtils.java
new file mode 100644
index 0000000000..028afd3ce1
--- /dev/null
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/test/MavenTestingUtils.java
@@ -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;
+ }
+}
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/test/PathAssert.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/test/PathAssert.java
new file mode 100644
index 0000000000..f85a0976df
--- /dev/null
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/test/PathAssert.java
@@ -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());
+ }
+}

Back to the top