commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/bag AbstractTestBag.java
Date Mon, 31 May 2004 22:39:21 GMT
scolebourne    2004/05/31 15:39:20

  Modified:    collections/src/test/org/apache/commons/collections/set
                        AbstractTestSortedSet.java
               collections/src/test/org/apache/commons/collections/list
                        AbstractTestList.java
               collections/src/test/org/apache/commons/collections/map
                        AbstractTestSortedMap.java AbstractTestMap.java
                        TestListOrderedMap.java TestLinkedMap.java
               collections/src/test/org/apache/commons/collections
                        AbstractTestObject.java
               collections/src/test/org/apache/commons/collections/collection
                        AbstractTestCollection.java
               collections/src/test/org/apache/commons/collections/bag
                        AbstractTestBag.java
  Log:
  Add isTestSerialization() method to block serialization tests
  
  Revision  Changes    Path
  1.6       +6 -2      jakarta-commons/collections/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
  
  Index: AbstractTestSortedSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractTestSortedSet.java	18 Feb 2004 01:20:39 -0000	1.5
  +++ AbstractTestSortedSet.java	31 May 2004 22:39:20 -0000	1.6
  @@ -284,7 +284,11 @@
               SortedSet s = (SortedSet) AbstractTestSortedSet.this.makeFullCollection();
               return getSubSet(s);
           }
  -
  +        
  +        public boolean isTestSerialization() {
  +            return false;
  +        }
  +        
           public BulkTest bulkTestSortedSetSubSet() {
               return null;  // prevent infinite recursion
           }
  
  
  
  1.9       +8 -5      jakarta-commons/collections/src/test/org/apache/commons/collections/list/AbstractTestList.java
  
  Index: AbstractTestList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/list/AbstractTestList.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractTestList.java	31 May 2004 19:09:14 -0000	1.8
  +++ AbstractTestList.java	31 May 2004 22:39:20 -0000	1.9
  @@ -946,7 +946,7 @@
       public void testEmptyListSerialization() 
       throws IOException, ClassNotFoundException {
           List list = makeEmptyList();
  -        if (!(list instanceof Serializable)) return;
  +        if (!(list instanceof Serializable && isTestSerialization())) return;
           
           byte[] objekt = writeExternalFormToBytes((Serializable) list);
           List list2 = (List) readExternalFormFromBytes(objekt);
  @@ -959,7 +959,7 @@
       throws IOException, ClassNotFoundException {
           List list = makeFullList();
           int size = getFullElements().length;
  -        if (!(list instanceof Serializable)) return;
  +        if (!(list instanceof Serializable && isTestSerialization())) return;
           
           byte[] objekt = writeExternalFormToBytes((Serializable) list);
           List list2 = (List) readExternalFormFromBytes(objekt);
  @@ -983,7 +983,7 @@
   
           // test to make sure the canonical form has been preserved
           List list = makeEmptyList();
  -        if(list instanceof Serializable && !skipSerializedCanonicalTests()) {
  +        if(list instanceof Serializable && !skipSerializedCanonicalTests() &&
isTestSerialization()) {
               List list2 = (List) readExternalFormFromDisk(getCanonicalEmptyCollectionName(list));
               assertTrue("List is empty",list2.size()  == 0);
               assertEquals(list, list2);
  @@ -1005,7 +1005,7 @@
   
           // test to make sure the canonical form has been preserved
           List list = makeFullList();
  -        if(list instanceof Serializable && !skipSerializedCanonicalTests()) {
  +        if(list instanceof Serializable && !skipSerializedCanonicalTests() &&
isTestSerialization()) {
               List list2 = (List) readExternalFormFromDisk(getCanonicalFullCollectionName(list));
               if (list2.size() == 4) {
                   // old serialized tests
  @@ -1098,6 +1098,9 @@
              outer.verify();
          }
   
  +       public boolean isTestSerialization() {
  +           return false;
  +       }
      }
   
   
  
  
  
  1.9       +18 -21    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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractTestSortedMap.java	9 Apr 2004 15:17:11 -0000	1.8
  +++ AbstractTestSortedMap.java	31 May 2004 22:39:20 -0000	1.9
  @@ -155,28 +155,25 @@
           public boolean isRemoveSupported() {
               return main.isRemoveSupported();
           }
  -        public boolean supportsEmptyCollections() {
  +        public boolean isTestSerialization() {
               return false;
           }
  -        public boolean supportsFullCollections() {
  -            return false;
  -        }
  -        public void testSimpleSerialization() throws Exception {
  -            if (main.isSubMapViewsSerializable() == false) return;
  -            super.testSimpleSerialization();
  -        }
  -        public void testSerializeDeserializeThenCompare() throws Exception {
  -            if (main.isSubMapViewsSerializable() == false) return;
  -            super.testSerializeDeserializeThenCompare();
  -        }
  -        public void testEmptyMapCompatibility() throws Exception {
  -            if (main.isSubMapViewsSerializable() == false) return;
  -            super.testEmptyMapCompatibility();
  -        }
  -        public void testFullMapCompatibility() throws Exception {
  -            if (main.isSubMapViewsSerializable() == false) return;
  -            super.testFullMapCompatibility();
  -        }
  +//        public void testSimpleSerialization() throws Exception {
  +//            if (main.isSubMapViewsSerializable() == false) return;
  +//            super.testSimpleSerialization();
  +//        }
  +//        public void testSerializeDeserializeThenCompare() throws Exception {
  +//            if (main.isSubMapViewsSerializable() == false) return;
  +//            super.testSerializeDeserializeThenCompare();
  +//        }
  +//        public void testEmptyMapCompatibility() throws Exception {
  +//            if (main.isSubMapViewsSerializable() == false) return;
  +//            super.testEmptyMapCompatibility();
  +//        }
  +//        public void testFullMapCompatibility() throws Exception {
  +//            if (main.isSubMapViewsSerializable() == false) return;
  +//            super.testFullMapCompatibility();
  +//        }
       }
       
       public static class TestHeadMap extends TestViewMap {
  
  
  
  1.15      +11 -20    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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AbstractTestMap.java	12 Apr 2004 12:04:00 -0000	1.14
  +++ AbstractTestMap.java	31 May 2004 22:39:20 -0000	1.15
  @@ -739,7 +739,7 @@
   
           // test to make sure the canonical form has been preserved
           Map map = makeEmptyMap();
  -        if (map instanceof Serializable && !skipSerializedCanonicalTests()) {
  +        if (map instanceof Serializable && !skipSerializedCanonicalTests() &&
isTestSerialization()) {
               Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
               assertEquals("Map is empty", 0, map2.size());
           }
  @@ -760,7 +760,7 @@
   
           // test to make sure the canonical form has been preserved
           Map map = makeFullMap();
  -        if (map instanceof Serializable && !skipSerializedCanonicalTests()) {
  +        if (map instanceof Serializable && !skipSerializedCanonicalTests() &&
isTestSerialization()) {
               Map map2 = (Map) readExternalFormFromDisk(getCanonicalFullCollectionName(map));
               assertEquals("Map is the right size", getSampleKeys().length, map2.size());
           }
  @@ -1255,13 +1255,10 @@
           public boolean isGetStructuralModify() {
               return AbstractTestMap.this.isGetStructuralModify();
           }
  -        public boolean supportsEmptyCollections() {
  -            return AbstractTestMap.this.supportsEmptyCollections();
  -        }
  -        public boolean supportsFullCollections() {
  -            return AbstractTestMap.this.supportsFullCollections();
  +        public boolean isTestSerialization() {
  +            return false;
           }
  -        
  +
           public void resetFull() {
               AbstractTestMap.this.resetFull();
               collection = map.entrySet();
  @@ -1415,11 +1412,8 @@
           public boolean isRemoveSupported() {
               return AbstractTestMap.this.isRemoveSupported();
           }
  -        public boolean supportsEmptyCollections() {
  -            return AbstractTestMap.this.supportsEmptyCollections();
  -        }
  -        public boolean supportsFullCollections() {
  -            return AbstractTestMap.this.supportsFullCollections();
  +        public boolean isTestSerialization() {
  +            return false;
           }
           
           public void resetEmpty() {
  @@ -1484,13 +1478,10 @@
           public boolean isRemoveSupported() {
               return AbstractTestMap.this.isRemoveSupported();
           }
  -        public boolean supportsEmptyCollections() {
  -            return AbstractTestMap.this.supportsEmptyCollections();
  -        }
  -        public boolean supportsFullCollections() {
  -            return AbstractTestMap.this.supportsFullCollections();
  +        public boolean isTestSerialization() {
  +            return false;
           }
  -
  +        
           public boolean areEqualElementsDistinguishable() {
               // equal values are associated with different keys, so they are
               // distinguishable.  
  
  
  
  1.10      +4 -2      jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestListOrderedMap.java
  
  Index: TestListOrderedMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestListOrderedMap.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestListOrderedMap.java	7 Apr 2004 23:17:25 -0000	1.9
  +++ TestListOrderedMap.java	31 May 2004 22:39:20 -0000	1.10
  @@ -188,7 +188,9 @@
           public boolean isNullSupported() {
               return TestListOrderedMap.this.isAllowNullKey();
           }
  -
  +        public boolean isTestSerialization() {
  +            return false;
  +        }
       }
   
       public String getCompatibilityVersion() {
  
  
  
  1.8       +4 -2      jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLinkedMap.java
  
  Index: TestLinkedMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLinkedMap.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestLinkedMap.java	27 Feb 2004 00:25:14 -0000	1.7
  +++ TestLinkedMap.java	31 May 2004 22:39:20 -0000	1.8
  @@ -252,7 +252,9 @@
           public boolean isNullSupported() {
               return TestLinkedMap.this.isAllowNullKey();
           }
  -
  +        public boolean isTestSerialization() {
  +            return false;
  +        }
       }
   
       public void testClone() {
  
  
  
  1.6       +13 -5     jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestObject.java
  
  Index: AbstractTestObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestObject.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractTestObject.java	9 Apr 2004 15:17:11 -0000	1.5
  +++ AbstractTestObject.java	31 May 2004 22:39:20 -0000	1.6
  @@ -87,6 +87,14 @@
           return true;
       }
   
  +    /**
  +     * Is serialization testing supported.
  +     * Default is true.
  +     */
  +    public boolean isTestSerialization() {
  +        return true;
  +    }
  +
       //-----------------------------------------------------------------------
       public void testObjectEqualsSelf() {
           Object obj = makeObject();
  @@ -123,7 +131,7 @@
   
       public void testSerializeDeserializeThenCompare() throws Exception {
           Object obj = makeObject();
  -        if (obj instanceof Serializable) {
  +        if (obj instanceof Serializable && isTestSerialization()) {
               ByteArrayOutputStream buffer = new ByteArrayOutputStream();
               ObjectOutputStream out = new ObjectOutputStream(buffer);
               out.writeObject(obj);
  @@ -146,7 +154,7 @@
        */
       public void testSimpleSerialization() throws Exception {
           Object o = makeObject();
  -        if (o instanceof Serializable) {
  +        if (o instanceof Serializable && isTestSerialization()) {
               byte[] objekt = writeExternalFormToBytes((Serializable) o);
               Object p = readExternalFormFromBytes(objekt);
           }
  @@ -157,7 +165,7 @@
        * If the test object is serializable, confirm that a canonical form exists.
        */
       public void testCanonicalEmptyCollectionExists() {
  -        if (supportsEmptyCollections()) {
  +        if (supportsEmptyCollections() && isTestSerialization() && !skipSerializedCanonicalTests())
{
               Object object = makeObject();
               if (object instanceof Serializable) {
                   String name = getCanonicalEmptyCollectionName(object);
  @@ -173,7 +181,7 @@
        * If the test object is serializable, confirm that a canonical form exists.
        */
       public void testCanonicalFullCollectionExists() {
  -        if (supportsFullCollections()) {
  +        if (supportsFullCollections() && isTestSerialization() && !skipSerializedCanonicalTests())
{
               Object object = makeObject();
               if (object instanceof Serializable) {
                   String name = getCanonicalFullCollectionName(object);
  
  
  
  1.7       +3 -3      jakarta-commons/collections/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java
  
  Index: AbstractTestCollection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractTestCollection.java	31 May 2004 19:09:14 -0000	1.6
  +++ AbstractTestCollection.java	31 May 2004 22:39:20 -0000	1.7
  @@ -1300,7 +1300,7 @@
   
       public void testSerializeDeserializeThenCompare() throws Exception {
           Object obj = makeCollection();
  -        if (obj instanceof Serializable) {
  +        if (obj instanceof Serializable && isTestSerialization()) {
               ByteArrayOutputStream buffer = new ByteArrayOutputStream();
               ObjectOutputStream out = new ObjectOutputStream(buffer);
               out.writeObject(obj);
  @@ -1314,7 +1314,7 @@
               }
           }
           obj = makeFullCollection();
  -        if (obj instanceof Serializable) {
  +        if (obj instanceof Serializable && isTestSerialization()) {
               ByteArrayOutputStream buffer = new ByteArrayOutputStream();
               ObjectOutputStream out = new ObjectOutputStream(buffer);
               out.writeObject(obj);
  
  
  
  1.9       +5 -5      jakarta-commons/collections/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
  
  Index: AbstractTestBag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/bag/AbstractTestBag.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractTestBag.java	18 Feb 2004 01:20:39 -0000	1.8
  +++ AbstractTestBag.java	31 May 2004 22:39:20 -0000	1.9
  @@ -425,7 +425,7 @@
       //-----------------------------------------------------------------------
       public void testEmptyBagSerialization() throws IOException, ClassNotFoundException
{
           Bag bag = makeBag();
  -        if (!(bag instanceof Serializable)) return;
  +        if (!(bag instanceof Serializable && isTestSerialization())) return;
           
           byte[] objekt = writeExternalFormToBytes((Serializable) bag);
           Bag bag2 = (Bag) readExternalFormFromBytes(objekt);
  @@ -442,7 +442,7 @@
           bag.add("B");
           bag.add("C");
           int size = bag.size();
  -        if (!(bag instanceof Serializable)) return;
  +        if (!(bag instanceof Serializable && isTestSerialization())) return;
           
           byte[] objekt = writeExternalFormToBytes((Serializable) bag);
           Bag bag2 = (Bag) readExternalFormFromBytes(objekt);
  @@ -458,7 +458,7 @@
       public void testEmptyBagCompatibility() throws IOException, ClassNotFoundException
{
           // test to make sure the canonical form has been preserved
           Bag bag = makeBag();
  -        if(bag instanceof Serializable && !skipSerializedCanonicalTests()) {
  +        if(bag instanceof Serializable && !skipSerializedCanonicalTests() &&
isTestSerialization()) {
               Bag bag2 = (Bag) readExternalFormFromDisk(getCanonicalEmptyCollectionName(bag));
               assertTrue("Bag is empty",bag2.size()  == 0);
               assertEquals(bag, bag2);
  @@ -477,7 +477,7 @@
           bag.add("B");
           bag.add("B");
           bag.add("C");
  -        if(bag instanceof Serializable && !skipSerializedCanonicalTests()) {
  +        if(bag instanceof Serializable && !skipSerializedCanonicalTests() &&
isTestSerialization()) {
               Bag bag2 = (Bag) readExternalFormFromDisk(getCanonicalFullCollectionName(bag));
               assertEquals("Bag is the right size",bag.size(), bag2.size());
               assertEquals(bag, bag2);
  
  
  

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


Mime
View raw message