Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Bartel2016-02-03 08:52:39 -0500
committerJan Bartel2016-02-03 08:52:39 -0500
commit459ba4ae5aa7f9a29d18b4e08848ff6e1cec0e4a (patch)
tree8cc4b97971f929d46fe07af5502c10818387d901
parent273e87a851669058f364303a206ce9929fe97f4c (diff)
downloadorg.eclipse.jetty.project-459ba4ae5aa7f9a29d18b4e08848ff6e1cec0e4a.tar.gz
org.eclipse.jetty.project-459ba4ae5aa7f9a29d18b4e08848ff6e1cec0e4a.tar.xz
org.eclipse.jetty.project-459ba4ae5aa7f9a29d18b4e08848ff6e1cec0e4a.zip
Fix FileSessionManagerTest to put tmp file in target dir
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/session/FileSessionManagerTest.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/session/FileSessionManagerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/session/FileSessionManagerTest.java
index a33c66bc9a..dfe52274cd 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/session/FileSessionManagerTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/session/FileSessionManagerTest.java
@@ -74,14 +74,15 @@ public class FileSessionManagerTest
handler.setSessionManager(manager);
manager.start();
- String expectedFilename = "../../_0.0.0.0_dangerFile";
-
+ //Create a file that is in the parent dir of the session storeDir
+ String expectedFilename = "_0.0.0.0_dangerFile";
MavenTestingUtils.getTargetFile(expectedFilename).createNewFile();
-
Assert.assertTrue("File should exist!", MavenTestingUtils.getTargetFile(expectedFilename).exists());
- manager.getSession("../../_0.0.0.0_dangerFile");
-
+ //Verify that passing in the relative filename of an unrecoverable session does not lead
+ //to deletion of file outside the session dir (needs deleteUnrecoverableFiles(true))
+ Session session = manager.getSession("../_0.0.0.0_dangerFile");
+ Assert.assertTrue(session == null);
Assert.assertTrue("File should exist!", MavenTestingUtils.getTargetFile(expectedFilename).exists());
}
@@ -111,7 +112,7 @@ public class FileSessionManagerTest
Assert.assertTrue("File should exist!", new File(testDir, expectedFilename).exists());
- manager.getSession("validFile123");
+ Session session = manager.getSession("validFile123");
Assert.assertTrue("File shouldn't exist!", !new File(testDir,expectedFilename).exists());
}

Back to the top