directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1395327 - in /directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core: jndi/ normalization/ operational/ suites/
Date Sun, 07 Oct 2012 15:10:43 GMT
Author: elecharny
Date: Sun Oct  7 15:10:43 2012
New Revision: 1395327

URL: http://svn.apache.org/viewvc?rev=1395327&view=rev
Log:
o Migrated some tests from JNDI to API
o Moved the RootDseIT test to the operations package
o Moved the API tests and JNDI tests that won't be migrated to MigratedStockCoreISuite

Removed:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/RootDSEIT.java
Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/normalization/NormalizationServiceIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/MigratedStockCoreISuite.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/normalization/NormalizationServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/normalization/NormalizationServiceIT.java?rev=1395327&r1=1395326&r2=1395327&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/normalization/NormalizationServiceIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/normalization/NormalizationServiceIT.java
Sun Oct  7 15:10:43 2012
@@ -20,19 +20,16 @@
 package org.apache.directory.server.core.normalization;
 
 
-import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.ldap.LdapContext;
-
+import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.core.integ.IntegrationUtils;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -50,36 +47,28 @@ public final class NormalizationServiceI
     @Test
     public void testDireve308Example() throws Exception
     {
-        /*
-
-        Use @Ldif to load this data but for now we can do it with code.
-
-        dn: ou=direct report view,ou=system
-        objectClass: organizationalUnit
-        ou: direct report view
-
-        dn: ou=corporate category\, operations,ou=direct report view,ou=system
-        objectClass: organizationalUnit
-        ou: corporate category\, operations
-
-         */
-
-        LdapContext sysRoot = getSystemContext( getService() );
-
-        Attributes attrs = new BasicAttributes( "objectClass", "organizationalUnit", true
);
-        attrs.put( "ou", "direct report view" );
-        sysRoot.createSubcontext( "ou=direct report view", attrs );
-
-        attrs = new BasicAttributes( "objectClass", "organizationalUnit", true );
-        attrs.put( "ou", "corporate category, operations" );
-        sysRoot.createSubcontext( "ou=corporate category\\, operations,ou=direct report view",
attrs );
+        LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
+        String dn = "ou=corporate category\\, operations,ou=direct report view, ou=system";
 
-        attrs = sysRoot.getAttributes( "ou=corporate category\\, operations,ou=direct report
view" );
-        assertNotNull( attrs );
-        Attribute ou = attrs.get( "ou" );
-        assertEquals( "corporate category, operations", ou.get() );
-        Attribute oc = attrs.get( "objectClass" );
-        assertTrue( oc.contains( "top" ) );
-        assertTrue( oc.contains( "organizationalUnit" ) );
+        Entry entry1 = new DefaultEntry( "ou=direct report view,ou=system",
+            "objectClass: top",
+            "objectClass: organizationalUnit",
+            "ou: direct report view"
+            );
+        
+        connection.add( entry1 );
+
+        Entry entry2 = new DefaultEntry( dn,
+            "objectClass: top",
+            "objectClass: organizationalUnit",
+            "ou: corporate category, operations"
+            );
+        
+        connection.add( entry2 );
+        
+        Entry result = connection.lookup( dn );
+        assertNotNull( result );
+        assertTrue( result.contains(  "ou", "corporate category, operations" ) );
+        assertTrue( result.contains( "objectClass", "top", "organizationalUnit" ) );
     }
 }

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java?rev=1395327&r1=1395326&r2=1395327&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
Sun Oct  7 15:10:43 2012
@@ -20,14 +20,11 @@
 package org.apache.directory.server.core.operational;
 
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import javax.naming.NamingException;
-
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
@@ -43,8 +40,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.exception.LdapNoPermissionException;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
-import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.util.Strings;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -124,19 +119,23 @@ public class OperationalAttributeService
         byte[] keyValue = new byte[]
             { ( byte ) 0xFF, ( byte ) 0xD8, ( byte ) 0xFF, ( byte ) 0xE0, 0x01, 0x02, 'J',
'F', 'I', 'F', 0x00, 0x45,
                 0x23, 0x7d, 0x7f };
-        entry.put( "jpegPhoto", keyValue );
-        entry.setDn( new Dn( "ou=anothertest,ou=system" ) );
-        entry.put( "ou", "anothertest" );
+        
+        entry = new DefaultEntry( "ou=anothertest,ou=system",
+            "objectClass: top",
+            "objectClass: person",
+            "objectClass: organizationalPerson",
+            "objectClass: inetOrgPerson",
+            "ou: anotherTest",
+            "cn", "test",
+            "sn", "test",
+            "jpegPhoto", keyValue );
+
         connection.add( entry );
+        
         Entry loadedEntry = connection.lookup( "ou=anothertest,ou=system" );
