directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleksander Adamowski (JIRA)" <j...@apache.org>
Subject [jira] Created: (DIRSERVER-1300) Only adding from LDIF is possible with injectEntries() in IntegrationUtils
Date Tue, 06 Jan 2009 15:50:44 GMT
Only adding from LDIF is possible with injectEntries() in IntegrationUtils
--------------------------------------------------------------------------

                 Key: DIRSERVER-1300
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1300
             Project: Directory ApacheDS
          Issue Type: Bug
          Components: core-integ
    Affects Versions: 1.5.4
            Reporter: Aleksander Adamowski


The method org.apache.directory.server.core.integ.IntegrationUtils.injectEntries(DirectoryService,
String) only supports adding entries - it assumes that there are no changetype: something-other-than-add
entries in the LDIF. This greatly complicates modifying the intergration testing server's
schema.

So the following LDIF cannot be currently processed by injectEntries:

version:   1
dn: cn=schema
changetype: modify
add: attributeTypes
attributeTypes: ( 1.3.6.1.4.1.12345.1.1 NAME 'customAttr1'
    DESC 'custom attribute 1'
    EQUALITY caseIgnoreMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    SINGLE-VALUE )
attributeTypes: ( 1.3.6.1.4.1.12345.1.2 NAME 'customAttr2'
    DESC 'custom attribute 2'
    EQUALITY caseIgnoreMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    SINGLE-VALUE )
-
add: objectClasses
objectClasses: ( .3.6.1.4.1.12345.2.1
    NAME 'customClass1'
    SUP top
    STRUCTURAL
    MUST ( cn $ customAttr1 )
    MAY ( customAttr2 ) )


I've tracked down the problem and found out it's quite simple to add support for the remaining
change types:

Index: src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
===================================================================
--- src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java	(revision 731909)
+++ src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java	(working copy)
@@ -99,8 +99,19 @@
 
         for ( LdifEntry entry : entries )
         {
-            service.getAdminSession().add( 
-                new DefaultServerEntry( service.getRegistries(), entry.getEntry() ) ); 
+            if ( entry.isChangeAdd() )
+            {
+                service.getAdminSession().add( new DefaultServerEntry( service.getRegistries(),
entry.getEntry() ) );
+
+            }
+            else if ( entry.isChangeModify() )
+            {
+                service.getAdminSession().modify( entry.getDn(), entry.getModificationItems()
);
+            }
+            else
+            {
+                throw new NamingException( "Unsupported changetype found in LDIF: " + entry.getChangeType()
);
+            }
         }
     }
 

I'll attach the patch in a minute.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message