You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2014/08/03 20:27:42 UTC
svn commit: r1615429 - in /directory/apacheds/trunk/mavibot-partition/src:
main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/
test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/
Author: kayyagari
Date: Sun Aug 3 18:27:41 2014
New Revision: 1615429
URL: http://svn.apache.org/r1615429
Log:
o removed a lookup call in put() method of MavibotTable
o fixed the RDN index test after adding the support for replacing an existing key's value in Mavibot
Modified:
directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java
Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java?rev=1615429&r1=1615428&r2=1615429&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java Sun Aug 3 18:27:41 2014
@@ -340,18 +340,10 @@ public class MavibotTable<K, V> extends
throw new IllegalArgumentException( I18n.err( I18n.ERR_594 ) );
}
- boolean existing = false;
- if ( bt.contains( key, value ) )
- {
- existing = true;
- }
-
- // Always insert the entry. If it already exists, it will replace the previous entry
- bt.insert( key, value );
-
- /// The entry has been added, increment the count if it wasn't existing before
- if ( ! existing )
+ V existingVal = bt.insert( key, value );
+
+ if ( existingVal == null )
{
count++;
}
Modified: directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java?rev=1615429&r1=1615428&r2=1615429&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java Sun Aug 3 18:27:41 2014
@@ -210,17 +210,8 @@ public class MavibotRdnIndexTest
assertEquals( 2, idx.count() );
//count shouldn't get affected cause of inserting the same key
- try
- {
- // We should not be able to add a new value to an existing key
- idx.add( key, Strings.getUUID( 2L ) );
- fail();
- }
- catch ( DuplicateValueNotAllowedException dvnae )
- {
- // expected
- }
-
+ // the value will be replaced instead
+ idx.add( key, Strings.getUUID( 2L ) );
assertEquals( 2, idx.count() );
key = new ParentIdAndRdn( Strings.getUUID( 2L ), new Rdn( "cn=key" ) );