directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r615071 [5/5] - in /directory: apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ apacheds/bra...
Date Thu, 24 Jan 2008 22:39:50 GMT
Added: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java?rev=615071&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java (added)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java Thu Jan 24 14:39:32 2008
@@ -0,0 +1,144 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+
+package org.apache.directory.server.core.partition.tree;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+
+/**
+ * Test the partition tree manipulations.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PartitionTreeTest
+{
+    /**
+     * Test the addition of a single partition
+     */
+    @Test public void testNewPartitionTree() throws NamingException
+    {
+        /** A structure to hold all the partitions */
+        BranchNode partitionLookupTree = new BranchNode();
+        
+        LdapDN suffix = new LdapDN( "dc=example, dc=com" );
+        Partition partition = new JdbmPartition();
+        partition.setSuffix( suffix.getUpName() );
+        
+        Node node = partitionLookupTree.recursivelyAddPartition( partitionLookupTree, suffix, 0, partition );
+        
+        assertNotNull( node );
+        assertTrue( node instanceof BranchNode );
+        assertEquals( "{Branch: {Leaf: 'dc=example, dc=com'}}", node.toString() );
+    }
+
+
+    /**
+     * Test the addition of a two disjointed partition
+     */
+    @Test public void testNewPartitionTree2Nodes() throws NamingException
+    {
+        /** A structure to hold all the partitions */
+        BranchNode partitionLookupTree = new BranchNode();
+        
+        LdapDN suffix1 = new LdapDN( "dc=example, dc=com" );
+        Partition partition1 = new JdbmPartition();
+        partition1.setSuffix( suffix1.getUpName() );
+        
+        Node node = partitionLookupTree.recursivelyAddPartition( partitionLookupTree, suffix1, 0, partition1 );
+        
+        LdapDN suffix2 = new LdapDN( "ou=system" );
+        Partition partition2 = new JdbmPartition();
+        partition2.setSuffix( suffix2.getUpName() );
+        
+        node = partitionLookupTree.recursivelyAddPartition( partitionLookupTree, suffix2, 0, partition2 );
+
+        assertNotNull( node );
+        assertTrue( node instanceof BranchNode );
+        assertEquals( "{Leaf: 'ou=system', Branch: {Leaf: 'dc=example, dc=com'}}", node.toString() );
+    }
+
+
+    /**
+     * Test the addition of a two overlapping partitions
+     */
+    @Test public void testNewPartitionTree2OverlapingNodes() throws NamingException
+    {
+        /** A structure to hold all the partitions */
+        BranchNode partitionLookupTree = new BranchNode();
+        
+        LdapDN suffix1 = new LdapDN( "dc=com" );
+        Partition partition1 = new JdbmPartition();
+        partition1.setSuffix( suffix1.getUpName() );
+        
+        partitionLookupTree.recursivelyAddPartition( partitionLookupTree, suffix1, 0, partition1 );
+        
+        LdapDN suffix2 = new LdapDN( "dc=example, dc=com" );
+        Partition partition2 = new JdbmPartition();
+        partition2.setSuffix( suffix2.getUpName() );
+        
+        try
+        {
+            partitionLookupTree.recursivelyAddPartition( partitionLookupTree, suffix2, 0, partition2 );
+            fail();
+        }
+        catch ( NamingException ne )
+        {
+            assertTrue( true );
+        }
+    }
+
+
+    /**
+     * Test the addition of a two partitions with the same root
+     */
+    @Test public void testNewPartitionTree2NodesWithSameRoot() throws NamingException
+    {
+        /** A structure to hold all the partitions */
+        BranchNode partitionLookupTree = new BranchNode();
+        
+        LdapDN suffix1 = new LdapDN( "dc=example1, dc=com" );
+        Partition partition1 = new JdbmPartition();
+        partition1.setSuffix( suffix1.getUpName() );
+        
+        partitionLookupTree.recursivelyAddPartition( partitionLookupTree, suffix1, 0, partition1 );
+        
+        LdapDN suffix2 = new LdapDN( "dc=example2, dc=com" );
+        Partition partition2 = new JdbmPartition();
+        partition2.setSuffix( suffix2.getUpName() );
+        
+        Node node = partitionLookupTree.recursivelyAddPartition( partitionLookupTree, suffix2, 0, partition2 );
+
+        assertNotNull( node );
+        assertTrue( node instanceof BranchNode );
+        assertEquals( "{Branch: {Leaf: 'dc=example2, dc=com', Leaf: 'dc=example1, dc=com'}}", node.toString() );
+    }
+}

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java Thu Jan 24 14:39:32 2008
@@ -20,7 +20,6 @@
 package org.apache.directory.server.core.schema;
 
 
-import junit.framework.TestCase;
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
@@ -40,6 +39,13 @@
 import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 
 import javax.naming.NamingException;
 import java.io.File;
