directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1087236 - in /directory/shared/trunk: dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/modifyRequest/ ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/modify/ ldap/codec/standalone/src/test/java/org/apache/d...
Date Thu, 31 Mar 2011 10:12:36 GMT
Author: elecharny
Date: Thu Mar 31 10:12:36 2011
New Revision: 1087236

URL: http://svn.apache.org/viewvc?rev=1087236&view=rev
Log:
Removed the useless get( int ) method

Modified:
    directory/shared/trunk/dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/modifyRequest/ModifyRequestTest.java
    directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
    directory/shared/trunk/ldap/codec/standalone/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
    directory/shared/trunk/ldap/extras/aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/AttributeValueItem.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

Modified: directory/shared/trunk/dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/modifyRequest/ModifyRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/modifyRequest/ModifyRequestTest.java?rev=1087236&r1=1087235&r2=1087236&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/modifyRequest/ModifyRequestTest.java
(original)
+++ directory/shared/trunk/dsml/parser/src/test/java/org/apache/directory/shared/dsmlv2/modifyRequest/ModifyRequestTest.java
Thu Mar 31 10:12:36 2011
@@ -313,7 +313,7 @@ public class ModifyRequestTest extends A
         EntryAttribute attribute = modification.getAttribute();
 
         assertEquals( "directreport", attribute.getId() );
-        assertEquals( "CN=John Smith, DC=microsoft, DC=com", attribute.get( 0 ).getString()
);
+        assertEquals( "CN=John Smith, DC=microsoft, DC=com", attribute.get().getString()
);
     }
 
 
@@ -357,7 +357,7 @@ public class ModifyRequestTest extends A
                 'a', 'r', 'n', 'y', ',', ' ', 'o', 'u', '=', 'p', 'e', 'o', 'p', 'l', 'e',
',', ' ', 'd', 'c', '=',
                 'e', 'x', 'a', 'm', 'p', 'l', 'e', ',', ' ', 'd', 'c', '=', 'c', 'o', 'm'
}, "UTF-8" );
 
-        assertEquals( expected, attribute.get( 0 ).getString() );
+        assertEquals( expected, attribute.get().getString() );
     }
 
 
@@ -396,7 +396,7 @@ public class ModifyRequestTest extends A
         EntryAttribute attribute = modification.getAttribute();
         assertEquals( "directreport", attribute.getId() );
 
-        assertEquals( "CN=John Smith, DC=microsoft, DC=com", attribute.get( 0 ).getString()
);
+        assertEquals( "CN=John Smith, DC=microsoft, DC=com", attribute.get().getString()
);
 
         modification = iter.next();
 
@@ -405,7 +405,7 @@ public class ModifyRequestTest extends A
         assertEquals( "sn", attribute.getId() );
         assertEquals( ModificationOperation.REPLACE_ATTRIBUTE, modification.getOperation()
);
 
-        assertEquals( "CN=Steve Jobs, DC=apple, DC=com", attribute.get( 0 ).getString() );
+        assertEquals( "CN=Steve Jobs, DC=apple, DC=com", attribute.get().getString() );
     }
 
 
@@ -610,8 +610,9 @@ public class ModifyRequestTest extends A
         assertEquals( "directreport", attribute.getId() );
 
         assertEquals( 2, attribute.size() );
-        assertEquals( "CN=John Smith, DC=microsoft, DC=com", attribute.get( 0 ).getString()
);
-        assertEquals( "CN=Steve Jobs, DC=apple, DC=com", attribute.get( 1 ).getString() );
+        
+        assertTrue( attribute.contains( "CN=John Smith, DC=microsoft, DC=com" ) );
+        assertTrue( attribute.contains( "CN=Steve Jobs, DC=apple, DC=com" ) );
     }
 
 
@@ -650,7 +651,7 @@ public class ModifyRequestTest extends A
         assertEquals( "directreport", attribute.getId() );
 
         assertEquals( 1, attribute.size() );
-        assertEquals( "", attribute.get( 0 ).getString() );
+        assertEquals( "", attribute.get().getString() );
     }
 
 

Modified: directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java?rev=1087236&r1=1087235&r2=1087236&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
(original)
+++ directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
Thu Mar 31 10:12:36 2011
@@ -570,18 +570,15 @@ public class ModifyRequestTest extends A
 
         assertEquals( "l", attributeValue.getUpId().toLowerCase() );
 
-        String attrValue = attributeValue.getString();
-        assertEquals( "Paris", attrValue );
-
-        attrValue = attributeValue.get( 1 ).getString();
-        assertEquals( "London", attrValue );
+        assertTrue( attributeValue.contains( "Paris" ) );
+        assertTrue( attributeValue.contains( "London" ) );
 
         modification = ( Modification ) modifications[1];
         attributeValue = modification.getAttribute();
 
         assertEquals( "attrs", attributeValue.getUpId().toLowerCase() );
 
