1
0

More removal of trailing spaces.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/logging/trunk@1432587 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart
2013-01-13 11:11:32 +00:00
parent 81e90d14a3
commit 2789e087fd
51 changed files with 334 additions and 357 deletions

View File

@@ -5,17 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
import junit.framework.TestCase; import junit.framework.TestCase;
@@ -25,7 +23,7 @@ import junit.framework.TestCase;
* Generic tests that can be applied to any log adapter by * Generic tests that can be applied to any log adapter by
* subclassing this class and defining method getLogObject * subclassing this class and defining method getLogObject
* appropriately. * appropriately.
* *
* @author Sean C. Sullivan * @author Sean C. Sullivan
* @version $Revision$ * @version $Revision$
*/ */
@@ -92,5 +90,5 @@ public abstract class AbstractLogTest extends TestCase {
log.warn(log.getClass().getName() + ": warn statement"); log.warn(log.getClass().getName() + ": warn statement");
log.warn(log.getClass().getName() + ": warn statement w/ null exception", new RuntimeException()); log.warn(log.getClass().getName() + ": warn statement w/ null exception", new RuntimeException());
} }
} }

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
@@ -23,7 +23,7 @@ public class AltHashtable extends Hashtable {
public static Object lastKey; public static Object lastKey;
public static Object lastValue; public static Object lastValue;
public Object put(Object key, Object value) { public Object put(Object key, Object value) {
lastKey = key; lastKey = key;
lastValue = value; lastValue = value;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
@@ -24,8 +24,6 @@ import junit.framework.TestCase;
* Test the ability to force the LogFactory class to use some * Test the ability to force the LogFactory class to use some
* arbitrary Hashtable implementation to store its mapping from * arbitrary Hashtable implementation to store its mapping from
* context-classloader -> LogFactory object. * context-classloader -> LogFactory object.
* <p>
* This is done by
*/ */
public class AltHashtableTestCase extends TestCase { public class AltHashtableTestCase extends TestCase {
@@ -47,20 +45,20 @@ public class AltHashtableTestCase extends TestCase {
* <p> * <p>
* This method ensures that the appropriate system property is defined * This method ensures that the appropriate system property is defined
* to force the LogFactory class to use the AltHashtable class as its * to force the LogFactory class to use the AltHashtable class as its
* Hashtable implementation for storing factories in. * Hashtable implementation for storing factories in.
* <p> * <p>
* This does make the assumption that whatever JVM we are running in * This does make the assumption that whatever JVM we are running in
* doesn't initialise classes until they are actually referenced (ie the * doesn't initialise classes until they are actually referenced (ie the
* LogFactory class hasn't been initialised before this method is called). * LogFactory class hasn't been initialised before this method is called).
* This is true of all JVMs I know of; and if it isn't then this test will * This is true of all JVMs I know of; and if it isn't then this test will
* fail and someone will tell us. * fail and someone will tell us.
*/ */
public void setUp() { public void setUp() {
System.setProperty( System.setProperty(
"org.apache.commons.logging.LogFactory.HashtableImpl", "org.apache.commons.logging.LogFactory.HashtableImpl",
AltHashtable.class.getName()); AltHashtable.class.getName());
} }
/** /**
* Verify that initialising the LogFactory class will cause it * Verify that initialising the LogFactory class will cause it
* to instantiate an object of type specified in system property * to instantiate an object of type specified in system property
@@ -75,7 +73,7 @@ public class AltHashtableTestCase extends TestCase {
// doesn't change the effectiveness of this test. // doesn't change the effectiveness of this test.
assertTrue(LogFactory.factories instanceof AltHashtable); assertTrue(LogFactory.factories instanceof AltHashtable);
} }
/** /**
* Verify that when LogFactory sees a context-classloader for the * Verify that when LogFactory sees a context-classloader for the
* first time that it creates a new entry in the LogFactory.factories * first time that it creates a new entry in the LogFactory.factories
@@ -86,7 +84,7 @@ public class AltHashtableTestCase extends TestCase {
public void testPutCalled() throws Exception { public void testPutCalled() throws Exception {
AltHashtable.lastKey = null; AltHashtable.lastKey = null;
AltHashtable.lastValue = null; AltHashtable.lastValue = null;
LogFactory.getLog(AltHashtableTestCase.class); LogFactory.getLog(AltHashtableTestCase.class);
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
assertEquals(contextLoader, AltHashtable.lastKey); assertEquals(contextLoader, AltHashtable.lastKey);

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
@@ -28,7 +28,7 @@ public class BadHashtablePropertyTestCase extends TestCase {
public void testType() { public void testType() {
assertTrue(LogFactory.factories instanceof Hashtable); assertTrue(LogFactory.factories instanceof Hashtable);
} }
public void testPutCalled() throws Exception { public void testPutCalled() throws Exception {
LogFactory.getLog(BadHashtablePropertyTestCase.class); LogFactory.getLog(BadHashtablePropertyTestCase.class);
} }

View File

@@ -5,25 +5,24 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
import junit.framework.TestCase; import junit.framework.TestCase;
/** /**
* Tests the basic logging operations to ensure that they all function * Tests the basic logging operations to ensure that they all function
* without exception failure. In other words, that they do no fail by * without exception failure. In other words, that they do no fail by
* throwing exceptions. * throwing exceptions.
* This is the minimum requirement for any well behaved logger * This is the minimum requirement for any well behaved logger
* and so this test should be run for each kind. * and so this test should be run for each kind.
*/ */
public class BasicOperationsTestCase extends TestCase public class BasicOperationsTestCase extends TestCase
@@ -33,13 +32,13 @@ public class BasicOperationsTestCase extends TestCase
Log log = LogFactory.getLog(BasicOperationsTestCase.class); Log log = LogFactory.getLog(BasicOperationsTestCase.class);
executeIsEnabledTest(log); executeIsEnabledTest(log);
} }
public void testIsEnabledNamedLog() public void testIsEnabledNamedLog()
{ {
Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName()); Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
executeIsEnabledTest(log); executeIsEnabledTest(log);
} }
public void executeIsEnabledTest(Log log) public void executeIsEnabledTest(Log log)
{ {
try try
@@ -57,20 +56,19 @@ public class BasicOperationsTestCase extends TestCase
fail("Exception thrown: " + t); fail("Exception thrown: " + t);
} }
} }
public void testMessageWithoutExceptionClassLog() public void testMessageWithoutExceptionClassLog()
{ {
Log log = LogFactory.getLog(BasicOperationsTestCase.class); Log log = LogFactory.getLog(BasicOperationsTestCase.class);
executeMessageWithoutExceptionTest(log); executeMessageWithoutExceptionTest(log);
} }
public void testMessageWithoutExceptionNamedLog() public void testMessageWithoutExceptionNamedLog()
{ {
Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName()); Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
executeMessageWithoutExceptionTest(log); executeMessageWithoutExceptionTest(log);
} }
public void executeMessageWithoutExceptionTest(Log log) public void executeMessageWithoutExceptionTest(Log log)
{ {
try try
@@ -88,19 +86,19 @@ public class BasicOperationsTestCase extends TestCase
fail("Exception thrown: " + t); fail("Exception thrown: " + t);
} }
} }
public void testMessageWithExceptionClassLog() public void testMessageWithExceptionClassLog()
{ {
Log log = LogFactory.getLog(BasicOperationsTestCase.class); Log log = LogFactory.getLog(BasicOperationsTestCase.class);
executeMessageWithExceptionTest(log); executeMessageWithExceptionTest(log);
} }
public void testMessageWithExceptionNamedLog() public void testMessageWithExceptionNamedLog()
{ {
Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName()); Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
executeMessageWithExceptionTest(log); executeMessageWithExceptionTest(log);
} }
public void executeMessageWithExceptionTest(Log log) public void executeMessageWithExceptionTest(Log log)
{ {
try try

View File

@@ -5,16 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
/** /**

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
import junit.framework.TestCase; import junit.framework.TestCase;

View File

@@ -5,16 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
import junit.framework.TestCase; import junit.framework.TestCase;

View File

@@ -5,16 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
import java.io.File; import java.io.File;

View File

@@ -5,16 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
import java.util.Properties; import java.util.Properties;

View File

@@ -5,16 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
import org.apache.commons.logging.impl.SimpleLog; import org.apache.commons.logging.impl.SimpleLog;

View File

@@ -5,23 +5,21 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging; package org.apache.commons.logging;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.impl.LogFactoryImpl; import org.apache.commons.logging.impl.LogFactoryImpl;
public class UserClass { public class UserClass {
/** /**
* Set the ALLOW_FLAWED_CONTEXT feature on the LogFactoryImpl object * Set the ALLOW_FLAWED_CONTEXT feature on the LogFactoryImpl object
@@ -33,11 +31,11 @@ public class UserClass {
*/ */
public static void setAllowFlawedContext(String state) { public static void setAllowFlawedContext(String state) {
LogFactory f = LogFactory.getFactory(); LogFactory f = LogFactory.getFactory();
f.setAttribute(LogFactoryImpl.ALLOW_FLAWED_CONTEXT_PROPERTY, state); f.setAttribute(LogFactoryImpl.ALLOW_FLAWED_CONTEXT_PROPERTY, state);
} }
public UserClass() { public UserClass() {
Log log = LogFactory.getLog(LoadTestCase.class); Log log = LogFactory.getLog(LoadTestCase.class);
} }
} }

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.avalon; package org.apache.commons.logging.avalon;
import org.apache.avalon.framework.logger.NullLogger; import org.apache.avalon.framework.logger.NullLogger;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.config; package org.apache.commons.logging.config;
@@ -58,7 +58,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
dummy.useExplicitLoader("junit.", Test.class.getClassLoader()); dummy.useExplicitLoader("junit.", Test.class.getClassLoader());
dummy.addLogicalLib("testclasses"); dummy.addLogicalLib("testclasses");
dummy.addLogicalLib("commons-logging"); dummy.addLogicalLib("commons-logging");
String thisClassPath = thisClass.getName().replace('.', '/') + ".class"; String thisClassPath = thisClass.getName().replace('.', '/') + ".class";
URL baseUrl = dummy.findResource(thisClassPath); URL baseUrl = dummy.findResource(thisClassPath);
@@ -68,7 +68,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
PathableClassLoader containerLoader = new PathableClassLoader(null); PathableClassLoader containerLoader = new PathableClassLoader(null);
containerLoader.useExplicitLoader("junit.", Test.class.getClassLoader()); containerLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
containerLoader.addLogicalLib("commons-logging"); containerLoader.addLogicalLib("commons-logging");
PathableClassLoader webappLoader = new PathableClassLoader(containerLoader); PathableClassLoader webappLoader = new PathableClassLoader(containerLoader);
webappLoader.addLogicalLib("testclasses"); webappLoader.addLogicalLib("testclasses");
@@ -77,7 +77,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
URL pri10URL = new URL(baseUrl, "priority10/"); URL pri10URL = new URL(baseUrl, "priority10/");
webappLoader.addURL(pri10URL); webappLoader.addURL(pri10URL);
// load the test class via webapp loader, and use the webapp loader // load the test class via webapp loader, and use the webapp loader
// as the tccl loader too. // as the tccl loader too.
Class testClass = webappLoader.loadClass(thisClass.getName()); Class testClass = webappLoader.loadClass(thisClass.getName());
@@ -113,7 +113,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
// context classloader should be thisClassLoader // context classloader should be thisClassLoader
assertEquals(thisClassLoader, contextClassLoader); assertEquals(thisClassLoader, contextClassLoader);
// lfClassLoader should be parent of this classloader // lfClassLoader should be parent of this classloader
assertEquals(lfClassLoader, thisClassLoader.getParent()); assertEquals(lfClassLoader, thisClassLoader.getParent());
assertEquals(PathableClassLoader.class.getName(), assertEquals(PathableClassLoader.class.getName(),

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.config; package org.apache.commons.logging.config;
@@ -65,7 +65,7 @@ public class PriorityConfigTestCase extends TestCase {
dummy.useExplicitLoader("junit.", Test.class.getClassLoader()); dummy.useExplicitLoader("junit.", Test.class.getClassLoader());
dummy.addLogicalLib("testclasses"); dummy.addLogicalLib("testclasses");
dummy.addLogicalLib("commons-logging"); dummy.addLogicalLib("commons-logging");
String thisClassPath = thisClass.getName().replace('.', '/') + ".class"; String thisClassPath = thisClass.getName().replace('.', '/') + ".class";
URL baseUrl = dummy.findResource(thisClassPath); URL baseUrl = dummy.findResource(thisClassPath);
@@ -79,7 +79,7 @@ public class PriorityConfigTestCase extends TestCase {
PathableClassLoader containerLoader = new PathableClassLoader(null); PathableClassLoader containerLoader = new PathableClassLoader(null);
containerLoader.useExplicitLoader("junit.", Test.class.getClassLoader()); containerLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
containerLoader.addLogicalLib("commons-logging"); containerLoader.addLogicalLib("commons-logging");
URL pri10URL = new URL(baseUrl, "priority10/"); URL pri10URL = new URL(baseUrl, "priority10/");
containerLoader.addURL(pri10URL); containerLoader.addURL(pri10URL);
@@ -89,13 +89,13 @@ public class PriorityConfigTestCase extends TestCase {
URL noPriorityURL = new URL(baseUrl, "nopriority/"); URL noPriorityURL = new URL(baseUrl, "nopriority/");
webappLoader.addURL(noPriorityURL); webappLoader.addURL(noPriorityURL);
URL pri20URL = new URL(baseUrl, "priority20/"); URL pri20URL = new URL(baseUrl, "priority20/");
webappLoader.addURL(pri20URL); webappLoader.addURL(pri20URL);
URL pri20aURL = new URL(baseUrl, "priority20a/"); URL pri20aURL = new URL(baseUrl, "priority20a/");
webappLoader.addURL(pri20aURL); webappLoader.addURL(pri20aURL);
// load the test class via webapp loader, and use the webapp loader // load the test class via webapp loader, and use the webapp loader
// as the tccl loader too. // as the tccl loader too.
Class testClass = webappLoader.loadClass(thisClass.getName()); Class testClass = webappLoader.loadClass(thisClass.getName());

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.impl; package org.apache.commons.logging.impl;
@@ -53,19 +53,18 @@ public class WeakHashtableTest extends TestCase {
public WeakHashtableTest(String testName) { public WeakHashtableTest(String testName) {
super(testName); super(testName);
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
weakHashtable = new WeakHashtable(); weakHashtable = new WeakHashtable();
keyOne = new Long(1); keyOne = new Long(1);
keyTwo = new Long(2); keyTwo = new Long(2);
keyThree = new Long(3); keyThree = new Long(3);
valueOne = new Long(100); valueOne = new Long(100);
valueTwo = new Long(200); valueTwo = new Long(200);
valueThree = new Long(300); valueThree = new Long(300);
weakHashtable.put(keyOne, valueOne); weakHashtable.put(keyOne, valueOne);
weakHashtable.put(keyTwo, valueTwo); weakHashtable.put(keyTwo, valueTwo);
weakHashtable.put(keyThree, valueThree); weakHashtable.put(keyThree, valueThree);
@@ -81,7 +80,7 @@ public class WeakHashtableTest extends TestCase {
assertTrue(weakHashtable.contains(new Long(300))); assertTrue(weakHashtable.contains(new Long(300)));
assertFalse(weakHashtable.contains(new Long(400))); assertFalse(weakHashtable.contains(new Long(400)));
} }
/** Tests public boolean containsKey(Object key) */ /** Tests public boolean containsKey(Object key) */
public void testContainsKey() throws Exception { public void testContainsKey() throws Exception {
assertTrue(weakHashtable.containsKey(new Long(1))); assertTrue(weakHashtable.containsKey(new Long(1)));
@@ -90,9 +89,9 @@ public class WeakHashtableTest extends TestCase {
assertFalse(weakHashtable.containsKey(new Long(100))); assertFalse(weakHashtable.containsKey(new Long(100)));
assertFalse(weakHashtable.containsKey(new Long(200))); assertFalse(weakHashtable.containsKey(new Long(200)));
assertFalse(weakHashtable.containsKey(new Long(300))); assertFalse(weakHashtable.containsKey(new Long(300)));
assertFalse(weakHashtable.containsKey(new Long(400))); assertFalse(weakHashtable.containsKey(new Long(400)));
} }
/** Tests public boolean containsValue(Object value) */ /** Tests public boolean containsValue(Object value) */
public void testContainsValue() throws Exception { public void testContainsValue() throws Exception {
assertFalse(weakHashtable.containsValue(new Long(1))); assertFalse(weakHashtable.containsValue(new Long(1)));
@@ -101,9 +100,9 @@ public class WeakHashtableTest extends TestCase {
assertTrue(weakHashtable.containsValue(new Long(100))); assertTrue(weakHashtable.containsValue(new Long(100)));
assertTrue(weakHashtable.containsValue(new Long(200))); assertTrue(weakHashtable.containsValue(new Long(200)));
assertTrue(weakHashtable.containsValue(new Long(300))); assertTrue(weakHashtable.containsValue(new Long(300)));
assertFalse(weakHashtable.containsValue(new Long(400))); assertFalse(weakHashtable.containsValue(new Long(400)));
} }
/** Tests public Enumeration elements() */ /** Tests public Enumeration elements() */
public void testElements() throws Exception { public void testElements() throws Exception {
ArrayList elements = new ArrayList(); ArrayList elements = new ArrayList();
@@ -115,7 +114,7 @@ public class WeakHashtableTest extends TestCase {
assertTrue(elements.contains(valueTwo)); assertTrue(elements.contains(valueTwo));
assertTrue(elements.contains(valueThree)); assertTrue(elements.contains(valueThree));
} }
/** Tests public Set entrySet() */ /** Tests public Set entrySet() */
public void testEntrySet() throws Exception { public void testEntrySet() throws Exception {
Set entrySet = weakHashtable.entrySet(); Set entrySet = weakHashtable.entrySet();
@@ -133,15 +132,15 @@ public class WeakHashtableTest extends TestCase {
} }
} }
} }
/** Tests public Object get(Object<EFBFBD>key) */ /** Tests public Object get(Object key) */
public void testGet() throws Exception { public void testGet() throws Exception {
assertEquals(valueOne, weakHashtable.get(keyOne)); assertEquals(valueOne, weakHashtable.get(keyOne));
assertEquals(valueTwo, weakHashtable.get(keyTwo)); assertEquals(valueTwo, weakHashtable.get(keyTwo));
assertEquals(valueThree, weakHashtable.get(keyThree)); assertEquals(valueThree, weakHashtable.get(keyThree));
assertNull(weakHashtable.get(new Long(50))); assertNull(weakHashtable.get(new Long(50)));
} }
/** Tests public Enumeration keys() */ /** Tests public Enumeration keys() */
public void testKeys() throws Exception { public void testKeys() throws Exception {
ArrayList keys = new ArrayList(); ArrayList keys = new ArrayList();
@@ -151,9 +150,9 @@ public class WeakHashtableTest extends TestCase {
assertEquals(3, keys.size()); assertEquals(3, keys.size());
assertTrue(keys.contains(keyOne)); assertTrue(keys.contains(keyOne));
assertTrue(keys.contains(keyTwo)); assertTrue(keys.contains(keyTwo));
assertTrue(keys.contains(keyThree)); assertTrue(keys.contains(keyThree));
} }
/** Tests public Set keySet() */ /** Tests public Set keySet() */
public void testKeySet() throws Exception { public void testKeySet() throws Exception {
Set keySet = weakHashtable.keySet(); Set keySet = weakHashtable.keySet();
@@ -162,14 +161,14 @@ public class WeakHashtableTest extends TestCase {
assertTrue(keySet.contains(keyTwo)); assertTrue(keySet.contains(keyTwo));
assertTrue(keySet.contains(keyThree)); assertTrue(keySet.contains(keyThree));
} }
/** Tests public Object put(Object key, Object value) */ /** Tests public Object put(Object key, Object value) */
public void testPut() throws Exception { public void testPut() throws Exception {
Long anotherKey = new Long(2004); Long anotherKey = new Long(2004);
weakHashtable.put(anotherKey, new Long(1066)); weakHashtable.put(anotherKey, new Long(1066));
assertEquals(new Long(1066), weakHashtable.get(anotherKey)); assertEquals(new Long(1066), weakHashtable.get(anotherKey));
// Test compliance with the hashtable API re nulls // Test compliance with the hashtable API re nulls
Exception caught = null; Exception caught = null;
try { try {
@@ -188,7 +187,7 @@ public class WeakHashtableTest extends TestCase {
} }
assertNotNull("did not throw an exception adding a null value", caught); assertNotNull("did not throw an exception adding a null value", caught);
} }
/** Tests public void putAll(Map t) */ /** Tests public void putAll(Map t) */
public void testPutAll() throws Exception { public void testPutAll() throws Exception {
Map newValues = new HashMap(); Map newValues = new HashMap();
@@ -199,19 +198,19 @@ public class WeakHashtableTest extends TestCase {
Long anotherNewValue = new Long(1815); Long anotherNewValue = new Long(1815);
newValues.put(anotherNewKey, anotherNewValue); newValues.put(anotherNewKey, anotherNewValue);
weakHashtable.putAll(newValues); weakHashtable.putAll(newValues);
assertEquals(5, weakHashtable.size()); assertEquals(5, weakHashtable.size());
assertEquals(newValue, weakHashtable.get(newKey)); assertEquals(newValue, weakHashtable.get(newKey));
assertEquals(anotherNewValue, weakHashtable.get(anotherNewKey)); assertEquals(anotherNewValue, weakHashtable.get(anotherNewKey));
} }
/** Tests public Object remove(Object<EFBFBD>key) */ /** Tests public Object remove(Object key) */
public void testRemove() throws Exception { public void testRemove() throws Exception {
weakHashtable.remove(keyOne); weakHashtable.remove(keyOne);
assertEquals(2, weakHashtable.size()); assertEquals(2, weakHashtable.size());
assertNull(weakHashtable.get(keyOne)); assertNull(weakHashtable.get(keyOne));
} }
/** Tests public Collection values() */ /** Tests public Collection values() */
public void testValues() throws Exception { public void testValues() throws Exception {
Collection values = weakHashtable.values(); Collection values = weakHashtable.values();
@@ -220,7 +219,7 @@ public class WeakHashtableTest extends TestCase {
assertTrue(values.contains(valueTwo)); assertTrue(values.contains(valueTwo));
assertTrue(values.contains(valueThree)); assertTrue(values.contains(valueThree));
} }
public void testRelease() throws Exception { public void testRelease() throws Exception {
assertNotNull(weakHashtable.get(new Long(1))); assertNotNull(weakHashtable.get(new Long(1)));
ReferenceQueue testQueue = new ReferenceQueue(); ReferenceQueue testQueue = new ReferenceQueue();
@@ -233,7 +232,7 @@ public class WeakHashtableTest extends TestCase {
valueOne = null; valueOne = null;
valueTwo = null; valueTwo = null;
valueThree = null; valueThree = null;
int iterations = 0; int iterations = 0;
int bytz = 2; int bytz = 2;
while(true) { while(true) {
@@ -241,23 +240,23 @@ public class WeakHashtableTest extends TestCase {
if(iterations++ > MAX_GC_ITERATIONS){ if(iterations++ > MAX_GC_ITERATIONS){
fail("Max iterations reached before resource released."); fail("Max iterations reached before resource released.");
} }
if(weakHashtable.get(new Long(1)) == null) { if(weakHashtable.get(new Long(1)) == null) {
break; break;
} else { } else {
// create garbage: // create garbage:
byte[] b = new byte[bytz]; byte[] b = new byte[bytz];
bytz = bytz * 2; bytz = bytz * 2;
} }
} }
// some JVMs seem to take a little time to put references on // some JVMs seem to take a little time to put references on
// the reference queue once the reference has been collected // the reference queue once the reference has been collected
// need to think about whether this is enough to justify // need to think about whether this is enough to justify
// stepping through the collection each time... // stepping through the collection each time...
while(testQueue.poll() == null) {} while(testQueue.poll() == null) {}
// Test that the released objects are not taking space in the table // Test that the released objects are not taking space in the table
assertEquals("underlying table not emptied", 0, weakHashtable.size()); assertEquals("underlying table not emptied", 0, weakHashtable.size());
} }

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.jdk14; package org.apache.commons.logging.jdk14;
@@ -54,7 +54,7 @@ public class CustomConfigAPITestCase extends CustomConfigTestCase {
PathableClassLoader child = new PathableClassLoader(parent); PathableClassLoader child = new PathableClassLoader(parent);
child.addLogicalLib("testclasses"); child.addLogicalLib("testclasses");
child.addLogicalLib("commons-logging"); child.addLogicalLib("commons-logging");
Class testClass = child.loadClass(CustomConfigAPITestCase.class.getName()); Class testClass = child.loadClass(CustomConfigAPITestCase.class.getName());
return new PathableTestSuite(testClass, child); return new PathableTestSuite(testClass, child);
} }

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.jdk14; package org.apache.commons.logging.jdk14;
@@ -56,7 +56,7 @@ public class CustomConfigFullTestCase extends CustomConfigTestCase {
PathableClassLoader child = new PathableClassLoader(parent); PathableClassLoader child = new PathableClassLoader(parent);
child.addLogicalLib("testclasses"); child.addLogicalLib("testclasses");
Class testClass = child.loadClass(CustomConfigFullTestCase.class.getName()); Class testClass = child.loadClass(CustomConfigFullTestCase.class.getName());
return new PathableTestSuite(testClass, child); return new PathableTestSuite(testClass, child);
} }

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.jdk14; package org.apache.commons.logging.jdk14;
@@ -46,8 +46,7 @@ import org.apache.commons.logging.PathableTestSuite;
public class CustomConfigTestCase extends DefaultConfigTestCase { public class CustomConfigTestCase extends DefaultConfigTestCase {
protected static final String HANDLER_NAME protected static final String HANDLER_NAME = "org.apache.commons.logging.jdk14.TestHandler";
= "org.apache.commons.logging.jdk14.TestHandler";
// ----------------------------------------------------------- Constructors // ----------------------------------------------------------- Constructors
@@ -147,9 +146,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
ClassLoader srcCL = CustomConfigAPITestCase.class.getClassLoader(); ClassLoader srcCL = CustomConfigAPITestCase.class.getClassLoader();
byte[] classData = readClass(className, srcCL); byte[] classData = readClass(className, srcCL);
Class[] params = new Class[] { Class[] params = new Class[] { String.class, classData.getClass(), Integer.TYPE, Integer.TYPE };
String.class, classData.getClass(),
Integer.TYPE, Integer.TYPE};
Method m = ClassLoader.class.getDeclaredMethod("defineClass", params); Method m = ClassLoader.class.getDeclaredMethod("defineClass", params);
Object[] args = new Object[4]; Object[] args = new Object[4];
@@ -195,7 +192,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
cl.useExplicitLoader(HANDLER_NAME, scl); cl.useExplicitLoader(HANDLER_NAME, scl);
cl.addLogicalLib("commons-logging"); cl.addLogicalLib("commons-logging");
cl.addLogicalLib("testclasses"); cl.addLogicalLib("testclasses");
Class testClass = cl.loadClass(CustomConfigTestCase.class.getName()); Class testClass = cl.loadClass(CustomConfigTestCase.class.getName());
return new PathableTestSuite(testClass, cl); return new PathableTestSuite(testClass, cl);
} }
@@ -358,14 +355,14 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
parent = parent.getParent(); parent = parent.getParent();
} }
handlers = parent.getHandlers(); handlers = parent.getHandlers();
// The CustomConfig.properties file explicitly defines one handler class // The CustomConfig.properties file explicitly defines one handler class
// to be attached to the root logger, so if it isn't there then // to be attached to the root logger, so if it isn't there then
// something is badly wrong... // something is badly wrong...
// //
// Yes this testing is also done in testPristineHandlers but // Yes this testing is also done in testPristineHandlers but
// unfortunately: // unfortunately:
// * we need to set up the handlers variable here, // * we need to set up the handlers variable here,
// * we don't want that to be set up incorrectly, as that can // * we don't want that to be set up incorrectly, as that can
// produce weird error messages in other tests, and // produce weird error messages in other tests, and
// * we can't rely on testPristineHandlers being the first // * we can't rely on testPristineHandlers being the first

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.jdk14; package org.apache.commons.logging.jdk14;
@@ -92,7 +92,7 @@ public class DefaultConfigTestCase extends TestCase {
loader.useExplicitLoader("junit.", Test.class.getClassLoader()); loader.useExplicitLoader("junit.", Test.class.getClassLoader());
loader.addLogicalLib("testclasses"); loader.addLogicalLib("testclasses");
loader.addLogicalLib("commons-logging"); loader.addLogicalLib("commons-logging");
Class testClass = loader.loadClass(DefaultConfigTestCase.class.getName()); Class testClass = loader.loadClass(DefaultConfigTestCase.class.getName());
return new PathableTestSuite(testClass, loader); return new PathableTestSuite(testClass, loader);
} }

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.jdk14; package org.apache.commons.logging.jdk14;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.log4j; package org.apache.commons.logging.log4j;
@@ -51,9 +51,9 @@ public abstract class StandardTests extends TestCase {
public Throwable throwable; public Throwable throwable;
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// JUnit Infrastructure Methods // JUnit Infrastructure Methods
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** /**
* Set up instance variables required by this test case. * Set up instance variables required by this test case.
@@ -69,9 +69,9 @@ public abstract class StandardTests extends TestCase {
LogFactory.releaseAll(); LogFactory.releaseAll();
} }
// ----------------------------------------------------------- // -----------------------------------------------------------
// abstract methods // abstract methods
// ----------------------------------------------------------- // -----------------------------------------------------------
/** /**
* Modify log4j's setup so that all messages actually logged get redirected * Modify log4j's setup so that all messages actually logged get redirected
@@ -81,7 +81,7 @@ public abstract class StandardTests extends TestCase {
* can test whether messages are getting properly filtered. * can test whether messages are getting properly filtered.
*/ */
public abstract void setUpTestAppender(List logEvents) throws Exception; public abstract void setUpTestAppender(List logEvents) throws Exception;
// ----------------------------------------------------------- Test Methods // ----------------------------------------------------------- Test Methods
/** /**
@@ -154,9 +154,9 @@ public abstract class StandardTests extends TestCase {
* <li>logPlainMessages or logExceptionMessages has been * <li>logPlainMessages or logExceptionMessages has been
* called to log a known number of messages at known levels. * called to log a known number of messages at known levels.
* </ul> * </ul>
* *
* @param logEvents is the list of log events received. * @param logEvents is the list of log events received.
* *
* @param thrown False if logPlainMessages was called * @param thrown False if logPlainMessages was called
* (ie the TestAppender is expected to have received * (ie the TestAppender is expected to have received
* logevents with no associated exception info). True if * logevents with no associated exception info). True if
@@ -164,24 +164,24 @@ public abstract class StandardTests extends TestCase {
*/ */
private void checkLoggingEvents(List logEvents, boolean thrown) { private void checkLoggingEvents(List logEvents, boolean thrown) {
LogEvent ev; LogEvent ev;
assertEquals("Unexpected number of log events", 4, logEvents.size()); assertEquals("Unexpected number of log events", 4, logEvents.size());
ev = (LogEvent) logEvents.get(0); ev = (LogEvent) logEvents.get(0);
assertEquals("Info message expected", "info", ev.msg); assertEquals("Info message expected", "info", ev.msg);
assertEquals("Info level expected", "INFO", ev.level); assertEquals("Info level expected", "INFO", ev.level);
assertEquals("Exception data incorrect", ev.throwable!=null, thrown); assertEquals("Exception data incorrect", ev.throwable!=null, thrown);
ev = (LogEvent) logEvents.get(1); ev = (LogEvent) logEvents.get(1);
assertEquals("Warn message expected", "warn", ev.msg); assertEquals("Warn message expected", "warn", ev.msg);
assertEquals("Warn level expected", "WARN", ev.level); assertEquals("Warn level expected", "WARN", ev.level);
assertEquals("Exception data incorrect", ev.throwable!=null, thrown); assertEquals("Exception data incorrect", ev.throwable!=null, thrown);
ev = (LogEvent) logEvents.get(2); ev = (LogEvent) logEvents.get(2);
assertEquals("Error message expected", "error", ev.msg); assertEquals("Error message expected", "error", ev.msg);
assertEquals("Error level expected", "ERROR", ev.level); assertEquals("Error level expected", "ERROR", ev.level);
assertEquals("Exception data incorrect", ev.throwable!=null, thrown); assertEquals("Exception data incorrect", ev.throwable!=null, thrown);
ev = (LogEvent) logEvents.get(3); ev = (LogEvent) logEvents.get(3);
assertEquals("Fatal message expected", "fatal", ev.msg); assertEquals("Fatal message expected", "fatal", ev.msg);
assertEquals("Fatal level expected", "FATAL", ev.level); assertEquals("Fatal level expected", "FATAL", ev.level);

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.log4j.log4j12; package org.apache.commons.logging.log4j.log4j12;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.log4j.log4j12; package org.apache.commons.logging.log4j.log4j12;
@@ -39,7 +39,7 @@ public class AppClasspathStandardTestCase extends TestCase {
loader.addLogicalLib("testclasses"); loader.addLogicalLib("testclasses");
loader.addLogicalLib("log4j12"); loader.addLogicalLib("log4j12");
loader.addLogicalLib("commons-logging"); loader.addLogicalLib("commons-logging");
Class testClass = loader.loadClass( Class testClass = loader.loadClass(
"org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests"); "org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests");
return new PathableTestSuite(testClass, loader); return new PathableTestSuite(testClass, loader);

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.log4j.log4j12; package org.apache.commons.logging.log4j.log4j12;
@@ -42,7 +42,7 @@ public class ChildClasspathStandardTestCase extends TestCase {
child.addLogicalLib("testclasses"); child.addLogicalLib("testclasses");
child.addLogicalLib("log4j12"); child.addLogicalLib("log4j12");
child.addLogicalLib("commons-logging"); child.addLogicalLib("commons-logging");
Class testClass = child.loadClass( Class testClass = child.loadClass(
"org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests"); "org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests");
return new PathableTestSuite(testClass, child); return new PathableTestSuite(testClass, child);

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.log4j.log4j12; package org.apache.commons.logging.log4j.log4j12;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.log4j.log4j12; package org.apache.commons.logging.log4j.log4j12;
@@ -41,7 +41,7 @@ public class ParentClasspathStandardTestCase extends TestCase {
PathableClassLoader child = new PathableClassLoader(parent); PathableClassLoader child = new PathableClassLoader(parent);
child.addLogicalLib("testclasses"); child.addLogicalLib("testclasses");
Class testClass = child.loadClass( Class testClass = child.loadClass(
"org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests"); "org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests");
return new PathableTestSuite(testClass, child); return new PathableTestSuite(testClass, child);

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.log4j.log4j12; package org.apache.commons.logging.log4j.log4j12;
@@ -51,7 +51,7 @@ public class TestAppender extends AppenderSkeleton {
protected void append(LoggingEvent event) { protected void append(LoggingEvent event) {
StandardTests.LogEvent lev = new StandardTests.LogEvent(); StandardTests.LogEvent lev = new StandardTests.LogEvent();
lev.level = event.getLevel().toString(); lev.level = event.getLevel().toString();
if (event.getMessage() == null) { if (event.getMessage() == null) {
@@ -59,7 +59,7 @@ public class TestAppender extends AppenderSkeleton {
} else { } else {
lev.msg = event.getMessage().toString(); lev.msg = event.getMessage().toString();
} }
if (event.getThrowableInformation() == null) { if (event.getThrowableInformation() == null) {
lev.throwable = null; lev.throwable = null;
} else { } else {

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.logkit; package org.apache.commons.logging.logkit;
@@ -100,7 +100,7 @@ public class StandardTestCase extends AbstractLogTest {
/** /**
* Override the abstract method from the parent class so that the * Override the abstract method from the parent class so that the
* inherited tests can access the right Log object type. * inherited tests can access the right Log object type.
*/ */
public Log getLogObject() public Log getLogObject()
{ {

View File

@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.noop; package org.apache.commons.logging.noop;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@@ -52,10 +52,10 @@ public class NoOpLogTestCase extends AbstractLogTest
LogFactory.releaseAll(); LogFactory.releaseAll();
System.getProperties().remove("org.apache.commons.logging.Log"); System.getProperties().remove("org.apache.commons.logging.Log");
} }
/** /**
* Override the abstract method from the parent class so that the * Override the abstract method from the parent class so that the
* inherited tests can access the right Log object type. * inherited tests can access the right Log object type.
*/ */
public Log getLogObject() public Log getLogObject()
{ {

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.pathable; package org.apache.commons.logging.pathable;
import java.net.URL; import java.net.URL;
@@ -41,7 +41,7 @@ import org.apache.commons.logging.PathableTestSuite;
*/ */
public class ChildFirstTestCase extends TestCase { public class ChildFirstTestCase extends TestCase {
/** /**
* Set up a custom classloader hierarchy for this test case. * Set up a custom classloader hierarchy for this test case.
* The hierarchy is: * The hierarchy is:
@@ -54,38 +54,38 @@ public class ChildFirstTestCase extends TestCase {
public static Test suite() throws Exception { public static Test suite() throws Exception {
Class thisClass = ChildFirstTestCase.class; Class thisClass = ChildFirstTestCase.class;
ClassLoader thisClassLoader = thisClass.getClassLoader(); ClassLoader thisClassLoader = thisClass.getClassLoader();
// Make the parent a direct child of the bootloader to hide all // Make the parent a direct child of the bootloader to hide all
// other classes in the system classpath // other classes in the system classpath
PathableClassLoader parent = new PathableClassLoader(null); PathableClassLoader parent = new PathableClassLoader(null);
parent.setParentFirst(false); parent.setParentFirst(false);
// Make the junit classes visible as a special case, as junit // Make the junit classes visible as a special case, as junit
// won't be able to call this class at all without this. The // won't be able to call this class at all without this. The
// junit classes must be visible from the classloader that loaded // junit classes must be visible from the classloader that loaded
// this class, so use that as the source for future access to classes // this class, so use that as the source for future access to classes
// from the junit package. // from the junit package.
parent.useExplicitLoader("junit.", thisClassLoader); parent.useExplicitLoader("junit.", thisClassLoader);
// Make the commons-logging.jar classes visible via the parent // Make the commons-logging.jar classes visible via the parent
parent.addLogicalLib("commons-logging"); parent.addLogicalLib("commons-logging");
// Create a child classloader to load the test case through // Create a child classloader to load the test case through
PathableClassLoader child = new PathableClassLoader(parent); PathableClassLoader child = new PathableClassLoader(parent);
child.setParentFirst(false); child.setParentFirst(false);
// Obviously, the child classloader needs to have the test classes // Obviously, the child classloader needs to have the test classes
// in its path! // in its path!
child.addLogicalLib("testclasses"); child.addLogicalLib("testclasses");
child.addLogicalLib("commons-logging-adapters"); child.addLogicalLib("commons-logging-adapters");
// Create a third classloader to be the context classloader. // Create a third classloader to be the context classloader.
PathableClassLoader context = new PathableClassLoader(child); PathableClassLoader context = new PathableClassLoader(child);
context.setParentFirst(false); context.setParentFirst(false);
// reload this class via the child classloader // reload this class via the child classloader
Class testClass = child.loadClass(thisClass.getName()); Class testClass = child.loadClass(thisClass.getName());
// and return our custom TestSuite class // and return our custom TestSuite class
return new PathableTestSuite(testClass, context); return new PathableTestSuite(testClass, context);
} }
@@ -118,14 +118,14 @@ public class ChildFirstTestCase extends TestCase {
assertEquals("Context classloader has unexpected type", assertEquals("Context classloader has unexpected type",
PathableClassLoader.class.getName(), PathableClassLoader.class.getName(),
contextLoader.getClass().getName()); contextLoader.getClass().getName());
// the classloader that loaded this class is obviously not null // the classloader that loaded this class is obviously not null
ClassLoader thisLoader = this.getClass().getClassLoader(); ClassLoader thisLoader = this.getClass().getClassLoader();
assertNotNull("thisLoader is null", thisLoader); assertNotNull("thisLoader is null", thisLoader);
assertEquals("thisLoader has unexpected type", assertEquals("thisLoader has unexpected type",
PathableClassLoader.class.getName(), PathableClassLoader.class.getName(),
thisLoader.getClass().getName()); thisLoader.getClass().getName());
// the suite method specified that the context classloader's parent // the suite method specified that the context classloader's parent
// is the loader that loaded this test case. // is the loader that loaded this test case.
assertSame("Context classloader is not child of thisLoader", assertSame("Context classloader is not child of thisLoader",
@@ -137,7 +137,7 @@ public class ChildFirstTestCase extends TestCase {
assertEquals("Parent classloader has unexpected type", assertEquals("Parent classloader has unexpected type",
PathableClassLoader.class.getName(), PathableClassLoader.class.getName(),
parentLoader.getClass().getName()); parentLoader.getClass().getName());
// parent should have a parent of null // parent should have a parent of null
assertNull("Parent classloader has non-null parent", parentLoader.getParent()); assertNull("Parent classloader has non-null parent", parentLoader.getParent());
@@ -155,7 +155,7 @@ public class ChildFirstTestCase extends TestCase {
// though it is accessable due to trickery in the PathableClassLoader. // though it is accessable due to trickery in the PathableClassLoader.
Class junitTest = contextLoader.loadClass("junit.framework.Test"); Class junitTest = contextLoader.loadClass("junit.framework.Test");
Set ancestorCLs = getAncestorCLs(); Set ancestorCLs = getAncestorCLs();
assertFalse("Junit not loaded by ancestor classloader", assertFalse("Junit not loaded by ancestor classloader",
ancestorCLs.contains(junitTest.getClassLoader())); ancestorCLs.contains(junitTest.getClassLoader()));
// jcl api classes should be visible only via the parent // jcl api classes should be visible only via the parent
@@ -166,14 +166,14 @@ public class ChildFirstTestCase extends TestCase {
// jcl adapter classes should be visible via both parent and child. However // jcl adapter classes should be visible via both parent and child. However
// as the classloaders are child-first we should see the child one. // as the classloaders are child-first we should see the child one.
Class log4jClass = contextLoader.loadClass("org.apache.commons.logging.impl.Log4JLogger"); Class log4jClass = contextLoader.loadClass("org.apache.commons.logging.impl.Log4JLogger");
assertSame("Log4JLogger not loaded via child", assertSame("Log4JLogger not loaded via child",
log4jClass.getClassLoader(), thisLoader); log4jClass.getClassLoader(), thisLoader);
// test classes should be visible via the child only // test classes should be visible via the child only
Class testClass = contextLoader.loadClass("org.apache.commons.logging.PathableTestSuite"); Class testClass = contextLoader.loadClass("org.apache.commons.logging.PathableTestSuite");
assertSame("PathableTestSuite not loaded via child", assertSame("PathableTestSuite not loaded via child",
testClass.getClassLoader(), thisLoader); testClass.getClassLoader(), thisLoader);
// test loading of class that is not available // test loading of class that is not available
try { try {
Class noSuchClass = contextLoader.loadClass("no.such.class"); Class noSuchClass = contextLoader.loadClass("no.such.class");
@@ -188,16 +188,16 @@ public class ChildFirstTestCase extends TestCase {
assertNull("String class classloader is not null!", assertNull("String class classloader is not null!",
stringClass.getClassLoader()); stringClass.getClassLoader());
} }
/** /**
* Test that the various flavours of ClassLoader.getResource work as expected. * Test that the various flavours of ClassLoader.getResource work as expected.
*/ */
public void testResource() { public void testResource() {
URL resource; URL resource;
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
ClassLoader childLoader = contextLoader.getParent(); ClassLoader childLoader = contextLoader.getParent();
// getResource where it doesn't exist // getResource where it doesn't exist
resource = childLoader.getResource("nosuchfile"); resource = childLoader.getResource("nosuchfile");
assertNull("Non-null URL returned for invalid resource name", resource); assertNull("Non-null URL returned for invalid resource name", resource);
@@ -205,7 +205,7 @@ public class ChildFirstTestCase extends TestCase {
// getResource where it is accessable only to parent classloader // getResource where it is accessable only to parent classloader
resource = childLoader.getResource("org/apache/commons/logging/Log.class"); resource = childLoader.getResource("org/apache/commons/logging/Log.class");
assertNotNull("Unable to locate Log.class resource", resource); assertNotNull("Unable to locate Log.class resource", resource);
// getResource where it is accessable only to child classloader // getResource where it is accessable only to child classloader
resource = childLoader.getResource("org/apache/commons/logging/PathableTestSuite.class"); resource = childLoader.getResource("org/apache/commons/logging/PathableTestSuite.class");
assertNotNull("Unable to locate PathableTestSuite.class resource", resource); assertNotNull("Unable to locate PathableTestSuite.class resource", resource);
@@ -219,36 +219,36 @@ public class ChildFirstTestCase extends TestCase {
assertTrue("Incorrect source for Log4JLogger class", assertTrue("Incorrect source for Log4JLogger class",
resource.toString().indexOf("/commons-logging-adapters-1.") > 0); resource.toString().indexOf("/commons-logging-adapters-1.") > 0);
} }
/** /**
* Test that the various flavours of ClassLoader.getResources work as expected. * Test that the various flavours of ClassLoader.getResources work as expected.
*/ */
public void testResources() throws Exception { public void testResources() throws Exception {
Enumeration resources; Enumeration resources;
URL[] urls; URL[] urls;
// verify the classloader hierarchy // verify the classloader hierarchy
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
ClassLoader childLoader = contextLoader.getParent(); ClassLoader childLoader = contextLoader.getParent();
ClassLoader parentLoader = childLoader.getParent(); ClassLoader parentLoader = childLoader.getParent();
ClassLoader bootLoader = parentLoader.getParent(); ClassLoader bootLoader = parentLoader.getParent();
assertNull("Unexpected classloader hierarchy", bootLoader); assertNull("Unexpected classloader hierarchy", bootLoader);
// getResources where no instances exist // getResources where no instances exist
resources = childLoader.getResources("nosuchfile"); resources = childLoader.getResources("nosuchfile");
urls = toURLArray(resources); urls = toURLArray(resources);
assertEquals("Non-null URL returned for invalid resource name", 0, urls.length); assertEquals("Non-null URL returned for invalid resource name", 0, urls.length);
// getResources where the resource only exists in the parent // getResources where the resource only exists in the parent
resources = childLoader.getResources("org/apache/commons/logging/Log.class"); resources = childLoader.getResources("org/apache/commons/logging/Log.class");
urls = toURLArray(resources); urls = toURLArray(resources);
assertEquals("Unexpected number of Log.class resources found", 1, urls.length); assertEquals("Unexpected number of Log.class resources found", 1, urls.length);
// getResources where the resource only exists in the child // getResources where the resource only exists in the child
resources = childLoader.getResources("org/apache/commons/logging/PathableTestSuite.class"); resources = childLoader.getResources("org/apache/commons/logging/PathableTestSuite.class");
urls = toURLArray(resources); urls = toURLArray(resources);
assertEquals("Unexpected number of PathableTestSuite.class resources found", 1, urls.length); assertEquals("Unexpected number of PathableTestSuite.class resources found", 1, urls.length);
// getResources where the resource exists in both. // getResources where the resource exists in both.
// resources should be returned in order (child-resource, parent-resource). // resources should be returned in order (child-resource, parent-resource).
// //
@@ -257,12 +257,12 @@ public class ChildFirstTestCase extends TestCase {
// to override this. So even when child-first is enabled the resource order // to override this. So even when child-first is enabled the resource order
// is still (parent-resources, child-resources). This test verifies the expected // is still (parent-resources, child-resources). This test verifies the expected
// behaviour - even though it's not the desired behaviour. // behaviour - even though it's not the desired behaviour.
resources = childLoader.getResources("org/apache/commons/logging/impl/Log4JLogger.class"); resources = childLoader.getResources("org/apache/commons/logging/impl/Log4JLogger.class");
urls = toURLArray(resources); urls = toURLArray(resources);
assertEquals("Unexpected number of Log4JLogger.class resources found", 2, urls.length); assertEquals("Unexpected number of Log4JLogger.class resources found", 2, urls.length);
// There is no gaurantee about the ordering of results returned from getResources // There is no guarantee about the ordering of results returned from getResources
// To make this test portable across JVMs, sort the string to give them a known order // To make this test portable across JVMs, sort the string to give them a known order
String[] urlsToStrings = new String[2]; String[] urlsToStrings = new String[2];
urlsToStrings[0] = urls[0].toString(); urlsToStrings[0] = urls[0].toString();
@@ -292,23 +292,23 @@ public class ChildFirstTestCase extends TestCase {
*/ */
public void testResourceAsStream() throws Exception { public void testResourceAsStream() throws Exception {
java.io.InputStream is; java.io.InputStream is;
// verify the classloader hierarchy // verify the classloader hierarchy
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
ClassLoader childLoader = contextLoader.getParent(); ClassLoader childLoader = contextLoader.getParent();
ClassLoader parentLoader = childLoader.getParent(); ClassLoader parentLoader = childLoader.getParent();
ClassLoader bootLoader = parentLoader.getParent(); ClassLoader bootLoader = parentLoader.getParent();
assertNull("Unexpected classloader hierarchy", bootLoader); assertNull("Unexpected classloader hierarchy", bootLoader);
// getResourceAsStream where no instances exist // getResourceAsStream where no instances exist
is = childLoader.getResourceAsStream("nosuchfile"); is = childLoader.getResourceAsStream("nosuchfile");
assertNull("Invalid resource returned non-null stream", is); assertNull("Invalid resource returned non-null stream", is);
// getResourceAsStream where resource does exist // getResourceAsStream where resource does exist
is = childLoader.getResourceAsStream("org/apache/commons/logging/Log.class"); is = childLoader.getResourceAsStream("org/apache/commons/logging/Log.class");
assertNotNull("Null returned for valid resource", is); assertNotNull("Null returned for valid resource", is);
is.close(); is.close();
// It would be nice to test parent-first ordering here, but that would require // It would be nice to test parent-first ordering here, but that would require
// having a resource with the same name in both the parent and child loaders, // having a resource with the same name in both the parent and child loaders,
// but with different contents. That's a little tricky to set up so we'll // but with different contents. That's a little tricky to set up so we'll

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.pathable; package org.apache.commons.logging.pathable;
import java.net.URL; import java.net.URL;
@@ -30,25 +30,25 @@ import org.apache.commons.logging.PathableTestSuite;
*/ */
public class GeneralTestCase extends TestCase { public class GeneralTestCase extends TestCase {
/** /**
* Set up a custom classloader hierarchy for this test case. * Set up a custom classloader hierarchy for this test case.
*/ */
public static Test suite() throws Exception { public static Test suite() throws Exception {
Class thisClass = GeneralTestCase.class; Class thisClass = GeneralTestCase.class;
ClassLoader thisClassLoader = thisClass.getClassLoader(); ClassLoader thisClassLoader = thisClass.getClassLoader();
PathableClassLoader loader = new PathableClassLoader(null); PathableClassLoader loader = new PathableClassLoader(null);
loader.useExplicitLoader("junit.", thisClassLoader); loader.useExplicitLoader("junit.", thisClassLoader);
loader.addLogicalLib("testclasses"); loader.addLogicalLib("testclasses");
// reload this class via the child classloader // reload this class via the child classloader
Class testClass = loader.loadClass(thisClass.getName()); Class testClass = loader.loadClass(thisClass.getName());
// and return our custom TestSuite class // and return our custom TestSuite class
return new PathableTestSuite(testClass, loader); return new PathableTestSuite(testClass, loader);
} }
/** /**
* Verify that a certain system property is not set, then set it. * Verify that a certain system property is not set, then set it.
*/ */
@@ -59,7 +59,7 @@ public class GeneralTestCase extends TestCase {
prop = System.getProperty("no.such.property"); prop = System.getProperty("no.such.property");
assertNotNull("no.such.property is unexpectedly undefined", prop); assertNotNull("no.such.property is unexpectedly undefined", prop);
} }
/** /**
* Verify that when a test method modifies the system properties they are * Verify that when a test method modifies the system properties they are
* reset before the next test is run. * reset before the next test is run.
@@ -81,21 +81,21 @@ public class GeneralTestCase extends TestCase {
public void testResetProps2() { public void testResetProps2() {
checkAndSetProperties(); checkAndSetProperties();
} }
/** /**
* Verify that the context classloader is a custom one, then reset it to * Verify that the context classloader is a custom one, then reset it to
* a non-custom one. * a non-custom one.
*/ */
private static void checkAndSetContext() { private static void checkAndSetContext() {
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
assertEquals("ContextLoader is of unexpected type", assertEquals("ContextLoader is of unexpected type",
contextLoader.getClass().getName(), contextLoader.getClass().getName(),
PathableClassLoader.class.getName()); PathableClassLoader.class.getName());
URL[] noUrls = new URL[0]; URL[] noUrls = new URL[0];
Thread.currentThread().setContextClassLoader(new URLClassLoader(noUrls)); Thread.currentThread().setContextClassLoader(new URLClassLoader(noUrls));
} }
/** /**
* Verify that when a test method modifies the context classloader it is * Verify that when a test method modifies the context classloader it is
* reset before the next test is run. * reset before the next test is run.

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.pathable; package org.apache.commons.logging.pathable;
import java.net.URL; import java.net.URL;
@@ -41,7 +41,7 @@ import org.apache.commons.logging.PathableTestSuite;
*/ */
public class ParentFirstTestCase extends TestCase { public class ParentFirstTestCase extends TestCase {
/** /**
* Set up a custom classloader hierarchy for this test case. * Set up a custom classloader hierarchy for this test case.
* The hierarchy is: * The hierarchy is:
@@ -58,7 +58,7 @@ public class ParentFirstTestCase extends TestCase {
// Make the parent a direct child of the bootloader to hide all // Make the parent a direct child of the bootloader to hide all
// other classes in the system classpath // other classes in the system classpath
PathableClassLoader parent = new PathableClassLoader(null); PathableClassLoader parent = new PathableClassLoader(null);
// Make the junit classes visible as a special case, as junit // Make the junit classes visible as a special case, as junit
// won't be able to call this class at all without this. The // won't be able to call this class at all without this. The
// junit classes must be visible from the classloader that loaded // junit classes must be visible from the classloader that loaded

View File

@@ -1,22 +1,20 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more
* or more contributor license agreements. See the NOTICE file * contributor license agreements. See the NOTICE file distributed with
* distributed with this work for additional information * this work for additional information regarding copyright ownership.
* regarding copyright ownership. The ASF licenses this file * The ASF licenses this file to You under the Apache License, Version 2.0
* to you under the Apache License, Version 2.0 (the * (the "License"); you may not use this file except in compliance with
* "License"); you may not use this file except in compliance * the License. You may obtain a copy of the License at
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing, software
* software distributed under the License is distributed on an * distributed under the License is distributed on an "AS IS" BASIS,
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* KIND, either express or implied. See the License for the * See the License for the specific language governing permissions and
* specific language governing permissions and limitations * limitations under the License.
* under the License. */
*/
package org.apache.commons.logging.security; package org.apache.commons.logging.security;
import java.io.FilePermission; import java.io.FilePermission;

View File

@@ -1,22 +1,20 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more
* or more contributor license agreements. See the NOTICE file * contributor license agreements. See the NOTICE file distributed with
* distributed with this work for additional information * this work for additional information regarding copyright ownership.
* regarding copyright ownership. The ASF licenses this file * The ASF licenses this file to You under the Apache License, Version 2.0
* to you under the Apache License, Version 2.0 (the * (the "License"); you may not use this file except in compliance with
* "License"); you may not use this file except in compliance * the License. You may obtain a copy of the License at
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing, software
* software distributed under the License is distributed on an * distributed under the License is distributed on an "AS IS" BASIS,
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* KIND, either express or implied. See the License for the * See the License for the specific language governing permissions and
* specific language governing permissions and limitations * limitations under the License.
* under the License. */
*/
package org.apache.commons.logging.security; package org.apache.commons.logging.security;
import java.io.PrintWriter; import java.io.PrintWriter;
@@ -39,7 +37,7 @@ import org.apache.commons.logging.PathableTestSuite;
* <p> * <p>
* This class has only one unit test, as we are (in part) checking behaviour in * 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 * 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 testcase class for each test.
*/ */

View File

@@ -1,22 +1,20 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more
* or more contributor license agreements. See the NOTICE file * contributor license agreements. See the NOTICE file distributed with
* distributed with this work for additional information * this work for additional information regarding copyright ownership.
* regarding copyright ownership. The ASF licenses this file * The ASF licenses this file to You under the Apache License, Version 2.0
* to you under the Apache License, Version 2.0 (the * (the "License"); you may not use this file except in compliance with
* "License"); you may not use this file except in compliance * the License. You may obtain a copy of the License at
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing, software
* software distributed under the License is distributed on an * distributed under the License is distributed on an "AS IS" BASIS,
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* KIND, either express or implied. See the License for the * See the License for the specific language governing permissions and
* specific language governing permissions and limitations * limitations under the License.
* under the License. */
*/
package org.apache.commons.logging.security; package org.apache.commons.logging.security;
import java.io.PrintWriter; import java.io.PrintWriter;
@@ -42,7 +40,7 @@ import org.apache.commons.logging.PathableTestSuite;
* <p> * <p>
* This class has only one unit test, as we are (in part) checking behaviour in * 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 * 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 testcase class for each test.
*/ */

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.servlet; package org.apache.commons.logging.servlet;
@@ -60,7 +60,7 @@ public class BasicServletTestCase extends TestCase {
Class testClass = child.loadClass(BasicServletTestCase.class.getName()); Class testClass = child.loadClass(BasicServletTestCase.class.getName());
return new PathableTestSuite(testClass, tccl); return new PathableTestSuite(testClass, tccl);
} }
/** /**
* Test that calling ServletContextCleaner.contextDestroyed doesn't crash. * Test that calling ServletContextCleaner.contextDestroyed doesn't crash.
* Testing anything else is rather difficult... * Testing anything else is rather difficult...

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.simple; package org.apache.commons.logging.simple;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.simple; package org.apache.commons.logging.simple;
@@ -31,7 +31,7 @@ import org.apache.commons.logging.PathableTestSuite;
* Tests custom date time format configuration * Tests custom date time format configuration
*/ */
public class DateTimeCustomConfigTestCase extends CustomConfigTestCase { public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
// ----------------------------------------------------------- Constructors // ----------------------------------------------------------- Constructors
/** /**
@@ -53,7 +53,7 @@ public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
loader.useExplicitLoader("junit.", Test.class.getClassLoader()); loader.useExplicitLoader("junit.", Test.class.getClassLoader());
loader.addLogicalLib("testclasses"); loader.addLogicalLib("testclasses");
loader.addLogicalLib("commons-logging"); loader.addLogicalLib("commons-logging");
Class testClass = loader.loadClass(thisClass.getName()); Class testClass = loader.loadClass(thisClass.getName());
return new PathableTestSuite(testClass, loader); return new PathableTestSuite(testClass, loader);
} }
@@ -61,12 +61,12 @@ public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
/** /**
* Set up system properties required by this unit test. Here, we * Set up system properties required by this unit test. Here, we
* set up the props defined in the parent class setProperties method, * set up the props defined in the parent class setProperties method,
* and add a few to configure the SimpleLog class date/time output. * and add a few to configure the SimpleLog class date/time output.
*/ */
public void setProperties() { public void setProperties() {
super.setProperties(); super.setProperties();
System.setProperty( System.setProperty(
"org.apache.commons.logging.simplelog.dateTimeFormat", "org.apache.commons.logging.simplelog.dateTimeFormat",
"dd.mm.yyyy"); "dd.mm.yyyy");
@@ -89,17 +89,17 @@ public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
protected void checkDecoratedDateTime() { protected void checkDecoratedDateTime() {
assertEquals("Expected date format to be set", "dd.mm.yyyy", assertEquals("Expected date format to be set", "dd.mm.yyyy",
((DecoratedSimpleLog) log).getDateTimeFormat()); ((DecoratedSimpleLog) log).getDateTimeFormat());
// try the formatter // try the formatter
Date now = new Date(); Date now = new Date();
DateFormat formatter = ((DecoratedSimpleLog) log).getDateTimeFormatter(); DateFormat formatter = ((DecoratedSimpleLog) log).getDateTimeFormatter();
SimpleDateFormat sampleFormatter = new SimpleDateFormat("dd.mm.yyyy"); SimpleDateFormat sampleFormatter = new SimpleDateFormat("dd.mm.yyyy");
assertEquals("Date should be formatters to pattern dd.mm.yyyy", sampleFormatter.format(now), formatter.format(now)); assertEquals("Date should be formatters to pattern dd.mm.yyyy",
sampleFormatter.format(now), formatter.format(now));
} }
/** Hook for subclassses */ /** Hook for subclassses */
protected void checkShowDateTime() { protected void checkShowDateTime() {
assertTrue(((DecoratedSimpleLog) log).getShowDateTime()); assertTrue(((DecoratedSimpleLog) log).getShowDateTime());
} }
} }

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.simple; package org.apache.commons.logging.simple;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.simple; package org.apache.commons.logging.simple;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.simple; package org.apache.commons.logging.simple;

View File

@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.tccl.custom; package org.apache.commons.logging.tccl.custom;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.tccl.custom; package org.apache.commons.logging.tccl.custom;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.tccl.log; package org.apache.commons.logging.tccl.log;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.tccl.log; package org.apache.commons.logging.tccl.log;
@@ -31,7 +31,7 @@ import org.apache.commons.logging.PathableTestSuite;
/** /**
* Verify that by default the standard LogFactoryImpl class loads a * Verify that by default the standard LogFactoryImpl class loads a
* custom Log implementation via the TCCL. * custom Log implementation via the TCCL.
*/ */
public class TcclEnabledTestCase extends TestCase { public class TcclEnabledTestCase extends TestCase {

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.tccl.logfactory; package org.apache.commons.logging.tccl.logfactory;

View File

@@ -5,15 +5,15 @@
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.commons.logging.tccl.logfactory; package org.apache.commons.logging.tccl.logfactory;