commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morg...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestMap.java TestObject.java
Date Tue, 26 Feb 2002 18:08:58 GMT
morgand     02/02/26 10:08:58

  Modified:    collections/src/test/org/apache/commons/collections
                        TestMap.java TestObject.java
  Log:
  more generic name for serialized collections
  
  Revision  Changes    Path
  1.14      +8 -33     jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java
  
  Index: TestMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestMap.java	26 Feb 2002 00:08:07 -0000	1.13
  +++ TestMap.java	26 Feb 2002 18:08:58 -0000	1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v
1.13 2002/02/26 00:08:07 morgand Exp $
  - * $Revision: 1.13 $
  - * $Date: 2002/02/26 00:08:07 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v
1.14 2002/02/26 18:08:58 morgand Exp $
  + * $Revision: 1.14 $
  + * $Date: 2002/02/26 18:08:58 $
    *
    * ====================================================================
    *
  @@ -87,7 +87,7 @@
    *
    * @author Michael Smith
    * @author Rodney Waldhoff
  - * @version $Id: TestMap.java,v 1.13 2002/02/26 00:08:07 morgand Exp $
  + * @version $Id: TestMap.java,v 1.14 2002/02/26 18:08:58 morgand Exp $
    */
   public abstract class TestMap extends TestObject {
   
  @@ -929,31 +929,6 @@
           assertEquals("Both maps are same size",map2.size(),getSampleKeys().length);
       }
   
  -
  -    public String getCanonicalEmptyMapName(Map map) {
  -        StringBuffer retval = new StringBuffer();
  -        retval.append("data/test/");
  -        String mapName = map.getClass().getName();
  -        mapName = mapName.substring(mapName.lastIndexOf(".")+1,mapName.length());
  -        retval.append(mapName);
  -        retval.append(".emptyMap.version");
  -        retval.append(getCompatibilityVersion());
  -        retval.append(".obj");
  -        return retval.toString();
  -    }
  -
  -    public String getCanonicalFullMapName(Map map) {
  -        StringBuffer retval = new StringBuffer();
  -        retval.append("data/test/");
  -        String mapName = map.getClass().getName();
  -        mapName = mapName.substring(mapName.lastIndexOf(".")+1,mapName.length());
  -        retval.append(mapName);
  -        retval.append(".fullMap.version");
  -        retval.append(getCompatibilityVersion());
  -        retval.append(".obj");
  -        return retval.toString();
  -    }
  -
       /**
        * Compare the current serialized form of the Map
        * against the canonical version in CVS.
  @@ -964,12 +939,12 @@
           Map map = makeEmptyMap();
           if (!(map instanceof Serializable)) return;
           
  -        writeExternalFormToDisk((Serializable) map, getCanonicalEmptyMapName(map));
  +        writeExternalFormToDisk((Serializable) map, getCanonicalEmptyCollectionName(map));
           */
   
           // test to make sure the canonical form has been preserved
           if (!(makeEmptyMap() instanceof Serializable)) return;
  -        Map map = (Map) readExternalFormFromDisk(getCanonicalEmptyMapName(makeEmptyMap()));
  +        Map map = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(makeEmptyMap()));
           assertTrue("Map is empty",map.isEmpty()  == true);
       }
   
  @@ -983,12 +958,12 @@
           Map map = makeFullMap();
           if (!(map instanceof Serializable)) return;
           
  -        writeExternalFormToDisk((Serializable) map, getCanonicalFullMapName(map));
  +        writeExternalFormToDisk((Serializable) map, getCanonicalFullCollectionName(map));
           */
   
           // test to make sure the canonical form has been preserved
           if (!(makeFullMap() instanceof Serializable)) return;
  -        Map map = (Map) readExternalFormFromDisk(getCanonicalFullMapName(makeFullMap()));
  +        Map map = (Map) readExternalFormFromDisk(getCanonicalFullCollectionName(makeFullMap()));
           assertEquals("Map is the right size",map.size(), getSampleKeys().length);
       }
   
  
  
  
  1.8       +28 -4     jakarta-commons/collections/src/test/org/apache/commons/collections/TestObject.java
  
  Index: TestObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestObject.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestObject.java	26 Feb 2002 00:08:07 -0000	1.7
  +++ TestObject.java	26 Feb 2002 18:08:58 -0000	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestObject.java,v
1.7 2002/02/26 00:08:07 morgand Exp $
  - * $Revision: 1.7 $
  - * $Date: 2002/02/26 00:08:07 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestObject.java,v
1.8 2002/02/26 18:08:58 morgand Exp $
  + * $Revision: 1.8 $
  + * $Date: 2002/02/26 18:08:58 $
    *
    * ====================================================================
    *
  @@ -90,7 +90,7 @@
    * test case (method) your {@link Object} fails.
    *
    * @author Rodney Waldhoff
  - * @version $Id: TestObject.java,v 1.7 2002/02/26 00:08:07 morgand Exp $
  + * @version $Id: TestObject.java,v 1.8 2002/02/26 18:08:58 morgand Exp $
    */
   public abstract class TestObject extends TestCase {
       public TestObject(String testName) {
  @@ -234,5 +234,29 @@
               byte[] objekt = writeExternalFormToBytes((Serializable) o);
               Object p = readExternalFormFromBytes(objekt);
           }
  +    }
  +
  +    public String getCanonicalEmptyCollectionName(Object object) {
  +        StringBuffer retval = new StringBuffer();
  +        retval.append("data/test/");
  +        String colName = object.getClass().getName();
  +        colName = colName.substring(colName.lastIndexOf(".")+1,colName.length());
  +        retval.append(colName);
  +        retval.append(".emptyCollection.version");
  +        retval.append(getCompatibilityVersion());
  +        retval.append(".obj");
  +        return retval.toString();
  +    }
  +
  +    public String getCanonicalFullCollectionName(Object object) {
  +        StringBuffer retval = new StringBuffer();
  +        retval.append("data/test/");
  +        String colName = object.getClass().getName();
  +        colName = colName.substring(colName.lastIndexOf(".")+1,colName.length());
  +        retval.append(colName);
  +        retval.append(".fullCollection.version");
  +        retval.append(getCompatibilityVersion());
  +        retval.append(".obj");
  +        return retval.toString();
       }
   }
  
  
  

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


Mime
View raw message