-        ou = loadedEntry.get( "ou" );
-        value = ou.getString();
-        assertEquals( "anothertest", value );
-        Attribute jpegPhoto = loadedEntry.get( "jpegPhoto" );
-        value = jpegPhoto.getBytes();
-        assertTrue( value instanceof byte[] );
-        assertEquals( "0xFF 0xD8 0xFF 0xE0 0x01 0x02 0x4A 0x46 0x49 0x46 0x00 0x45 0x23 0x7D
0x7F ", Strings
-            .dumpBytes( ( byte[] ) value ) );
+
+        assertTrue( loadedEntry.contains( "ou", "anothertest" ) );
+        assertTrue( loadedEntry.contains( "jpegPhoto", keyValue ) );
     }
 
 
@@ -158,11 +157,9 @@ public class OperationalAttributeService
         entry = connection.lookup( "ou=testing00,ou=system", "*" );
 
         assertNotNull( entry );
-        assertEquals( "testing00", entry.get( "ou" ).getString() );
-        Attribute attribute = entry.get( "objectClass" );
-        assertNotNull( attribute );
-        assertTrue( attribute.contains( "top" ) );
-        assertTrue( attribute.contains( "organizationalUnit" ) );
+        assertTrue( entry.contains( "ou", "testing00" ) );
+        assertTrue( entry.contains( "objectClass", "top", "organizationalUnit" ) );
+
         assertNull( entry.get( "createTimestamp" ) );
         assertNull( entry.get( "creatorsName" ) );
 
@@ -185,7 +182,7 @@ public class OperationalAttributeService
      * @see <a href="http://nagoya.apache.org/jira/browse/DIREVE-57">DIREVE-57:
      * ou=system does not contain operational attributes</a>
      *
-     * @throws NamingException on error
+     * @throws Exception on error
      */
     @Test
     public void testSystemContextRoot() throws Exception
@@ -228,7 +225,7 @@ public class OperationalAttributeService
      *
      * @see <a href="http://nagoya.apache.org/jira/browse/DIREVE-67">JIRA Issue DIREVE-67</a>
      *
-     * @throws NamingException on error
+     * @throws Exception on error
      */
     @Test
     public void testConfirmNonAdminUserDnIsCreatorsName() throws Exception
@@ -263,7 +260,7 @@ public class OperationalAttributeService
     /**
      * Modify an entry and check whether attributes modifiersName and modifyTimestamp are
present.
      *
-     * @throws NamingException on error
+     * @throws Exception on error
      */
     @Test
     public void testModifyShouldLeadToModifiersAttributes() throws Exception
@@ -288,7 +285,7 @@ public class OperationalAttributeService
     /**
      * Modify an entry and check whether attribute modifyTimestamp changes.
      *
-     * @throws NamingException on error
+     * @throws Exception on error
      * @throws InterruptedException on error
      */
     @Test
@@ -346,7 +343,7 @@ public class OperationalAttributeService
     /**
      * Try to remove creatorsName attribute from an entry.
      *
-     * @throws NamingException on error
+     * @throws Exception on error
      */
     @Test(expected = LdapNoPermissionException.class)
     public void testModifyOperationalAttributeRemove() throws Exception
@@ -361,7 +358,7 @@ public class OperationalAttributeService
     /**
      * Try to replace creatorsName attribute on an entry.
      *
-     * @throws NamingException on error
+     * @throws Exception on error
      */
     @Test(expected = LdapNoPermissionException.class)
     public void testModifyOperationalAttributeReplace() throws Exception
@@ -449,5 +446,4 @@ public class OperationalAttributeService
 
         connection.delete( "cn=KB,ou=users,ou=system" );
     }
-
 }

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/MigratedStockCoreISuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/MigratedStockCoreISuite.java?rev=1395327&r1=1395326&r2=1395327&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/MigratedStockCoreISuite.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/MigratedStockCoreISuite.java
Sun Oct  7 15:10:43 2012
@@ -39,6 +39,23 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.event.EventServiceIT;
 import org.apache.directory.server.core.exception.ExceptionServiceIT;
 import org.apache.directory.server.core.integ.FrameworkSuite;
+import org.apache.directory.server.core.jndi.AddJndiIT;
+import org.apache.directory.server.core.jndi.CreateContextIT;
+import org.apache.directory.server.core.jndi.DIRSERVER169IT;
+import org.apache.directory.server.core.jndi.DestroyContextIT;
+import org.apache.directory.server.core.jndi.RootDSEJndiIT;
+import org.apache.directory.server.core.jndi.SimpleBindJndiIT;
+import org.apache.directory.server.core.jndi.referral.AddReferralIT;
+import org.apache.directory.server.core.jndi.referral.CompareReferralIT;
+import org.apache.directory.server.core.jndi.referral.DeleteReferralIT;
+import org.apache.directory.server.core.jndi.referral.ModifyReferralIT;
+import org.apache.directory.server.core.jndi.referral.MoveAndRenameReferralIT;
+import org.apache.directory.server.core.jndi.referral.MoveReferralIT;
+import org.apache.directory.server.core.jndi.referral.RenameReferralIT;
+import org.apache.directory.server.core.jndi.referral.RenameReferralIgnoreIT;
+import org.apache.directory.server.core.jndi.referral.SearchReferralIT;
+import org.apache.directory.server.core.normalization.NormalizationServiceIT;
+import org.apache.directory.server.core.operational.OperationalAttributeServiceIT;
 import org.apache.directory.server.core.operations.add.AddIT;
 import org.apache.directory.server.core.operations.add.DIRSERVER783IT;
 import org.apache.directory.server.core.operations.add.PasswordHashingInterceptorTest;
