Spelling
This commit is contained in:
@@ -19,7 +19,7 @@ package org.apache.commons.logging;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testcase to emulate container and application isolated from container
|
* test to emulate container and application isolated from container
|
||||||
*/
|
*/
|
||||||
public class LoadTestCase extends TestCase{
|
public class LoadTestCase extends TestCase{
|
||||||
//TODO: need some way to add service provider packages
|
//TODO: need some way to add service provider packages
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ public class PathableClassLoader extends URLClassLoader {
|
|||||||
* <p>
|
* <p>
|
||||||
* This is necessary in order for the rest of the world to communicate
|
* This is necessary in order for the rest of the world to communicate
|
||||||
* with classes loaded via a custom classloader. As an example, junit
|
* with classes loaded via a custom classloader. As an example, junit
|
||||||
* testcases which are loaded via a custom classloader needs to see
|
* tests which are loaded via a custom classloader needs to see
|
||||||
* the same junit classes as the code invoking the testcase, otherwise
|
* the same junit classes as the code invoking the test, otherwise
|
||||||
* they can't pass result objects back.
|
* they can't pass result objects back.
|
||||||
* <p>
|
* <p>
|
||||||
* Normally, only a classloader created with a null parent needs to
|
* Normally, only a classloader created with a null parent needs to
|
||||||
@@ -79,7 +79,7 @@ public class PathableClassLoader extends URLClassLoader {
|
|||||||
* totally clean; nothing but the standard java library will be
|
* totally clean; nothing but the standard java library will be
|
||||||
* present.
|
* present.
|
||||||
* <p>
|
* <p>
|
||||||
* When using a null parent classloader with a junit testcase, it *is*
|
* When using a null parent classloader with a junit test, it *is*
|
||||||
* necessary for the junit library to also be visible. In this case, it
|
* necessary for the junit library to also be visible. In this case, it
|
||||||
* is recommended that the following code be used:
|
* is recommended that the following code be used:
|
||||||
* <pre>
|
* <pre>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
|
|||||||
final URL baseUrl = dummy.findResource(thisClassPath);
|
final URL baseUrl = dummy.findResource(thisClassPath);
|
||||||
|
|
||||||
// Now set up the desired classloader hierarchy. We'll put JCL
|
// Now set up the desired classloader hierarchy. We'll put JCL
|
||||||
// in the container path, the testcase in a webapp path, and
|
// in the container path, the test in a webapp path, and
|
||||||
// both config files into the webapp path too.
|
// both config files into the webapp path too.
|
||||||
final PathableClassLoader containerLoader = new PathableClassLoader(null);
|
final PathableClassLoader containerLoader = new PathableClassLoader(null);
|
||||||
containerLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
containerLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ public class MockSecurityManager extends SecurityManager {
|
|||||||
// this is the unit test code; treat this like an untrusted client
|
// this is the unit test code; treat this like an untrusted client
|
||||||
// app that is using JCL
|
// app that is using JCL
|
||||||
++untrustedCodeCount;
|
++untrustedCodeCount;
|
||||||
System.out.println("Untrusted code [testcase] found");
|
System.out.println("Untrusted code [test] found");
|
||||||
throw new SecurityException("Untrusted code [testcase] found");
|
throw new SecurityException("Untrusted code [test] found");
|
||||||
} else if (cname.startsWith("org.apache.commons.logging.")) {
|
} else if (cname.startsWith("org.apache.commons.logging.")) {
|
||||||
if (!permissions.implies(p)) {
|
if (!permissions.implies(p)) {
|
||||||
System.out.println("Permission refused:" + p.getClass() + ":" + p);
|
System.out.println("Permission refused:" + p.getClass() + ":" + p);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import org.apache.commons.logging.PathableTestSuite;
|
|||||||
* the static block of the LogFactory class. As that class cannot be unloaded after
|
* 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
|
* being loaded into a classloader, the only workaround is to use the
|
||||||
* PathableClassLoader approach to ensure each test is run in its own
|
* PathableClassLoader approach to ensure each test is run in its own
|
||||||
* classloader, and use a separate testcase class for each test.
|
* classloader, and use a separate test class for each test.
|
||||||
*/
|
*/
|
||||||
public class SecurityAllowedTestCase extends TestCase
|
public class SecurityAllowedTestCase extends TestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import org.apache.commons.logging.PathableTestSuite;
|
|||||||
* the static block of the LogFactory class. As that class cannot be unloaded after
|
* 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
|
* being loaded into a classloader, the only workaround is to use the
|
||||||
* PathableClassLoader approach to ensure each test is run in its own
|
* PathableClassLoader approach to ensure each test is run in its own
|
||||||
* classloader, and use a separate testcase class for each test.
|
* classloader, and use a separate test class for each test.
|
||||||
*/
|
*/
|
||||||
public class SecurityForbiddenTestCase extends TestCase
|
public class SecurityForbiddenTestCase extends TestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class TcclDisabledTestCase extends TestCase {
|
|||||||
parentLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
parentLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
||||||
parentLoader.addLogicalLib("commons-logging");
|
parentLoader.addLogicalLib("commons-logging");
|
||||||
parentLoader.addLogicalLib("testclasses");
|
parentLoader.addLogicalLib("testclasses");
|
||||||
// hack to ensure that the testcase classloader can't see
|
// hack to ensure that the test classloader can't see
|
||||||
// the custom MyLog
|
// the custom MyLog
|
||||||
parentLoader.useExplicitLoader(MY_LOG_PKG + ".", emptyLoader);
|
parentLoader.useExplicitLoader(MY_LOG_PKG + ".", emptyLoader);
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class TcclEnabledTestCase extends TestCase {
|
|||||||
parentLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
parentLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
||||||
parentLoader.addLogicalLib("commons-logging");
|
parentLoader.addLogicalLib("commons-logging");
|
||||||
parentLoader.addLogicalLib("testclasses");
|
parentLoader.addLogicalLib("testclasses");
|
||||||
// hack to ensure that the testcase classloader can't see
|
// hack to ensure that the test classloader can't see
|
||||||
// the custom MyLogFactoryImpl
|
// the custom MyLogFactoryImpl
|
||||||
parentLoader.useExplicitLoader(MY_LOG_PKG + ".", emptyLoader);
|
parentLoader.useExplicitLoader(MY_LOG_PKG + ".", emptyLoader);
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class TcclDisabledTestCase extends TestCase {
|
|||||||
parentLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
parentLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
||||||
parentLoader.addLogicalLib("commons-logging");
|
parentLoader.addLogicalLib("commons-logging");
|
||||||
parentLoader.addLogicalLib("testclasses");
|
parentLoader.addLogicalLib("testclasses");
|
||||||
// hack to ensure that the testcase classloader can't see
|
// hack to ensure that the test classloader can't see
|
||||||
// the custom MyLogFactoryImpl
|
// the custom MyLogFactoryImpl
|
||||||
parentLoader.useExplicitLoader(
|
parentLoader.useExplicitLoader(
|
||||||
MY_LOG_FACTORY_PKG + ".", emptyLoader);
|
MY_LOG_FACTORY_PKG + ".", emptyLoader);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class TcclEnabledTestCase extends TestCase {
|
|||||||
parentLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
parentLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
|
||||||
parentLoader.addLogicalLib("commons-logging");
|
parentLoader.addLogicalLib("commons-logging");
|
||||||
parentLoader.addLogicalLib("testclasses");
|
parentLoader.addLogicalLib("testclasses");
|
||||||
// hack to ensure that the testcase classloader can't see
|
// hack to ensure that the test classloader can't see
|
||||||
// the cust MyLogFactoryImpl
|
// the cust MyLogFactoryImpl
|
||||||
parentLoader.useExplicitLoader(
|
parentLoader.useExplicitLoader(
|
||||||
"org.apache.commons.logging.tccl.custom.", emptyLoader);
|
"org.apache.commons.logging.tccl.custom.", emptyLoader);
|
||||||
|
|||||||
Reference in New Issue
Block a user