You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/12/17 19:39:45 UTC

svn commit: r604961 - /directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java

Author: elecharny
Date: Mon Dec 17 10:39:45 2007
New Revision: 604961

URL: http://svn.apache.org/viewvc?rev=604961&view=rev
Log:
Added a test for the toAttribute() method

Modified:
    directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java

Modified: directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java?rev=604961&r1=604960&r2=604961&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java Mon Dec 17 10:39:45 2007
@@ -25,6 +25,7 @@
 import java.util.Set;
 
 import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
 import javax.naming.directory.InvalidAttributeValueException;
 
 import org.apache.directory.shared.ldap.schema.AbstractAttributeType;
@@ -461,5 +462,24 @@
         
         assertTrue( value instanceof ServerStringValue );
         assertNull( ((ServerStringValue)value).get() );
+    }
+    
+    @Test public void testGetAttribute() throws NamingException
+    {
+        AttributeType at = getIA5StringAttributeType();
+        
+        DefaultServerAttribute attr = new DefaultServerAttribute( at );
+        
+        attr.add( "Test1" );
+        attr.add( "Test2" );
+        attr.add( "Test3" );
+        
+        Attribute attribute = attr.toAttribute();
+        
+        assertEquals( "1.1",attribute.getID() );
+        assertEquals( 3, attribute.size() );
+        assertTrue( attribute.contains( "Test1" ) );
+        assertTrue( attribute.contains( "Test2" ) );
+        assertTrue( attribute.contains( "Test3" ) );
     }
 }