[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Property replacement
adrian@jboss.org
do-not-reply at jboss.com
Tue Jan 23 11:06:45 EST 2007
"alesj" wrote :
| AbstractTestDelegate delegate = getDelegate();
| delegate.enableSecurity = false;
|
This won't work.
The flag is only considered during test setup
You could perhaps add a couple of methods to AbstractTestCaseWithSetup
that let you temporarily suspend the security manager.
| protected SecurityManager suspendSecurity()
| {
| SecurityManager result = System.getSecurityManager();
| System.setSecurityManager(null);
| return result;
| }
|
| protected void resumeSecurity(SecurityManager securityManager)
| {
| System.setSecurityManager(securityManager);
| }
|
| |
| | You could then do:
| |
| |
| | | SecurityManager sm = suspendSecurity();
| | | try
| | | {
| | | // Do priviledged stuff
| | | }
| | | finally
| | | {
| | | resumeSecurity(sm);
| | | }
| | |
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005362#4005362
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005362
More information about the jboss-dev-forums
mailing list