directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1087153 - in /directory: apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/ shared/trunk/ldap/model/src/test/java/org/apache/dir...
Date Thu, 31 Mar 2011 00:44:55 GMT
Author: elecharny
Date: Thu Mar 31 00:44:54 2011
New Revision: 1087153

URL: http://svn.apache.org/viewvc?rev=1087153&view=rev
Log:
Removed the setHR() method

Modified:
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttribute.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttributeTest.java
    directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java?rev=1087153&r1=1087152&r2=1087153&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java
(original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java
Thu Mar 31 00:44:54 2011
@@ -998,8 +998,6 @@ public class SchemaAwareEntryAttributeTe
         attr2.add( "c", "b", "a" );
         assertTrue( attr1.equals( attr2 ) );
 
-        attr1.setHR( true );
-        attr2.setHR( false );
         assertTrue( attr1.equals( attr2 ) );
 
         EntryAttribute attr3 = new DefaultEntryAttribute( atPwd );
@@ -1193,7 +1191,6 @@ public class SchemaAwareEntryAttributeTe
 
         EntryAttribute attr6 = new DefaultEntryAttribute( atPwd );
 
-        attr6.setHR( true );
         assertFalse( attr6.isHumanReadable() );
         nbAdded = attr6.add( BYTES1, ( byte[] ) null );
         assertEquals( 2, nbAdded );
@@ -1342,9 +1339,6 @@ public class SchemaAwareEntryAttributeTe
 
         assertFalse( attr1.remove( STR_VALUE1 ) );
 
-        attr1.setHR( true );
-        assertFalse( attr1.remove( STR_VALUE1 ) );
-
         attr1.add( "a", "b", "c" );
         assertTrue( attr1.remove( STR_VALUE1 ) );
         assertEquals( 2, attr1.size() );
@@ -1374,9 +1368,6 @@ public class SchemaAwareEntryAttributeTe
 
         assertFalse( attr2.remove( BIN_VALUE1 ) );
 
-        attr2.setHR( true );
-        assertFalse( attr2.remove( BIN_VALUE1 ) );
-
         attr2.add( BYTES1, BYTES2, BYTES3 );
         assertTrue( attr2.remove( BIN_VALUE1 ) );
         assertEquals( 2, attr2.size() );
@@ -1446,9 +1437,6 @@ public class SchemaAwareEntryAttributeTe
 
         assertFalse( attr1.remove( "a" ) );
 
-        attr1.setHR( true );
-        assertFalse( attr1.remove( "a" ) );
-
         attr1.add( "a", "b", "c" );
         assertTrue( attr1.remove( "a" ) );
         assertEquals( 2, attr1.size() );
@@ -2069,7 +2057,6 @@ public class SchemaAwareEntryAttributeTe
     public void testSerializeCompleteAttribute() throws LdapException, IOException, ClassNotFoundException
     {
         DefaultEntryAttribute dsa = new DefaultEntryAttribute( atCN );
-        dsa.setHR( true );
         dsa.setUpId( "CommonName" );
         dsa.add( "test1", "test2" );
 
@@ -2090,7 +2077,6 @@ public class SchemaAwareEntryAttributeTe
     public void testSerializeAttributeWithNoValue() throws LdapException, IOException, ClassNotFoundException
     {
         DefaultEntryAttribute dsa = new DefaultEntryAttribute( atCN );
-        dsa.setHR( true );
         dsa.setUpId( "cn" );
 
         DefaultEntryAttribute dsaSer = deserializeValue( serializeValue( dsa ), atCN );
@@ -2109,7 +2095,6 @@ public class SchemaAwareEntryAttributeTe
     public void testSerializeAttributeNullValue() throws LdapException, IOException, ClassNotFoundException
     {
         DefaultEntryAttribute dsa = new DefaultEntryAttribute( atDC );
-        dsa.setHR( true );
         dsa.setUpId( "DomainComponent" );
         dsa.add( ( String ) null );
 
@@ -2131,7 +2116,6 @@ public class SchemaAwareEntryAttributeTe
     public void testSerializeAttributeBinaryValue() throws LdapException, IOException, ClassNotFoundException
     {
         DefaultEntryAttribute dsa = new DefaultEntryAttribute( atPwd );
-        dsa.setHR( false );
         byte[] password = Strings.getBytesUtf8("secret");
         dsa.add( password );
 

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java?rev=1087153&r1=1087152&r2=1087153&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
Thu Mar 31 00:44:54 2011
@@ -542,27 +542,6 @@ public class DefaultEntryAttribute imple
 
 
     /**
-     * <p>
-     * Set the attribute to Human Readable or to Binary. 
-     * </p>
-     * @param isHR <code>true</code> for a Human Readable attribute, 
-     * <code>false</code> for a Binary attribute.
-     */
-    public void setHR( boolean isHR )
-    {
-        //TODO : deal with the values, we may have to convert them.
-
-        if ( attributeType == null )
-        {
-            this.isHR = isHR;
-            
-            // Compute the hashCode
-            rehash();
-        }
-    }
-
-    
-    /**
      * Get's the user provided identifier for this entry.  This is the value
      * that will be used as the identifier for the attribute within the
      * entry.  If this is a commonName attribute for example and the user

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttribute.java?rev=1087153&r1=1087152&r2=1087153&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttribute.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttribute.java
Thu Mar 31 00:44:54 2011
@@ -411,16 +411,6 @@ public interface EntryAttribute extends 
 
     
     /**
-     * <p>
-     * Set the attribute to Human Readable or to Binary. 
-     * </p>
-     * @param isHR <code>true</code> for a Human Readable attribute, 
-     * <code>false</code> for a Binary attribute.
-     */
-    void setHR( boolean isHR );
-
-    
-    /**
      * Set the user provided ID. It will also set the ID, normalizing
      * the upId (removing spaces before and after, and lower casing it)
      *

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttributeTest.java?rev=1087153&r1=1087152&r2=1087153&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttributeTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttributeTest.java
Thu Mar 31 00:44:54 2011
@@ -615,12 +615,11 @@ public class DefaultEntryAttributeTest
 
         EntryAttribute attr6 = new DefaultEntryAttribute( "test" );
         
-        attr6.setHR( false );
         nbAdded = attr6.add( "a", (String)null );
         assertEquals( 2, nbAdded );
-        assertFalse( attr6.isHumanReadable() );
-        assertTrue( attr6.contains( new byte[]{'a'} ) );
-        assertTrue( attr6.contains( (byte[])null ) );
+        assertTrue( attr6.isHumanReadable() );
+        assertTrue( attr6.contains( "a" ) );
+        assertTrue( attr6.contains( (String)null ) );
         
         EntryAttribute attr7 = new DefaultEntryAttribute( "test" );
         
@@ -682,12 +681,11 @@ public class DefaultEntryAttributeTest
 
         EntryAttribute attr6 = new DefaultEntryAttribute( "test" );
         
-        attr6.setHR( true );
         nbAdded = attr6.add( BYTES1, (byte[])null );
-        assertEquals( 0, nbAdded );
-        assertTrue( attr6.isHumanReadable() );
-        assertFalse( attr6.contains( "ab" ) );
-        assertFalse( attr6.contains( (String)null ) );
+        assertEquals( 2, nbAdded );
+        assertFalse( attr6.isHumanReadable() );
+        assertTrue( attr6.contains( "ab" ) );
+        assertTrue( attr6.contains( (byte[])null ) );
     }
 
 
@@ -976,8 +974,6 @@ public class DefaultEntryAttributeTest
         EntryAttribute attr1 = new DefaultEntryAttribute( "test" );
 
         assertFalse( attr1.remove( STR_VALUE1 ) );
-
-        attr1.setHR( true );
         assertFalse( attr1.remove( STR_VALUE1 ) );
         
         attr1.add( "a", "b", "c" );
@@ -1008,16 +1004,13 @@ public class DefaultEntryAttributeTest
         EntryAttribute attr2 = new DefaultEntryAttribute( "test" );
 
         assertFalse( attr2.remove( BIN_VALUE1 ) );
-
-        attr2.setHR( true );
-        assertFalse( attr2.remove( BIN_VALUE1 ) );
         
         attr2.clear();
         attr2.add( BYTES1, BYTES2, BYTES3 );
-        assertFalse( attr2.remove( BIN_VALUE1 ) );
-        assertEquals( 0, attr2.size() );
+        assertTrue( attr2.remove( BIN_VALUE1 ) );
+        assertEquals( 2, attr2.size() );
         
-        assertFalse( attr2.remove( BIN_VALUE2, BIN_VALUE3 ) );
+        assertTrue( attr2.remove( BIN_VALUE2, BIN_VALUE3 ) );
         assertEquals( 0, attr2.size() );
         
         assertFalse( attr2.remove( BIN_VALUE4 ) );
@@ -1025,19 +1018,19 @@ public class DefaultEntryAttributeTest
         attr2.clear();
         attr2.add( BYTES1, BYTES2, BYTES3 );
         assertFalse( attr2.remove( BIN_VALUE2, STR_VALUE4 ) );
-        assertEquals( 0, attr2.size() );
+        assertEquals( 2, attr2.size() );
         
         attr2.clear();
         attr2.add( BYTES1, (byte[])null, BYTES3 );
         assertFalse( attr2.remove( NULL_STRING_VALUE, BIN_VALUE1 ) );
-        assertEquals( 0, attr2.size() );
+        assertEquals( 2, attr2.size() );
         
         attr2.clear();
         attr2.add( BYTES1, (byte[])null, BYTES2 );
         attr2.add( "c" );
-        assertEquals( 1, attr2.size() );
+        assertEquals( 4, attr2.size() );
         assertFalse( attr2.remove( NULL_STRING_VALUE, BIN_VALUE1, STR_VALUE3 ) );
-        assertEquals( 0, attr2.size() );
+        assertEquals( 3, attr2.size() );
     }
 
 
@@ -1050,9 +1043,6 @@ public class DefaultEntryAttributeTest
         EntryAttribute attr1 = new DefaultEntryAttribute( "test" );
 
         assertFalse( attr1.remove( BYTES1 ) );
-
-        attr1.setHR( false );
-        assertFalse( attr1.remove( BYTES1 ) );
         
         attr1.add( BYTES1, BYTES2, BYTES3 );
         assertTrue( attr1.remove( BYTES1 ) );
@@ -1092,9 +1082,6 @@ public class DefaultEntryAttributeTest
         EntryAttribute attr1 = new DefaultEntryAttribute( "test" );
 
         assertFalse( attr1.remove( "a" ) );
-
-        attr1.setHR( true );
-        assertFalse( attr1.remove( "a" ) );
         
         attr1.add( "a", "b", "c" );
         assertTrue( attr1.remove( "a" ) );
@@ -1174,12 +1161,11 @@ public class DefaultEntryAttributeTest
 
         EntryAttribute attr6 = new DefaultEntryAttribute( "test" );
         
-        attr6.setHR( false );
         nbAdded = attr6.add( "a", (String)null );
         assertEquals( 2, nbAdded );
-        assertFalse( attr6.isHumanReadable() );
-        assertTrue( attr6.contains( new byte[]{'a'} ) );
-        assertTrue( attr6.contains( (byte[])null ) );
+        assertTrue( attr6.isHumanReadable() );
+        assertTrue( attr6.contains( "a" ) );
+        assertTrue( attr6.contains( (String)null ) );
     }
 
 
@@ -1236,12 +1222,11 @@ public class DefaultEntryAttributeTest
 
         EntryAttribute attr6 = new DefaultEntryAttribute( "test" );
         
-        attr6.setHR( true );
         nbAdded = attr6.add( BYTES1, (byte[])null );
-        assertEquals( 0, nbAdded );
-        assertTrue( attr6.isHumanReadable() );
-        assertFalse( attr6.contains( "ab" ) );
-        assertFalse( attr6.contains( (String)null ) );
+        assertEquals( 2, nbAdded );
+        assertFalse( attr6.isHumanReadable() );
+        assertTrue( attr6.contains( "ab" ) );
+        assertTrue( attr6.contains( (byte[])null ) );
     }
 
 
@@ -1338,12 +1323,6 @@ public class DefaultEntryAttributeTest
     {
         EntryAttribute attr = new DefaultEntryAttribute();
         assertEquals( 37, attr.hashCode() );
-        
-        attr.setHR( true );
-        assertEquals( 37*17 + 1231, attr.hashCode() );
-        
-        attr.setHR(  false );
-        assertEquals( 37*17 + 1237, attr.hashCode() );
 
         EntryAttribute attr1 = new DefaultEntryAttribute( "test" );
         EntryAttribute attr2 = new DefaultEntryAttribute( "test" );
@@ -1420,9 +1399,7 @@ public class DefaultEntryAttributeTest
         attr2.add( "c", "b", "a" );
         assertTrue( attr1.equals( attr2 ) );
         
-        attr1.setHR( true );
-        attr2.setHR( false );
-        assertFalse( attr1.equals( attr2 ) );
+        assertTrue( attr1.equals( attr2 ) );
         
         EntryAttribute attr3 = new DefaultEntryAttribute( "test" );
         EntryAttribute attr4 = new DefaultEntryAttribute( "test" );
@@ -1478,9 +1455,6 @@ public class DefaultEntryAttributeTest
         
         clone = attr.clone();
         assertEquals( attr, clone );
-
-        attr.setHR( false );
-        assertNotSame( attr, clone );
     }
     
     
@@ -1491,7 +1465,6 @@ public class DefaultEntryAttributeTest
     public void testSerializeCompleteAttribute() throws LdapException, IOException, ClassNotFoundException
     {
         DefaultEntryAttribute dca = new DefaultEntryAttribute( "CommonName" );
-        dca.setHR( true );
         dca.setUpId( "CN" );
         dca.add( "test1", "test2" );
 
@@ -1512,7 +1485,6 @@ public class DefaultEntryAttributeTest
     public void testSerializeAttributeWithNoValue() throws LdapException, IOException, ClassNotFoundException
     {
         DefaultEntryAttribute dca = new DefaultEntryAttribute( "CommonName" );
-        dca.setHR( true );
         dca.setUpId( "CN" );
 
         DefaultEntryAttribute dcaSer = deserializeValue( serializeValue( dca ) );
@@ -1520,7 +1492,7 @@ public class DefaultEntryAttributeTest
         assertEquals( "cn", dcaSer.getId() );
         assertEquals( "CN", dcaSer.getUpId() );
         assertEquals( 0, dcaSer.size() );
-        assertTrue( dcaSer.isHumanReadable() );
+        assertFalse( dcaSer.isHumanReadable() );
     }
     
     
@@ -1531,7 +1503,6 @@ public class DefaultEntryAttributeTest
     public void testSerializeAttributeNullValue() throws LdapException, IOException, ClassNotFoundException
     {
         DefaultEntryAttribute dca = new DefaultEntryAttribute( "CommonName" );
-        dca.setHR( true );
         dca.setUpId( "CN" );
         dca.add( (String)null );
 
@@ -1553,7 +1524,6 @@ public class DefaultEntryAttributeTest
     public void testSerializeAttributeBinaryValue() throws LdapException, IOException, ClassNotFoundException
     {
         DefaultEntryAttribute dca = new DefaultEntryAttribute( "UserPassword" );
-        dca.setHR( false );
         byte[] password = Strings.getBytesUtf8("secret");
         dca.add( password );
 

Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java?rev=1087153&r1=1087152&r2=1087153&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java
(original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java
Thu Mar 31 00:44:54 2011
@@ -904,7 +904,6 @@ public class SchemaEntityFactory impleme
 
         if ( ( mSyntax != null ) && ( mSyntax.get() != null ) )
         {
-            mSyntax.setHR( true );
             attributeType.setSyntaxOid( mSyntax.getString() );
         }
 
@@ -913,7 +912,6 @@ public class SchemaEntityFactory impleme
 
         if ( mSyntaxLength != null )
         {
-            mSyntaxLength.setHR( true );
             attributeType.setSyntaxLength( Integer.parseInt( mSyntaxLength.getString() )
);
         }
 
@@ -922,7 +920,6 @@ public class SchemaEntityFactory impleme
 
         if ( mEquality != null )
         {
-            mEquality.setHR( true );
             attributeType.setEqualityOid( mEquality.getString() );
         }
 
@@ -931,7 +928,6 @@ public class SchemaEntityFactory impleme
 
         if ( mOrdering != null )
         {
-            mOrdering.setHR( true );
             attributeType.setOrderingOid( mOrdering.getString() );
         }
 
@@ -940,7 +936,6 @@ public class SchemaEntityFactory impleme
 
         if ( mSubstr != null )
         {
-            mSubstr.setHR( true );
             attributeType.setSubstringOid( mSubstr.getString() );
         }
 
@@ -949,7 +944,6 @@ public class SchemaEntityFactory impleme
         // Sup
         if ( mSupAttributeType != null )
         {
-            mSupAttributeType.setHR( true );
             attributeType.setSuperiorOid( mSupAttributeType.getString() );
         }
 
@@ -958,7 +952,6 @@ public class SchemaEntityFactory impleme
 
         if ( mCollective != null )
         {
-            mCollective.setHR( true );
             String val = mCollective.getString();
             attributeType.setCollective( val.equalsIgnoreCase( "TRUE" ) );
         }
@@ -968,7 +961,6 @@ public class SchemaEntityFactory impleme
 
         if ( mSingleValued != null )
         {
-            mSingleValued.setHR( true );
             String val = mSingleValued.getString();
             attributeType.setSingleValued( val.equalsIgnoreCase( "TRUE" ) );
         }
@@ -978,7 +970,6 @@ public class SchemaEntityFactory impleme
 
         if ( mNoUserModification != null )
         {
-            mNoUserModification.setHR( true );
             String val = mNoUserModification.getString();
             attributeType.setUserModifiable( !val.equalsIgnoreCase( "TRUE" ) );
         }
@@ -988,7 +979,6 @@ public class SchemaEntityFactory impleme
 
         if ( mUsage != null )
         {
-            mUsage.setHR( true );
             attributeType.setUsage( UsageEnum.getUsage( mUsage.getString() ) );
         }
 
@@ -1079,7 +1069,6 @@ public class SchemaEntityFactory impleme
 
         if ( mObsolete != null )
         {
-            mObsolete.setHR( true );
             String val = mObsolete.getString();
             schemaObject.setObsolete( val.equalsIgnoreCase( "TRUE" ) );
         }
@@ -1089,7 +1078,6 @@ public class SchemaEntityFactory impleme
 
         if ( mDescription != null )
         {
-            mDescription.setHR( true );
             schemaObject.setDescription( mDescription.getString() );
         }
 
@@ -1098,7 +1086,6 @@ public class SchemaEntityFactory impleme
 
         if ( names != null )
         {
-            names.setHR( true );
             List<String> values = new ArrayList<String>();
 
             for ( Value<?> name : names )
@@ -1116,7 +1103,6 @@ public class SchemaEntityFactory impleme
         // Otherwise, inherit it from the schema
         if ( mDisabled != null )
         {
-            mDisabled.setHR( true );
             String val = mDisabled.getString();
             schemaObject.setEnabled( !val.equalsIgnoreCase( "TRUE" ) );
         }
@@ -1130,7 +1116,6 @@ public class SchemaEntityFactory impleme
 
         if ( mIsReadOnly != null )
         {
-            mIsReadOnly.setHR( true );
             String val = mIsReadOnly.getString();
             schemaObject.setReadOnly( val.equalsIgnoreCase( "TRUE" ) );
         }



Mime
View raw message