@@ -88,6 +105,33 @@ import org.junit.runners.Suite;
         // exception
         ExceptionServiceIT.class,
         
+        // jndi Operations (we keep those tests using JNDI here, just to be sure
+        // that the server works well with JNDI API)
+        AddJndiIT.class,
+        CreateContextIT.class,
+        DestroyContextIT.class,
+        DIRSERVER169IT.class,
+        RootDSEJndiIT.class,
+        SimpleBindJndiIT.class,
+
+
+        // jndi.referral (We don't yet support Referral with the API, so we use JNDI instead)
+        AddReferralIT.class,
+        CompareReferralIT.class,
+        DeleteReferralIT.class,
+        ModifyReferralIT.class,
+        MoveAndRenameReferralIT.class,
+        MoveReferralIT.class,
+        RenameReferralIgnoreIT.class,
+        RenameReferralIT.class,
+        SearchReferralIT.class,
+        
+        // normalization
+        NormalizationServiceIT.class,
+
+        // operational
+        OperationalAttributeServiceIT.class,
+
         // Operations add
         AddIT.class,
         DIRSERVER783IT.class,

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite.java?rev=1395327&r1=1395326&r2=1395327&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/suites/StockCoreISuite.java
Sun Oct  7 15:10:43 2012
@@ -21,11 +21,7 @@ package org.apache.directory.server.core
 
 import org.apache.directory.server.core.configuration.PartitionConfigurationIT;
 import org.apache.directory.server.core.integ.FrameworkSuite;
-import org.apache.directory.server.core.jndi.AddJndiIT;
-import org.apache.directory.server.core.jndi.CreateContextIT;
-import org.apache.directory.server.core.jndi.DIRSERVER169IT;
 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.MixedCaseIT;
@@ -33,20 +29,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.jndi.ObjStateFactoryIT;
 import org.apache.directory.server.core.jndi.RFC2713IT;
 import org.apache.directory.server.core.jndi.ReferralIT;
-import org.apache.directory.server.core.jndi.RootDSEJndiIT;
-import org.apache.directory.server.core.jndi.SimpleBindJndiIT;
 import org.apache.directory.server.core.jndi.UniqueMemberIT;
-import org.apache.directory.server.core.jndi.referral.AddReferralIT;
-import org.apache.directory.server.core.jndi.referral.CompareReferralIT;
-import org.apache.directory.server.core.jndi.referral.DeleteReferralIT;
-import org.apache.directory.server.core.jndi.referral.ModifyReferralIT;
-import org.apache.directory.server.core.jndi.referral.MoveAndRenameReferralIT;
-import org.apache.directory.server.core.jndi.referral.MoveReferralIT;
-import org.apache.directory.server.core.jndi.referral.RenameReferralIT;
-import org.apache.directory.server.core.jndi.referral.RenameReferralIgnoreIT;
-import org.apache.directory.server.core.jndi.referral.SearchReferralIT;
-import org.apache.directory.server.core.normalization.NormalizationServiceIT;
-import org.apache.directory.server.core.operational.OperationalAttributeServiceIT;
 import org.apache.directory.server.core.operations.compare.CompareDirserver1139IT;
 import org.apache.directory.server.core.operations.exists.ExistsIT;
 import org.apache.directory.server.core.operations.lookup.LookupIT;
@@ -100,10 +83,6 @@ import org.junit.runners.Suite;
         PartitionConfigurationIT.class,
 
         // jndi Operations
-        AddJndiIT.class,
-        CreateContextIT.class,
-        DestroyContextIT.class,
-        DIRSERVER169IT.class,
         DIRSERVER791IT.class,
         ExtensibleObjectIT.class,
         ListIT.class,
@@ -112,27 +91,8 @@ import org.junit.runners.Suite;
         ObjStateFactoryIT.class,
         ReferralIT.class,
         RFC2713IT.class,
-        RootDSEJndiIT.class,
-        SimpleBindJndiIT.class,
         UniqueMemberIT.class,
 
-        // jndi.referral
-        AddReferralIT.class,
-        CompareReferralIT.class,
-        DeleteReferralIT.class,
-        ModifyReferralIT.class,
-        MoveAndRenameReferralIT.class,
-        MoveReferralIT.class,
-        RenameReferralIgnoreIT.class,
-        RenameReferralIT.class,
-        SearchReferralIT.class,
-
-        // normalization
-        NormalizationServiceIT.class,
-
-        // operational
-        OperationalAttributeServiceIT.class,
-
         // operations.compare
         CompareDirserver1139IT.class,
 
@@ -187,7 +147,6 @@ import org.junit.runners.Suite;
         // trigger
         SubentryServiceForTriggersIT.class,
         TriggerInterceptorIT.class
-
 })
 public class StockCoreISuite
 {



Mime
View raw message