Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 61212 invoked from network); 18 Jul 2006 22:03:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Jul 2006 22:03:25 -0000 Received: (qmail 15236 invoked by uid 500); 18 Jul 2006 22:03:24 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 14672 invoked by uid 500); 18 Jul 2006 22:03:22 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 14661 invoked by uid 500); 18 Jul 2006 22:03:22 -0000 Received: (qmail 14658 invoked by uid 99); 18 Jul 2006 22:03:22 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jul 2006 15:03:22 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jul 2006 15:03:21 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id B26DA1A981A; Tue, 18 Jul 2006 15:03:01 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r423264 - in /jakarta/commons/proper/collections/trunk: RELEASE-NOTES.html src/java/org/apache/commons/collections/map/Flat3Map.java src/test/org/apache/commons/collections/map/TestFlat3Map.java Date: Tue, 18 Jul 2006 22:03:01 -0000 To: commons-cvs@jakarta.apache.org From: scolebourne@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060718220301.B26DA1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: scolebourne Date: Tue Jul 18 15:03:00 2006 New Revision: 423264 URL: http://svn.apache.org/viewvc?rev=423264&view=rev Log: COLLECTIONS-217 - Flat3Map - Fix setValue in MapIterator and EntrySetIterator to work correctly Modified: jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java Modified: jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html?rev=423264&r1=423263&r2=423264&view=diff ============================================================================== --- jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html (original) +++ jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html Tue Jul 18 15:03:00 2006 @@ -54,7 +54,7 @@

BUG FIXES

    -
  • xxxxxxxxxxxxxx
  • +
  • Flat3Map - Fix setValue in MapIterator and EntrySetIterator to work correctly [COLLECTIONS-217]

JAVADOC

Modified: jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java?rev=423264&r1=423263&r2=423264&view=diff ============================================================================== --- jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java (original) +++ jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java Tue Jul 18 15:03:00 2006 @@ -651,10 +651,13 @@ switch (nextIndex) { case 3: parent.value3 = value; + break; case 2: parent.value2 = value; + break; case 1: parent.value1 = value; + break; } return old; } @@ -803,10 +806,13 @@ switch (nextIndex) { case 3: parent.value3 = value; + break; case 2: parent.value2 = value; + break; case 1: parent.value1 = value; + break; } return old; } Modified: jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java?rev=423264&r1=423263&r2=423264&view=diff ============================================================================== --- jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java (original) +++ jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java Tue Jul 18 15:03:00 2006 @@ -19,6 +19,7 @@ import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.util.Iterator; import java.util.Map; import junit.framework.Test; @@ -39,8 +40,10 @@ private static final Integer ONE = new Integer(1); private static final Integer TWO = new Integer(2); + private static final Integer THREE = new Integer(3); private static final String TEN = "10"; private static final String TWENTY = "20"; + private static final String THIRTY = "30"; public TestFlat3Map(String testName) { super(testName); @@ -207,7 +210,123 @@ assertEquals(ONE, ser.get(TEN)); assertEquals(TWO, ser.get(TWENTY)); } - + + //----------------------------------------------------------------------- + public void testEntryIteratorSetValue1() throws Exception { + Flat3Map map = new Flat3Map(); + map.put(ONE, TEN); + map.put(TWO, TWENTY); + map.put(THREE, THIRTY); + + Iterator it = map.entrySet().iterator(); + Map.Entry entry = (Map.Entry) it.next(); + entry.setValue("NewValue"); + assertEquals(3, map.size()); + assertEquals(true, map.containsKey(ONE)); + assertEquals(true, map.containsKey(TWO)); + assertEquals(true, map.containsKey(THREE)); + assertEquals("NewValue", map.get(ONE)); + assertEquals(TWENTY, map.get(TWO)); + assertEquals(THIRTY, map.get(THREE)); + } + + public void testEntryIteratorSetValue2() throws Exception { + Flat3Map map = new Flat3Map(); + map.put(ONE, TEN); + map.put(TWO, TWENTY); + map.put(THREE, THIRTY); + + Iterator it = map.entrySet().iterator(); + it.next(); + Map.Entry entry = (Map.Entry) it.next(); + entry.setValue("NewValue"); + assertEquals(3, map.size()); + assertEquals(true, map.containsKey(ONE)); + assertEquals(true, map.containsKey(TWO)); + assertEquals(true, map.containsKey(THREE)); + assertEquals(TEN, map.get(ONE)); + assertEquals("NewValue", map.get(TWO)); + assertEquals(THIRTY, map.get(THREE)); + } + + public void testEntryIteratorSetValue3() throws Exception { + Flat3Map map = new Flat3Map(); + map.put(ONE, TEN); + map.put(TWO, TWENTY); + map.put(THREE, THIRTY); + + Iterator it = map.entrySet().iterator(); + it.next(); + it.next(); + Map.Entry entry = (Map.Entry) it.next(); + entry.setValue("NewValue"); + assertEquals(3, map.size()); + assertEquals(true, map.containsKey(ONE)); + assertEquals(true, map.containsKey(TWO)); + assertEquals(true, map.containsKey(THREE)); + assertEquals(TEN, map.get(ONE)); + assertEquals(TWENTY, map.get(TWO)); + assertEquals("NewValue", map.get(THREE)); + } + + //----------------------------------------------------------------------- + public void testMapIteratorSetValue1() throws Exception { + Flat3Map map = new Flat3Map(); + map.put(ONE, TEN); + map.put(TWO, TWENTY); + map.put(THREE, THIRTY); + + MapIterator it = map.mapIterator(); + it.next(); + it.setValue("NewValue"); + assertEquals(3, map.size()); + assertEquals(true, map.containsKey(ONE)); + assertEquals(true, map.containsKey(TWO)); + assertEquals(true, map.containsKey(THREE)); + assertEquals("NewValue", map.get(ONE)); + assertEquals(TWENTY, map.get(TWO)); + assertEquals(THIRTY, map.get(THREE)); + } + + public void testMapIteratorSetValue2() throws Exception { + Flat3Map map = new Flat3Map(); + map.put(ONE, TEN); + map.put(TWO, TWENTY); + map.put(THREE, THIRTY); + + MapIterator it = map.mapIterator(); + it.next(); + it.next(); + it.setValue("NewValue"); + assertEquals(3, map.size()); + assertEquals(true, map.containsKey(ONE)); + assertEquals(true, map.containsKey(TWO)); + assertEquals(true, map.containsKey(THREE)); + assertEquals(TEN, map.get(ONE)); + assertEquals("NewValue", map.get(TWO)); + assertEquals(THIRTY, map.get(THREE)); + } + + public void testMapIteratorSetValue3() throws Exception { + Flat3Map map = new Flat3Map(); + map.put(ONE, TEN); + map.put(TWO, TWENTY); + map.put(THREE, THIRTY); + + MapIterator it = map.mapIterator(); + it.next(); + it.next(); + it.next(); + it.setValue("NewValue"); + assertEquals(3, map.size()); + assertEquals(true, map.containsKey(ONE)); + assertEquals(true, map.containsKey(TWO)); + assertEquals(true, map.containsKey(THREE)); + assertEquals(TEN, map.get(ONE)); + assertEquals(TWENTY, map.get(TWO)); + assertEquals("NewValue", map.get(THREE)); + } + //----------------------------------------------------------------------- public BulkTest bulkTestMapIterator() { return new TestFlatMapIterator(); --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org