You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/05/18 11:38:14 UTC

git commit: WICKET-4554 WicketTester tries to create a directory called "tester" every time the tests run and thus fails when run under the security manager

Updated Branches:
  refs/heads/wicket-1.5.x 9a53bcd61 -> 635885717


WICKET-4554 WicketTester tries to create a directory called "tester" every time the tests run and thus fails when run under the security manager


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/63588571
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/63588571
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/63588571

Branch: refs/heads/wicket-1.5.x
Commit: 63588571774a76e450d12b0a6749a89a5a80099e
Parents: 9a53bcd
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri May 18 11:37:21 2012 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri May 18 11:37:21 2012 +0200

----------------------------------------------------------------------
 .../protocol/http/mock/MockServletContext.java     |   18 ++++++++++++--
 1 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/63588571/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
index 392e921..0b7be70 100755
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
@@ -95,12 +95,24 @@ public class MockServletContext implements ServletContext
 			}
 		}
 
-		// assume we're running in maven or an eclipse project created by maven,
+		// the user app can configure specific work folder by setting -Dwicket.tester.work.folder JVM option,
+		// otherwise assume we're running in maven or an eclipse project created by maven,
 		// so the sessions directory will be created inside the target directory,
 		// and will be cleaned up with a mvn clean
 
-		File file = new File("target/work/");
-		file.mkdirs();
+		String workFolder = System.getProperty("wicket.tester.work.folder", "target/work/");
+		File file = new File(workFolder);
+		try
+		{
+			file.mkdirs();
+		}
+		catch (SecurityException sx)
+		{
+			// not allowed to write so fallback to tmpdir
+			String tmpDir = System.getProperty("java.io.tmpdir");
+			file = new File(tmpDir);
+		}
+			
 		attributes.put("javax.servlet.context.tempdir", file);
 
 		mimeTypes.put("html", "text/html");