directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r955661 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
Date Thu, 17 Jun 2010 16:11:58 GMT
Author: elecharny
Date: Thu Jun 17 16:11:58 2010
New Revision: 955661

URL: http://svn.apache.org/viewvc?rev=955661&view=rev
Log:
o Switched the changeLog to true
o Added a test 
o Removed commented code

Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java?rev=955661&r1=955660&r2=955661&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
Thu Jun 17 16:11:58 2010
@@ -35,6 +35,7 @@ import javax.naming.directory.BasicAttri
 import javax.naming.directory.DirContext;
 import javax.naming.directory.InvalidAttributeIdentifierException;
 import javax.naming.directory.ModificationItem;
+import javax.naming.directory.SchemaViolationException;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
@@ -55,7 +56,7 @@ import org.junit.runner.RunWith;
  * no values (deletion) causes an error").
  */
 @RunWith ( FrameworkRunner.class ) 
-@CreateDS( enableChangeLog=false, name="ModifyReplaceIT-class" )
+@CreateDS( enableChangeLog=true, name="ModifyReplaceIT-class" )
 @CreateLdapServer ( 
     transports = 
     {
@@ -244,7 +245,6 @@ public class ModifyReplaceIT extends Abs
         DirContext sysRoot = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
         
         String rdn = "cn=Kim Wilde";
-        //ldapServer.getDirectoryService().getPartitions();
 
         Attribute attr = new BasicAttribute( "ou", "test" );
         ModificationItem item = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr
);
@@ -265,8 +265,6 @@ public class ModifyReplaceIT extends Abs
             assertNotNull( ou );
             assertTrue( ou.contains( "test" ) );
         }
-
-        sysRoot.destroySubcontext( rdn );
     }
     
     
@@ -295,4 +293,29 @@ public class ModifyReplaceIT extends Abs
         assertTrue( attr.contains( newValue ) );
         assertEquals( 1, attr.size() );
     }
+    
+    
+    /**
+     * Create a person entry, replace an attribute not present in the ObjectClasses
+     */
+    @Test
+    public void testReplaceAttributeNotInOC() throws Exception
+    {
+        DirContext ctx = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
+        String rdn = "cn=Kate Bush";
+
+        // Replace ou
+        String newValue = "Test";
+        Attributes attrs = new BasicAttributes( "ou", newValue, false );
+        
+        try
+        {
+            ctx.modifyAttributes( rdn, DirContext.REPLACE_ATTRIBUTE, attrs );
+            fail( "Should get a SchemaViolationException" );
+        }
+        catch ( SchemaViolationException sve )
+        {
+            assertTrue( true );
+        }
+    }
 }



Mime
View raw message