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/set TestTypedSet.java TestPredicatedSortedSet.java TestTransformedSet.java TestUnmodifiableSet.java TestMapBackedSet.java TestUnmodifiableSortedSet.java TestTypedSortedSet.java TestMapBackedSet2.java TestAll.java TestTransformedSortedSet.java TestListOrderedSet.java TestPredicatedSet.java
Date Wed, 02 Jun 2004 22:12:15 GMT
scolebourne    2004/06/02 15:12:15

  Modified:    collections/src/test/org/apache/commons/collections
                        TestBufferUtils.java TestListUtils.java
                        TestSetUtils.java
               collections/src/test/org/apache/commons/collections/set
                        TestPredicatedSortedSet.java
                        TestTransformedSet.java TestUnmodifiableSet.java
                        TestMapBackedSet.java
                        TestUnmodifiableSortedSet.java
                        TestTypedSortedSet.java TestMapBackedSet2.java
                        TestAll.java TestTransformedSortedSet.java
                        TestListOrderedSet.java TestPredicatedSet.java
  Added:       collections/src/test/org/apache/commons/collections/set
                        TestTypedSet.java
  Log:
  Make decorator classes serializable, bug 18815
  
  Revision  Changes    Path
  1.13      +1 -39     jakarta-commons/collections/src/test/org/apache/commons/collections/TestBufferUtils.java
  
  Index: TestBufferUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestBufferUtils.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestBufferUtils.java	18 Feb 2004 01:20:35 -0000	1.12
  +++ TestBufferUtils.java	2 Jun 2004 22:12:14 -0000	1.13
  @@ -15,13 +15,9 @@
    */
   package org.apache.commons.collections;
   
  -import java.util.Arrays;
  -import java.util.Collection;
  -
   import junit.framework.Test;
   
   import org.apache.commons.collections.buffer.PredicatedBuffer;
  -import org.apache.commons.collections.collection.AbstractTestCollection;
   
   /**
    * Tests for BufferUtils.
  @@ -67,38 +63,4 @@
           }
       }
   
  -
  -    public BulkTest bulkTestUnmodifiableBuffer() {
  -        return new AbstractTestCollection("") {
  -            public boolean isAddSupported() {
  -                return false;
  -            }
  -
  -            public boolean isRemoveSupported() {
  -                return false;
  -            }
  -
  -            public Collection makeCollection() {
  -                return BufferUtils.unmodifiableBuffer(new ArrayStack());
  -            }
  -
  -            public Collection makeFullCollection() {
  -                ArrayStack a = new ArrayStack();
  -                a.addAll(Arrays.asList(getFullElements()));
  -                return BufferUtils.unmodifiableBuffer(a);
  -            }
  -
  -
  -            public Collection makeConfirmedCollection() {
  -                return new ArrayStack();
  -            }
  -
  -            public Collection makeConfirmedFullCollection() {
  -                ArrayStack a = new ArrayStack();
  -                a.addAll(Arrays.asList(getFullElements()));
  -                return a;
  -            }
  -
  -        };
  -    }
   }
  
  
  
  1.19      +1 -30     jakarta-commons/collections/src/test/org/apache/commons/collections/TestListUtils.java
  
  Index: TestListUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestListUtils.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TestListUtils.java	18 Feb 2004 01:20:35 -0000	1.18
  +++ TestListUtils.java	2 Jun 2004 22:12:14 -0000	1.19
  @@ -22,7 +22,6 @@
   
   import junit.framework.Test;
   
  -import org.apache.commons.collections.list.AbstractTestList;
   import org.apache.commons.collections.list.PredicatedList;
   
   /**
  @@ -72,34 +71,6 @@
               // expected
           }
       }
  -
  -    public BulkTest bulkTestTypedList() {
  -        return new TestTypedCollection("") {
  -
  -            public Collection typedCollection() {
  -                Class type = getType();
  -                return ListUtils.typedList(new ArrayList(), type);
  -            }
  -
  -            public BulkTest bulkTestAll() {
  -                return new AbstractTestList("") {
  -                    public List makeEmptyList() {
  -                        return (List)typedCollection();
  -                    }
  -
  -                    public Object[] getFullElements() {
  -                        return getFullNonNullStringElements();
  -                    }
  -
  -                    public Object[] getOtherElements() {
  -                        return getOtherNonNullStringElements();
  -                    }
  -
  -                };
  -            }
  -        };
  -    }
  -
   
       public void testLazyList() {
           List list = ListUtils.lazyList(new ArrayList(), new Factory() {
  
  
  
  1.16      +1 -29     jakarta-commons/collections/src/test/org/apache/commons/collections/TestSetUtils.java
  
  Index: TestSetUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestSetUtils.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TestSetUtils.java	18 Feb 2004 01:20:35 -0000	1.15
  +++ TestSetUtils.java	2 Jun 2004 22:12:14 -0000	1.16
  @@ -22,7 +22,6 @@
   
   import junit.framework.Test;
   
  -import org.apache.commons.collections.set.AbstractTestSet;
   import org.apache.commons.collections.set.PredicatedSet;
   
   /**
  @@ -70,33 +69,6 @@
           }
       }
   
  -
  -    public BulkTest bulkTestTypedSet() {
  -        return new TestTypedCollection("") {
  -
  -            public Collection typedCollection() {
  -                Class type = getType();
  -                return SetUtils.typedSet(new HashSet(), type);
  -            }
  -
  -            public BulkTest bulkTestAll() {
  -                return new AbstractTestSet("") {
  -                    public Set makeEmptySet() {
  -                        return (Set)typedCollection();
  -                    }
  -
  -                    public Object[] getFullElements() {
  -                        return getFullNonNullStringElements();
  -                    }
  -
  -                    public Object[] getOtherElements() {
  -                        return getOtherNonNullStringElements();
  -                    }
  -                };
  -            }
  -        };
  -    }
  -     
       public void testEquals() {
           Collection data = Arrays.asList( new String[] { "a", "b", "c" });
           
  
  
  
  1.5       +14 -3     jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java
  
  Index: TestPredicatedSortedSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestPredicatedSortedSet.java	18 Feb 2004 01:20:39 -0000	1.4
  +++ TestPredicatedSortedSet.java	2 Jun 2004 22:12:14 -0000	1.5
  @@ -127,5 +127,16 @@
           Comparator c = set.comparator();
           assertTrue("natural order, so comparator should be null", c == null);
       }
  -        
  -}
  \ No newline at end of file
  +
  +    public String getCompatibilityVersion() {
  +        return "3.1";
  +    }
  +
  +//    public void testCreate() throws Exception {
  +//        resetEmpty();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/PredicatedSortedSet.emptyCollection.version3.1.obj");
  +//        resetFull();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/PredicatedSortedSet.fullCollection.version3.1.obj");
  +//    }
  +
  +}
  
  
  
  1.6       +13 -1     jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestTransformedSet.java
  
  Index: TestTransformedSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestTransformedSet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestTransformedSet.java	18 Feb 2004 01:20:39 -0000	1.5
  +++ TestTransformedSet.java	2 Jun 2004 22:12:14 -0000	1.6
  @@ -84,4 +84,16 @@
           assertEquals(true, set.remove(new Integer((String) els[0])));
           
       }
  +
  +    public String getCompatibilityVersion() {
  +        return "3.1";
  +    }
  +
  +//    public void testCreate() throws Exception {
  +//        resetEmpty();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/TransformedSet.emptyCollection.version3.1.obj");
  +//        resetFull();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/TransformedSet.fullCollection.version3.1.obj");
  +//    }
  +
   }
  
  
  
  1.4       +13 -2     jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java
  
  Index: TestUnmodifiableSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestUnmodifiableSet.java	18 Feb 2004 01:20:39 -0000	1.3
  +++ TestUnmodifiableSet.java	2 Jun 2004 22:12:14 -0000	1.4
  @@ -65,5 +65,16 @@
       public boolean isRemoveSupported() {
           return false;
       }
  -           
  +
  +    public String getCompatibilityVersion() {
  +        return "3.1";
  +    }
  +
  +//    public void testCreate() throws Exception {
  +//        resetEmpty();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableSet.emptyCollection.version3.1.obj");
  +//        resetFull();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableSet.fullCollection.version3.1.obj");
  +//    }
  +
   }
  
  
  
  1.2       +12 -1     jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
  
  Index: TestMapBackedSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestMapBackedSet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestMapBackedSet.java	20 Apr 2004 23:51:31 -0000	1.1
  +++ TestMapBackedSet.java	2 Jun 2004 22:12:14 -0000	1.2
  @@ -49,4 +49,15 @@
           return MapBackedSet.decorate(new HashedMap());
       }
   
  +    public String getCompatibilityVersion() {
  +        return "3.1";
  +    }
  +
  +//    public void testCreate() throws Exception {
  +//        resetEmpty();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/MapBackedSet.emptyCollection.version3.1.obj");
  +//        resetFull();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/MapBackedSet.fullCollection.version3.1.obj");
  +//    }
  +
   }
  
  
  
  1.7       +14 -2     jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java
  
  Index: TestUnmodifiableSortedSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestUnmodifiableSortedSet.java	18 Feb 2004 01:20:39 -0000	1.6
  +++ TestUnmodifiableSortedSet.java	2 Jun 2004 22:12:14 -0000	1.7
  @@ -136,4 +136,16 @@
           Comparator c = set.comparator();
           assertTrue("natural order, so comparator should be null", c == null);
       }
  -}
  \ No newline at end of file
  +
  +    public String getCompatibilityVersion() {
  +        return "3.1";
  +    }
  +
  +//    public void testCreate() throws Exception {
  +//        resetEmpty();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableSortedSet.emptyCollection.version3.1.obj");
  +//        resetFull();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableSortedSet.fullCollection.version3.1.obj");
  +//    }
  +
  +}
  
  
  
  1.5       +7 -2      jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestTypedSortedSet.java
  
  Index: TestTypedSortedSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestTypedSortedSet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestTypedSortedSet.java	18 Feb 2004 01:20:39 -0000	1.4
  +++ TestTypedSortedSet.java	2 Jun 2004 22:12:14 -0000	1.5
  @@ -101,4 +101,9 @@
           assertTrue("Collection shouldn't convert long to int", 
            !set.contains(getNextAsInt()));  
       }       
  -}
  \ No newline at end of file
  +
  +    public boolean skipSerializedCanonicalTests() {
  +        return true;  // Typed and Predicated get confused
  +    }
  +
  +}
  
  
  
  1.2       +8 -2      jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java
  
  Index: TestMapBackedSet2.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestMapBackedSet2.java	20 Apr 2004 23:51:31 -0000	1.1
  +++ TestMapBackedSet2.java	2 Jun 2004 22:12:14 -0000	1.2
  @@ -90,5 +90,11 @@
               assertEquals("Sequence is wrong", Integer.toString(i), it.next());
           }
       }
  -    
  +
  +    public void testCanonicalEmptyCollectionExists() {
  +    }
  +
  +    public void testCanonicalFullCollectionExists() {
  +    }
  +
   }
  
  
  
  1.8       +2 -2      jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestAll.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestAll.java	1 Jun 2004 23:08:50 -0000	1.7
  +++ TestAll.java	2 Jun 2004 22:12:14 -0000	1.8
  @@ -51,7 +51,7 @@
           suite.addTest(TestSynchronizedSortedSet.suite());
           suite.addTest(TestTransformedSet.suite());
           suite.addTest(TestTransformedSortedSet.suite());
  -//        suite.addTest(TestTypedSet.suite());
  +        suite.addTest(TestTypedSet.suite());
           suite.addTest(TestTypedSortedSet.suite());
           suite.addTest(TestUnmodifiableSet.suite());
           suite.addTest(TestUnmodifiableSortedSet.suite());
  
  
  
  1.6       +13 -1     jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
  
  Index: TestTransformedSortedSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestTransformedSortedSet.java	18 Feb 2004 01:20:39 -0000	1.5
  +++ TestTransformedSortedSet.java	2 Jun 2004 22:12:14 -0000	1.6
  @@ -77,4 +77,16 @@
           assertEquals(true, set.remove(new Integer((String) els[0])));
           
       } 
  +
  +    public String getCompatibilityVersion() {
  +        return "3.1";
  +    }
  +
  +//    public void testCreate() throws Exception {
  +//        resetEmpty();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/TransformedSortedSet.emptyCollection.version3.1.obj");
  +//        resetFull();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/TransformedSortedSet.fullCollection.version3.1.obj");
  +//    }
  +
   }
  
  
  
  1.6       +12 -1     jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestListOrderedSet.java
  
  Index: TestListOrderedSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestListOrderedSet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestListOrderedSet.java	18 Feb 2004 01:20:39 -0000	1.5
  +++ TestListOrderedSet.java	2 Jun 2004 22:12:14 -0000	1.6
  @@ -166,4 +166,15 @@
           assertSame(ONE, set.get(3));
       }
       
  +    public String getCompatibilityVersion() {
  +        return "3.1";
  +    }
  +
  +//    public void testCreate() throws Exception {
  +//        resetEmpty();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/ListOrderedSet.emptyCollection.version3.1.obj");
  +//        resetFull();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/ListOrderedSet.fullCollection.version3.1.obj");
  +//    }
  +
   }
  
  
  
  1.6       +13 -2     jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestPredicatedSet.java
  
  Index: TestPredicatedSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestPredicatedSet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestPredicatedSet.java	18 Feb 2004 01:20:39 -0000	1.5
  +++ TestPredicatedSet.java	2 Jun 2004 22:12:14 -0000	1.6
  @@ -118,5 +118,16 @@
           assertTrue("Set shouldn't contain illegal element", 
            !set.contains("four"));   
       }
  -        
  +
  +    public String getCompatibilityVersion() {
  +        return "3.1";
  +    }
  +
  +//    public void testCreate() throws Exception {
  +//        resetEmpty();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/PredicatedSet.emptyCollection.version3.1.obj");
  +//        resetFull();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/PredicatedSet.fullCollection.version3.1.obj");
  +//    }
  +
   }
  
  
  
  1.1                  jakarta-commons/collections/src/test/org/apache/commons/collections/set/TestTypedSet.java
  
  Index: TestTypedSet.java
  ===================================================================
  /*
   *  Copyright 2004 The Apache Software Foundation
   *
   *  Licensed 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.collections.set;
  
  import java.util.HashSet;
  import java.util.Set;
  
  import junit.framework.Test;
  
  import org.apache.commons.collections.BulkTest;
  
  /**
   * Extension of {@link AbstractTestSet} for exercising the 
   * {@link TypedSet} implementation.
   *
   * @since Commons Collections 3.1
   * @version $Revision: 1.1 $ $Date: 2004/06/02 22:12:14 $
   * 
   * @author Phil Steitz
   */
  public class TestTypedSet extends AbstractTestSet{
      
      public TestTypedSet(String testName) {
          super(testName);
      }
      
      public static Test suite() {
          return BulkTest.makeSuite(TestTypedSet.class);
      }
      
      public static void main(String args[]) {
          String[] testCaseName = { TestTypedSet.class.getName()};
          junit.textui.TestRunner.main(testCaseName);
      }
      
     //-------------------------------------------------------------------      
      public Set makeEmptySet() {
          return TypedSet.decorate(new HashSet(), Object.class);
      }
  
      public boolean isNullSupported() {
          return false;
      }
  
      public boolean skipSerializedCanonicalTests() {
          return true;  // Typed and Predicated get confused
      }
  
  }
  
  
  

---------------------------------------------------------------------
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