You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2004/04/09 11:38:31 UTC

cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/map AbstractTestSortedMap.java AbstractTestMap.java

scolebourne    2004/04/09 02:38:31

  Modified:    collections/src/test/org/apache/commons/collections/map
                        AbstractTestSortedMap.java AbstractTestMap.java
  Log:
  Enable support to work around bug in TreeMap sub map deserialization
  
  Revision  Changes    Path
  1.6       +26 -3     jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java
  
  Index: AbstractTestSortedMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractTestSortedMap.java	2 Apr 2004 23:09:09 -0000	1.5
  +++ AbstractTestSortedMap.java	9 Apr 2004 09:38:31 -0000	1.6
  @@ -45,6 +45,17 @@
       
       //-----------------------------------------------------------------------
       /**
  +     * Returns whether the sub map views are serializable.
  +     * If the class being tested is based around a TreeMap then you should
  +     * override and return false as TreeMap has a bug in deserialization.
  +     * 
  +     * @return false
  +     */
  +    public boolean isSubMapViewsSerializable() {
  +        return true;
  +    }
  +    
  +    /**
        * Can't sort null keys.
        * 
        * @return false
  @@ -161,6 +172,18 @@
           public boolean supportsFullCollections() {
               return false;
           }
  +        public void testSerializeDeserializeThenCompare() throws Exception {
  +            if (((AbstractTestSortedMap) main).isSubMapViewsSerializable() == false) return;
  +            super.testSerializeDeserializeThenCompare();
  +        }
  +        public void testEmptyMapCompatibility() throws Exception {
  +            if (((AbstractTestSortedMap) main).isSubMapViewsSerializable() == false) return;
  +            super.testEmptyMapCompatibility();
  +        }
  +        public void testFullMapCompatibility() throws Exception {
  +            if (((AbstractTestSortedMap) main).isSubMapViewsSerializable() == false) return;
  +            super.testFullMapCompatibility();
  +        }
       }
       
       public static class TestHeadMap extends TestViewMap {
  @@ -313,11 +336,11 @@
   //            Map map = makeEmptyMap();
   //            writeExternalFormToDisk(
   //                (java.io.Serializable) map,
  -//                "D:/dev/collections/data/test/FixedSizeSortedMap.emptyCollection.version3.1.SubMapView.obj");
  +//                "D:/dev/collections/data/test/TransformedSortedMap.emptyCollection.version3.1.SubMapView.obj");
   //            map = makeFullMap();
   //            writeExternalFormToDisk(
   //                (java.io.Serializable) map,
  -//                "D:/dev/collections/data/test/FixedSizeSortedMap.fullCollection.version3.1.SubMapView.obj");
  +//                "D:/dev/collections/data/test/TransformedSortedMap.fullCollection.version3.1.SubMapView.obj");
   //        }
       }
       
  
  
  
  1.10      +3 -4      jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java
  
  Index: AbstractTestMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractTestMap.java	1 Apr 2004 22:18:12 -0000	1.9
  +++ AbstractTestMap.java	9 Apr 2004 09:38:31 -0000	1.10
  @@ -15,7 +15,6 @@
    */
   package org.apache.commons.collections.map;
   
  -import java.io.IOException;
   import java.io.Serializable;
   import java.util.ArrayList;
   import java.util.Collection;
  @@ -718,7 +717,7 @@
        * Compare the current serialized form of the Map
        * against the canonical version in CVS.
        */
  -    public void testEmptyMapCompatibility() throws IOException, ClassNotFoundException {
  +    public void testEmptyMapCompatibility() throws Exception {
           /**
            * Create canonical objects with this code
           Map map = makeEmptyMap();
  @@ -739,7 +738,7 @@
        * Compare the current serialized form of the Map
        * against the canonical version in CVS.
        */
  -    public void testFullMapCompatibility() throws IOException, ClassNotFoundException {
  +    public void testFullMapCompatibility() throws Exception {
           /**
            * Create canonical objects with this code
           Map map = makeFullMap();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org