You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/12/04 08:24:43 UTC
svn commit: r600815 - in /directory/apacheds/branches/bigbang:
core-integ/src/test/java/org/apache/directory/server/core/
core-integ/src/test/java/org/apache/directory/server/core/jndi/
core-unit/src/test/java/org/apache/directory/server/core/jndi/
Author: akarasulu
Date: Mon Dec 3 23:24:42 2007
New Revision: 600815
URL: http://svn.apache.org/viewvc?rev=600815&view=rev
Log:
migrated two more tests to use the new framework
Added:
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/AddIT.java
- copied, changed from r600772, directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java
- copied, changed from r600772, directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/CreateContextITest.java
Removed:
directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java
directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/ComparatorNPEBugITest.java
directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/CreateContextITest.java
Modified:
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java?rev=600815&r1=600814&r2=600815&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java Mon Dec 3 23:24:42 2007
@@ -28,6 +28,8 @@
import org.apache.directory.server.core.integ.SetupMode;
import org.apache.directory.server.core.integ.annotations.Mode;
import org.apache.directory.server.core.integ.annotations.Scope;
+import org.apache.directory.server.core.jndi.AddIT;
+import org.apache.directory.server.core.jndi.CreateContextIT;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -44,6 +46,8 @@
CollectiveAttributeServiceIT.class,
ExceptionServiceIT.class,
EventServiceIT.class,
+ AddIT.class,
+ CreateContextIT.class,
PartitionConfigurationIT.class // Leaves the server in a bad state (partition removal is incomplete)
} )
@Scope ( ServiceScope.TESTSUITE )
Copied: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/AddIT.java (from r600772, directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/AddIT.java?p2=directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/AddIT.java&p1=directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java&r1=600772&r2=600815&rev=600815&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/AddIT.java Mon Dec 3 23:24:42 2007
@@ -20,14 +20,21 @@
package org.apache.directory.server.core.jndi;
-import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+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.exception.LdapInvalidAttributeValueException;
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-import javax.naming.directory.Attributes;
import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.ldap.LdapContext;
/**
@@ -36,14 +43,12 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class AddITest extends AbstractAdminTestCase
+@RunWith ( CiRunner.class )
+public class AddIT
{
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
+ public static DirectoryService service;
+
// /**
// * Test that attribute name case is preserved after adding an entry
// * in the case the user added them. This is to test DIRSERVER-832.
@@ -94,9 +99,14 @@
/**
* Test that we can't add an entry with an attribute type not within
* any of the MUST or MAY of any of its objectClasses
+ *
+ * @throws Exception on error
*/
+ @Test
public void testAddAttributesNotInObjectClasses() throws Exception
{
+ LdapContext sysRoot = getSystemContext( service );
+
Attributes attrs = new AttributesImpl( true );
Attribute oc = new AttributeImpl( "ObjectClass", "top" );
Attribute cn = new AttributeImpl( "cn", "kevin Spacey" );
@@ -119,11 +129,17 @@
}
}
+
/**
* Test that we can't add an entry with an attribute with a bad syntax
+ *
+ * @throws Exception on error
*/
+ @Test
public void testAddAttributesBadSyntax() throws Exception
{
+ LdapContext sysRoot = getSystemContext( service );
+
Attributes attrs = new AttributesImpl( true );
Attribute oc = new AttributeImpl( "ObjectClass", "top" );
oc.add( "person" );
Copied: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java (from r600772, directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/CreateContextITest.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java?p2=directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java&p1=directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/CreateContextITest.java&r1=600772&r2=600815&rev=600815&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/CreateContextITest.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java Mon Dec 3 23:24:42 2007
@@ -20,22 +20,26 @@
package org.apache.directory.server.core.jndi;
+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.exception.LdapSchemaViolationException;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.junit.Test;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertNull;
+import org.junit.runner.RunWith;
+
import javax.naming.CompositeName;
import javax.naming.Name;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-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.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.unit.AbstractAdminTestCase;
-import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
+import javax.naming.directory.*;
+import javax.naming.ldap.LdapContext;
/**
@@ -44,8 +48,12 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class CreateContextITest extends AbstractAdminTestCase
+@RunWith ( CiRunner.class )
+public class CreateContextIT
{
+ public static DirectoryService service;
+
+
protected Attributes getPersonAttributes( String sn, String cn )
{
Attributes attrs = new AttributesImpl();
@@ -63,13 +71,17 @@
/**
* DIRSERVER-628: Creation of entry with multivalued RDN leads to wrong
* attribute value.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testMultiValuedRdn() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
String rdn = "cn=Kate Bush+sn=Bush";
- super.sysRoot.createSubcontext( rdn, attrs );
+ sysRoot.createSubcontext( rdn, attrs );
SearchControls sctls = new SearchControls();
sctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -89,16 +101,19 @@
sysRoot.destroySubcontext( rdn );
}
-
-
+
+
/**
* Tests the creation and subsequent read of a new JNDI context under the
* system context root.
*
* @throws javax.naming.NamingException if there are failures
*/
+ @Test
public void testCreateContexts() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
/*
* create ou=testing00,ou=system
*/
@@ -195,8 +210,11 @@
}
+ @Test
public void testFailCreateExisting() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
Attribute attribute;
Attributes attributes;
DirContext ctx = null;
@@ -249,8 +267,11 @@
}
+ @Test
public void testCreateContextWithCompositeName() throws Exception
{
+ LdapContext sysRoot = getSystemContext( service );
+
Attributes attrs = new AttributesImpl( true );
Attribute objclass = new AttributeImpl( "objectClass" );
objclass.add( "top" );
@@ -263,14 +284,18 @@
sysRoot.createSubcontext( relativeName, attrs );//Fails!
}
+
/**
* Tests the creation and subsequent read of a new JNDI context under the
* system context root.
*
* @throws javax.naming.NamingException if there are failures
*/
+ @Test
public void testCreateContextWithBasicAttributesCaseSensitive() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
/*
* create ou=testing00,ou=system
*/
@@ -366,8 +391,12 @@
assertTrue( attribute.contains( "organizationalUnit" ) );
}
+
+ @Test
public void testCreateContextWithNoObjectClass() throws Exception
{
+ LdapContext sysRoot = getSystemContext( service );
+
Attributes attrs = new AttributesImpl( true );
try
@@ -381,8 +410,12 @@
}
}
+
+ @Test
public void testCreateJavaContainer() throws Exception
{
+ LdapContext sysRoot = getSystemContext( service );
+
DirContext ctx = (DirContext)sysRoot.createSubcontext( "cn=subtest" );
assertNotNull( ctx );
@@ -395,9 +428,13 @@
assertTrue( attribute.contains( "top" ) );
assertTrue( attribute.contains( "javaContainer" ) );
}
-
+
+
+ @Test
public void testCreateJavaContainerBadRDN() throws Exception
{
+ LdapContext sysRoot = getSystemContext( service );
+
try
{
sysRoot.createSubcontext( "ou=subtest" );