@@ -56,24 +62,24 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class PartitionSchemaLoaderTest extends TestCase
+public class PartitionSchemaLoaderTest
 {
-    private Registries registries;
-    private DirectoryService directoryService;
-    private JdbmPartition schemaPartition;
+    private static Registries registries;
+    private static DirectoryService directoryService;
+    private static JdbmPartition schemaPartition;
 
 
-    public void setUp() throws Exception
+    @BeforeClass public static void setUp() throws Exception
     {
-        super.setUp();
-
         // setup working directory
         directoryService = new DefaultDirectoryService();
         File workingDirectory = new File( System.getProperty( "workingDirectory", System.getProperty( "user.dir" ) ) );
+        
         if ( ! workingDirectory.exists() )
         {
             workingDirectory.mkdirs();
         }
+        
         directoryService.setWorkingDirectory( workingDirectory );
         
         // --------------------------------------------------------------------
@@ -147,7 +153,7 @@
     }
     
     
-    public void testGetSchemas() throws NamingException
+    @Test public void testGetSchemas() throws NamingException
     {
         PartitionSchemaLoader loader = new PartitionSchemaLoader( schemaPartition, registries );
         Map<String,Schema> schemas = loader.getSchemas();
@@ -266,7 +272,7 @@
     }
     
     
-    public void testGetSchemaNames() throws NamingException
+    @Test public void testGetSchemaNames() throws NamingException
     {
         PartitionSchemaLoader loader = new PartitionSchemaLoader( schemaPartition, registries );
         Set<String> schemaNames = loader.getSchemaNames();

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java Thu Jan 24 14:39:32 2008
@@ -27,12 +27,17 @@
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.schema.SchemaChecker;
 import org.apache.directory.server.schema.bootstrap.ApacheSchema;
 import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
 import org.apache.directory.server.schema.bootstrap.CoreSchema;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.bootstrap.SystemSchema;
+import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.DefaultOidRegistry;
 import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.ObjectClassRegistry;
@@ -43,6 +48,7 @@
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import java.util.Collections;
@@ -83,7 +89,8 @@
         schemas.add( new CoreSchema() );
         loader.loadWithDependencies( schemas,registries );
 
-        java.util.List errors = registries.checkRefInteg();
+        List<Throwable> errors = registries.checkRefInteg();
+        
         if ( !errors.isEmpty() )
         {
             NamingException e = new NamingException();
@@ -220,14 +227,16 @@
     {
         int mod = DirContext.REMOVE_ATTRIBUTE;
         LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
-        Attributes attributes = new AttributesImpl( true );
+        ServerEntry attributes = new DefaultServerEntry( registries, name );
         attributes.put( "cn", "does not matter" );
 
         // postive test which should pass
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getOidRegistry() );
 
         // test should fail since we are removing the ou attribute
-        attributes.put( new AttributeImpl( "ou" ) );
+        AttributeType OU_AT = registries.getAttributeTypeRegistry().lookup( "ou" );
+        attributes.put( new DefaultServerAttribute( "ou", OU_AT ) );
+
         try
         {
             SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getOidRegistry() );
@@ -240,12 +249,14 @@
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
         name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
-        attributes = new AttributesImpl( true );
+        attributes = new DefaultServerEntry( registries, name );
         attributes.put( "sn", "does not matter" );
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getOidRegistry() );
 
         // test for failure when modifying Rdn attribute in multi attribute Rdn
-        attributes.put( new AttributeImpl( "cn" ) );
+        AttributeType CN_AT = registries.getAttributeTypeRegistry().lookup( "cn" );
+        attributes.put( new DefaultServerAttribute( "cn", CN_AT ) );
+        
         try
         {
             SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getOidRegistry() );
@@ -258,12 +269,12 @@
 
         // should succeed since the value being deleted from the rdn attribute is
         // is not used when composing the Rdn
-        attributes = new AttributesImpl( true );
+        attributes = new DefaultServerEntry( registries, name );
         attributes.put( "ou", "container" );
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getOidRegistry() );
 
         // now let's make it fail again just by providing the right value for ou (users)
-        attributes = new AttributesImpl( true );
+        attributes = new DefaultServerEntry( registries, name );
         attributes.put( "ou", "users" );
         try
         {
@@ -285,14 +296,15 @@
     {
         int mod = DirContext.REPLACE_ATTRIBUTE;
         LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
-        Attributes attributes = new AttributesImpl( true );
+        ServerEntry attributes = new DefaultServerEntry( registries, name );
         attributes.put( "cn", "does not matter" );
 
         // postive test which should pass
         SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getOidRegistry() );
 
         // test should fail since we are removing the ou attribute
-        attributes.put( new AttributeImpl( "ou" ) );
+        attributes.put( "ou", (String)null );
+        
         try
         {
             SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getOidRegistry() );
@@ -305,12 +317,13 @@
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
         name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
-        attributes = new AttributesImpl( true );
+        attributes = new DefaultServerEntry( registries, name );
         attributes.put( "sn", "does not matter" );
         SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getOidRegistry() );
 
         // test for failure when modifying Rdn attribute in multi attribute Rdn
-        attributes.put( new AttributeImpl( "cn" ) );
+        attributes.put("cn", (String)null );
+        
         try
         {
             SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getOidRegistry() );
@@ -323,13 +336,13 @@
 
         // should succeed since the values being replaced from the rdn attribute is
         // is includes the old Rdn attribute value
-        attributes = new AttributesImpl( true );
+        attributes = new DefaultServerEntry( registries, name );
         attributes.put( "ou", "container" );
         attributes.put( "ou", "users" );
         SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getOidRegistry() );
 
         // now let's make it fail by not including the old value for ou (users)
-        attributes = new AttributesImpl( true );
+        attributes = new DefaultServerEntry( registries, name );
         attributes.put( "ou", "container" );
         try
         {
@@ -354,20 +367,22 @@
     public void testPreventStructuralClassRemovalOnModifyReplaceAttribute() throws Exception
     {
         ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
+        AttributeType OBJECT_CLASS = registries.getAttributeTypeRegistry().lookup( "objectClass" );
+        AttributeType CN_AT = registries.getAttributeTypeRegistry().lookup( "cn" );
 
         // this should pass
         LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REPLACE_ATTRIBUTE;
-        SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, new AttributeImpl( "cn" ) );
+        SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, new DefaultServerAttribute( "cn", CN_AT ) );
 
         // this should succeed since person is still in replaced set and is structural
-        Attribute objectClassesReplaced = new AttributeImpl( "objectClass" );
+        ServerAttribute objectClassesReplaced = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
         objectClassesReplaced.add( "top" );
         objectClassesReplaced.add( "person" );
         SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, objectClassesReplaced );
 
         // this should fail since only top is left
