Update licence and version

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131244 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-10-05 21:17:40 +00:00
parent 7621d6e135
commit 2e1a8cb3f2
8 changed files with 127 additions and 136 deletions

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestHashBag.java,v 1.5 2003/10/02 22:35:31 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestHashBag.java,v 1.6 2003/10/05 21:17:40 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -63,9 +63,10 @@ import junit.framework.TestSuite;
/**
* Extension of {@link TestBag} for exercising the {@link HashBag}
* implementation.
*
* @version $Revision: 1.6 $ $Date: 2003/10/05 21:17:40 $
*
* @author Chuck Burdick
* @version $Id: TestHashBag.java,v 1.5 2003/10/02 22:35:31 scolebourne Exp $
*/
public class TestHashBag extends AbstractTestBag {

View File

@ -1,10 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestIteratorUtils.java,v 1.6 2003/09/29 03:56:12 psteitz Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestIteratorUtils.java,v 1.7 2003/10/05 21:17:40 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -68,8 +68,13 @@ import junit.framework.Test;
import org.apache.commons.collections.iterators.ResetableIterator;
import org.apache.commons.collections.iterators.ResetableListIterator;
/**
* Tests for IteratorUtils.
* Tests for IteratorUtils.
*
* @version $Revision: 1.7 $ $Date: 2003/10/05 21:17:40 $
*
* @author Unknown
*/
public class TestIteratorUtils extends BulkTest {

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.24 2003/08/31 17:28:43 scolebourne Exp $
* $Revision: 1.24 $
* $Date: 2003/08/31 17:28:43 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.25 2003/10/05 21:17:40 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -58,7 +55,6 @@
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections;
import java.util.ArrayList;
@ -70,13 +66,15 @@ import java.util.Set;
import junit.framework.Test;
/**
* Tests LRUMap.
*
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @author <a href="mailto:morgand@apache.org">Morgan Delagrange</a>
* @version $Id: TestLRUMap.java,v 1.24 2003/08/31 17:28:43 scolebourne Exp $
* @version $Revision: 1.25 $ $Date: 2003/10/05 21:17:40 $
*
* @author James Strachan
* @author Morgan Delagrange
*/
public class TestLRUMap extends TestSequencedHashMap
{
public class TestLRUMap extends TestSequencedHashMap {
public TestLRUMap(String testName) {
super(testName);
}

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLinkedList.java,v 1.4 2003/10/02 22:14:29 scolebourne Exp $
* $Revision: 1.4 $
* $Date: 2003/10/02 22:14:29 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLinkedList.java,v 1.5 2003/10/05 21:17:40 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -58,7 +55,6 @@
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections;
import java.util.Arrays;
@ -67,7 +63,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
/**
* Tests base {@link java.util.LinkedList} methods and contracts.
* <p>
@ -77,9 +72,10 @@ import java.util.NoSuchElementException;
* If your {@link LinkedList} fails one of these tests by design,
* you may still use this base set of cases. Simply override the
* test case (method) your {@link List} fails.
*
* @version $Revision: 1.5 $ $Date: 2003/10/05 21:17:40 $
*
* @author <a href="mailto:rich@rd.gen.nz">Rich Dougherty</a>
* @version $Id: TestLinkedList.java,v 1.4 2003/10/02 22:14:29 scolebourne Exp $
* @author Rich Dougherty
*/
public abstract class TestLinkedList extends AbstractTestList {

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestListUtils.java,v 1.13 2003/10/02 22:14:29 scolebourne Exp $
* $Revision: 1.13 $
* $Date: 2003/10/02 22:14:29 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestListUtils.java,v 1.14 2003/10/05 21:17:39 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -72,6 +69,8 @@ import org.apache.commons.collections.decorators.PredicatedList;
/**
* Tests for ListUtils.
*
* @version $Revision: 1.14 $ $Date: 2003/10/05 21:17:39 $
*
* @author Stephen Colebourne
* @author Neil O'Toole
* @author Matthew Hawthorne

View File

@ -1,10 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMapUtils.java,v 1.16 2003/10/02 23:01:09 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMapUtils.java,v 1.17 2003/10/05 21:17:40 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -33,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -76,7 +76,7 @@ import org.apache.commons.collections.decorators.PredicatedMap;
/**
* Tests for MapUtils.
*
* @version $Revision: 1.16 $ $Date: 2003/10/02 23:01:09 $
* @version $Revision: 1.17 $ $Date: 2003/10/05 21:17:40 $
*
* @author Stephen Colebourne
* @author Arun Mammen Thomas

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMultiHashMap.java,v 1.12 2003/10/02 23:01:10 scolebourne Exp $
* $Revision: 1.12 $
* $Date: 2003/10/02 23:01:10 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMultiHashMap.java,v 1.13 2003/10/05 21:17:40 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -58,7 +55,6 @@
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections;
import java.util.Collection;
@ -68,26 +64,25 @@ import java.util.Map;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Unit Tests for <code>MultiHashMap</code>.
*
* @version $Revision: 1.13 $ $Date: 2003/10/05 21:17:40 $
*
* @author Unknown
*/
public class TestMultiHashMap extends AbstractTestMap
{
public TestMultiHashMap(String testName)
{
public class TestMultiHashMap extends AbstractTestMap {
public TestMultiHashMap(String testName) {
super(testName);
}
public static Test suite()
{
public static Test suite() {
return new TestSuite(TestMultiHashMap.class);
}
public static void main(String args[])
{
String[] testCaseName = { TestMultiHashMap.class.getName() };
public static void main(String args[]) {
String[] testCaseName = { TestMultiHashMap.class.getName()};
junit.textui.TestRunner.main(testCaseName);
}
@ -103,52 +98,46 @@ public class TestMultiHashMap extends AbstractTestMap
//----------------------------
// Tests
//----------------------------
public void testPutNGet()
{
public void testPutNGet() {
MultiHashMap map = new MultiHashMap();
loadMap( map );
checkMap( map );
assertTrue( map.get(new Integer(99)) == null );
loadMap(map);
checkMap(map);
assertTrue(map.get(new Integer(99)) == null);
map.clear();
assertTrue( map.size() == 0 );
assertTrue(map.size() == 0);
}
public void testContainsValue()
{
public void testContainsValue() {
MultiHashMap map = new MultiHashMap();
loadMap( map );
assertTrue( map.containsValue( "uno" ) );
assertTrue( map.containsValue( "quatro" ) );
assertTrue( map.containsValue( "two" ) );
assertTrue( ! map.containsValue( "uggaBugga" ) );
loadMap(map);
assertTrue(map.containsValue("uno"));
assertTrue(map.containsValue("quatro"));
assertTrue(map.containsValue("two"));
assertTrue(!map.containsValue("uggaBugga"));
map.clear();
}
public void testValues()
{
public void testValues() {
MultiHashMap map = new MultiHashMap();
loadMap( map );
loadMap(map);
Collection vals = map.values();
assertTrue( vals.size() == getFullSize() );
assertTrue(vals.size() == getFullSize());
map.clear();
}
static private class MapPair
{
MapPair( int key, String val )
{
mKey = new Integer( key );
static private class MapPair {
MapPair(int key, String val) {
mKey = new Integer(key);
mValue = val;
}
Integer mKey = null;
String mValue = null;
}
@ -162,68 +151,66 @@ public class TestMultiHashMap extends AbstractTestMap
{new MapPair(4,"four"), new MapPair(4,"quatro")}
};
private void loadMap( MultiHashMap map )
{
private void loadMap(MultiHashMap map) {
// Set up so that we load the keys "randomly"
// (i.e. we don't want to load int row-order, so that all like keys
// load together. We want to mix it up...)
int numRows = sMapPairs.length;
int maxCols = 0;
for( int ii=0; ii < sMapPairs.length; ii++ ){
if ( sMapPairs[ii].length > maxCols )
for (int ii = 0; ii < sMapPairs.length; ii++) {
if (sMapPairs[ii].length > maxCols) {
maxCols = sMapPairs[ii].length;
}
}
for( int ii=0; ii < maxCols; ii++ ){
for( int jj=0; jj < numRows; jj++ ){
if ( ii < sMapPairs[jj].length ) {
map.put( sMapPairs[jj][ii].mKey, sMapPairs[jj][ii].mValue);
for (int ii = 0; ii < maxCols; ii++) {
for (int jj = 0; jj < numRows; jj++) {
if (ii < sMapPairs[jj].length) {
map.put(sMapPairs[jj][ii].mKey, sMapPairs[jj][ii].mValue);
//---------------------------------------------------------
}
}
}
assertTrue( map.size() == sMapPairs.length );
assertTrue(map.size() == sMapPairs.length);
}
private void checkMap( MultiHashMap map )
{
for( int ii=0; ii < sMapPairs.length; ii++ ){
checkKeyList( map, ii );
private void checkMap(MultiHashMap map) {
for (int ii = 0; ii < sMapPairs.length; ii++) {
checkKeyList(map, ii);
}
}
private void checkKeyList( MultiHashMap map, int index )
{
assertTrue( index < sMapPairs.length );
Integer key = sMapPairs[index][0].mKey ;
Object obj = map.get( key );
private void checkKeyList(MultiHashMap map, int index) {
assertTrue(index < sMapPairs.length);
Integer key = sMapPairs[index][0].mKey;
Object obj = map.get(key);
//--------------------------
assertTrue( obj != null );
assertTrue( obj instanceof Collection );
Collection keyList = (Collection)obj;
assertTrue( keyList.size() == sMapPairs[index].length );
assertTrue(obj != null);
assertTrue(obj instanceof Collection);
Collection keyList = (Collection) obj;
assertTrue(keyList.size() == sMapPairs[index].length);
Iterator iter = keyList.iterator();
while ( iter.hasNext() ) {
while (iter.hasNext()) {
Object oval = iter.next();
assertTrue( oval != null );
assertTrue( oval instanceof String );
String val = (String)oval;
assertTrue(oval != null);
assertTrue(oval instanceof String);
String val = (String) oval;
boolean foundIt = false;
for( int ii=0; ii < sMapPairs[index].length; ii++ ){
if( val.equals( sMapPairs[index][ii].mValue ) )
for (int ii = 0; ii < sMapPairs[index].length; ii++) {
if (val.equals(sMapPairs[index][ii].mValue)) {
foundIt = true;
}
}
assertTrue( foundIt );
assertTrue(foundIt);
}
}
public int getFullSize()
{
public int getFullSize() {
int len = 0;
for( int ii=0; ii < sMapPairs.length; ii++ ){
for (int ii = 0; ii < sMapPairs.length; ii++) {
len += sMapPairs[ii].length;
}
return len;

View File

@ -1,7 +1,10 @@
/* ====================================================================
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestMultiKey.java,v 1.3 2003/10/05 21:17:40 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -16,21 +19,21 @@
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgement:
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -50,6 +53,7 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections;
@ -61,8 +65,9 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit tests
* {@link org.apache.commons.collections.MultiKey}.
* Unit tests for {@link org.apache.commons.collections.MultiKey}.
*
* @version $Revision: 1.3 $ $Date: 2003/10/05 21:17:40 $
*
* @author Stephen Colebourne
*/