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 2009/08/10 20:26:35 UTC

svn commit: r802885 - in /directory/apacheds/trunk: core-integ/src/test/java/org/apache/directory/server/core/jndi/ core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ core-integ/src/test/java/org/apache/directory/server/core/s...

Author: elecharny
Date: Mon Aug 10 18:26:35 2009
New Revision: 802885

URL: http://svn.apache.org/viewvc?rev=802885&view=rev
Log:
Fixed many tests which were failing after the modify fix

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/ModifyContextIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyDelIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceObjectClassChangeHandlingIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyRemoveIT.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/ModifyContextIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/ModifyContextIT.java?rev=802885&r1=802884&r2=802885&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/ModifyContextIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/ModifyContextIT.java Mon Aug 10 18:26:35 2009
@@ -258,7 +258,7 @@
     }
 
     
-    @Test
+    @Test( expected = LdapNoSuchAttributeException.class )
     public void testRemoveNonExistingValue() throws Exception
     {
         createData();
@@ -267,21 +267,5 @@
         Attributes attributes = new BasicAttributes( true );
         attributes.put( "ou", "testCases" );
         sysRoot.modifyAttributes( "ou=testing00", DirContext.REMOVE_ATTRIBUTE, attributes );
-
-        DirContext ctx = ( DirContext ) sysRoot.lookup( "ou=testing00" );
-        attributes = ctx.getAttributes( "" );
-        assertFalse( attributes.get( "ou" ).contains( "testCases" ) );
-
-        Attribute attribute = attributes.get( "creatorsName" );
-        assertNull( attribute );
-
-        attribute = attributes.get( "createTimestamp" );
-        assertNull( attribute );
-
-        attribute = attributes.get( "modifiersName" );
-        assertNull( attribute );
-
-        attributes.get( "modifyTimestamp" );
-        assertNull( attribute );
     }
 }

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyDelIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyDelIT.java?rev=802885&r1=802884&r2=802885&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyDelIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyDelIT.java Mon Aug 10 18:26:35 2009
@@ -29,24 +29,20 @@
 import static org.junit.Assert.assertFalse;
 
 import javax.naming.NamingException;
-import javax.naming.NoPermissionException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
-import javax.naming.directory.NoSuchAttributeException;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.integ.CiRunner;
 import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
-import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
 import org.junit.runner.RunWith;
  
@@ -510,7 +506,7 @@
     /**
      * Delete a value not present in an existing AT
      */
-    @Test
+    @Test( expected = LdapNoSuchAttributeException.class )
     public void testModifyDelExistingEntryValueNotPresentInExistingAT() throws Exception
     {
         LdapContext sysRoot = getSystemContext( service );

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java?rev=802885&r1=802884&r2=802885&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java Mon Aug 10 18:26:35 2009
@@ -377,7 +377,6 @@
         // -------------------------------------------------------------------
         // check add no schema info
         // -------------------------------------------------------------------
-        
         descriptions.clear();
         descriptions.add( "( 1.3.6.1.4.1.18060.0.4.1.0.10002 DESC 'bogus desc' FQCN DummySyntaxChecker BYTECODE " 
             +  getByteCode( "DummySyntaxChecker.bytecode" ) + " )" );

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceObjectClassChangeHandlingIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceObjectClassChangeHandlingIT.java?rev=802885&r1=802884&r2=802885&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceObjectClassChangeHandlingIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceObjectClassChangeHandlingIT.java Mon Aug 10 18:26:35 2009
@@ -71,17 +71,6 @@
     }
 
 
-    public Attributes getModsForIntroducingNewOC() throws NamingException
-    {
-        Attributes changes = new BasicAttributes( true );
-        Attribute objectClass = new BasicAttribute( "objectClass" );
-        objectClass.add( "organizationalPerson" );
-        changes.put( objectClass );
-        changes.put( "ou", "Test Organizational Unit" );
-        return changes;
-    }
-
-
     public Attributes getCollectiveAttributeTestSubentry( String cn )
     {
         Attributes subentry = new BasicAttributes( true );
@@ -135,7 +124,8 @@
         addAdministrativeRoles();
         sysRoot.createSubcontext( "cn=collectiveAttributeTestSubentry",
             getCollectiveAttributeTestSubentry( "collectiveAttributeTestSubentry" ) );
-        sysRoot.createSubcontext( "cn=testEntry", getTestEntry( "testEntry" ) );
+        Attributes entry = getTestEntry( "testEntry" );
+        sysRoot.createSubcontext( "cn=testEntry", entry );
 
         //----------------------------------------------------------------------
 
@@ -147,8 +137,13 @@
         assertNull( collectiveAttributeSubentries );
 
         //----------------------------------------------------------------------
-
-        sysRoot.modifyAttributes( "cn=testEntry", DirContext.ADD_ATTRIBUTE, getModsForIntroducingNewOC() );
+        ModificationItem[] modItems = new ModificationItem[2];
+        Attribute objectClass = new BasicAttribute( "ObjectClass", "organizationalPerson" );
+        modItems[0] = new ModificationItem( DirContext.ADD_ATTRIBUTE, objectClass );
+        Attribute ou = new BasicAttribute( "ou", "Test Organizational Unit" );
+        modItems[1] = new ModificationItem( DirContext.ADD_ATTRIBUTE, ou );
+        
+        sysRoot.modifyAttributes( "cn=testEntry", modItems );
 
         results = getAllEntries();
         testEntry = ( Attributes ) results.get( "cn=testEntry,ou=system" );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyRemoveIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyRemoveIT.java?rev=802885&r1=802884&r2=802885&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyRemoveIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyRemoveIT.java Mon Aug 10 18:26:35 2009
@@ -179,7 +179,16 @@
         
         // Now test remove of value ( bar ) that does not exist in cn
         mod = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, new BasicAttribute( "cn", "bar" ) );
-        ctx.modifyAttributes( RDN, new ModificationItem[] { mod } );
+        try
+        {
+            ctx.modifyAttributes( RDN, new ModificationItem[] { mod } );
+            fail();
+        }
+        catch ( NoSuchAttributeException nsae )
+        {
+            assertTrue( true );
+        }
+        
         tori = ctx.getAttributes( RDN );
         assertNotNull( tori.get( "objectClass" ) );
         assertNotNull( tori.get( "cn" ) );
@@ -387,10 +396,16 @@
         Attributes attrs2 = new BasicAttributes( true );
         attrs2.put( attr2 );
     
-        ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs2 );
-        
-        // We shopuld not get an exception
-        assertTrue( true );
+        try
+        {
+            ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs2 );
+            // We should get an exception
+            fail();
+        }
+        catch( NoSuchAttributeException nsae )
+        {
+            assertTrue( true );
+        }
     }