-        objectClassesReplaced = new AttributeImpl( "objectClass" );
+        objectClassesReplaced = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
         objectClassesReplaced.add( "top" );
         try
         {
@@ -381,7 +396,7 @@
 
         // this should fail since the modify operation tries to delete all
         // objectClass attribute values
-        objectClassesReplaced = new AttributeImpl( "objectClass" );
+        objectClassesReplaced = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
         try
         {
             SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, objectClassesReplaced );
@@ -400,29 +415,35 @@
      */
     public void testPreventStructuralClassRemovalOnModifyRemoveAttribute() throws Exception
     {
+        AttributeTypeRegistry atReg = registries.getAttributeTypeRegistry();
         LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REMOVE_ATTRIBUTE;
-        Attribute entryObjectClasses = new AttributeImpl( "objectClass" );
-        entryObjectClasses.add( "top" );
-        entryObjectClasses.add( "person" );
-        entryObjectClasses.add( "organizationalPerson" );
+        AttributeType ocAt = atReg.lookup( "objectClass" );
+        
+        ServerAttribute entryObjectClasses = new DefaultServerAttribute( "objectClass", ocAt );
+        entryObjectClasses.add( "top", "person", "organizationalPerson" );
 
         ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
 
         // this should pass
-        SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod, new AttributeImpl( "cn" ),
+        SchemaChecker.preventStructuralClassRemovalOnModifyRemove( 
+            ocRegistry, 
+            name, 
+            mod, 
+            new DefaultServerAttribute( "cn", atReg.lookup( "cn" ) ),
             entryObjectClasses );
 
         // this should succeed since person is left and is structural
-        Attribute objectClassesRemoved = new AttributeImpl( "objectClass" );
+        ServerAttribute objectClassesRemoved = new DefaultServerAttribute( 
+            "objectClass", ocAt );
         objectClassesRemoved.add( "person" );
         SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod, objectClassesRemoved,
             entryObjectClasses );
 
         // this should fail since only top is left
-        objectClassesRemoved = new AttributeImpl( "objectClass" );
-        objectClassesRemoved.add( "person" );
-        objectClassesRemoved.add( "organizationalPerson" );
+        objectClassesRemoved = new DefaultServerAttribute( "objectClass", ocAt );
+        objectClassesRemoved.add( "person", "organizationalPerson" );
+        
         try
         {
             SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod, objectClassesRemoved,
@@ -436,7 +457,8 @@
 
         // this should fail since the modify operation tries to delete all
         // objectClass attribute values
-        objectClassesRemoved = new AttributeImpl( "objectClass" );
+        objectClassesRemoved = new DefaultServerAttribute( "objectClass", ocAt );
+
         try
         {
             SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod, objectClassesRemoved,
@@ -459,15 +481,19 @@
         OidRegistry registry = new MockOidRegistry();
         int mod = DirContext.REMOVE_ATTRIBUTE;
         LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
+        AttributeType cnAt = registries.getAttributeTypeRegistry().lookup( "cn" );
+        AttributeType ouAt = registries.getAttributeTypeRegistry().lookup( "ou" );
+        AttributeType snAt = registries.getAttributeTypeRegistry().lookup( "sn" );
 
         // postive test which should pass
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, 
-            new AttributeImpl( "cn", "does not matter" ), registry );
+            new DefaultServerAttribute( "cn", cnAt, "does not matter" ), registry );
 
         // test should fail since we are removing the ou attribute
         try
         {
-            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new AttributeImpl( "ou" ), registry );
+            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, 
+                new DefaultServerAttribute( "ou", ouAt ), registry );
             fail( "should never get here due to a LdapSchemaViolationException being thrown" );
         }
         catch ( LdapSchemaViolationException e )
@@ -478,12 +504,13 @@
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
         name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, 
-            new AttributeImpl( "sn", "does not matter" ), registry );
+            new DefaultServerAttribute( "sn", snAt, "does not matter" ), registry );
 
         // test for failure when modifying Rdn attribute in multi attribute Rdn
         try
         {
-            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new AttributeImpl( "cn" ), registry );
+            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, 
+                new DefaultServerAttribute( "cn", cnAt ), registry );
             fail( "should never get here due to a LdapSchemaViolationException being thrown" );
         }
         catch ( LdapSchemaViolationException e )
@@ -493,12 +520,14 @@
 
         // should succeed since the value being deleted from the rdn attribute is
         // is not used when composing the Rdn
-        SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new AttributeImpl( "ou", "container" ), registry );
+        SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, 
+            new DefaultServerAttribute( "ou", ouAt, "container" ), registry );
 
         // now let's make it fail again just by providing the right value for ou (users)
         try
         {
-            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new AttributeImpl( "ou", "users" ), registry );
+            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, 
+                new DefaultServerAttribute( "ou", ouAt, "users" ), registry );
             fail( "should never get here due to a LdapSchemaViolationException being thrown" );
         }
         catch ( LdapSchemaViolationException e )

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java Thu Jan 24 14:39:32 2008
@@ -20,30 +20,29 @@
 package org.apache.directory.server.core.subtree;
 
 
-import junit.framework.TestCase;
-
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
 
+import org.apache.directory.server.core.DefaultDirectoryService;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.subtree.RefinementEvaluator;
 import org.apache.directory.server.core.subtree.RefinementLeafEvaluator;
-import org.apache.directory.server.schema.bootstrap.ApacheSchema;
-import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
-import org.apache.directory.server.schema.bootstrap.CoreSchema;
-import org.apache.directory.server.schema.bootstrap.Schema;
-import org.apache.directory.server.schema.bootstrap.SystemSchema;
-import org.apache.directory.server.schema.registries.DefaultOidRegistry;
-import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.NotNode;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-
-import java.util.Set;
-import java.util.HashSet;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -52,28 +51,32 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class RefinementEvaluatorTest extends TestCase
+public class RefinementEvaluatorTest
 {
     /** the registries */
-    private Registries registries;
+    private static Registries registries;
+    
     /** the refinement evaluator to test */
-    private RefinementEvaluator evaluator;
+    private static RefinementEvaluator evaluator;
+
+    /** The ObjectClass AttributeType */
+    private static AttributeType OBJECT_CLASS;
+
+    /** The CN AttributeType */
+    private static AttributeType CN;
 
+    /** A reference to the directory service */
+    private static DirectoryService service;
 
+    
     /**
      * Initializes the global registries.
      * @throws javax.naming.NamingException if there is a failure loading the schema
      */
-    private void init() throws NamingException
+    @BeforeClass public static void init() throws NamingException
     {
-        BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
-        DefaultRegistries bsRegistries = new DefaultRegistries( "bootstrap", loader, new DefaultOidRegistry() );
-        Set<Schema> schemas = new HashSet<Schema>();
-        schemas.add( new SystemSchema() );
-        schemas.add( new ApacheSchema() );
-        schemas.add( new CoreSchema() );
-        loader.loadWithDependencies( schemas, bsRegistries );
-        registries = bsRegistries;
+        service = new DefaultDirectoryService();
+        registries = service.getRegistries();
     }
 
 
@@ -81,34 +84,35 @@
      * Initializes registries and creates the leaf evalutator
      * @throws Exception if there are schema initialization problems
      */
-    protected void setUp() throws Exception
+    @Before public void setUp() throws Exception
     {
-        init();
         OidRegistry registry = registries.getOidRegistry();
         RefinementLeafEvaluator leafEvaluator = new RefinementLeafEvaluator( registry );
         evaluator = new RefinementEvaluator( leafEvaluator );
+        
+        OBJECT_CLASS = registries.getAttributeTypeRegistry().lookup( "objectClass" );
+        CN = registries.getAttributeTypeRegistry().lookup( "cn" );
     }
 
 
     /**
      * Sets evaluator and registries to null.
      */
-    protected void tearDown()
+    @After public void tearDown()
     {
         evaluator = null;
-        registries = null;
     }
 
 
     /**
      * Test cases for various bad combinations of arguments
-     * @throws Exception if something goes wrongg
+     * @throws Exception if something goes wrong
      */
-    public void testForBadArguments() throws Exception
+    @Test public void testForBadArguments() throws Exception
     {
         try
         {
-            assertFalse( evaluator.evaluate( null, new AttributeImpl( "objectClass" ) ) );
+            assertFalse( evaluator.evaluate( null, new DefaultServerAttribute( "objectClass", OBJECT_CLASS ) ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -126,7 +130,7 @@
 
         try
         {
-            assertFalse( evaluator.evaluate( new EqualityNode( "", "" ), new AttributeImpl( "blah" ) ) );
+            assertFalse( evaluator.evaluate( new EqualityNode( "", "" ), new DefaultServerAttribute( "cn", CN ) ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -135,102 +139,104 @@
     }
 
 
-    public void testMatchByName() throws Exception
+    @Test public void testMatchByName() throws Exception
     {
-        Attribute objectClasses = null;
+        ServerAttribute objectClasses = null;
 
         // positive test
-        objectClasses = new AttributeImpl( "objectClass", "person" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
         assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
 
-        objectClasses = new AttributeImpl( "objectClass" );
-        objectClasses.add( "person" );
-        objectClasses.add( "blah" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person", "blah" );
         assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
 
         // negative tests
-        objectClasses = new AttributeImpl( "objectClass", "person" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
         assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "blah" ), objectClasses ) );
 
-        objectClasses = new AttributeImpl( "objectClass", "blah" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "blah" );
         assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
     }
 
 
-    public void testMatchByOID() throws Exception
+    @Test public void testMatchByOID() throws Exception
     {
-        Attribute objectClasses = null;
-
+        ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
+        
         // positive test
-        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
 
-        objectClasses = new AttributeImpl( "objectClass" );
-        objectClasses.add( "person" );
-        objectClasses.add( "blah" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person", "blah" );
         assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
 
         // negative tests
-        objectClasses = new AttributeImpl( "objectClass", "person" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
         assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
 
-        objectClasses = new AttributeImpl( "objectClass", "blah" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "blah" );
         assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
     }
 
 
-    public void testComplexOrRefinement() throws Exception
+    @Test public void testComplexOrRefinement() throws Exception
     {
         ExprNode refinement = null;
-        Attribute objectClasses = new AttributeImpl( "objectClass", "person" );
+        ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
         String refStr = "(|(objectClass=person)(objectClass=organizationalUnit))";
         
         refinement = FilterParser.parse( refStr );
 
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new AttributeImpl( "objectClass", "organizationalUnit" );
+        
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "organizationalUnit" );
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new AttributeImpl( "objectClass", "domain" );
+        
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "domain" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
     }
 
 
-    public void testComplexAndRefinement() throws Exception
+    @Test public void testComplexAndRefinement() throws Exception
     {
         ExprNode refinement = null;
-        Attribute objectClasses = new AttributeImpl( "objectClass", "person" );
+        ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
         objectClasses.add( "organizationalUnit" );
         String refStr = "(&(objectClass=person)(objectClass=organizationalUnit))";
         
         refinement = FilterParser.parse( refStr );
 
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new AttributeImpl( "objectClass", "organizationalUnit" );
+        
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "organizationalUnit" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new AttributeImpl( "objectClass", "person" );
+        
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new AttributeImpl( "objectClass", "domain" );
+        
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "domain" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
     }
 
 
-    public void testComplexNotRefinement() throws Exception
+    @Test public void testComplexNotRefinement() throws Exception
     {
         ExprNode refinement = null;
-        Attribute objectClasses = new AttributeImpl( "objectClass", "person" );
+        ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
         String refStr = "(!(objectClass=person))";
 
         refinement = FilterParser.parse( refStr );
 
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new AttributeImpl( "objectClass", "organizationalUnit" );
+        
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "organizationalUnit" );
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new AttributeImpl( "objectClass", "domain" );
+        
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "domain" );
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
 
         try
         {
-            assertFalse( evaluator.evaluate( new NotNode(), new AttributeImpl( "objectClass" ) ) );
+            assertFalse( evaluator.evaluate( new NotNode(), new DefaultServerAttribute( "objectClass", OBJECT_CLASS ) ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java Thu Jan 24 14:39:32 2008
@@ -23,24 +23,24 @@
 import junit.framework.TestCase;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
 
+import org.apache.directory.server.core.DefaultDirectoryService;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.subtree.RefinementLeafEvaluator;
-import org.apache.directory.server.schema.bootstrap.ApacheSchema;
-import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
-import org.apache.directory.server.schema.bootstrap.CoreSchema;
-import org.apache.directory.server.schema.bootstrap.Schema;
-import org.apache.directory.server.schema.bootstrap.SystemSchema;
-import org.apache.directory.server.schema.registries.DefaultOidRegistry;
-import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.GreaterEqNode;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-
-import java.util.Set;
-import java.util.HashSet;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 
 /**
@@ -49,38 +49,39 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class RefinementLeafEvaluatorTest extends TestCase
+public class RefinementLeafEvaluatorTest
 {
-    /** the global registries */
-    private Registries registries;
+    /** The ObjectClass AttributeType */
+    private static AttributeType OBJECT_CLASS;
+
+    /** A reference to the directory service */
+    private static DirectoryService service;
+    
+    /** the registries */
+    private static Registries registries;
+
     /** the refinement leaf evaluator to test */
     private RefinementLeafEvaluator evaluator;
 
 
     /**
      * Initializes the global registries.
-     * @throws NamingException if there is a failure loading the schema
+     * @throws javax.naming.NamingException if there is a failure loading the schema
      */
-    private void init() throws NamingException
+    @BeforeClass public static void init() throws NamingException
     {
-        BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
-        DefaultRegistries bsRegistries = new DefaultRegistries( "bootstrap", loader, new DefaultOidRegistry() );
-        Set<Schema> schemas = new HashSet<Schema>();
-        schemas.add( new SystemSchema() );
-        schemas.add( new ApacheSchema() );
-        schemas.add( new CoreSchema() );
-        loader.loadWithDependencies( schemas, bsRegistries );
-        registries = bsRegistries;
+        service = new DefaultDirectoryService();
+        registries = service.getRegistries();
+        OBJECT_CLASS = registries.getAttributeTypeRegistry().lookup( "objectClass" );
     }
-
+    
 
     /**
      * Initializes registries and creates the leaf evalutator
      * @throws Exception if there are schema initialization problems
      */
-    protected void setUp() throws Exception
+    @Before public void setUp() throws Exception
     {
-        init();
         OidRegistry registry = registries.getOidRegistry();
         evaluator = new RefinementLeafEvaluator( registry );
     }
@@ -89,10 +90,9 @@
     /**
      * Sets evaluator and registries to null.
      */
-    protected void tearDown()
+    @After public void tearDown()
     {
         evaluator = null;
-        registries = null;
     }
 
 
@@ -100,9 +100,9 @@
      * Test cases for various bad combinations of arguments
      * @throws Exception if something goes wrongg
      */
-    public void testForBadArguments() throws Exception
+    @Test public void testForBadArguments() throws Exception
     {
-        Attribute objectClasses = null;
+        ServerAttribute objectClasses = null;
 
         try
         {
@@ -142,7 +142,7 @@
 
         try
         {
-            objectClasses = new AttributeImpl( "incorrectAttrId" );
+            objectClasses = new DefaultServerAttribute( "cn", OBJECT_CLASS );
             assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "" ), objectClasses ) );
             fail( "should never get here due to an IAE" );
         }
@@ -152,46 +152,43 @@
     }
 
 
-    public void testMatchByName() throws Exception
+    @Test public void testMatchByName() throws Exception
     {
-        Attribute objectClasses = null;
-
         // positive test
-        objectClasses = new AttributeImpl( "objectClass", "person" );
+        ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
         assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
 
-        objectClasses = new AttributeImpl( "objectClass" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
         assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
 
         // negative tests
-        objectClasses = new AttributeImpl( "objectClass", "person" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
         assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "blah" ), objectClasses ) );
 
-        objectClasses = new AttributeImpl( "objectClass", "blah" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "blah" );
         assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
     }
 
 
-    public void testMatchByOID() throws Exception
+    @Test public void testMatchByOID() throws Exception
     {
-        Attribute objectClasses = null;
+        ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
 
         // positive test
-        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
 
-        objectClasses = new AttributeImpl( "objectClass" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
         assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
 
         // negative tests
-        objectClasses = new AttributeImpl( "objectClass", "person" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
         assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
 
-        objectClasses = new AttributeImpl( "objectClass", "blah" );
+        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "blah" );
         assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
     }
 }

Modified: directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Thu Jan 24 14:39:32 2008
@@ -32,7 +32,6 @@
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 
@@ -76,7 +75,6 @@
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -295,7 +293,7 @@
 
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes userEntry;
+        ServerEntry userEntry;
 
         LookupOperationContext lookupContext = 
             new LookupOperationContext( modContext.getRegistries(),
@@ -315,9 +313,9 @@
             throw new LdapAuthenticationException( "Failed to authenticate user '" + principalDn + "'." );
         }
 
-        Attribute objectClass = userEntry.get( SchemaConstants.OBJECT_CLASS_AT );
+        ServerAttribute objectClass = userEntry.get( SchemaConstants.OBJECT_CLASS_AT );
         
-        if ( !AttributeUtils.containsValueCaseIgnore( objectClass, SchemaConstants.KRB5_PRINCIPAL_OC ) )
+        if ( !objectClass.contains( SchemaConstants.KRB5_PRINCIPAL_OC ) )
         {
             return;
         }
@@ -329,13 +327,13 @@
 
         if ( subContext.getPrincipalName() == null )
         {
-            Attribute principalAttribute = userEntry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT );
-            String principalName = ( String ) principalAttribute.get();
+            ServerAttribute principalAttribute = userEntry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT );
+            String principalName = principalAttribute.getString();
             subContext.setPrincipalName( principalName );
             log.debug( "Found principal '{}' from lookup.", principalName );
         }
 
-        Attribute keyVersionNumberAttr = userEntry.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT );
+        ServerAttribute keyVersionNumberAttr = userEntry.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT );
 
         if ( keyVersionNumberAttr == null )
         {
@@ -344,7 +342,7 @@
         }
         else
         {
-            int oldKeyVersionNumber = Integer.valueOf( ( String ) keyVersionNumberAttr.get() );
+            int oldKeyVersionNumber = Integer.valueOf( keyVersionNumberAttr.getString() );
             int newKeyVersionNumber = oldKeyVersionNumber + 1;
             subContext.setNewKeyVersionNumber( newKeyVersionNumber );
             log.debug( "Found key version number '{}', setting to '{}'.", oldKeyVersionNumber, newKeyVersionNumber );

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeEnumeration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeEnumeration.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeEnumeration.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeEnumeration.java Thu Jan 24 14:39:32 2008
@@ -121,7 +121,6 @@
         }
         catch ( NamingException e )
         {
-            e.printStackTrace();
             throw new NoSuchElementException( "Got IO Failure on btree: " + e.getCause().getMessage() );
         }
     }

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleEnumeration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleEnumeration.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleEnumeration.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleEnumeration.java Thu Jan 24 14:39:32 2008
@@ -180,7 +180,6 @@
         }
         catch ( NamingException e )
         {
-            e.printStackTrace();
             throw new NoSuchElementException( "Got IO Failure on btree: " + e.getCause().getMessage() );
         }
     }

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java Thu Jan 24 14:39:32 2008
@@ -54,18 +54,39 @@
             {
                 throw new IllegalArgumentException( "Argument 'obj2' is null" );
             }