-        attrValue = attributeValue.getString();
+        String attrValue = attributeValue.getString();
         assertEquals( "test", attrValue );
 
         // Check the encoding
@@ -1281,11 +1278,8 @@ public class ModifyRequestTest extends A
         assertEquals( "l", attributeValue.getUpId().toLowerCase() );
         assertEquals( 2, attributeValue.size() );
 
-        String attrValue = attributeValue.getString();
-        assertEquals( "a", attrValue );
-
-        attrValue = attributeValue.get( 1 ).getString();
-        assertEquals( "b", attrValue );
+        assertTrue( attributeValue.contains( "a" ) );
+        assertTrue( attributeValue.contains( "b" ) );
 
         // Check the encoding
         try

Modified: directory/shared/trunk/ldap/codec/standalone/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/standalone/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java?rev=1087236&r1=1087235&r2=1087236&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/standalone/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
(original)
+++ directory/shared/trunk/ldap/codec/standalone/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
Thu Mar 31 10:12:36 2011
@@ -570,19 +570,15 @@ public class ModifyRequestTest extends A
 
         assertEquals( "l", attributeValue.getUpId().toLowerCase() );
 
-        String attrValue = attributeValue.getString();
-        assertEquals( "Paris", attrValue );
-
-        attrValue = attributeValue.get( 1 ).getString();
-        assertEquals( "London", attrValue );
+        assertTrue( attributeValue.contains( "Paris" ) );
+        assertTrue( attributeValue.contains( "London" ) );
 
         modification = ( Modification ) modifications[1];
         attributeValue = modification.getAttribute();
 
         assertEquals( "attrs", attributeValue.getUpId().toLowerCase() );
 
-        attrValue = attributeValue.getString();
-        assertEquals( "test", attrValue );
+        assertTrue( attributeValue.contains( "test" ) );
 
         // Check the encoding
         try
@@ -1281,11 +1277,7 @@ public class ModifyRequestTest extends A
         assertEquals( "l", attributeValue.getUpId().toLowerCase() );
         assertEquals( 2, attributeValue.size() );
 
-        String attrValue = attributeValue.getString();
-        assertEquals( "a", attrValue );
-
-        attrValue = attributeValue.get( 1 ).getString();
-        assertEquals( "b", attrValue );
+        assertTrue( attributeValue.contains( "a", "b" ) );
 
         // Check the encoding
         try

Modified: directory/shared/trunk/ldap/extras/aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/AttributeValueItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/AttributeValueItem.java?rev=1087236&r1=1087235&r2=1087236&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/AttributeValueItem.java
(original)
+++ directory/shared/trunk/ldap/extras/aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/AttributeValueItem.java
Thu Mar 31 10:12:36 2011
@@ -122,7 +122,7 @@ public class AttributeValueItem extends 
 
             buf.append( attribute.getId() );
             buf.append( '=' );
-            buf.append( attribute.get( 0 ) );
+            buf.append( attribute.get() );
         }
 
         buf.append( " }" );

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=1087236&r1=1087235&r2=1087236&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 10:12:36 2011
@@ -1644,46 +1644,6 @@ public class DefaultEntryAttribute imple
 
 
     /**
-     * <p>
-     * Get the nth value of this attribute. If there is none, 
-     * null is returned.
-     * </p>
-     * <p>
-     * Note : even if we are storing values into a Set, one can assume
-     * the values are ordered following the insertion order.
-     * </p>
-     * <p> 
-     * 
-     * @param i the index  of the value to get
-     *  @return The nth value for this attribute.
-     */
-    public Value<?> get( int i )
-    {
-        if ( values.size() < i )
-        {
-            return null;
-        }
-        else
-        {
-            int n = 0;
-            
-            for ( Value<?> value:values )
-            {
-                if ( n == i )
-                {
-                    return value;
-                }
-                
-                n++;
-            }
-        }
-        
-        // fallback to 
-        return null;
-    }
-    
-    
-    /**
      * Returns an iterator over all the attribute's values.
      * <p>
      * The effect on the returned enumeration of adding or removing values of

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=1087236&r1=1087235&r2=1087236&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 10:12:36 2011
@@ -275,23 +275,6 @@ public interface EntryAttribute extends 
 
     /**
      * <p>
-     * Get the nth value of this attribute. If there is none, 
-     * null is returned.
-     * </p>
-     * <p>
-     * Note : even if we are storing values into a Set, one can assume
-     * the values are ordered following the insertion order.
-     * </p>
-     * <p> 
-     * 
-     * @param i the index  of the value to get
-     *  @return The nth value for this attribute.
-     */
-    Value<?> get( int i );
-    
-    
-    /**
-     * <p>
      * Get the byte[] value, if and only if the value is known to be Binary,
      * otherwise a InvalidAttributeValueException will be thrown
      * </p>



Mime
View raw message