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/buffer TestUnmodifiableBuffer.java TestSynchronizedBuffer.java TestAll.java TestPredicatedBuffer.java
Date Wed, 02 Jun 2004 22:05:54 GMT
scolebourne    2004/06/02 15:05:54

  Modified:    collections/src/test/org/apache/commons/collections/buffer
                        TestAll.java TestPredicatedBuffer.java
  Added:       collections/src/test/org/apache/commons/collections/buffer
                        TestUnmodifiableBuffer.java
                        TestSynchronizedBuffer.java
  Log:
  Make decorator classes serializable, bug 18815
  
  Revision  Changes    Path
  1.7       +3 -1      jakarta-commons/collections/src/test/org/apache/commons/collections/buffer/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/buffer/TestAll.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestAll.java	18 Feb 2004 01:20:37 -0000	1.6
  +++ TestAll.java	2 Jun 2004 22:05:54 -0000	1.7
  @@ -49,7 +49,9 @@
           
           suite.addTest(TestBlockingBuffer.suite());
           suite.addTest(TestPredicatedBuffer.suite());
  +        suite.addTest(TestSynchronizedBuffer.suite());
           suite.addTest(TestTransformedBuffer.suite());
  +        suite.addTest(TestUnmodifiableBuffer.suite());
           
           return suite;
       }
  
  
  
  1.4       +13 -1     jakarta-commons/collections/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.java
  
  Index: TestPredicatedBuffer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestPredicatedBuffer.java	18 Feb 2004 01:20:37 -0000	1.3
  +++ TestPredicatedBuffer.java	2 Jun 2004 22:05:54 -0000	1.4
  @@ -101,4 +101,16 @@
               // expected
           }      
       }
  +
  +    public String getCompatibilityVersion() {
  +        return "3.1";
  +    }
  +
  +//    public void testCreate() throws Exception {
  +//        resetEmpty();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/PredicatedBuffer.emptyCollection.version3.1.obj");
  +//        resetFull();
  +//        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/PredicatedBuffer.fullCollection.version3.1.obj");
  +//    }
  +
   }
  
  
  
  1.1                  jakarta-commons/collections/src/test/org/apache/commons/collections/buffer/TestUnmodifiableBuffer.java
  
  Index: TestUnmodifiableBuffer.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.buffer;
  
  import java.util.Arrays;
  import java.util.Collection;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.commons.collections.ArrayStack;
  import org.apache.commons.collections.Buffer;
  import org.apache.commons.collections.collection.AbstractTestCollection;
  
  /**
   * Extension of {@link AbstractTestCollection} for exercising the 
   * {@link UnmodifiableBuffer} implementation.
   *
   * @since Commons Collections 3.1
   * @version $Revision: 1.1 $ $Date: 2004/06/02 22:05:54 $
   * 
   * @author Phil Steitz
   * @author Stephen Colebourne
   */
  public class TestUnmodifiableBuffer extends AbstractTestCollection {
      
      public TestUnmodifiableBuffer(String testName) {
          super(testName);
      }
      
      public static Test suite() {
          return new TestSuite(TestUnmodifiableBuffer.class);
      }
      
      public static void main(String args[]) {
          String[] testCaseName = { TestUnmodifiableBuffer.class.getName()};
          junit.textui.TestRunner.main(testCaseName);
      }
  
      //-----------------------------------------------------------------------    
      public Collection makeCollection() {
          return UnmodifiableBuffer.decorate(new UnboundedFifoBuffer());
      }
      
      public Collection makeFullCollection() {
          Buffer buffer = new UnboundedFifoBuffer();
          buffer.addAll(Arrays.asList(getFullElements()));
          return UnmodifiableBuffer.decorate(buffer);
      }
      
      public Collection makeConfirmedCollection() {
          ArrayStack list = new ArrayStack();
          return list;
      }
  
      public Collection makeConfirmedFullCollection() {
          ArrayStack list = new ArrayStack();
          list.addAll(Arrays.asList(getFullElements()));
          return list;
      }
  
      public boolean isAddSupported() {
          return false;
      }
      
      public boolean isRemoveSupported() {
          return false;
      }
      
      public boolean isNullSupported() {
          return false;
      }
      
      public void testBufferRemove() {
          resetEmpty();
          Buffer buffer = (Buffer) collection;
          try {
              buffer.remove();
              fail();
          } catch (UnsupportedOperationException ex) {}
      }
  
      public String getCompatibilityVersion() {
          return "3.1";
      }
  
  //    public void testCreate() throws Exception {
  //        resetEmpty();
  //        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableBuffer.emptyCollection.version3.1.obj");
  //        resetFull();
  //        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableBuffer.fullCollection.version3.1.obj");
  //    }
  
  }
  
  
  
  1.1                  jakarta-commons/collections/src/test/org/apache/commons/collections/buffer/TestSynchronizedBuffer.java
  
  Index: TestSynchronizedBuffer.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.buffer;
  
  import java.util.Arrays;
  import java.util.Collection;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.commons.collections.ArrayStack;
  import org.apache.commons.collections.Buffer;
  import org.apache.commons.collections.collection.AbstractTestCollection;
  
  /**
   * Extension of {@link AbstractTestCollection} for exercising the 
   * {@link SynchronizedBuffer} implementation.
   *
   * @since Commons Collections 3.1
   * @version $Revision: 1.1 $ $Date: 2004/06/02 22:05:54 $
   * 
   * @author Phil Steitz
   * @author Stephen Colebourne
   */
  public class TestSynchronizedBuffer extends AbstractTestCollection {
      
      public TestSynchronizedBuffer(String testName) {
          super(testName);
      }
      
      public static Test suite() {
          return new TestSuite(TestSynchronizedBuffer.class);
      }
      
      public static void main(String args[]) {
          String[] testCaseName = { TestSynchronizedBuffer.class.getName()};
          junit.textui.TestRunner.main(testCaseName);
      }
  
      //-----------------------------------------------------------------------    
      public Collection makeCollection() {
          return SynchronizedBuffer.decorate(new UnboundedFifoBuffer());
      }
      
      public Collection makeFullCollection() {
          Buffer buffer = new UnboundedFifoBuffer();
          buffer.addAll(Arrays.asList(getFullElements()));
          return SynchronizedBuffer.decorate(buffer);
      }
      
      public Collection makeConfirmedCollection() {
          ArrayStack list = new ArrayStack();
          return list;
      }
  
      public Collection makeConfirmedFullCollection() {
          ArrayStack list = new ArrayStack();
          list.addAll(Arrays.asList(getFullElements()));
          return list;
      }
  
      public boolean isNullSupported() {
          return false;
      }
      
      public String getCompatibilityVersion() {
          return "3.1";
      }
  
  //    public void testCreate() throws Exception {
  //        resetEmpty();
  //        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/SynchronizedBuffer.emptyCollection.version3.1.obj");
  //        resetFull();
  //        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/SynchronizedBuffer.fullCollection.version3.1.obj");
  //    }
  
  }
  
  
  

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