Index: C:/Daten/Apache/Directory Server/Eclipse Workspace/apacheds/core/src/test/org/apache/ldap/server/jndi/ModifyContextTest.java =================================================================== --- C:/Daten/Apache/Directory Server/Eclipse Workspace/apacheds/core/src/test/org/apache/ldap/server/jndi/ModifyContextTest.java (revision 231199) +++ C:/Daten/Apache/Directory Server/Eclipse Workspace/apacheds/core/src/test/org/apache/ldap/server/jndi/ModifyContextTest.java (working copy) @@ -64,7 +64,24 @@ assertNotNull( attribute ); assertTrue( attribute.contains( "top" ) ); assertTrue( attribute.contains( "organizationalUnit" ) ); + + /* + * create a person + */ + attributes = new BasicAttributes(); + attribute = new BasicAttribute( "objectClass" ); + attribute.add( "top" ); + attribute.add( "person" ); + attributes.put( attribute ); + attributes.put( "cn", "The Person" ); + attributes.put( "sn", "Person" ); + ctx = sysRoot.createSubcontext( "cn=The Person,ou=testing00", attributes ); + + ctx = ( DirContext ) sysRoot.lookup( "cn=The Person,ou=testing00" ); + assertNotNull( ctx ); + + /* * create ou=testing01,ou=system */ @@ -135,6 +152,8 @@ assertNotNull( attribute ); assertTrue( attribute.contains( "top" ) ); assertTrue( attribute.contains( "organizationalUnit" ) ); + + } catch( NamingException e ) { @@ -165,4 +184,27 @@ attributes.get( "modifyTimestamp" ); assertNull( attribute ); } + + public void testModifyPerson() throws NamingException { + Attributes attributes = new BasicAttributes(); + Attribute ocls = new BasicAttribute("objectClass"); + ocls.add("organizationalPerson"); + ocls.add("inetOrgPerson"); + attributes.put(ocls); + + DirContext ctx = ( DirContext ) sysRoot.lookup( "cn=The Person,ou=testing00" ); + assertNotNull(ctx); + + ctx.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, attributes ); + + ctx = ( DirContext ) sysRoot.lookup( "cn=The Person,ou=testing00" ); + attributes = ctx.getAttributes( "" ); + Attribute newOcls = attributes.get( "objectClass"); + + String[] expectedOcls = { "top", "person", "organizationalPerson", "inetOrgPerson"}; + for (int i = 0; i < expectedOcls.length; i++) { + String name = expectedOcls[i]; + assertTrue("object class "+name+" is present", newOcls.contains(name)); + } + } }