changed compatibility version to a method, and had it default to the

maximum level of compatibility: version 1


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130583 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Morgan James Delagrange 2002-02-26 00:08:07 +00:00
parent e238eff5de
commit d5ab2edce1
3 changed files with 32 additions and 17 deletions

View File

@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestMap.java,v 1.12 2002/02/25 20:57:08 morgand Exp $
* $Revision: 1.12 $
* $Date: 2002/02/25 20:57:08 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestMap.java,v 1.13 2002/02/26 00:08:07 morgand Exp $
* $Revision: 1.13 $
* $Date: 2002/02/26 00:08:07 $
*
* ====================================================================
*
@ -87,7 +87,7 @@ import java.util.NoSuchElementException;
*
* @author Michael Smith
* @author Rodney Waldhoff
* @version $Id: TestMap.java,v 1.12 2002/02/25 20:57:08 morgand Exp $
* @version $Id: TestMap.java,v 1.13 2002/02/26 00:08:07 morgand Exp $
*/
public abstract class TestMap extends TestObject {
@ -937,7 +937,7 @@ public abstract class TestMap extends TestObject {
mapName = mapName.substring(mapName.lastIndexOf(".")+1,mapName.length());
retval.append(mapName);
retval.append(".emptyMap.version");
retval.append(COMPATIBILITY_VERSION);
retval.append(getCompatibilityVersion());
retval.append(".obj");
return retval.toString();
}
@ -949,7 +949,7 @@ public abstract class TestMap extends TestObject {
mapName = mapName.substring(mapName.lastIndexOf(".")+1,mapName.length());
retval.append(mapName);
retval.append(".fullMap.version");
retval.append(COMPATIBILITY_VERSION);
retval.append(getCompatibilityVersion());
retval.append(".obj");
return retval.toString();
}

View File

@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestObject.java,v 1.6 2002/02/25 20:57:08 morgand Exp $
* $Revision: 1.6 $
* $Date: 2002/02/25 20:57:08 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestObject.java,v 1.7 2002/02/26 00:08:07 morgand Exp $
* $Revision: 1.7 $
* $Date: 2002/02/26 00:08:07 $
*
* ====================================================================
*
@ -90,7 +90,7 @@ import java.util.NoSuchElementException;
* test case (method) your {@link Object} fails.
*
* @author Rodney Waldhoff
* @version $Id: TestObject.java,v 1.6 2002/02/25 20:57:08 morgand Exp $
* @version $Id: TestObject.java,v 1.7 2002/02/26 00:08:07 morgand Exp $
*/
public abstract class TestObject extends TestCase {
public TestObject(String testName) {
@ -99,13 +99,22 @@ public abstract class TestObject extends TestCase {
// current major release for Collections
public static final int COLLECTIONS_MAJOR_VERSION = 2;
// This constant makes it possible for TestMap (and other subclasses,
// if necessary) to automatically check CVS for a versionX copy of a
// Serialized object, so we can make sure that compatibility is maintained.
// See, for example, TestMap.getCanonicalFullMapName(Map map).
// Subclasses can override this variable, indicating compatibility
// with earlier Collections versions.
public int COMPATIBILITY_VERSION = COLLECTIONS_MAJOR_VERSION;
/**
* This constant makes it possible for TestMap (and other subclasses,
* if necessary) to automatically check CVS for a versionX copy of a
* Serialized object, so we can make sure that compatibility is maintained.
* See, for example, TestMap.getCanonicalFullMapName(Map map).
* Subclasses can override this variable, indicating compatibility
* with earlier Collections versions.
* Defaults to 1, the earliest Collections version. (Note: some
* collections did not even exist in this version).
*
* @return 1
*/
public int getCompatibilityVersion() {
return 1;
}
/**
* Return a new, empty {@link Object} to used for testing.

View File

@ -91,6 +91,12 @@ implements TestMap.SupportsPut, TestMap.EntrySetSupportsRemove
return new TestSuite(TestSequencedHashMap.class);
}
// current versions of SequencedHashMap and subclasses are not
// compatible with Collections 1.x
public int getCompatibilityVersion() {
return 2;
}
public static void main(String[] args[]) {
String[] testCaseName = { TestSequencedHashMap.class.getName() };
junit.textui.TestRunner.main(testCaseName);