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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
import junit.framework.TestCase;
@@ -25,7 +23,7 @@ import junit.framework.TestCase;
* Generic tests that can be applied to any log adapter by
* subclassing this class and defining method getLogObject
* appropriately.
*
*
* @author Sean C. Sullivan
* @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 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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
@@ -23,7 +23,7 @@ public class AltHashtable extends Hashtable {
public static Object lastKey;
public static Object lastValue;
public Object put(Object key, Object value) {
lastKey = key;
lastValue = value;

View File

@@ -5,15 +5,15 @@
* 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 obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
@@ -24,8 +24,6 @@ import junit.framework.TestCase;
* Test the ability to force the LogFactory class to use some
* arbitrary Hashtable implementation to store its mapping from
* context-classloader -> LogFactory object.
* <p>
* This is done by
*/
public class AltHashtableTestCase extends TestCase {
@@ -47,20 +45,20 @@ public class AltHashtableTestCase extends TestCase {
* <p>
* This method ensures that the appropriate system property is defined
* 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>
* This does make the assumption that whatever JVM we are running in
* doesn't initialise classes until they are actually referenced (ie the
* 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
* fail and someone will tell us.
* fail and someone will tell us.
*/
public void setUp() {
System.setProperty(
"org.apache.commons.logging.LogFactory.HashtableImpl",
AltHashtable.class.getName());
}
/**
* Verify that initialising the LogFactory class will cause it
* 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.
assertTrue(LogFactory.factories instanceof AltHashtable);
}
/**
* Verify that when LogFactory sees a context-classloader for the
* 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 {
AltHashtable.lastKey = null;
AltHashtable.lastValue = null;
LogFactory.getLog(AltHashtableTestCase.class);
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
@@ -28,7 +28,7 @@ public class BadHashtablePropertyTestCase extends TestCase {
public void testType() {
assertTrue(LogFactory.factories instanceof Hashtable);
}
public void testPutCalled() throws Exception {
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
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
* 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.
*/
public class BasicOperationsTestCase extends TestCase
@@ -33,13 +32,13 @@ public class BasicOperationsTestCase extends TestCase
Log log = LogFactory.getLog(BasicOperationsTestCase.class);
executeIsEnabledTest(log);
}
public void testIsEnabledNamedLog()
{
Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
executeIsEnabledTest(log);
}
}
public void executeIsEnabledTest(Log log)
{
try
@@ -57,20 +56,19 @@ public class BasicOperationsTestCase extends TestCase
fail("Exception thrown: " + t);
}
}
public void testMessageWithoutExceptionClassLog()
{
Log log = LogFactory.getLog(BasicOperationsTestCase.class);
executeMessageWithoutExceptionTest(log);
}
public void testMessageWithoutExceptionNamedLog()
{
Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
executeMessageWithoutExceptionTest(log);
}
}
public void executeMessageWithoutExceptionTest(Log log)
{
try
@@ -88,19 +86,19 @@ public class BasicOperationsTestCase extends TestCase
fail("Exception thrown: " + t);
}
}
public void testMessageWithExceptionClassLog()
{
Log log = LogFactory.getLog(BasicOperationsTestCase.class);
executeMessageWithExceptionTest(log);
}
public void testMessageWithExceptionNamedLog()
{
Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
executeMessageWithExceptionTest(log);
}
}
public void executeMessageWithExceptionTest(Log log)
{
try

View File

@@ -5,16 +5,15 @@
* 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 obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.impl.LogFactoryImpl;
public class UserClass {
/**
* Set the ALLOW_FLAWED_CONTEXT feature on the LogFactoryImpl object
@@ -33,11 +31,11 @@ public class UserClass {
*/
public static void setAllowFlawedContext(String state) {
LogFactory f = LogFactory.getFactory();
f.setAttribute(LogFactoryImpl.ALLOW_FLAWED_CONTEXT_PROPERTY, state);
f.setAttribute(LogFactoryImpl.ALLOW_FLAWED_CONTEXT_PROPERTY, state);
}
public UserClass() {
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.avalon;
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.config;
@@ -58,7 +58,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
dummy.useExplicitLoader("junit.", Test.class.getClassLoader());
dummy.addLogicalLib("testclasses");
dummy.addLogicalLib("commons-logging");
String thisClassPath = thisClass.getName().replace('.', '/') + ".class";
URL baseUrl = dummy.findResource(thisClassPath);
@@ -68,7 +68,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
PathableClassLoader containerLoader = new PathableClassLoader(null);
containerLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
containerLoader.addLogicalLib("commons-logging");
PathableClassLoader webappLoader = new PathableClassLoader(containerLoader);
webappLoader.addLogicalLib("testclasses");
@@ -77,7 +77,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
URL pri10URL = new URL(baseUrl, "priority10/");
webappLoader.addURL(pri10URL);
// load the test class via webapp loader, and use the webapp loader
// as the tccl loader too.
Class testClass = webappLoader.loadClass(thisClass.getName());
@@ -113,7 +113,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
// context classloader should be thisClassLoader
assertEquals(thisClassLoader, contextClassLoader);
// lfClassLoader should be parent of this classloader
assertEquals(lfClassLoader, thisClassLoader.getParent());
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.config;
@@ -65,7 +65,7 @@ public class PriorityConfigTestCase extends TestCase {
dummy.useExplicitLoader("junit.", Test.class.getClassLoader());
dummy.addLogicalLib("testclasses");
dummy.addLogicalLib("commons-logging");
String thisClassPath = thisClass.getName().replace('.', '/') + ".class";
URL baseUrl = dummy.findResource(thisClassPath);
@@ -79,7 +79,7 @@ public class PriorityConfigTestCase extends TestCase {
PathableClassLoader containerLoader = new PathableClassLoader(null);
containerLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
containerLoader.addLogicalLib("commons-logging");
URL pri10URL = new URL(baseUrl, "priority10/");
containerLoader.addURL(pri10URL);
@@ -89,13 +89,13 @@ public class PriorityConfigTestCase extends TestCase {
URL noPriorityURL = new URL(baseUrl, "nopriority/");
webappLoader.addURL(noPriorityURL);
URL pri20URL = new URL(baseUrl, "priority20/");
webappLoader.addURL(pri20URL);
URL pri20aURL = new URL(baseUrl, "priority20a/");
webappLoader.addURL(pri20aURL);
// load the test class via webapp loader, and use the webapp loader
// as the tccl loader too.
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.impl;
@@ -53,19 +53,18 @@ public class WeakHashtableTest extends TestCase {
public WeakHashtableTest(String testName) {
super(testName);
}
protected void setUp() throws Exception {
super.setUp();
weakHashtable = new WeakHashtable();
keyOne = new Long(1);
keyTwo = new Long(2);
keyThree = new Long(3);
valueOne = new Long(100);
valueTwo = new Long(200);
valueThree = new Long(300);
weakHashtable.put(keyOne, valueOne);
weakHashtable.put(keyTwo, valueTwo);
weakHashtable.put(keyThree, valueThree);
@@ -81,7 +80,7 @@ public class WeakHashtableTest extends TestCase {
assertTrue(weakHashtable.contains(new Long(300)));
assertFalse(weakHashtable.contains(new Long(400)));
}
/** Tests public boolean containsKey(Object key) */
public void testContainsKey() throws Exception {
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(200)));
assertFalse(weakHashtable.containsKey(new Long(300)));
assertFalse(weakHashtable.containsKey(new Long(400)));
assertFalse(weakHashtable.containsKey(new Long(400)));
}
/** Tests public boolean containsValue(Object value) */
public void testContainsValue() throws Exception {
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(200)));
assertTrue(weakHashtable.containsValue(new Long(300)));
assertFalse(weakHashtable.containsValue(new Long(400)));
assertFalse(weakHashtable.containsValue(new Long(400)));
}
/** Tests public Enumeration elements() */
public void testElements() throws Exception {
ArrayList elements = new ArrayList();
@@ -115,7 +114,7 @@ public class WeakHashtableTest extends TestCase {
assertTrue(elements.contains(valueTwo));
assertTrue(elements.contains(valueThree));
}
/** Tests public Set entrySet() */
public void testEntrySet() throws Exception {
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 {
assertEquals(valueOne, weakHashtable.get(keyOne));
assertEquals(valueTwo, weakHashtable.get(keyTwo));
assertEquals(valueThree, weakHashtable.get(keyThree));
assertNull(weakHashtable.get(new Long(50)));
}
/** Tests public Enumeration keys() */
public void testKeys() throws Exception {
ArrayList keys = new ArrayList();
@@ -151,9 +150,9 @@ public class WeakHashtableTest extends TestCase {
assertEquals(3, keys.size());
assertTrue(keys.contains(keyOne));
assertTrue(keys.contains(keyTwo));
assertTrue(keys.contains(keyThree));
assertTrue(keys.contains(keyThree));
}
/** Tests public Set keySet() */
public void testKeySet() throws Exception {
Set keySet = weakHashtable.keySet();
@@ -162,14 +161,14 @@ public class WeakHashtableTest extends TestCase {
assertTrue(keySet.contains(keyTwo));
assertTrue(keySet.contains(keyThree));
}
/** Tests public Object put(Object key, Object value) */
public void testPut() throws Exception {
Long anotherKey = new Long(2004);
weakHashtable.put(anotherKey, new Long(1066));
assertEquals(new Long(1066), weakHashtable.get(anotherKey));
// Test compliance with the hashtable API re nulls
Exception caught = null;
try {
@@ -188,7 +187,7 @@ public class WeakHashtableTest extends TestCase {
}
assertNotNull("did not throw an exception adding a null value", caught);
}
/** Tests public void putAll(Map t) */
public void testPutAll() throws Exception {
Map newValues = new HashMap();
@@ -199,19 +198,19 @@ public class WeakHashtableTest extends TestCase {
Long anotherNewValue = new Long(1815);
newValues.put(anotherNewKey, anotherNewValue);
weakHashtable.putAll(newValues);
assertEquals(5, weakHashtable.size());
assertEquals(newValue, weakHashtable.get(newKey));
assertEquals(anotherNewValue, weakHashtable.get(anotherNewKey));
}
/** Tests public Object remove(Object<EFBFBD>key) */
/** Tests public Object remove(Object key) */
public void testRemove() throws Exception {
weakHashtable.remove(keyOne);
assertEquals(2, weakHashtable.size());
assertNull(weakHashtable.get(keyOne));
}
/** Tests public Collection values() */
public void testValues() throws Exception {
Collection values = weakHashtable.values();
@@ -220,7 +219,7 @@ public class WeakHashtableTest extends TestCase {
assertTrue(values.contains(valueTwo));
assertTrue(values.contains(valueThree));
}
public void testRelease() throws Exception {
assertNotNull(weakHashtable.get(new Long(1)));
ReferenceQueue testQueue = new ReferenceQueue();
@@ -233,7 +232,7 @@ public class WeakHashtableTest extends TestCase {
valueOne = null;
valueTwo = null;
valueThree = null;
int iterations = 0;
int bytz = 2;
while(true) {
@@ -241,23 +240,23 @@ public class WeakHashtableTest extends TestCase {
if(iterations++ > MAX_GC_ITERATIONS){
fail("Max iterations reached before resource released.");
}
if(weakHashtable.get(new Long(1)) == null) {
break;
} else {
// create garbage:
byte[] b = new byte[bytz];
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
// need to think about whether this is enough to justify
// stepping through the collection each time...
while(testQueue.poll() == null) {}
// Test that the released objects are not taking space in the table
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.jdk14;
@@ -54,7 +54,7 @@ public class CustomConfigAPITestCase extends CustomConfigTestCase {
PathableClassLoader child = new PathableClassLoader(parent);
child.addLogicalLib("testclasses");
child.addLogicalLib("commons-logging");
Class testClass = child.loadClass(CustomConfigAPITestCase.class.getName());
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.jdk14;
@@ -56,7 +56,7 @@ public class CustomConfigFullTestCase extends CustomConfigTestCase {
PathableClassLoader child = new PathableClassLoader(parent);
child.addLogicalLib("testclasses");
Class testClass = child.loadClass(CustomConfigFullTestCase.class.getName());
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.jdk14;
@@ -46,8 +46,7 @@ import org.apache.commons.logging.PathableTestSuite;
public class CustomConfigTestCase extends DefaultConfigTestCase {
protected static final String HANDLER_NAME
= "org.apache.commons.logging.jdk14.TestHandler";
protected static final String HANDLER_NAME = "org.apache.commons.logging.jdk14.TestHandler";
// ----------------------------------------------------------- Constructors
@@ -147,9 +146,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
ClassLoader srcCL = CustomConfigAPITestCase.class.getClassLoader();
byte[] classData = readClass(className, srcCL);
Class[] params = new Class[] {
String.class, classData.getClass(),
Integer.TYPE, Integer.TYPE};
Class[] params = new Class[] { String.class, classData.getClass(), Integer.TYPE, Integer.TYPE };
Method m = ClassLoader.class.getDeclaredMethod("defineClass", params);
Object[] args = new Object[4];
@@ -195,7 +192,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
cl.useExplicitLoader(HANDLER_NAME, scl);
cl.addLogicalLib("commons-logging");
cl.addLogicalLib("testclasses");
Class testClass = cl.loadClass(CustomConfigTestCase.class.getName());
return new PathableTestSuite(testClass, cl);
}
@@ -358,14 +355,14 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
parent = parent.getParent();
}
handlers = parent.getHandlers();
// 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...
//
// Yes this testing is also done in testPristineHandlers but
// 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
// produce weird error messages in other tests, and
// * 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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.jdk14;
@@ -92,7 +92,7 @@ public class DefaultConfigTestCase extends TestCase {
loader.useExplicitLoader("junit.", Test.class.getClassLoader());
loader.addLogicalLib("testclasses");
loader.addLogicalLib("commons-logging");
Class testClass = loader.loadClass(DefaultConfigTestCase.class.getName());
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.log4j;
@@ -51,9 +51,9 @@ public abstract class StandardTests extends TestCase {
public Throwable throwable;
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// JUnit Infrastructure Methods
// -------------------------------------------------------------------
// -------------------------------------------------------------------
/**
* Set up instance variables required by this test case.
@@ -69,9 +69,9 @@ public abstract class StandardTests extends TestCase {
LogFactory.releaseAll();
}
// -----------------------------------------------------------
// -----------------------------------------------------------
// abstract methods
// -----------------------------------------------------------
// -----------------------------------------------------------
/**
* 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.
*/
public abstract void setUpTestAppender(List logEvents) throws Exception;
// ----------------------------------------------------------- Test Methods
/**
@@ -154,9 +154,9 @@ public abstract class StandardTests extends TestCase {
* <li>logPlainMessages or logExceptionMessages has been
* called to log a known number of messages at known levels.
* </ul>
*
*
* @param logEvents is the list of log events received.
*
*
* @param thrown False if logPlainMessages was called
* (ie the TestAppender is expected to have received
* 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) {
LogEvent ev;
assertEquals("Unexpected number of log events", 4, logEvents.size());
ev = (LogEvent) logEvents.get(0);
assertEquals("Info message expected", "info", ev.msg);
assertEquals("Info level expected", "INFO", ev.level);
assertEquals("Exception data incorrect", ev.throwable!=null, thrown);
ev = (LogEvent) logEvents.get(1);
assertEquals("Warn message expected", "warn", ev.msg);
assertEquals("Warn level expected", "WARN", ev.level);
assertEquals("Exception data incorrect", ev.throwable!=null, thrown);
ev = (LogEvent) logEvents.get(2);
assertEquals("Error message expected", "error", ev.msg);
assertEquals("Error level expected", "ERROR", ev.level);
assertEquals("Exception data incorrect", ev.throwable!=null, thrown);
ev = (LogEvent) logEvents.get(3);
assertEquals("Fatal message expected", "fatal", ev.msg);
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.log4j.log4j12;
@@ -39,7 +39,7 @@ public class AppClasspathStandardTestCase extends TestCase {
loader.addLogicalLib("testclasses");
loader.addLogicalLib("log4j12");
loader.addLogicalLib("commons-logging");
Class testClass = loader.loadClass(
"org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests");
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.log4j.log4j12;
@@ -42,7 +42,7 @@ public class ChildClasspathStandardTestCase extends TestCase {
child.addLogicalLib("testclasses");
child.addLogicalLib("log4j12");
child.addLogicalLib("commons-logging");
Class testClass = child.loadClass(
"org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests");
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.log4j.log4j12;
@@ -41,7 +41,7 @@ public class ParentClasspathStandardTestCase extends TestCase {
PathableClassLoader child = new PathableClassLoader(parent);
child.addLogicalLib("testclasses");
Class testClass = child.loadClass(
"org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests");
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.log4j.log4j12;
@@ -51,7 +51,7 @@ public class TestAppender extends AppenderSkeleton {
protected void append(LoggingEvent event) {
StandardTests.LogEvent lev = new StandardTests.LogEvent();
lev.level = event.getLevel().toString();
if (event.getMessage() == null) {
@@ -59,7 +59,7 @@ public class TestAppender extends AppenderSkeleton {
} else {
lev.msg = event.getMessage().toString();
}
if (event.getThrowableInformation() == null) {
lev.throwable = null;
} else {

View File

@@ -5,15 +5,15 @@
* 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 obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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
* inherited tests can access the right Log object type.
* inherited tests can access the right Log object type.
*/
public Log getLogObject()
{

View File

@@ -5,16 +5,16 @@
* 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 obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.noop;
import java.io.ByteArrayInputStream;
@@ -52,10 +52,10 @@ public class NoOpLogTestCase extends AbstractLogTest
LogFactory.releaseAll();
System.getProperties().remove("org.apache.commons.logging.Log");
}
/**
* 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()
{

View File

@@ -5,15 +5,15 @@
* 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 obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.pathable;
import java.net.URL;
@@ -41,7 +41,7 @@ import org.apache.commons.logging.PathableTestSuite;
*/
public class ChildFirstTestCase extends TestCase {
/**
* Set up a custom classloader hierarchy for this test case.
* The hierarchy is:
@@ -54,38 +54,38 @@ public class ChildFirstTestCase extends TestCase {
public static Test suite() throws Exception {
Class thisClass = ChildFirstTestCase.class;
ClassLoader thisClassLoader = thisClass.getClassLoader();
// Make the parent a direct child of the bootloader to hide all
// other classes in the system classpath
PathableClassLoader parent = new PathableClassLoader(null);
parent.setParentFirst(false);
// Make the junit classes visible as a special case, as junit
// won't be able to call this class at all without this. The
// junit classes must be visible from the classloader that loaded
// this class, so use that as the source for future access to classes
// from the junit package.
parent.useExplicitLoader("junit.", thisClassLoader);
// Make the commons-logging.jar classes visible via the parent
parent.addLogicalLib("commons-logging");
// Create a child classloader to load the test case through
PathableClassLoader child = new PathableClassLoader(parent);
child.setParentFirst(false);
// Obviously, the child classloader needs to have the test classes
// in its path!
child.addLogicalLib("testclasses");
child.addLogicalLib("commons-logging-adapters");
// Create a third classloader to be the context classloader.
PathableClassLoader context = new PathableClassLoader(child);
context.setParentFirst(false);
// reload this class via the child classloader
Class testClass = child.loadClass(thisClass.getName());
// and return our custom TestSuite class
return new PathableTestSuite(testClass, context);
}
@@ -118,14 +118,14 @@ public class ChildFirstTestCase extends TestCase {
assertEquals("Context classloader has unexpected type",
PathableClassLoader.class.getName(),
contextLoader.getClass().getName());
// the classloader that loaded this class is obviously not null
ClassLoader thisLoader = this.getClass().getClassLoader();
assertNotNull("thisLoader is null", thisLoader);
assertEquals("thisLoader has unexpected type",
PathableClassLoader.class.getName(),
thisLoader.getClass().getName());
// the suite method specified that the context classloader's parent
// is the loader that loaded this test case.
assertSame("Context classloader is not child of thisLoader",
@@ -137,7 +137,7 @@ public class ChildFirstTestCase extends TestCase {
assertEquals("Parent classloader has unexpected type",
PathableClassLoader.class.getName(),
parentLoader.getClass().getName());
// parent should have a parent of null
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.
Class junitTest = contextLoader.loadClass("junit.framework.Test");
Set ancestorCLs = getAncestorCLs();
assertFalse("Junit not loaded by ancestor classloader",
assertFalse("Junit not loaded by ancestor classloader",
ancestorCLs.contains(junitTest.getClassLoader()));
// 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
// as the classloaders are child-first we should see the child one.
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);
// test classes should be visible via the child only
Class testClass = contextLoader.loadClass("org.apache.commons.logging.PathableTestSuite");
assertSame("PathableTestSuite not loaded via child",
assertSame("PathableTestSuite not loaded via child",
testClass.getClassLoader(), thisLoader);
// test loading of class that is not available
try {
Class noSuchClass = contextLoader.loadClass("no.such.class");
@@ -188,16 +188,16 @@ public class ChildFirstTestCase extends TestCase {
assertNull("String class classloader is not null!",
stringClass.getClassLoader());
}
/**
* Test that the various flavours of ClassLoader.getResource work as expected.
*/
public void testResource() {
URL resource;
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
ClassLoader childLoader = contextLoader.getParent();
// getResource where it doesn't exist
resource = childLoader.getResource("nosuchfile");
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
resource = childLoader.getResource("org/apache/commons/logging/Log.class");
assertNotNull("Unable to locate Log.class resource", resource);
// getResource where it is accessable only to child classloader
resource = childLoader.getResource("org/apache/commons/logging/PathableTestSuite.class");
assertNotNull("Unable to locate PathableTestSuite.class resource", resource);
@@ -219,36 +219,36 @@ public class ChildFirstTestCase extends TestCase {
assertTrue("Incorrect source for Log4JLogger class",
resource.toString().indexOf("/commons-logging-adapters-1.") > 0);
}
/**
* Test that the various flavours of ClassLoader.getResources work as expected.
*/
public void testResources() throws Exception {
Enumeration resources;
URL[] urls;
// verify the classloader hierarchy
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
ClassLoader childLoader = contextLoader.getParent();
ClassLoader parentLoader = childLoader.getParent();
ClassLoader bootLoader = parentLoader.getParent();
assertNull("Unexpected classloader hierarchy", bootLoader);
// getResources where no instances exist
resources = childLoader.getResources("nosuchfile");
urls = toURLArray(resources);
assertEquals("Non-null URL returned for invalid resource name", 0, urls.length);
// getResources where the resource only exists in the parent
resources = childLoader.getResources("org/apache/commons/logging/Log.class");
urls = toURLArray(resources);
assertEquals("Unexpected number of Log.class resources found", 1, urls.length);
// getResources where the resource only exists in the child
resources = childLoader.getResources("org/apache/commons/logging/PathableTestSuite.class");
urls = toURLArray(resources);
assertEquals("Unexpected number of PathableTestSuite.class resources found", 1, urls.length);
// getResources where the resource exists in both.
// 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
// is still (parent-resources, child-resources). This test verifies the expected
// behaviour - even though it's not the desired behaviour.
resources = childLoader.getResources("org/apache/commons/logging/impl/Log4JLogger.class");
urls = toURLArray(resources);
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
String[] urlsToStrings = new String[2];
urlsToStrings[0] = urls[0].toString();
@@ -292,23 +292,23 @@ public class ChildFirstTestCase extends TestCase {
*/
public void testResourceAsStream() throws Exception {
java.io.InputStream is;
// verify the classloader hierarchy
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
ClassLoader childLoader = contextLoader.getParent();
ClassLoader parentLoader = childLoader.getParent();
ClassLoader bootLoader = parentLoader.getParent();
assertNull("Unexpected classloader hierarchy", bootLoader);
// getResourceAsStream where no instances exist
is = childLoader.getResourceAsStream("nosuchfile");
assertNull("Invalid resource returned non-null stream", is);
// getResourceAsStream where resource does exist
is = childLoader.getResourceAsStream("org/apache/commons/logging/Log.class");
assertNotNull("Null returned for valid resource", is);
is.close();
// 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,
// 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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.pathable;
import java.net.URL;
@@ -30,25 +30,25 @@ import org.apache.commons.logging.PathableTestSuite;
*/
public class GeneralTestCase extends TestCase {
/**
* Set up a custom classloader hierarchy for this test case.
*/
public static Test suite() throws Exception {
Class thisClass = GeneralTestCase.class;
ClassLoader thisClassLoader = thisClass.getClassLoader();
PathableClassLoader loader = new PathableClassLoader(null);
loader.useExplicitLoader("junit.", thisClassLoader);
loader.addLogicalLib("testclasses");
// reload this class via the child classloader
Class testClass = loader.loadClass(thisClass.getName());
// and return our custom TestSuite class
return new PathableTestSuite(testClass, loader);
}
/**
* 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");
assertNotNull("no.such.property is unexpectedly undefined", prop);
}
/**
* Verify that when a test method modifies the system properties they are
* reset before the next test is run.
@@ -81,21 +81,21 @@ public class GeneralTestCase extends TestCase {
public void testResetProps2() {
checkAndSetProperties();
}
/**
* Verify that the context classloader is a custom one, then reset it to
* a non-custom one.
*/
private static void checkAndSetContext() {
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
assertEquals("ContextLoader is of unexpected type",
contextLoader.getClass().getName(),
assertEquals("ContextLoader is of unexpected type",
contextLoader.getClass().getName(),
PathableClassLoader.class.getName());
URL[] noUrls = new URL[0];
Thread.currentThread().setContextClassLoader(new URLClassLoader(noUrls));
}
/**
* Verify that when a test method modifies the context classloader it is
* 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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.pathable;
import java.net.URL;
@@ -41,7 +41,7 @@ import org.apache.commons.logging.PathableTestSuite;
*/
public class ParentFirstTestCase extends TestCase {
/**
* Set up a custom classloader hierarchy for this test case.
* The hierarchy is:
@@ -58,7 +58,7 @@ public class ParentFirstTestCase extends TestCase {
// Make the parent a direct child of the bootloader to hide all
// other classes in the system classpath
PathableClassLoader parent = new PathableClassLoader(null);
// Make the junit classes visible as a special case, as junit
// won't be able to call this class at all without this. The
// 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
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. 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 obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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 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 distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.logging.security;
import java.io.FilePermission;

View File

@@ -1,22 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. 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 obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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 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 distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.logging.security;
import java.io.PrintWriter;
@@ -39,7 +37,7 @@ import org.apache.commons.logging.PathableTestSuite;
* <p>
* This class has only one unit test, as we are (in part) checking behaviour in
* the static block of the LogFactory class. As that class cannot be unloaded after
* being loaded into a classloader, the only workaround is to use the
* being loaded into a classloader, the only workaround is to use the
* PathableClassLoader approach to ensure each test is run in its own
* classloader, and use a separate testcase class for each test.
*/

View File

@@ -1,22 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. 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 obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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 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 distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.logging.security;
import java.io.PrintWriter;
@@ -42,7 +40,7 @@ import org.apache.commons.logging.PathableTestSuite;
* <p>
* This class has only one unit test, as we are (in part) checking behaviour in
* the static block of the LogFactory class. As that class cannot be unloaded after
* being loaded into a classloader, the only workaround is to use the
* being loaded into a classloader, the only workaround is to use the
* PathableClassLoader approach to ensure each test is run in its own
* classloader, and use a separate testcase class for each test.
*/

View File

@@ -5,15 +5,15 @@
* 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 obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.servlet;
@@ -60,7 +60,7 @@ public class BasicServletTestCase extends TestCase {
Class testClass = child.loadClass(BasicServletTestCase.class.getName());
return new PathableTestSuite(testClass, tccl);
}
/**
* Test that calling ServletContextCleaner.contextDestroyed doesn't crash.
* 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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.simple;
@@ -31,7 +31,7 @@ import org.apache.commons.logging.PathableTestSuite;
* Tests custom date time format configuration
*/
public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
// ----------------------------------------------------------- Constructors
/**
@@ -53,7 +53,7 @@ public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
loader.useExplicitLoader("junit.", Test.class.getClassLoader());
loader.addLogicalLib("testclasses");
loader.addLogicalLib("commons-logging");
Class testClass = loader.loadClass(thisClass.getName());
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 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.
*/
public void setProperties() {
super.setProperties();
System.setProperty(
"org.apache.commons.logging.simplelog.dateTimeFormat",
"dd.mm.yyyy");
@@ -89,17 +89,17 @@ public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
protected void checkDecoratedDateTime() {
assertEquals("Expected date format to be set", "dd.mm.yyyy",
((DecoratedSimpleLog) log).getDateTimeFormat());
// try the formatter
Date now = new Date();
DateFormat formatter = ((DecoratedSimpleLog) log).getDateTimeFormatter();
DateFormat formatter = ((DecoratedSimpleLog) log).getDateTimeFormatter();
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 */
protected void checkShowDateTime() {
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.tccl.custom;
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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
* custom Log implementation via the TCCL.
* custom Log implementation via the TCCL.
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
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 "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.apache.commons.logging.tccl.logfactory;