directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r894275 - in /directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core: jndi/CreateContextIT.java jndi/DestroyContextIT.java suites/StockCoreISuite.java suites/StockCoreISuite2.java
Date Mon, 28 Dec 2009 23:30:39 GMT
Author: elecharny
Date: Mon Dec 28 23:30:38 2009
New Revision: 894275

URL: http://svn.apache.org/viewvc?rev=894275&view=rev
Log:
Migrated some more tests to the new framework

Modified:
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/DestroyContextIT.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite2.java

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java?rev=894275&r1=894274&r2=894275&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java
Mon Dec 28 23:30:38 2009
@@ -20,17 +20,12 @@
 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.junit.Test;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 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;
@@ -45,6 +40,13 @@
 import javax.naming.directory.SearchResult;
 import javax.naming.ldap.LdapContext;
 
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 
 /**
  * Tests the creation of contexts in various ways.
@@ -52,21 +54,16 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-@RunWith ( CiRunner.class )
-public class CreateContextIT
+@RunWith ( FrameworkRunner.class )
+public class CreateContextIT extends AbstractTestUnit
 {
-    public static DirectoryService service;
-
-
-    protected Attributes getPersonAttributes( String sn, String cn )
+    protected Attributes getPersonAttributes( String sn, String cn ) throws Exception
     {
-        Attributes attrs = new BasicAttributes( true );
-        Attribute ocls = new BasicAttribute( "objectClass" );
-        ocls.add( "top" );
-        ocls.add( "person" );
-        attrs.put( ocls );
-        attrs.put( "cn", cn );
-        attrs.put( "sn", sn );
+        Attributes attrs = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass: person",
+            "cn", cn,
+            "sn", sn );
 
         return attrs;
     }

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/DestroyContextIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/DestroyContextIT.java?rev=894275&r1=894274&r2=894275&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/DestroyContextIT.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/DestroyContextIT.java
Mon Dec 28 23:30:38 2009
@@ -20,25 +20,20 @@
 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.LdapNameNotFoundException;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 
 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.ldap.LdapContext;
 
+import org.apache.directory.server.core.annotations.ApplyLdifs;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 
 /**
  * Tests the destroyContext methods of the provider.
@@ -46,117 +41,30 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-@RunWith ( CiRunner.class )
-public class DestroyContextIT
+@RunWith ( FrameworkRunner.class )
+@ApplyLdifs({
+    "dn: ou=testing00,ou=system\n" +
+    "objectclass: top\n" +
+    "objectclass: organizationalUnit\n" +
+    "ou: testing00\n" +
+    "\n" +
+    "dn: ou=testing01,ou=system\n" +
+    "objectclass: top\n" +
+    "objectclass: organizationalUnit\n" +
+    "ou: testing01\n" +
+    "\n" +
+    "dn: ou=testing02,ou=system\n" +
+    "objectclass: top\n" +
+    "objectclass: organizationalUnit\n" +
+    "ou: testing02\n" +
+    "\n" +
+    "dn: ou=subtest,ou=testing01,ou=system\n" +
+    "objectclass: top\n" +
+    "objectclass: organizationalUnit\n" +
+    "ou: subtest\n"
+})
+public class DestroyContextIT extends AbstractTestUnit
 {
-    public static DirectoryService service;
-
-    
-    /**
-     * @todo Replace this with an LDIF directive!!!!!!
-     *
-     * @throws NamingException on error
-     */
-    public void createEntries() throws Exception
-    {
-        LdapContext sysRoot = getSystemContext( service );
-
-        /*
-         * create ou=testing00,ou=system
-         */
-        Attributes attributes = new BasicAttributes( true );
-        Attribute attribute = new BasicAttribute( "objectClass" );
-        attribute.add( "top" );
-        attribute.add( "organizationalUnit" );
-        attributes.put( attribute );
-        attributes.put( "ou", "testing00" );
-        DirContext ctx = sysRoot.createSubcontext( "ou=testing00", attributes );
-        assertNotNull( ctx );
-
-        ctx = ( DirContext ) sysRoot.lookup( "ou=testing00" );
-        assertNotNull( ctx );
-
-        attributes = ctx.getAttributes( "" );
-        assertNotNull( attributes );
-        assertEquals( "testing00", attributes.get( "ou" ).get() );
-        attribute = attributes.get( "objectClass" );
-        assertNotNull( attribute );
-        assertTrue( attribute.contains( "top" ) );
-        assertTrue( attribute.contains( "organizationalUnit" ) );
-
-        /*
-         * create ou=testing01,ou=system
-         */
-        attributes = new BasicAttributes( true );
-        attribute = new BasicAttribute( "objectClass" );
-        attribute.add( "top" );
-        attribute.add( "organizationalUnit" );
-        attributes.put( attribute );
-        attributes.put( "ou", "testing01" );
-        ctx = sysRoot.createSubcontext( "ou=testing01", attributes );
-        assertNotNull( ctx );
-
-        ctx = ( DirContext ) sysRoot.lookup( "ou=testing01" );
-        assertNotNull( ctx );
-
-        attributes = ctx.getAttributes( "" );
-        assertNotNull( attributes );
-        assertEquals( "testing01", attributes.get( "ou" ).get() );
-        attribute = attributes.get( "objectClass" );
-        assertNotNull( attribute );
-        assertTrue( attribute.contains( "top" ) );
-        assertTrue( attribute.contains( "organizationalUnit" ) );
-
-        /*
-         * create ou=testing02,ou=system
-         */
-        attributes = new BasicAttributes( true );
-        attribute = new BasicAttribute( "objectClass" );
-        attribute.add( "top" );
-        attribute.add( "organizationalUnit" );
-        attributes.put( attribute );
-        attributes.put( "ou", "testing02" );
-        ctx = sysRoot.createSubcontext( "ou=testing02", attributes );
-        assertNotNull( ctx );
-
-        ctx = ( DirContext ) sysRoot.lookup( "ou=testing02" );
-        assertNotNull( ctx );
-
-        attributes = ctx.getAttributes( "" );
-        assertNotNull( attributes );
-        assertEquals( "testing02", attributes.get( "ou" ).get() );
-        attribute = attributes.get( "objectClass" );
-        assertNotNull( attribute );
-        assertTrue( attribute.contains( "top" ) );
-        assertTrue( attribute.contains( "organizationalUnit" ) );
-
-        /*
-         * create ou=subtest,ou=testing01,ou=system
-         */
-        ctx = ( DirContext ) sysRoot.lookup( "ou=testing01" );
-
-        attributes = new BasicAttributes( true );
-        attribute = new BasicAttribute( "objectClass" );
-        attribute.add( "top" );
-        attribute.add( "organizationalUnit" );
-        attributes.put( attribute );
-        attributes.put( "ou", "subtest" );
-        ctx = ctx.createSubcontext( "ou=subtest", attributes );
-        assertNotNull( ctx );
-
-        ctx = ( DirContext ) sysRoot.lookup( "ou=subtest,ou=testing01" );
-        assertNotNull( ctx );
-
-        attributes = ctx.getAttributes( "" );
-        assertNotNull( attributes );
-        assertEquals( "subtest", attributes.get( "ou" ).get() );
-        attribute = attributes.get( "objectClass" );
-        assertNotNull( attribute );
-        assertTrue( attribute.contains( "top" ) );
-        assertTrue( attribute.contains( "organizationalUnit" ) );
-    }
-
-
     /**
      * Tests the creation and subsequent read of a new JNDI context under the
      * system context root.
@@ -168,8 +76,6 @@
     {
         LdapContext sysRoot = getSystemContext( service );
 
-        createEntries();
-
         /*
          * delete ou=testing00,ou=system
          */

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite.java?rev=894275&r1=894274&r2=894275&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite.java
Mon Dec 28 23:30:38 2009
@@ -26,12 +26,9 @@
 import org.apache.directory.server.core.integ.SetupMode;
 import org.apache.directory.server.core.integ.annotations.CleanupLevel;
 import org.apache.directory.server.core.integ.annotations.Mode;
