On Tue, Sep 6, 2011 at 4:53 PM, sebb <seb...@gmail.com> wrote: > On 6 September 2011 17:55, Gary Gregory <garydgreg...@gmail.com> wrote: > > Here is the current set up: > > > > - To run tests: Same as before: "mvn test" > > - To runt tests with the Java security manager: comment out some XML in > the > > POM and run "mvn integration-test" > > > > The policy file does for Sufire+JUnit 4 what Surefire does by itself for > > JUnit 3: It grants Surefire and JUnit just enough permissions to run > tests, > > no more, no less. > > > > Surefire needs to get fixed. > > > > I hope this clarifies it all :) > > OK, I see now [1] et seq. >
I created http://jira.codehaus.org/browse/SUREFIRE-767 to track JUnit 4 support. > > With JUnit3, Surefire is able to independently change the permissions > for the Surefire and JUnit code, regardless of whatever permissions > are set up for the test run as a whole. > > Otherwise, the permissions have to be set up to support the test code > and the code under test. > Right, the current policy file is enough to get tests started but does not guarantee a clean separation b/w the test infra and the tests themselves. Gary > > [1] > http://maven.apache.org/plugins/maven-surefire-plugin/examples/junit.html#Using_a_security_manager_JUnit3_only > > > Gary > > > > On Tue, Sep 6, 2011 at 12:42 PM, sebb <seb...@gmail.com> wrote: > > > >> On 6 September 2011 17:16, Gary Gregory <garydgreg...@gmail.com> wrote: > >> > On Tue, Sep 6, 2011 at 11:14 AM, sebb <seb...@gmail.com> wrote: > >> > > >> >> On 6 September 2011 15:44, Gary Gregory <garydgreg...@gmail.com> > wrote: > >> >> > On Tue, Sep 6, 2011 at 9:48 AM, sebb <seb...@gmail.com> wrote: > >> >> > > >> >> >> On 6 September 2011 13:46, <ggreg...@apache.org> wrote: > >> >> >> > Author: ggregory > >> >> >> > Date: Tue Sep 6 12:46:39 2011 > >> >> >> > New Revision: 1165645 > >> >> >> > > >> >> >> > URL: http://svn.apache.org/viewvc?rev=1165645&view=rev > >> >> >> > Log: > >> >> >> > Changes for [parent] 22-SNAPSHOT. > >> >> >> > > >> >> >> > Modified: > >> >> >> > commons/proper/lang/trunk/src/test/resources/java.policy > >> >> >> > > >> >> >> > Modified: > commons/proper/lang/trunk/src/test/resources/java.policy > >> >> >> > URL: > >> >> >> > >> >> > >> > http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/resources/java.policy?rev=1165645&r1=1165644&r2=1165645&view=diff > >> >> >> > > >> >> >> > >> >> > >> > ============================================================================== > >> >> >> > --- commons/proper/lang/trunk/src/test/resources/java.policy > >> >> (original) > >> >> >> > +++ commons/proper/lang/trunk/src/test/resources/java.policy Tue > >> Sep > >> >> 6 > >> >> >> 12:46:39 2011 > >> >> >> > @@ -194,6 +194,7 @@ grant { > >> >> >> > // at > >> >> >> > >> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69) > >> >> >> > > >> >> >> > permission java.io.FilePermission > >> >> >> > >> >> > >> > "${user.home}/.m2/repository/org/apache/maven/surefire/surefire-junit4/2.8.1/surefire-junit4-2.8.1.jar", > >> >> >> "read"; > >> >> >> > + permission java.io.FilePermission > >> >> >> > >> >> > >> > "${user.home}/.m2/repository/org/apache/maven/surefire/surefire-junit4/2.9/surefire-junit4-2.9.jar", > >> >> >> "read"; > >> >> >> > >> >> >> That won't work for me - I use a customised repo directory. Also > it's > >> >> >> a pain to keep changing the jar versions. > >> >> >> Probably won't work for some IDEs either, and may not work on CIs > >> such > >> >> >> as Gump and Continuum. > >> >> >> > >> >> >> Is there any way to give the test classes normal permissions, and > >> just > >> >> >> restrict the classes under test? > >> >> >> > >> >> > > >> >> > Yes, only if you use Surefire with JUnit 3. JUnit 4 is not > supported > >> >> IIRC. > >> >> > >> >> Surely this is a JAAS issue? > >> >> > >> > > >> > This is about configuring JAAS, which surefire does for JUnit 3 but > not 4 > >> > (based on what I read). > >> > >> I thought it was controlled by setting properties for the JVM, i.e. > >> nothing to do with Surefire (except it has to pass the parameters to > >> the forked JVM). > >> > >> > Gary > >> > > >> > > >> >> > >> >> > Gary > >> >> > > >> >> > > >> >> >> > >> >> >> > > >> >> >> > // java.security.AccessControlException: access denied > >> >> >> (java.io.FilePermission > >> >> >> > >> >> > >> > C:\Users\ggregory\.m2\repository\org\apache\maven\surefire\surefire-api\2.8.1\surefire-api-2.8.1.jar > >> >> >> read) > >> >> >> > @@ -212,6 +213,7 @@ grant { > >> >> >> > //at > >> >> >> > >> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69) > >> >> >> > > >> >> >> > permission java.io.FilePermission > >> >> >> > >> >> > >> > "${user.home}/.m2/repository/org/apache/maven/surefire/surefire-api/2.8.1/surefire-api-2.8.1.jar", > >> >> >> "read"; > >> >> >> > + permission java.io.FilePermission > >> >> >> > >> >> > >> > "${user.home}/.m2/repository/org/apache/maven/surefire/surefire-api/2.9/surefire-api-2.9.jar", > >> >> >> "read"; > >> >> >> > > >> >> >> > > >> >> >> > // java.security.AccessControlException: access denied > >> >> >> (java.lang.RuntimePermission createClassLoader) > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > >> >> >> > --------------------------------------------------------------------- > >> >> >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > >> >> >> For additional commands, e-mail: dev-h...@commons.apache.org > >> >> >> > >> >> >> > >> >> > > >> >> > > >> >> > -- > >> >> > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org > >> >> > JUnit in Action, 2nd Ed: http://s.apache.org/rl > >> >> > Spring Batch in Action: http://s.apache.org/HOq > >> >> > Blog: http://garygregory.wordpress.com > >> >> > Home: http://garygregory.com/ > >> >> > Tweet! http://twitter.com/GaryGregory > >> >> > > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > >> >> For additional commands, e-mail: dev-h...@commons.apache.org > >> >> > >> >> > >> > > >> > > >> > -- > >> > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org > >> > JUnit in Action, 2nd Ed: http://s.apache.org/rl > >> > Spring Batch in Action: http://s.apache.org/HOq > >> > Blog: http://garygregory.wordpress.com > >> > Home: http://garygregory.com/ > >> > Tweet! http://twitter.com/GaryGregory > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > >> For additional commands, e-mail: dev-h...@commons.apache.org > >> > >> > > > > > > -- > > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org > > JUnit in Action, 2nd Ed: http://s.apache.org/rl > > Spring Batch in Action: http://s.apache.org/HOq > > Blog: http://garygregory.wordpress.com > > Home: http://garygregory.com/ > > Tweet! http://twitter.com/GaryGregory > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org JUnit in Action, 2nd Ed: http://s.apache.org/rl Spring Batch in Action: http://s.apache.org/HOq Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory