diff --git a/maven.xml b/maven.xml index 1a28e1d45..1e3e0a9c5 100644 --- a/maven.xml +++ b/maven.xml @@ -1,4 +1,6 @@ - - + + + + + diff --git a/src/test/org/apache/commons/collections/TestList.java b/src/test/org/apache/commons/collections/TestList.java index a1aec4d04..2b6a0f8a5 100644 --- a/src/test/org/apache/commons/collections/TestList.java +++ b/src/test/org/apache/commons/collections/TestList.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestList.java,v 1.15 2003/01/25 12:55:43 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestList.java,v 1.16 2003/02/26 01:33:22 rwaldhoff Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -82,7 +82,7 @@ import java.util.NoSuchElementException; * you may still use this base set of cases. Simply override the * test case (method) your {@link List} fails. * - * @version $Revision: 1.15 $ $Date: 2003/01/25 12:55:43 $ + * @version $Revision: 1.16 $ $Date: 2003/02/26 01:33:22 $ * * @author Rodney Waldhoff * @author Paul Jack @@ -925,9 +925,11 @@ public abstract class TestList extends TestCollection { */ // test to make sure the canonical form has been preserved - if (!(makeEmptyList() instanceof Serializable)) return; - List list = (List) readExternalFormFromDisk(getCanonicalEmptyCollectionName(makeEmptyList())); - assertTrue("List is empty",list.size() == 0); + List list = makeEmptyList(); + if(list instanceof Serializable && !skipSerializedCanonicalTests()) { + List list2 = (List) readExternalFormFromDisk(getCanonicalEmptyCollectionName(list)); + assertTrue("List is empty",list2.size() == 0); + } } /** @@ -944,9 +946,11 @@ public abstract class TestList extends TestCollection { */ // test to make sure the canonical form has been preserved - if (!(makeFullList() instanceof Serializable)) return; - List list = (List) readExternalFormFromDisk(getCanonicalFullCollectionName(makeFullList())); - assertEquals("List is the right size",list.size(), 4); + List list = makeFullList(); + if(list instanceof Serializable && !skipSerializedCanonicalTests()) { + List list2 = (List) readExternalFormFromDisk(getCanonicalFullCollectionName(list)); + assertEquals("List is the right size",list2.size(), 4); + } } diff --git a/src/test/org/apache/commons/collections/TestMap.java b/src/test/org/apache/commons/collections/TestMap.java index c992a76e7..792348449 100644 --- a/src/test/org/apache/commons/collections/TestMap.java +++ b/src/test/org/apache/commons/collections/TestMap.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestMap.java,v 1.22 2002/11/01 19:36:54 rwaldhoff Exp $ - * $Revision: 1.22 $ - * $Date: 2002/11/01 19:36:54 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestMap.java,v 1.23 2003/02/26 01:33:22 rwaldhoff Exp $ + * $Revision: 1.23 $ + * $Date: 2003/02/26 01:33:22 $ * * ==================================================================== * @@ -152,7 +152,7 @@ import java.util.Set; * @author Michael Smith * @author Rodney Waldhoff * @author Paul Jack - * @version $Revision: 1.22 $ $Date: 2002/11/01 19:36:54 $ + * @version $Revision: 1.23 $ $Date: 2003/02/26 01:33:22 $ */ public abstract class TestMap extends TestObject { @@ -633,9 +633,11 @@ public abstract class TestMap extends TestObject { */ // test to make sure the canonical form has been preserved - if (!(makeEmptyMap() instanceof Serializable)) return; - Map map = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(makeEmptyMap())); - assertTrue("Map is empty",map.isEmpty() == true); + Map map = makeEmptyMap(); + if(map instanceof Serializable && !skipSerializedCanonicalTests()) { + Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map)); + assertTrue("Map is empty",map2.isEmpty()); + } } /** @@ -652,9 +654,11 @@ public abstract class TestMap extends TestObject { */ // test to make sure the canonical form has been preserved - if (!(makeFullMap() instanceof Serializable)) return; - Map map = (Map) readExternalFormFromDisk(getCanonicalFullCollectionName(makeFullMap())); - assertEquals("Map is the right size",map.size(), getSampleKeys().length); + Map map = makeFullMap(); + if(map instanceof Serializable && !skipSerializedCanonicalTests()) { + Map map2 = (Map) readExternalFormFromDisk(getCanonicalFullCollectionName(map)); + assertEquals("Map is the right size",map2.size(), getSampleKeys().length); + } } /** diff --git a/src/test/org/apache/commons/collections/TestObject.java b/src/test/org/apache/commons/collections/TestObject.java index 7b6b56526..19da26a9e 100644 --- a/src/test/org/apache/commons/collections/TestObject.java +++ b/src/test/org/apache/commons/collections/TestObject.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestObject.java,v 1.19 2003/02/26 00:35:19 rwaldhoff Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestObject.java,v 1.20 2003/02/26 01:33:22 rwaldhoff Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -83,7 +83,7 @@ import java.io.Serializable; * @author Rodney Waldhoff * @author Anonymous * - * @version $Revision: 1.19 $ $Date: 2003/02/26 00:35:19 $ + * @version $Revision: 1.20 $ $Date: 2003/02/26 01:33:22 $ */ public abstract class TestObject extends BulkTest { @@ -334,6 +334,10 @@ public abstract class TestObject extends BulkTest { return readExternalFormFromStream(stream); } + protected boolean skipSerializedCanonicalTests() { + return Boolean.getBoolean("org.apache.commons.collections:with-clover"); + } + // private // ------------------------------------------------------------------------ diff --git a/src/test/org/apache/commons/collections/comparators/TestComparator.java b/src/test/org/apache/commons/collections/comparators/TestComparator.java index 458b57b75..56cdc8228 100644 --- a/src/test/org/apache/commons/collections/comparators/TestComparator.java +++ b/src/test/org/apache/commons/collections/comparators/TestComparator.java @@ -131,40 +131,40 @@ public abstract class TestComparator extends TestObject { * against the canonical version in CVS. */ public void testComparatorCompatibility() throws IOException, ClassNotFoundException { - Comparator comparator = null; - - // test to make sure the canonical form has been preserved - try { - comparator = - (Comparator) readExternalFormFromDisk - (getCanonicalComparatorName(makeComparator())); - } catch (FileNotFoundException exception) { - - boolean autoCreateSerialized = false; - - if(autoCreateSerialized) { - comparator = makeComparator(); - String fileName = getCanonicalComparatorName(comparator); - writeExternalFormToDisk((Serializable) comparator, fileName); - fail("Serialized form could not be found. A serialized version " + - "has now been written (and should be added to CVS): " + fileName); - } else { - fail("The Serialized form could be located to test serialization " + - "compatibility: " + exception.getMessage()); - } - } - - - // make sure the canonical form produces the ordering we currently - // expect - List randomList = getComparableObjectsOrdered(); - reverseObjects(randomList); - sortObjects(randomList,comparator); - - List orderedList = getComparableObjectsOrdered(); - - assertTrue("Comparator did not reorder the List correctly", - orderedList.equals(randomList)); + if(!skipSerializedCanonicalTests()) { + Comparator comparator = null; + + // test to make sure the canonical form has been preserved + try { + comparator = (Comparator) readExternalFormFromDisk(getCanonicalComparatorName(makeComparator())); + } catch (FileNotFoundException exception) { + + boolean autoCreateSerialized = false; + + if(autoCreateSerialized) { + comparator = makeComparator(); + String fileName = getCanonicalComparatorName(comparator); + writeExternalFormToDisk((Serializable) comparator, fileName); + fail("Serialized form could not be found. A serialized version " + + "has now been written (and should be added to CVS): " + fileName); + } else { + fail("The Serialized form could be located to test serialization " + + "compatibility: " + exception.getMessage()); + } + } + + + // make sure the canonical form produces the ordering we currently + // expect + List randomList = getComparableObjectsOrdered(); + reverseObjects(randomList); + sortObjects(randomList,comparator); + + List orderedList = getComparableObjectsOrdered(); + + assertTrue("Comparator did not reorder the List correctly", + orderedList.equals(randomList)); + } } }