-import org.apache.directory.server.core.jndi.AddIT;
-import org.apache.directory.server.core.jndi.CreateContextIT;
 import org.apache.directory.server.core.jndi.DIRSERVER169IT;
 import org.apache.directory.server.core.jndi.DIRSERVER783IT;
 import org.apache.directory.server.core.jndi.DIRSERVER791IT;
-import org.apache.directory.server.core.jndi.DestroyContextIT;
 import org.apache.directory.server.core.jndi.ExtensibleObjectIT;
 import org.apache.directory.server.core.jndi.ListIT;
 import org.apache.directory.server.core.jndi.ModifyContextIT;
@@ -67,9 +64,9 @@
         //CollectiveAttributeServiceIT.class,
         //ExceptionServiceIT.class,
         //EventServiceIT.class,
-        AddIT.class,
-        CreateContextIT.class,
-        DestroyContextIT.class,
+        //AddIT.class,
+        //CreateContextIT.class,
+        //DestroyContextIT.class,
         PartitionConfigurationIT.class,
         DIRSERVER169IT.class,
         DIRSERVER759IT.class,

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite2.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite2.java?rev=894275&r1=894274&r2=894275&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite2.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite2.java
Mon Dec 28 23:30:38 2009
@@ -25,6 +25,8 @@
 import org.apache.directory.server.core.exception.ExceptionServiceIT;
 import org.apache.directory.server.core.integ.FrameworkSuite;
 import org.apache.directory.server.core.jndi.AddIT;
+import org.apache.directory.server.core.jndi.CreateContextIT;
+import org.apache.directory.server.core.jndi.DestroyContextIT;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
@@ -41,9 +43,9 @@
         CollectiveAttributeServiceIT.class,
         ExceptionServiceIT.class,
         EventServiceIT.class,
-        AddIT.class/*,
+        AddIT.class,
         CreateContextIT.class,
-        DestroyContextIT.class,
+        DestroyContextIT.class/*,
         PartitionConfigurationIT.class,
         DIRSERVER169IT.class,
         DIRSERVER759IT.class,



Mime
View raw message