This content has been marked as final.
Show 2 replies
-
1. Re: Security errors with maven tests
anil.saldhana Dec 4, 2007 12:35 PM (in response to pgier)It is possible that the Java Security Manager is enabled and you will need to add appropriate Java permissions.
-
2. Re: Security errors with maven tests
adrian.brock Dec 4, 2007 12:47 PM (in response to pgier)This is the security policy from jboss-test.
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/test/trunk/src/main/java/org/jboss/test/security/TestsPolicyPlugin.java?revision=62656&view=markup
Specifically:// Is this a test location? File file = new File(url.toString()); String name = file.getName(); if (name.indexOf("tests") != -1 || name.indexOf("test-classes") != -1 || name.indexOf("-test.jar") != -1) {
Your AOPTestDelegate class will be in target/test-classes so it gets no permissions.
If you can't figure out how to do it properly, you can workaround the problem with a hack.
You can't suspend the security manager, but there is somebody who can. ;-)import org.jboss.test.AbstractTestCaseWithSetup; // turn off security SecurityManager sm = AbstractTestCaseWithSetup.suspendSecurity(); try { // do bad things here } finally { // resume security AbstractTestCaseWithSetup.resumeSecurity(sm); }
This is only intended for test infrastructure.
The point of testing with a security manager enabled is to determine which parts
of the code need privileged blocks to work correctly.