|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.commons.logging.security.SecurityForbiddenTestCase
public class SecurityForbiddenTestCase
Tests for logging with a security policy that forbids JCL access to anything.
Performing tests with security permissions disabled is tricky, as building error messages on failure requires certain security permissions. If the security manager blocks these, then the test can fail without the error messages being output.
This class has only one unit test, as we are (in part) checking behaviour in the static block of the LogFactory class. As that class cannot be unloaded after being loaded into a classloader, the only workaround is to use the PathableClassLoader approach to ensure each test is run in its own classloader, and use a separate testcase class for each test.
Nested Class Summary | |
---|---|
static class |
SecurityForbiddenTestCase.CustomHashtable
|
Constructor Summary | |
---|---|
SecurityForbiddenTestCase()
|
Method Summary | |
---|---|
void |
setUp()
|
static junit.framework.Test |
suite()
Return the tests included in this test suite. |
void |
tearDown()
|
void |
testAllForbidden()
Test what happens when JCL is run with absolutely no security priveleges at all, including reading system properties. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SecurityForbiddenTestCase()
Method Detail |
---|
public static junit.framework.Test suite() throws Exception
Exception
public void setUp()
setUp
in class junit.framework.TestCase
public void tearDown()
tearDown
in class junit.framework.TestCase
public void testAllForbidden()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |