directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doan Tin Nghia <doting...@gmail.com>
Subject apacheds unit tests cannot execute ldif update statements
Date Thu, 08 Sep 2016 01:12:44 GMT
Hi all,

I am using

-  api-ldap-client-api 1.0.0-RC1
-  apacheds-core-integ, apacheds-server-integ (2.0.0-M23)

and facing 2 issues when trying to apply LDIF update statements to embedded
apacheds.

1. Both @ApplyLdifFiles and @ApplyLdifs  cannot execute the general format
of LDIF update statements as:

dn: m-oid=2.5.6.9, ou=objectclasses, cn=core, ou=schema
changetype: modify
delete: m-must
m-must: member
-
add: m-may
m-may: member

Seems each operation must have 'dn' in the first line.

2. Modified entry will cause the entry deleted from schema registry(
 SchemaObjectRegistry), e.g in my case

*action 1:* modify groupOfNames

    dn: m-oid=2.5.6.9, ou=objectclasses, cn=core, ou=schema
    changetype: modify
    delete: m-must
     m-must: member

*action 2:* add new object class that depend on  groupOfNames

dn: m-oid=1.3.6.1.4.1.2552.2.2, ou=objectclasses, cn=Test, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 1.3.6.1.4.1.2552.2.2
m-name: TestObjectClass
m-description: Test Object class
m-supObjectClass: groupOfNames
m-must: givenName


Then I got exception:

Caused by: java.lang.NullPointerException: null
at org.apache.directory.api.ldap.model.schema.registries.
DefaultSchemaObjectRegistry.unregister(DefaultSchemaObjectRegistry.java:302)
at org.apache.directory.api.ldap.model.schema.registries.
DefaultObjectClassRegistry.unregister(DefaultObjectClassRegistry.java:190)
at org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager.
unregisterObjectClass(DefaultSchemaManager.java:2263)
at org.apache.directory.server.core.api.schema.registries.synchronizers.
ObjectClassSynchronizer.modify(ObjectClassSynchronizer.java:80)
at org.apache.directory.server.core.api.schema.registries.synchronizers.
RegistrySynchronizerAdaptor.modify(RegistrySynchronizerAdaptor.java:296)
at org.apache.directory.server.core.api.schema.SchemaPartition.modify(
SchemaPartition.java:400)
at org.apache.directory.server.core.shared.partition.
DefaultPartitionNexus.modify(DefaultPartitionNexus.java:491)
at org.apache.directory.server.core.api.interceptor.
BaseInterceptor$1.modify(BaseInterceptor.java:170)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(
BaseInterceptor.java:506)
at org.apache.directory.server.core.journal.JournalInterceptor.modify(
JournalInterceptor.java:229)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(
BaseInterceptor.java:506)
at org.apache.directory.server.core.changelog.ChangeLogInterceptor.modify(
ChangeLogInterceptor.java:222)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(
BaseInterceptor.java:506)
at org.apache.directory.server.core.trigger.TriggerInterceptor.modify(
TriggerInterceptor.java:370)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(
BaseInterceptor.java:506)
at org.apache.directory.server.core.event.EventInterceptor.
modify(EventInterceptor.java:282)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(
BaseInterceptor.java:506)
at org.apache.directory.server.core.subtree.SubentryInterceptor.modify(
SubentryInterceptor.java:1220)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(
BaseInterceptor.java:506)
at org.apache.directory.server.core.collective.
CollectiveAttributeInterceptor.modify(CollectiveAttributeInterceptor
.java:165)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(
BaseInterceptor.java:506)
at org.apache.directory.server.core.operational.
OperationalAttributeInterceptor.modify(OperationalAttributeIntercepto
r.java:449)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(
BaseInterceptor.java:506)
at org.apache.directory.server.core.schema.SchemaInterceptor.
modify(SchemaInterceptor.java:1206)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(
BaseInterceptor.java:506)
at org.apache.directory.server.core.exception.ExceptionInterceptor.modify(
ExceptionInterceptor.java:252)
....

My java class is:

RunWith(FrameworkRunner.class)
@CreateLdapServer(transports = {
@CreateTransport(port = 10489, protocol = "LDAP")
})

@CreateDS(
        name = "LicenseServerDS",
        enableChangeLog = false,
        partitions =
            {
                @CreatePartition(
                    name = "myexample",
                    suffix = "dc=myexample,dc=com",
                    contextEntry = @ContextEntry(
                        entryLdif =
                        "dn: dc=myexample,dc=com\n" +
                            "dc: myexample\n" +
                            "objectClass: top\n" +
                            "objectClass: domain\n\n"))
        })

@ApplyLdifs ( {
"dn: m-oid=2.5.6.9, ou=objectclasses, cn=core, ou=schema",
"changetype: modify",
"delete: m-must",
"m-must: member",
"-"
})
@ApplyLdifFiles({
"action2.ldif"
})

public class MyTest extends AbstractLdapTestUnit{
@Test
    public void testCreateDS() throws Exception
    {
SearchControls controls = new SearchControls();
       controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
       controls.setReturningAttributes( new String[]
           { "+", "*" } );

       NamingEnumeration<SearchResult> res = getRootContext( getService()
).search( "", "(ObjectClass=*)", controls );

       assertTrue( res.hasMore() );

       while ( res.hasMoreElements() )
       {
           SearchResult result = ( SearchResult ) res.next();

           System.out.println( result.getName() );
       }
    }
}

Any help is appreciated. Thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message