Author: akarasulu Date: Mon Jul 7 12:05:49 2008 New Revision: 674593 URL: http://svn.apache.org/viewvc?rev=674593&view=rev Log: applying test for DIRSERVER-1157: where alias deletion was hung Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169IT.java directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/AddITest.java Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169IT.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169IT.java?rev=674593&r1=674592&r2=674593&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169IT.java (original) +++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169IT.java Mon Jul 7 12:05:49 2008 @@ -23,11 +23,15 @@ import org.apache.directory.server.core.DirectoryService; import org.apache.directory.server.core.integ.CiRunner; import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext; + import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.AttributesImpl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; + +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -86,10 +90,15 @@ user.put( "sn", "Hamilton" ); sysRoot.createSubcontext( "uid=bob,ou=people", user ); + Attributes reloaded = sysRoot.getAttributes( "uid=bob,ou=people" ); + assertNotNull( reloaded ); + assertNotNull( reloaded.get( "objectClass" ) ); + System.out.println( "attributes for bob = " + reloaded ); } @Test + @Ignore public void testSearchResultNameIsRelativeToSearchContext() throws Exception { // @todo replace with ldif tags Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/AddITest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/AddITest.java?rev=674593&r1=674592&r2=674593&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/AddITest.java (original) +++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/AddITest.java Mon Jul 7 12:05:49 2008 @@ -495,4 +495,42 @@ // Remove container ctx.destroySubcontext( containerRdn ); } + + + /** + * Try to add entry and an alias to it. Afterwards, remove it. Taken from + * DIRSERVER-1157 test contribution. + * + * @see https://issues.apache.org/jira/browse/DIRSERVER-1157 + * @throws Exception + */ + public void testAddDeleteAlias() throws Exception + { + // Create entry ou=favorite,dc=example,dc=com + Attributes entry = new AttributesImpl(); + Attribute entryOcls = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT ); + entryOcls.add( SchemaConstants.TOP_OC ); + entryOcls.add( SchemaConstants.ORGANIZATIONAL_UNIT_OC ); + entry.put( entryOcls ); + entry.put( SchemaConstants.OU_AT, "favorite" ); + String entryRdn = "ou=favorite"; + ctx.createSubcontext( entryRdn, entry ); + + // Create Alias ou=bestFruit,dc=example,dc=com to ou=favorite + String aliasedObjectName = entryRdn + "," + ctx.getNameInNamespace(); + Attributes alias = new AttributesImpl(); + Attribute aliasOcls = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT ); + aliasOcls.add( SchemaConstants.TOP_OC ); + aliasOcls.add( SchemaConstants.EXTENSIBLE_OBJECT_OC ); + aliasOcls.add( SchemaConstants.ALIAS_OC ); + alias.put( aliasOcls ); + alias.put( SchemaConstants.OU_AT, "bestFruit" ); + alias.put( SchemaConstants.ALIASED_OBJECT_NAME_AT, aliasedObjectName ); + String rdnAlias = "ou=bestFruit"; + ctx.createSubcontext( rdnAlias, alias ); + + // Remove alias and entry + ctx.destroySubcontext( rdnAlias ); //Waiting for Connection.reply() + ctx.destroySubcontext( entryRdn ); + } }