Enable support to work around bug in TreeMap sub map deserialization
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131630 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
70dc4fb1c3
commit
ea2aa40945
|
@ -15,7 +15,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.commons.collections.map;
|
package org.apache.commons.collections.map;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -118,7 +117,7 @@ import org.apache.commons.collections.set.AbstractTestSet;
|
||||||
* @author Rodney Waldhoff
|
* @author Rodney Waldhoff
|
||||||
* @author Paul Jack
|
* @author Paul Jack
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
* @version $Revision: 1.9 $ $Date: 2004/04/01 22:18:12 $
|
* @version $Revision: 1.10 $ $Date: 2004/04/09 09:38:31 $
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTestMap extends AbstractTestObject {
|
public abstract class AbstractTestMap extends AbstractTestObject {
|
||||||
|
|
||||||
|
@ -718,7 +717,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
||||||
* Compare the current serialized form of the Map
|
* Compare the current serialized form of the Map
|
||||||
* against the canonical version in CVS.
|
* against the canonical version in CVS.
|
||||||
*/
|
*/
|
||||||
public void testEmptyMapCompatibility() throws IOException, ClassNotFoundException {
|
public void testEmptyMapCompatibility() throws Exception {
|
||||||
/**
|
/**
|
||||||
* Create canonical objects with this code
|
* Create canonical objects with this code
|
||||||
Map map = makeEmptyMap();
|
Map map = makeEmptyMap();
|
||||||
|
@ -739,7 +738,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
||||||
* Compare the current serialized form of the Map
|
* Compare the current serialized form of the Map
|
||||||
* against the canonical version in CVS.
|
* against the canonical version in CVS.
|
||||||
*/
|
*/
|
||||||
public void testFullMapCompatibility() throws IOException, ClassNotFoundException {
|
public void testFullMapCompatibility() throws Exception {
|
||||||
/**
|
/**
|
||||||
* Create canonical objects with this code
|
* Create canonical objects with this code
|
||||||
Map map = makeFullMap();
|
Map map = makeFullMap();
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.commons.collections.BulkTest;
|
||||||
/**
|
/**
|
||||||
* Abstract test class for {@link java.util.SortedMap} methods and contracts.
|
* Abstract test class for {@link java.util.SortedMap} methods and contracts.
|
||||||
*
|
*
|
||||||
* @version $Revision: 1.5 $ $Date: 2004/04/02 23:09:09 $
|
* @version $Revision: 1.6 $ $Date: 2004/04/09 09:38:31 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
|
@ -44,6 +44,17 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Returns whether the sub map views are serializable.
|
||||||
|
* If the class being tested is based around a TreeMap then you should
|
||||||
|
* override and return false as TreeMap has a bug in deserialization.
|
||||||
|
*
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
|
public boolean isSubMapViewsSerializable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can't sort null keys.
|
* Can't sort null keys.
|
||||||
*
|
*
|
||||||
|
@ -161,6 +172,18 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
|
||||||
public boolean supportsFullCollections() {
|
public boolean supportsFullCollections() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public void testSerializeDeserializeThenCompare() throws Exception {
|
||||||
|
if (((AbstractTestSortedMap) main).isSubMapViewsSerializable() == false) return;
|
||||||
|
super.testSerializeDeserializeThenCompare();
|
||||||
|
}
|
||||||
|
public void testEmptyMapCompatibility() throws Exception {
|
||||||
|
if (((AbstractTestSortedMap) main).isSubMapViewsSerializable() == false) return;
|
||||||
|
super.testEmptyMapCompatibility();
|
||||||
|
}
|
||||||
|
public void testFullMapCompatibility() throws Exception {
|
||||||
|
if (((AbstractTestSortedMap) main).isSubMapViewsSerializable() == false) return;
|
||||||
|
super.testFullMapCompatibility();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TestHeadMap extends TestViewMap {
|
public static class TestHeadMap extends TestViewMap {
|
||||||
|
@ -313,11 +336,11 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
|
||||||
// Map map = makeEmptyMap();
|
// Map map = makeEmptyMap();
|
||||||
// writeExternalFormToDisk(
|
// writeExternalFormToDisk(
|
||||||
// (java.io.Serializable) map,
|
// (java.io.Serializable) map,
|
||||||
// "D:/dev/collections/data/test/FixedSizeSortedMap.emptyCollection.version3.1.SubMapView.obj");
|
// "D:/dev/collections/data/test/TransformedSortedMap.emptyCollection.version3.1.SubMapView.obj");
|
||||||
// map = makeFullMap();
|
// map = makeFullMap();
|
||||||
// writeExternalFormToDisk(
|
// writeExternalFormToDisk(
|
||||||
// (java.io.Serializable) map,
|
// (java.io.Serializable) map,
|
||||||
// "D:/dev/collections/data/test/FixedSizeSortedMap.fullCollection.version3.1.SubMapView.obj");
|
// "D:/dev/collections/data/test/TransformedSortedMap.fullCollection.version3.1.SubMapView.obj");
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue