directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1089163 - in /directory: apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ shared/trunk/ldap/model/src/main/java/org/apache/directory...
Date Tue, 05 Apr 2011 19:14:27 GMT
Author: elecharny
Date: Tue Apr  5 19:14:27 2011
New Revision: 1089163

URL: http://svn.apache.org/viewvc?rev=1089163&view=rev
Log:
o Removed the set( AttributeType...) method
o Removed two unused DefaultEntry constructors
O Fixed tests accordingly to the upper changes

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java?rev=1089163&r1=1089162&r2=1089163&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
Tue Apr  5 19:14:27 2011
@@ -235,12 +235,6 @@ public class ClonedServerEntry implement
     }
 
 
-    public List<Attribute> set( AttributeType... attributeTypes )
-    {
-        return clonedEntry.set( attributeTypes );
-    }
-
-
     public void add( Attribute... attributes ) throws LdapException
     {
         clonedEntry.add( attributes );

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java?rev=1089163&r1=1089162&r2=1089163&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java
(original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java
Tue Apr  5 19:14:27 2011
@@ -41,11 +41,11 @@ import javax.naming.directory.Attributes
 import javax.naming.directory.BasicAttributes;
 
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.BinaryValue;
-import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.StringValue;
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -191,7 +191,7 @@ public class SchemaAwareEntryTest
 
     /**
      * Test for method DefaultEntry( registries, Dn, AttributeType... )
-     */
+     *
     @Test
     public void testDefaultClientEntryRegistriesDNAttributeTypeArray() throws Exception
     {
@@ -207,7 +207,7 @@ public class SchemaAwareEntryTest
 
     /**
      * Test for method DefaultEntry( registries, Dn, AttributeType, upId )
-     */
+     *
     @Test
     public void testDefaultClientEntryRegistriesDNAttributeTypeUpId() throws Exception
     {
@@ -3596,86 +3596,6 @@ public class SchemaAwareEntryTest
 
 
     /**
-     * Test the set(AT...) method
-     */
-    @Test
-    public void testSetATElipsis() throws Exception
-    {
-        Dn dn = new Dn( schemaManager, "cn=test" );
-        Entry entry = new DefaultEntry( schemaManager, dn );
-
-        List<Attribute> result = null;
-
-        // First check that this method fails if we pass an empty list of ATs
-        result = entry.set( ( AttributeType ) null );
-        assertNull( result );
-
-        // Now, check what we get when adding one existing AT
-        result = entry.set( atSN );
-
-        assertNull( result );
-        Attribute sa = entry.get( "sn" );
-        assertNotNull( sa );
-        assertEquals( atSN, sa.getAttributeType() );
-        assertEquals( "sn", sa.getAttributeType().getName() );
-
-        // Add two AT now
-        AttributeType atGN = schemaManager.lookupAttributeTypeRegistry( "givenname" );
-        AttributeType atStreet = schemaManager.lookupAttributeTypeRegistry( "2.5.4.9" );
-        result = entry.set( atL, atC, atGN, atStreet );
-
-        assertNull( result );
-
-        sa = entry.get( "l" );
-        assertNotNull( sa );
-        assertEquals( atL, sa.getAttributeType() );
-        assertEquals( "l", sa.getAttributeType().getName() );
-
-        sa = entry.get( "c" );
-        assertNotNull( sa );
-        assertEquals( atC, sa.getAttributeType() );
-        assertEquals( "c", sa.getAttributeType().getName() );
-
-        sa = entry.get( "2.5.4.9" );
-        assertNotNull( sa );
-        assertEquals( atStreet, sa.getAttributeType() );
-        assertEquals( "street", sa.getAttributeType().getName() );
-
-        sa = entry.get( "givenName" );
-        assertNotNull( sa );
-        assertEquals( atGN, sa.getAttributeType() );
-        assertEquals( "givenName", sa.getAttributeType().getName() );
-
-        // Now try to add existing ATs
-        // First, set some value to the modified AT
-        sa = entry.get( "sn" );
-        sa.add( "test" );
-
-        // Check that the value has been added to the entry
-        assertEquals( "test", entry.get( "sn" ).get().getString() );
-
-        // Now add a new SN empty AT : it should replace the existing one.
-        AttributeType atSNEmpty = schemaManager.lookupAttributeTypeRegistry( "sn" );
-        sa = entry.set( atSNEmpty ).get( 0 );
-        assertEquals( "test", sa.get().getString() );
-        assertNotNull( entry.get( "sn" ) );
-        assertNull( entry.get( "sn" ).get() );
-
-        // Last, not least, put an ObjectClass AT
-        AttributeType OBJECT_CLASS_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASS_AT
);
-
-        entry.set( OBJECT_CLASS_AT );
-
-        assertNotNull( entry.get( "objectClass" ) );
-
-        Attribute oc = entry.get( "objectClass" );
-
-        assertEquals( OBJECT_CLASS_AT, oc.getAttributeType() );
-        assertNull( oc.get() );
-    }
-
-
-    /**
      * Test the set( upId ) method
      */
     @Test
@@ -3763,36 +3683,6 @@ public class SchemaAwareEntryTest
 
 
     /**
-     * Test method for set( AttributeType... )
-     */
-    @Test
-    public void testSetAttributeTypeArray() throws Exception
-    {
-        Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
-
-        entry.add( "ObjectClass", "top", "person" );
-        entry.add( "cn", "test1", "test2" );
-        entry.add( "sn", "Test" );
-
-        List<Attribute> removed = entry.set( atOC, atCN, atPwd );
-
-        assertEquals( 4, entry.size() );
-        assertNotNull( entry.get( "objectclass" ) );
-        assertNotNull( entry.get( "cn" ) );
-        assertNotNull( entry.get( "userPassword" ) );
-        assertNotNull( entry.get( "sn" ) );
-
-        assertNull( entry.get( "objectclass" ).get() );
-        assertNull( entry.get( "cn" ).get() );
-        assertNull( entry.get( "userPassword" ).get() );
-        assertNotNull( entry.get( "sn" ).get() );
-
-        assertNotNull( removed );
-        assertEquals( 2, removed.size() );
-    }
-
-
-    /**
      * Test method for set( String... )
      */
     @Test
@@ -3906,7 +3796,6 @@ public class SchemaAwareEntryTest
 
         Value<String> strValueTop = new StringValue( "top" );
         Value<String> strValuePerson = new StringValue( "person" );
-        Value<String> strNullValue = new StringValue( ( String ) null );
 
         Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
         Value<byte[]> binValue2 = new BinaryValue( BYTES2 );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java?rev=1089163&r1=1089162&r2=1089163&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java
Tue Apr  5 19:14:27 2011
@@ -361,87 +361,6 @@ public final class DefaultEntry implemen
     }
 
 
-    /**
-     * <p>
-     * Creates a new instance of DefaultEntry, with a
-     * Dn, a list of attributeTypes and schema aware.
-     * </p>
-     * <p>
-     * The newly created entry is fed with the list of attributeTypes. No
-     * values are associated with those attributeTypes.
-     * </p>
-     * <p>
-     * If any of the AttributeType does not exist, they it's simply discarded.
-     * </p>
-     *
-     * @param schemaManager The reference to the schemaManager
-     * @param dn The Dn for this serverEntry. Can be null.
-     * @param attributeTypes The list of attributes to create, without value.
-     */
-    public DefaultEntry( SchemaManager schemaManager, Dn dn, AttributeType... attributeTypes
)
-    {
-        this.schemaManager = schemaManager;
-
-        if ( dn == null )
-        {
-            this.dn = Dn.EMPTY_DN;
-        }
-        else
-        {
-            this.dn = dn;
-            normalizeDN( this.dn );
-        }
-
-        // Initialize the ObjectClass object
-        initObjectClassAT();
-
-        // Add the attributeTypes
-        set( attributeTypes );
-    }
-
-
-    /**
-     * <p>
-     * Creates a new instance of DefaultEntry, with a
-     * Dn, an attributeType with the user provided ID, and schema aware.
-     * </p>
-     * <p>
-     * The newly created entry is fed with the given attributeType. No
-     * values are associated with this attributeType.
-     * </p>
-     * <p>
-     * If the AttributeType does not exist, they it's simply discarded.
-     * </p>
-     * <p>
-     * We also check that the normalized upID equals the AttributeType ID
-     * </p>
-     *
-     * @param schemaManager The reference to the schemaManager
-     * @param dn The Dn for this serverEntry. Can be null.
-     * @param attributeType The attribute to create, without value.
-     * @param upId The User Provided ID fro this AttributeType
-     */
-    public DefaultEntry( SchemaManager schemaManager, Dn dn, AttributeType attributeType,
String upId )
-    {
-        this.schemaManager = schemaManager;
-
-        if ( dn == null )
-        {
-            this.dn = Dn.EMPTY_DN;
-        }
-        else
-        {
-            this.dn = dn;
-            normalizeDN( dn );
-        }
-
-        // Initialize the ObjectClass object
-        initObjectClassAT();
-        set( attributeType );
-        set( upId );
-    }
-
-
     //-------------------------------------------------------------------------
     // Helper methods
     //-------------------------------------------------------------------------

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java?rev=1089163&r1=1089162&r2=1089163&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java
Tue Apr  5 19:14:27 2011
@@ -144,22 +144,6 @@ public interface Entry extends Cloneable
 
 
     /**
-     * <p>
-     * Put some new attributes using the attributeTypes. 
-     * No value is inserted. 
-     * </p>
-     * <p>
-     * If an existing Attribute is found, it will be replaced by an
-     * empty attribute, and returned to the caller.
-     * </p>
-     * 
-     * @param attributeTypes The AttributeTypes to add.
-     * @return A list of replaced Attributes, of <code>null</code> if no attribute
are removed.
-     */
-    List<Attribute> set( AttributeType... attributeTypes );
-
-
-    /**
      * Set this entry's Dn.
      *
      * @param dn The Dn associated with this entry



Mime
View raw message