-            //NB qdox has a fit if you try to compare 2 longs with < or >, but accepts the following circuitous locution:
+
             long thisVal = ( Long ) o1;
             long anotherVal = ( Long ) o2;
+            
             if ( thisVal == anotherVal )
             {
                 return 0;
             }
-            if (  thisVal < anotherVal )
+            
+            if ( thisVal == anotherVal )
+            {
+                return 0;
+            }
+            
+            if ( thisVal >= 0 )
+            {
+                if ( anotherVal >= 0 )
+                {
+                    return ( thisVal > anotherVal ) ? 1 : -1;
+                }
+                else
+                {
+                    return -1;
+                }
+            }
+            else if ( anotherVal >= 0 )
             {
                 return 1;
             }
-            return -1;
+            else
+            {
+                return ( thisVal < anotherVal ) ? -1 : 1;
+            }
         }
     };
 

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java Thu Jan 24 14:39:32 2008
@@ -49,7 +49,6 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
@@ -347,8 +346,8 @@
     {
         if ( nexus.hasEntry( new EntryOperationContext( registries, newEntryName ) ) )
         {
-            Attributes entry = nexus.lookup( new LookupOperationContext( registries, newEntryName ) );
-            Attribute deleted = entry.get( Constants.ENTRY_DELETED );
+            ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, newEntryName ) );
+            ServerAttribute deleted = entry.get( Constants.ENTRY_DELETED );
             Object value = deleted == null ? null : deleted.get();
 
             /*

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java Thu Jan 24 14:39:32 2008
@@ -22,10 +22,9 @@
 
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 
 import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
@@ -46,14 +45,14 @@
     @SuppressWarnings("unchecked")
     public static boolean isEntryUpdatable( Registries registries, PartitionNexus nexus, LdapDN name, CSN newCSN ) throws NamingException
     {
-        Attributes entry = nexus.lookup( new LookupOperationContext( registries, name ) );
+        ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
 
         if ( entry == null )
         {
             return true;
         }
 
-        Attribute entryCSNAttr = entry.get( Constants.ENTRY_CSN );
+        ServerAttribute entryCSNAttr = entry.get( Constants.ENTRY_CSN );
 
         if ( entryCSNAttr == null )
         {

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java Thu Jan 24 14:39:32 2008
@@ -73,8 +73,6 @@
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
@@ -378,7 +376,7 @@
             try
             {
                 name.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
-                Attributes entry = nexus.lookup( new LookupOperationContext( registries, name ) );
+                ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
                 LOG.info( "[Replica-{}] Purge: " + name + " (" + entry + ')', configuration.getReplicaId() );
                 nexus.delete( new DeleteOperationContext( registries, name ) );
             }
@@ -450,7 +448,7 @@
             // Check DELETED attribute.
             try
             {
-                Attributes entry = nextInterceptor.lookup( new LookupOperationContext( registries, entryContext.getDn() ) );
+                ServerEntry entry = nextInterceptor.lookup( new LookupOperationContext( registries, entryContext.getDn() ) );
                 hasEntry = !isDeleted( entry );
             }
             catch ( NameNotFoundException e )
@@ -464,7 +462,7 @@
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, LookupOperationContext lookupContext ) throws NamingException
+    public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext lookupContext ) throws NamingException
     {
         if ( lookupContext.getAttrsId() != null )
         {
@@ -492,7 +490,7 @@
             }
         }
 
-        Attributes result = nextInterceptor.lookup( lookupContext );
+        ServerEntry result = nextInterceptor.lookup( lookupContext );
         ensureNotDeleted( lookupContext.getDn(), result );
         return result;
     }
@@ -535,7 +533,7 @@
     }
 
 
-    private void ensureNotDeleted( LdapDN name, Attributes entry ) throws NamingException {
+    private void ensureNotDeleted( LdapDN name, ServerEntry entry ) throws NamingException {
         if ( isDeleted( entry ) )
         {
             LdapNameNotFoundException e = new LdapNameNotFoundException( "Deleted entry: " + name.getUpName() );
@@ -545,15 +543,14 @@
     }
 
 
-    private boolean isDeleted( Attributes entry ) throws NamingException
+    private boolean isDeleted( ServerEntry entry ) throws NamingException
     {
         if ( entry == null )
         {
             return true;
         }
 
-        Attribute deleted = entry.get( Constants.ENTRY_DELETED );
-        return ( deleted != null && "TRUE".equalsIgnoreCase( deleted.get().toString() ) );
+        return entry.contains( Constants.ENTRY_DELETED, "TRUE" );
     }
 
 

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java Thu Jan 24 14:39:32 2008
@@ -28,6 +28,8 @@
 import javax.naming.event.NamingExceptionEvent;
 import javax.naming.event.ObjectChangeListener;
 
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.ldap.SessionRegistry;
 import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
@@ -243,6 +245,8 @@
             }
         }
 
+        Object attr;
+        
         switch ( evt.getType() )
         {
             case ( NamingEvent.OBJECT_ADDED  ):
@@ -252,7 +256,16 @@
                 }
             
                 respEntry.setObjectName( newBinding );
-                respEntry.setAttributes( ( Attributes ) evt.getChangeInfo() );
+                attr = evt.getChangeInfo();
+                
+                if ( attr instanceof ServerEntry )
+                {
+                    respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) );
+                }
+                else
+                {
+                    respEntry.setAttributes( ( Attributes ) attr );
+                }
                 
                 if ( ecControl != null )
                 {
@@ -268,7 +281,16 @@
                 }
             
                 respEntry.setObjectName( oldBinding );
-                respEntry.setAttributes( ( Attributes ) evt.getOldBinding().getObject() );
+                attr = evt.getOldBinding().getObject();
+                
+                if ( attr instanceof ServerEntry )
+                {
+                    respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) );
+                }
+                else
+                {
+                    respEntry.setAttributes( ( Attributes ) attr );
+                }
 
                 if ( ecControl != null )
                 {
@@ -284,7 +306,16 @@
                 }
             
                 respEntry.setObjectName( oldBinding );
-                respEntry.setAttributes( ( Attributes ) evt.getOldBinding().getObject() );
+                attr = evt.getOldBinding().getObject();
+                
+                if ( attr instanceof ServerEntry )
+                {
+                    respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) );
+                }
+                else
+                {
+                    respEntry.setAttributes( ( Attributes ) attr );
+                }
 
                 if ( ecControl != null )
                 {
@@ -300,7 +331,16 @@
                 }
             
                 respEntry.setObjectName( newBinding );
-                respEntry.setAttributes( ( Attributes ) evt.getNewBinding().getObject() );
+                attr = evt.getNewBinding().getObject();
+                
+                if ( attr instanceof ServerEntry )
+                {
+                    respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) );
+                }
+                else
+                {
+                    respEntry.setAttributes( ( Attributes ) attr );
+                }
 
                 if ( ecControl != null )
                 {

Modified: directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdComparator.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdComparator.java (original)
+++ directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdComparator.java Thu Jan 24 14:39:32 2008
@@ -123,7 +123,6 @@
             }
             catch ( NamingException e )
             {
-                e.printStackTrace();
                 throw new RuntimeException( "Failed to lookup OID for " + strValue, e );
             }
         }

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java Thu Jan 24 14:39:32 2008
@@ -28,6 +28,7 @@
 import java.util.Map;
 
 import javax.naming.NamingException;
+import javax.naming.directory.NoSuchAttributeException;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -110,7 +111,7 @@
             return oid;
         }
 
-        NamingException fault = new NamingException( "OID for name '" + name + "' was not "
+        NamingException fault = new NoSuchAttributeException( "OID for name '" + name + "' was not "
             + "found within the OID registry" );
         LOG.error( fault.getMessage() );
         throw fault;

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java (original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java Thu Jan 24 14:39:32 2008
@@ -34,6 +34,7 @@
 import javax.naming.directory.InvalidAttributeIdentifierException;
 import javax.naming.directory.InvalidAttributeValueException;
 import javax.naming.directory.ModificationItem;
+import javax.naming.directory.NoSuchAttributeException;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 import javax.naming.ldap.InitialLdapContext;
@@ -241,20 +242,20 @@
     {
         // Change description attribute
         Attributes attrs = new AttributesImpl( true );
-        attrs.put( new AttributeImpl( "attr1", "attr 1" ) );
-        attrs.put( new AttributeImpl( "attr2", "attr 2" ) );
-        attrs.put( new AttributeImpl( "attr3", "attr 3" ) );
-        attrs.put( new AttributeImpl( "attr4", "attr 4" ) );
-        attrs.put( new AttributeImpl( "attr5", "attr 5" ) );
-        attrs.put( new AttributeImpl( "attr6", "attr 6" ) );
-        attrs.put( new AttributeImpl( "attr7", "attr 7" ) );
-        attrs.put( new AttributeImpl( "attr8", "attr 8" ) );
-        attrs.put( new AttributeImpl( "attr9", "attr 9" ) );
-        attrs.put( new AttributeImpl( "attr10", "attr 10" ) );
-        attrs.put( new AttributeImpl( "attr11", "attr 11" ) );
-        attrs.put( new AttributeImpl( "attr12", "attr 12" ) );
-        attrs.put( new AttributeImpl( "attr13", "attr 13" ) );
-        attrs.put( new AttributeImpl( "attr14", "attr 14" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 1" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 2" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 3" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 4" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 5" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 6" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 7" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 8" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 9" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 10" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 11" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 12" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 13" ) );
+        attrs.put( new AttributeImpl( "telephoneNumber", "attr 14" ) );
         
         Attribute attr = new AttributeImpl( "description", PERSON_DESCRIPTION );
 
@@ -401,7 +402,7 @@
 
 
     /**
-     * Modu=ify the entry with a bad attribute : this should fail 
+     * Modify the entry with a bad attribute : this should fail 
      * 
      * @throws NamingException
      */
