[Arakhnę-Dev] [244] * Prepare for Maven 3 |
[ Thread Index |
Date Index
| More arakhne.org/dev Archives
]
Revision: 244
Author: galland
Date: 2011-08-13 14:56:14 +0200 (Sat, 13 Aug 2011)
Log Message:
-----------
* Prepare for Maven 3
Modified Paths:
--------------
trunk/arakhneRefs/pom.xml
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/AbstractWeakSoftValueMap.java
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableSoftReference.java
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableWeakReference.java
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ReferenceListener.java
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/SoftValueMap.java
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakArrayList.java
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakValueMap.java
trunk/arakhneRefs/src/test/java/org/arakhne/junit/AbstractRepeatedTest.java
trunk/arakhneRefs/src/test/java/org/arakhne/junit/AbstractTestCase.java
trunk/arakhneRefs/src/test/java/org/arakhne/junit/RepeatableTest.java
trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/SoftValueMapTest.java
trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/WeakValueMapTest.java
Modified: trunk/arakhneRefs/pom.xml
===================================================================
--- trunk/arakhneRefs/pom.xml 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/pom.xml 2011-08-13 12:56:14 UTC (rev 244)
@@ -33,21 +33,6 @@
<build>
<!--
- Configure the source files as resources to be filtered into a custom
- target directory
- -->
- <resources>
- <resource>
- <directory>src/main/java</directory>
- <filtering>true</filtering>
- <targetPath>${project.build.directory}/generated-sources/java</targetPath>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
- <!--
Overrule the default pom source directory to match our generated
sources so the compiler will pick them up
-->
@@ -93,12 +78,20 @@
<groupId>org.arakhne.afc</groupId>
<artifactId>tag-replacer</artifactId>
<executions>
- <execution>
- <phase>process-resources</phase>
- <goals>
- <goal>replacesrc</goal>
- </goals>
- </execution>
+ <execution>
+ <id>source_generation</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generatesrc</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>property_preparation</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>replaceresource</goal>
+ </goals>
+ </execution>
</executions>
</plugin>
<plugin>
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/AbstractWeakSoftValueMap.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/AbstractWeakSoftValueMap.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/AbstractWeakSoftValueMap.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,9 +1,7 @@
/*
* $Id: WeakValueMap.java,v 1.1 2007-02-20 08:52:37 sgalland Exp $
*
- * Copyright (C) 2005-2009 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2005-2009 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -38,7 +36,7 @@
* @param <K> is the type of the keys.
* @param <V> is the type of the values.
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@@ -273,7 +271,7 @@
* @param <K> is the type of the map keys.
* @param <V> is the type of the map values.
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@@ -302,7 +300,7 @@
/**
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@@ -466,7 +464,7 @@
/**
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@@ -518,7 +516,7 @@
/**
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableSoftReference.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableSoftReference.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableSoftReference.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,9 +1,7 @@
/*
* $Id: ComparableSoftReference.java,v 1.1 2007-02-20 08:52:37 sgalland Exp $
*
- * Copyright (C) 2005-2009 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2005-2009 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -31,7 +29,7 @@
*
* @param <T> is the type of the referenced object.
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableWeakReference.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableWeakReference.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableWeakReference.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,9 +1,7 @@
/*
* $Id: ComparableWeakReference.java,v 1.1 2007-02-20 08:52:37 sgalland Exp $
*
- * Copyright (C) 2005-2009 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2005-2009 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -31,7 +29,7 @@
*
* @param <T> is the type of the referenced object.
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ReferenceListener.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ReferenceListener.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ReferenceListener.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,9 +1,7 @@
/*
* $Id$
*
- * Copyright (C) 2009 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2009 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -27,7 +25,7 @@
* Listener on the release of a reference.
*
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/SoftValueMap.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/SoftValueMap.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/SoftValueMap.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,9 +1,7 @@
/*
* $Id: SoftValueMap.java,v 1.1 2007-02-20 08:52:37 sgalland Exp $
*
- * Copyright (C) 2005-2007 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2005-2007 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -57,7 +55,7 @@
* @param <K> is the type of the keys.
* @param <V> is the type of the values.
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@@ -123,7 +121,7 @@
/**
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakArrayList.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakArrayList.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakArrayList.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,9 +1,7 @@
/*
* $Id: WeakArrayList.java,v 1.1 2007-02-20 08:52:37 sgalland Exp $
*
- * Copyright (C) 2005-2009 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2005-2009 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -66,7 +64,7 @@
*
* @param <T> is the type of the array's elements.
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakValueMap.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakValueMap.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakValueMap.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,9 +1,7 @@
/*
* $Id: WeakValueMap.java,v 1.1 2007-02-20 08:52:37 sgalland Exp $
*
- * Copyright (C) 2005-2007 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2005-2007 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -58,7 +56,7 @@
* @param <K> is the type of the keys.
* @param <V> is the type of the values.
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@@ -124,7 +122,7 @@
/**
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
Modified: trunk/arakhneRefs/src/test/java/org/arakhne/junit/AbstractRepeatedTest.java
===================================================================
--- trunk/arakhneRefs/src/test/java/org/arakhne/junit/AbstractRepeatedTest.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/test/java/org/arakhne/junit/AbstractRepeatedTest.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,8 +1,6 @@
/* $Id$
*
- * Copyright (C) 2007-09 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2007-09 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -32,9 +30,9 @@
/** Test case that repeat another test.
*
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
- * @mavengroupid org.arakhne.afc
- * @mavenartifactid arakhneRefs
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
*/
public abstract class AbstractRepeatedTest extends TestDecorator {
@@ -99,7 +97,9 @@
/** Handler on test result errors for a repeated test.
*
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
*/
private class TestResultHandler implements TestListener {
@@ -132,7 +132,9 @@
/** Test suite that could be repeated.
*
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
*/
private static class RepeatableTestSuite extends TestSuite implements RepeatableTest {
Modified: trunk/arakhneRefs/src/test/java/org/arakhne/junit/AbstractTestCase.java
===================================================================
--- trunk/arakhneRefs/src/test/java/org/arakhne/junit/AbstractTestCase.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/test/java/org/arakhne/junit/AbstractTestCase.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,8 +1,6 @@
/* $Id$
*
- * Copyright (C) 2007-09 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2007-09 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -39,7 +37,7 @@
/** Test case with utility functions.
*
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid org.arakhne.afc
* @mavenartifactid arakhneRefs
*/
Modified: trunk/arakhneRefs/src/test/java/org/arakhne/junit/RepeatableTest.java
===================================================================
--- trunk/arakhneRefs/src/test/java/org/arakhne/junit/RepeatableTest.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/test/java/org/arakhne/junit/RepeatableTest.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,8 +1,6 @@
/* $Id$
*
- * Copyright (C) 2007-09 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2007-09 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -24,7 +22,7 @@
/** Test case that could be repeated.
*
* @author $Author: galland$
- * @version $Name$ $Revision$ $Date$
+ * @version $FullVersion$
* @mavengroupid org.arakhne.afc
* @mavenartifactid arakhneRefs
*/
Modified: trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/SoftValueMapTest.java
===================================================================
--- trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/SoftValueMapTest.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/SoftValueMapTest.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,8 +1,6 @@
/* $Id$
*
- * Copyright (C) 2007-09 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2007-09 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -28,19 +26,21 @@
import org.arakhne.junit.AbstractTestCase;
/**
-* @author $Author: galland$
-* @version $Name$ $Revision$ $Date$
-*/
+ * @author $Author: galland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
public class SoftValueMapTest extends AbstractTestCase {
private static final int REFERENCE_SIZE = 0;
-
+
private final HashMap<String,String> reference = new HashMap<String,String>();
-
+
private static void collect() {
System.gc();System.gc();System.gc();
}
-
+
private void spawnReference() {
this.reference.clear();
Random rnd = new Random();
@@ -54,12 +54,12 @@
}
str = null;
}
-
+
private String getReferenceObject(int index) {
Object[] tab = this.reference.keySet().toArray();
return (String)tab[index];
}
-
+
private Map<String,String> removeElementsFromReference() {
HashMap<String,String> removed = new HashMap<String,String>();
Random rnd = new Random();
@@ -76,75 +76,75 @@
value = null;
return removed;
}
-
+
@Override
public void setUp() {
spawnReference();
}
-
+
@Override
public void tearDown() {
this.reference.clear();
}
-
+
/**
*/
public void testSoftValueMapMap() {
- SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
- assertDeepSimilars(this.reference, test);
- }
+ SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
+ assertDeepSimilars(this.reference, test);
+ }
/**
*/
- public void testSize() {
- SoftValueMap<String,String> test = new SoftValueMap<String,String>();
- assertEquals(0, test.size());
-
- test = new SoftValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
- assertEquals(this.reference.size(), test.size());
+ public void testSize() {
+ SoftValueMap<String,String> test = new SoftValueMap<String,String>();
+ assertEquals(0, test.size());
- Map<String,String> removed = removeElementsFromReference();
- assertNotNull(removed);
- int count = removed.size();
- removed = null;
-
+ test = new SoftValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
+ assertEquals(this.reference.size(), test.size());
+
+ Map<String,String> removed = removeElementsFromReference();
+ assertNotNull(removed);
+ int count = removed.size();
+ removed = null;
+
collect();
-
- assertTrue(((this.reference.size()-count)<=test.size())||(this.reference.size()>test.size()));
- }
+ assertTrue(((this.reference.size()-count)<=test.size())||(this.reference.size()>test.size()));
+ }
+
/**
*/
- public void testIsEmpty() {
- SoftValueMap<String,String> test = new SoftValueMap<String,String>();
- assertTrue(test.isEmpty());
-
- test = new SoftValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
- assertFalse(test.isEmpty());
-
- removeElementsFromReference();
+ public void testIsEmpty() {
+ SoftValueMap<String,String> test = new SoftValueMap<String,String>();
+ assertTrue(test.isEmpty());
+ test = new SoftValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
+ assertFalse(test.isEmpty());
+
+ removeElementsFromReference();
+
collect();
-
- assertFalse(test.isEmpty());
-
- this.reference.clear();
+ assertFalse(test.isEmpty());
+
+ this.reference.clear();
+
collect();
-
- assertFalse(test.isEmpty());
- }
-
+
+ assertFalse(test.isEmpty());
+ }
+
/**
*/
- public void testContainsKey() {
- SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
- assertDeepSimilars(this.reference, test);
+ public void testContainsKey() {
+ SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
+ assertDeepSimilars(this.reference, test);
- // Test the content
+ // Test the content
{
String elt;
Iterator<String> iter = this.reference.keySet().iterator();
@@ -156,38 +156,38 @@
}
assertDeepSimilars(this.reference, test);
- Map<String,String> removedElements = removeElementsFromReference();
- int originalSize = removedElements.size() + this.reference.size();
+ Map<String,String> removedElements = removeElementsFromReference();
+ int originalSize = removedElements.size() + this.reference.size();
// Collects the objects
collect();
- // Test the content
+ // Test the content
assertEquals(originalSize, test.size());
assertNotDeepSimilars(this.reference, test);
-
+
// Clear the list of removed elements, which will cause collecting
removedElements.clear();
removedElements = null;
// Collects the objects
collect();
-
- // Test the content
+
+ // Test the content
assertNotEquals(this.reference.size(), test.size());
for(String elt : this.reference.keySet()) {
assertTrue(test.containsKey(elt));
}
- }
+ }
/**
*/
- public void testContainsValue() {
- SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
- assertDeepSimilars(this.reference, test);
+ public void testContainsValue() {
+ SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
+ assertDeepSimilars(this.reference, test);
- // Test the content
+ // Test the content
{
String elt;
Iterator<String> iter = this.reference.values().iterator();
@@ -199,66 +199,66 @@
}
assertDeepSimilars(this.reference, test);
- Map<String,String> removedElements = removeElementsFromReference();
- int originalSize = removedElements.size() + this.reference.size();
+ Map<String,String> removedElements = removeElementsFromReference();
+ int originalSize = removedElements.size() + this.reference.size();
// Collects the objects
collect();
- // Test the content
+ // Test the content
assertEquals(originalSize, test.size());
assertNotDeepSimilars(this.reference, test);
-
+
// Clear the list of removed elements, which will cause collecting
removedElements.clear();
removedElements = null;
// Collects the objects
collect();
-
- // Test the content
+
+ // Test the content
assertNotEquals(this.reference.size(), test.size());
for(String elt : this.reference.values()) {
assertTrue(test.containsValue(elt));
}
- }
+ }
/**
*/
- public void testEntryIterator() {
- SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
-
- // Test the content
- {
- assertDeepSimilars(this.reference, test);
- Entry<String,String> e;
- Iterator<Entry<String,String>> iter = test.entrySet().iterator();
- while (iter.hasNext()) {
- e = iter.next();
- assertTrue(this.reference.containsKey(e.getKey()));
- assertEquals(this.reference.get(e.getKey()),this.reference.get(e.getKey()));
- }
- }
+ public void testEntryIterator() {
+ SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
- // Remove elements
- Map<String,String> baseElements = new HashMap<String,String>(this.reference);
- removeElementsFromReference();
+ // Test the content
+ {
+ assertDeepSimilars(this.reference, test);
+ Entry<String,String> e;
+ Iterator<Entry<String,String>> iter = test.entrySet().iterator();
+ while (iter.hasNext()) {
+ e = iter.next();
+ assertTrue(this.reference.containsKey(e.getKey()));
+ assertEquals(this.reference.get(e.getKey()),this.reference.get(e.getKey()));
+ }
+ }
+ // Remove elements
+ Map<String,String> baseElements = new HashMap<String,String>(this.reference);
+ removeElementsFromReference();
+
// Collects the objects
collect();
- // Test the content
- {
- assertNotDeepSimilars(this.reference, test);
- Entry<String,String> e;
- Iterator<Entry<String,String>> iter = test.entrySet().iterator();
- while (iter.hasNext()) {
- e = iter.next();
- assertTrue(baseElements.containsKey(e.getKey()));
- assertEquals(baseElements.get(e.getKey()),baseElements.get(e.getKey()));
- }
- }
+ // Test the content
+ {
+ assertNotDeepSimilars(this.reference, test);
+ Entry<String,String> e;
+ Iterator<Entry<String,String>> iter = test.entrySet().iterator();
+ while (iter.hasNext()) {
+ e = iter.next();
+ assertTrue(baseElements.containsKey(e.getKey()));
+ assertEquals(baseElements.get(e.getKey()),baseElements.get(e.getKey()));
+ }
+ }
// Clear the list of removed elements, which will cause collecting
baseElements.clear();
@@ -267,52 +267,52 @@
// Collects the objects
collect();
- // Test the content
- {
- assertNotDeepSimilars(this.reference, test);
- Entry<String,String> e;
- Iterator<Entry<String,String>> iter = test.entrySet().iterator();
- while (iter.hasNext()) {
- e = iter.next();
- assertEquals(this.reference.get(e.getKey()),this.reference.get(e.getKey()));
- }
- }
- }
+ // Test the content
+ {
+ assertNotDeepSimilars(this.reference, test);
+ Entry<String,String> e;
+ Iterator<Entry<String,String>> iter = test.entrySet().iterator();
+ while (iter.hasNext()) {
+ e = iter.next();
+ assertEquals(this.reference.get(e.getKey()),this.reference.get(e.getKey()));
+ }
+ }
+ }
/**
*/
- public void testKeyIterator() {
- SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
-
- // Test the content
- {
- assertDeepSimilars(this.reference, test);
- String k;
- Iterator<String> iter = test.keySet().iterator();
- while (iter.hasNext()) {
- k = iter.next();
- assertTrue(this.reference.containsKey(k));
- }
- }
+ public void testKeyIterator() {
+ SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
- // Remove elements
- Map<String,String> baseElements = new HashMap<String,String>(this.reference);
- removeElementsFromReference();
+ // Test the content
+ {
+ assertDeepSimilars(this.reference, test);
+ String k;
+ Iterator<String> iter = test.keySet().iterator();
+ while (iter.hasNext()) {
+ k = iter.next();
+ assertTrue(this.reference.containsKey(k));
+ }
+ }
+ // Remove elements
+ Map<String,String> baseElements = new HashMap<String,String>(this.reference);
+ removeElementsFromReference();
+
// Collects the objects
collect();
- // Test the content
- {
- assertNotDeepSimilars(this.reference, test);
- String k;
- Iterator<String> iter = test.keySet().iterator();
- while (iter.hasNext()) {
- k = iter.next();
- assertTrue(baseElements.containsKey(k));
- }
- }
+ // Test the content
+ {
+ assertNotDeepSimilars(this.reference, test);
+ String k;
+ Iterator<String> iter = test.keySet().iterator();
+ while (iter.hasNext()) {
+ k = iter.next();
+ assertTrue(baseElements.containsKey(k));
+ }
+ }
// Clear the list of removed elements, which will cause collecting
baseElements.clear();
@@ -321,50 +321,50 @@
// Collects the objects
collect();
- // Test the content
- {
- assertNotDeepSimilars(this.reference, test);
- }
- }
+ // Test the content
+ {
+ assertNotDeepSimilars(this.reference, test);
+ }
+ }
/**
*/
- public void testValueIterator() {
- SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
-
- // Test the content
- {
- assertDeepSimilars(this.reference, test);
- String v;
- Iterator<String> iter = test.values().iterator();
- while (iter.hasNext()) {
- v = iter.next();
- assertTrue(this.reference.containsValue(v));
- }
- v = null;
- iter = null;
- }
+ public void testValueIterator() {
+ SoftValueMap<String,String> test = new SoftValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
- // Remove elements
- Map<String,String> baseElements = new HashMap<String,String>(this.reference);
- removeElementsFromReference();
+ // Test the content
+ {
+ assertDeepSimilars(this.reference, test);
+ String v;
+ Iterator<String> iter = test.values().iterator();
+ while (iter.hasNext()) {
+ v = iter.next();
+ assertTrue(this.reference.containsValue(v));
+ }
+ v = null;
+ iter = null;
+ }
+ // Remove elements
+ Map<String,String> baseElements = new HashMap<String,String>(this.reference);
+ removeElementsFromReference();
+
// Collects the objects
collect();
- // Test the content
- {
- assertNotDeepSimilars(this.reference, test);
- String v;
- Iterator<String> iter = test.values().iterator();
- while (iter.hasNext()) {
- v = iter.next();
- assertTrue(baseElements.containsValue(v));
- }
- v = null;
- iter = null;
- }
+ // Test the content
+ {
+ assertNotDeepSimilars(this.reference, test);
+ String v;
+ Iterator<String> iter = test.values().iterator();
+ while (iter.hasNext()) {
+ v = iter.next();
+ assertTrue(baseElements.containsValue(v));
+ }
+ v = null;
+ iter = null;
+ }
// Clear the list of removed elements, which will cause collecting
baseElements.clear();
@@ -373,10 +373,10 @@
// Collects the objects
collect();
- // Test the content
- {
- assertNotDeepSimilars(this.reference, test);
- }
- }
+ // Test the content
+ {
+ assertNotDeepSimilars(this.reference, test);
+ }
+ }
}
Modified: trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/WeakValueMapTest.java
===================================================================
--- trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/WeakValueMapTest.java 2011-08-13 12:56:03 UTC (rev 243)
+++ trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/WeakValueMapTest.java 2011-08-13 12:56:14 UTC (rev 244)
@@ -1,8 +1,6 @@
/* $Id$
*
- * Copyright (C) 2007-09 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
+ * Copyright (C) 2007-09 Stephane GALLAND This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -28,19 +26,21 @@
import org.arakhne.junit.AbstractTestCase;
/**
-* @author $Author: galland$
-* @version $Name$ $Revision$ $Date$
-*/
+ * @author $Author: galland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
public class WeakValueMapTest extends AbstractTestCase {
private static final int REFERENCE_SIZE = 0;
-
+
private final HashMap<String,String> reference = new HashMap<String,String>();
-
+
private static void collect() {
System.gc();System.gc();System.gc();
}
-
+
private void spawnReference() {
this.reference.clear();
Random rnd = new Random();
@@ -54,12 +54,12 @@
}
str = null;
}
-
+
private String getReferenceObject(int index) {
Object[] tab = this.reference.keySet().toArray();
return (String)tab[index];
}
-
+
private Map<String,String> removeElementsFromReference() {
HashMap<String,String> removed = new HashMap<String,String>();
Random rnd = new Random();
@@ -76,66 +76,66 @@
value = null;
return removed;
}
-
+
@Override
public void setUp() {
spawnReference();
}
-
+
@Override
public void tearDown() {
this.reference.clear();
}
-
+
/**
*/
- public void testEntryIterator() {
- WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
-
- // Test the content
- {
- assertDeepSimilars(this.reference, test);
- Entry<String,String> e;
- Iterator<Entry<String,String>> iter = test.entrySet().iterator();
- while (iter.hasNext()) {
- e = iter.next();
- assertTrue(this.reference.containsKey(e.getKey()));
- assertEquals(this.reference.get(e.getKey()),this.reference.get(e.getKey()));
- }
- }
+ public void testEntryIterator() {
+ WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
- {
- // Remove elements
- Map<String,String> baseElements = new HashMap<String,String>(this.reference);
- removeElementsFromReference();
-
+ // Test the content
+ {
+ assertDeepSimilars(this.reference, test);
+ Entry<String,String> e;
+ Iterator<Entry<String,String>> iter = test.entrySet().iterator();
+ while (iter.hasNext()) {
+ e = iter.next();
+ assertTrue(this.reference.containsKey(e.getKey()));
+ assertEquals(this.reference.get(e.getKey()),this.reference.get(e.getKey()));
+ }
+ }
+
+ {
+ // Remove elements
+ Map<String,String> baseElements = new HashMap<String,String>(this.reference);
+ removeElementsFromReference();
+
// Collects the objects
collect();
-
- // Test the content
- {
- assertNotDeepSimilars(this.reference, test);
- Entry<String,String> e;
- Iterator<Entry<String,String>> iter = test.entrySet().iterator();
- while (iter.hasNext()) {
- e = iter.next();
- assertTrue(baseElements.containsKey(e.getKey()));
- assertEquals(baseElements.get(e.getKey()),baseElements.get(e.getKey()));
- }
- }
-
+
+ // Test the content
+ {
+ assertNotDeepSimilars(this.reference, test);
+ Entry<String,String> e;
+ Iterator<Entry<String,String>> iter = test.entrySet().iterator();
+ while (iter.hasNext()) {
+ e = iter.next();
+ assertTrue(baseElements.containsKey(e.getKey()));
+ assertEquals(baseElements.get(e.getKey()),baseElements.get(e.getKey()));
+ }
+ }
+
// Clear the list of removed elements, which will cause collecting
baseElements.clear();
baseElements = null;
-
+
// Collects the objects
collect();
collect();
- }
+ }
- // Test the content
- /*{
+ // Test the content
+ /*{
assertDeepSimilars(this.reference, test);
Entry<String,String> e;
Iterator<Entry<String,String>> iter = test.entrySet().iterator();
@@ -145,63 +145,63 @@
assertEquals(this.reference.get(e.getKey()),this.reference.get(e.getKey()));
}
}*/
- }
+ }
/**
*/
- public void testWeakValueMapMap() {
- WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
- assertDeepSimilars(this.reference, test);
- }
+ public void testWeakValueMapMap() {
+ WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
+ assertDeepSimilars(this.reference, test);
+ }
/**
*/
- public void testSize() {
- WeakValueMap<String,String> test = new WeakValueMap<String,String>();
- assertEquals(0, test.size());
-
- test = new WeakValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
- assertEquals(this.reference.size(), test.size());
+ public void testSize() {
+ WeakValueMap<String,String> test = new WeakValueMap<String,String>();
+ assertEquals(0, test.size());
- removeElementsFromReference();
-
+ test = new WeakValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
+ assertEquals(this.reference.size(), test.size());
+
+ removeElementsFromReference();
+
collect();
-
- assertEquals(this.reference.size(), test.size());
- }
+ assertEquals(this.reference.size(), test.size());
+ }
+
/**
*/
- public void testIsEmpty() {
- WeakValueMap<String,String> test = new WeakValueMap<String,String>();
- assertTrue(test.isEmpty());
-
- test = new WeakValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
- assertFalse(test.isEmpty());
-
- removeElementsFromReference();
+ public void testIsEmpty() {
+ WeakValueMap<String,String> test = new WeakValueMap<String,String>();
+ assertTrue(test.isEmpty());
+ test = new WeakValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
+ assertFalse(test.isEmpty());
+
+ removeElementsFromReference();
+
collect();
-
- assertFalse(test.isEmpty());
-
- this.reference.clear();
+ assertFalse(test.isEmpty());
+
+ this.reference.clear();
+
collect();
-
- assertTrue(test.isEmpty());
- }
-
+
+ assertTrue(test.isEmpty());
+ }
+
/**
*/
- public void testContainsKey() {
- WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
- assertDeepSimilars(this.reference, test);
+ public void testContainsKey() {
+ WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
+ assertDeepSimilars(this.reference, test);
- // Test the content
+ // Test the content
{
String elt;
Iterator<String> iter = this.reference.keySet().iterator();
@@ -213,39 +213,39 @@
}
assertDeepSimilars(this.reference, test);
- Map<String,String> removedElements = removeElementsFromReference();
- int originalSize = removedElements.size() + this.reference.size();
+ Map<String,String> removedElements = removeElementsFromReference();
+ int originalSize = removedElements.size() + this.reference.size();
// Collects the objects
collect();
- // Test the content
+ // Test the content
assertEquals(originalSize, test.size());
assertNotDeepSimilars(this.reference, test);
-
+
// Clear the list of removed elements, which will cause collecting
removedElements.clear();
removedElements = null;
// Collects the objects
collect();
-
- // Test the content
+
+ // Test the content
assertEquals(this.reference.size(), test.size());
assertDeepSimilars(this.reference, test);
for(String elt : this.reference.keySet()) {
assertTrue(test.containsKey(elt));
}
- }
+ }
/**
*/
- public void testContainsValue() {
- WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
- assertDeepSimilars(this.reference, test);
+ public void testContainsValue() {
+ WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
+ assertDeepSimilars(this.reference, test);
- // Test the content
+ // Test the content
{
String elt;
Iterator<String> iter = this.reference.values().iterator();
@@ -257,65 +257,65 @@
}
assertDeepSimilars(this.reference, test);
- Map<String,String> removedElements = removeElementsFromReference();
- int originalSize = removedElements.size() + this.reference.size();
+ Map<String,String> removedElements = removeElementsFromReference();
+ int originalSize = removedElements.size() + this.reference.size();
// Collects the objects
collect();
- // Test the content
+ // Test the content
assertEquals(originalSize, test.size());
assertNotDeepSimilars(this.reference, test);
-
+
// Clear the list of removed elements, which will cause collecting
removedElements.clear();
removedElements = null;
// Collects the objects
collect();
-
- // Test the content
+
+ // Test the content
assertEquals(this.reference.size(), test.size());
assertDeepSimilars(this.reference, test);
for(String elt : this.reference.values()) {
assertTrue(test.containsValue(elt));
}
- }
+ }
/**
*/
- public void testKeyIterator() {
- WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
-
- // Test the content
- {
- assertDeepSimilars(this.reference, test);
- String k;
- Iterator<String> iter = test.keySet().iterator();
- while (iter.hasNext()) {
- k = iter.next();
- assertTrue(this.reference.containsKey(k));
- }
- }
+ public void testKeyIterator() {
+ WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
- // Remove elements
- Map<String,String> baseElements = new HashMap<String,String>(this.reference);
- removeElementsFromReference();
+ // Test the content
+ {
+ assertDeepSimilars(this.reference, test);
+ String k;
+ Iterator<String> iter = test.keySet().iterator();
+ while (iter.hasNext()) {
+ k = iter.next();
+ assertTrue(this.reference.containsKey(k));
+ }
+ }
+ // Remove elements
+ Map<String,String> baseElements = new HashMap<String,String>(this.reference);
+ removeElementsFromReference();
+
// Collects the objects
collect();
- // Test the content
- {
- assertNotDeepSimilars(this.reference, test);
- String k;
- Iterator<String> iter = test.keySet().iterator();
- while (iter.hasNext()) {
- k = iter.next();
- assertTrue(baseElements.containsKey(k));
- }
- }
+ // Test the content
+ {
+ assertNotDeepSimilars(this.reference, test);
+ String k;
+ Iterator<String> iter = test.keySet().iterator();
+ while (iter.hasNext()) {
+ k = iter.next();
+ assertTrue(baseElements.containsKey(k));
+ }
+ }
// Clear the list of removed elements, which will cause collecting
baseElements.clear();
@@ -324,56 +324,56 @@
// Collects the objects
collect();
- // Test the content
- {
- assertDeepSimilars(this.reference, test);
- String k;
- Iterator<String> iter = test.keySet().iterator();
- while (iter.hasNext()) {
- k = iter.next();
- assertTrue(this.reference.containsKey(k));
- }
- }
- }
+ // Test the content
+ {
+ assertDeepSimilars(this.reference, test);
+ String k;
+ Iterator<String> iter = test.keySet().iterator();
+ while (iter.hasNext()) {
+ k = iter.next();
+ assertTrue(this.reference.containsKey(k));
+ }
+ }
+ }
/**
*/
- public void testValueIterator() {
- WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
- test.setDeeplyExpurge(true);
-
- // Test the content
- {
- assertDeepSimilars(this.reference, test);
- String v;
- Iterator<String> iter = test.values().iterator();
- while (iter.hasNext()) {
- v = iter.next();
- assertTrue(this.reference.containsValue(v));
- }
- v = null;
- iter = null;
- }
+ public void testValueIterator() {
+ WeakValueMap<String,String> test = new WeakValueMap<String,String>(this.reference);
+ test.setDeeplyExpurge(true);
- // Remove elements
- Map<String,String> baseElements = new HashMap<String,String>(this.reference);
- removeElementsFromReference();
+ // Test the content
+ {
+ assertDeepSimilars(this.reference, test);
+ String v;
+ Iterator<String> iter = test.values().iterator();
+ while (iter.hasNext()) {
+ v = iter.next();
+ assertTrue(this.reference.containsValue(v));
+ }
+ v = null;
+ iter = null;
+ }
+ // Remove elements
+ Map<String,String> baseElements = new HashMap<String,String>(this.reference);
+ removeElementsFromReference();
+
// Collects the objects
collect();
- // Test the content
- {
- assertNotDeepSimilars(this.reference, test);
- String v;
- Iterator<String> iter = test.values().iterator();
- while (iter.hasNext()) {
- v = iter.next();
- assertTrue(baseElements.containsValue(v));
- }
- v = null;
- iter = null;
- }
+ // Test the content
+ {
+ assertNotDeepSimilars(this.reference, test);
+ String v;
+ Iterator<String> iter = test.values().iterator();
+ while (iter.hasNext()) {
+ v = iter.next();
+ assertTrue(baseElements.containsValue(v));
+ }
+ v = null;
+ iter = null;
+ }
// Clear the list of removed elements, which will cause collecting
baseElements.clear();
@@ -382,18 +382,18 @@
// Collects the objects
collect();
- // Test the content
- {
- assertDeepSimilars(this.reference, test);
- String v;
- Iterator<String> iter = test.values().iterator();
- while (iter.hasNext()) {
- v = iter.next();
- assertTrue(this.reference.containsValue(v));
- }
- v = null;
- iter = null;
- }
- }
+ // Test the content
+ {
+ assertDeepSimilars(this.reference, test);
+ String v;
+ Iterator<String> iter = test.values().iterator();
+ while (iter.hasNext()) {
+ v = iter.next();
+ assertTrue(this.reference.containsValue(v));
+ }
+ v = null;
+ iter = null;
+ }
+ }
}