@@ -415,7 +416,7 @@
         {
             ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs );
         }
-        catch ( InvalidAttributeIdentifierException iaie )
+        catch ( NoSuchAttributeException nsae )
         {
             // We have a failure : the attribute is unknown in the schema
             assertTrue( true );
@@ -439,7 +440,7 @@
         String rdn = "cn=Kate Bush";
         ctx.createSubcontext(rdn, attrs);
 
-        // Add a decsription with two values
+        // Add a description with two values
         String[] descriptions = {
                 "Kate Bush is a British singer-songwriter.",
                 "She has become one of the most influential female artists of the twentieth century." };
@@ -464,11 +465,11 @@
         String base = "";
 
         // Check entry
-        NamingEnumeration enm = ctx.search(base, filter, sctls);
+        NamingEnumeration<SearchResult> enm = ctx.search(base, filter, sctls);
         assertTrue(enm.hasMore());
         
         while (enm.hasMore()) {
-            SearchResult sr = (SearchResult) enm.next();
+            SearchResult sr = enm.next();
             attrs = sr.getAttributes();
             Attribute desc = sr.getAttributes().get("description");
             assertNotNull(desc);

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java (original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java Thu Jan 24 14:39:32 2008
@@ -503,6 +503,8 @@
             // expected
         } catch (InvalidAttributeValueException e) {
             // expected
+        } catch ( Exception e ) {
+            e.printStackTrace();
         }
 
         ctx.destroySubcontext(rdn);

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyReplaceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyReplaceITest.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyReplaceITest.java (original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyReplaceITest.java Thu Jan 24 14:39:32 2008
@@ -132,7 +132,7 @@
         String rdn = "cn=Kate Bush";
         ctx.createSubcontext( rdn, attrs );
 
-        Attribute attr = new AttributeImpl( "numberOfOctaves" );
+        Attribute attr = new AttributeImpl( "l" );
         ModificationItemImpl item = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attr );
 
         ctx.modifyAttributes( rdn, new ModificationItemImpl[]

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java Thu Jan 24 14:39:32 2008
@@ -20,6 +20,7 @@
 
 import java.io.Serializable;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.naming.NamingException;
 import javax.naming.directory.InvalidAttributeValueException;
@@ -53,7 +54,7 @@
     /**
      * Puts some values to this attribute.
      * <p>
-     * The new values are replace the previous values.
+     * The new values will replace the previous values.
      * </p>
      * <p>
      * This method returns the number of values that were put.
@@ -69,6 +70,24 @@
 
 
     /**
+     * Puts some values to this attribute.
+     * <p>
+     * The new values will replace the previous values.
+     * </p>
+     * <p>
+     * This method returns the number of values that were put.
+     * </p>
+     *
+     * @param vals some values to be put which may be null
+     * @return the number of added values, or 0 if none has been added
+     * @throws InvalidAttributeValueException If we try to add some values
+     * which conflicts with the AttributeType for this attribute
+     * @throws NamingException If the attributeType does not have a syntax
+     */
+    int put( List<?> vals ) throws InvalidAttributeValueException, NamingException;
+
+
+    /**
      * Adds some values to this attribute. If the new values are already present in
      * the attribute values, the method has no effect.
      * <p>
@@ -87,7 +106,7 @@
     /**
      * Puts some values to this attribute.
      * <p>
-     * The new values are replace the previous values.
+     * The new values will replace the previous values.
      * </p>
      * <p>
      * This method returns the number of values that were put.
@@ -121,6 +140,15 @@
      * @return true if this attribute contains all the values, otherwise false
      */
     boolean contains( byte[]... vals );
+
+
+    /**
+     * Indicates whether the specified values are some of the attribute's values.
+     *
+     * @param vals the values
+     * @return true if this attribute contains all the values, otherwise false
+     */
+    boolean contains( Object... vals );
 
 
    /**

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/AbstractClientAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/AbstractClientAttribute.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/AbstractClientAttribute.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/AbstractClientAttribute.java Thu Jan 24 14:39:32 2008
@@ -211,6 +211,29 @@
     
     
     /**
+     * @see EntryAttribute#put(List<String>)
+     */
+    public int put( List<?> vals ) throws InvalidAttributeValueException, NamingException
+    {
+        values.clear();
+        
+        for ( Object value:vals )
+        {
+            if ( value instanceof String )
+            {
+                add( (String)value );
+            }
+            else
+            {
+                add( (byte[])value );
+            }
+        }
+        
+        return size();
+    }
+
+    
+    /**
      * @see EntryAttribute#add(byte[]...)
      */
     public int add( byte[]... vals ) throws InvalidAttributeValueException, NamingException

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java Thu Jan 24 14:39:32 2008
@@ -404,6 +404,64 @@
     
     
     /**
+     * @see EntryAttribute#contains(Object...)
+     */
+    public boolean contains( Object... vals )
+    {
+        boolean isHR = true;
+        boolean seen = false;
+        
+        // Iterate through all the values, and quit if we 
+        // don't find one in the values
+        for ( Object val:vals )
+        {
+            if ( ( val instanceof String ) ) 
+            {
+                if ( !seen )
+                {
+                    isHR = true;
+                    seen = true;
+                }
+
+                if ( isHR )
+                {
+                    if ( !contains( (String)val ) )
+                    {
+                        return false;
+                    }
+                }
+                else
+                {
+                    return false;
+                }
+            }
+            else
+            {
+                if ( !seen )
+                {
+                    isHR = false;
+                    seen = true;
+                }
+
+                if ( !isHR )
+                {
+                    if ( !contains( (byte[])val ) )
+                    {
+                        return false;
+                    }
+                }
+                else
+                {
+                    return false;
+                }
+            }
+        }
+        
+        return true;
+    }
+
+    
+    /**
      * Get the first value of this attribute. If there is none, 
      * null is returned.
      * 
@@ -538,6 +596,7 @@
         return values.iterator();
     }
     
+    
     /**
      * @see Object#toString() 
      */
@@ -559,5 +618,4 @@
         
         return sb.toString();
     }
-
 }

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java?rev=615071&r1=615070&r2=615071&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java Thu Jan 24 14:39:32 2008
@@ -639,7 +639,6 @@
                 }
                 catch ( InvalidNameException e )
                 {
-                    e.printStackTrace();
                     LOG.error( "Failed to parse RDN for name " + name.toString(), e );
                     return false;
                 }



Mime
View raw message