directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Ayyagari <ayyagariki...@gmail.com>
Subject Re: Loading custom schemas with AbstractServerTest under 1.5.4
Date Mon, 17 Nov 2008 12:46:51 GMT
hi Juergen,

    AFAIK its not possible to add a custom schema on the fly to the server using
    directory service. To add a custom schema

    1) One need to build schema-bootstrap (with the custom schema file) and then
       bootstrap-partition (to include the custom schema in the server statically)

    2) Export schema as LDIF and add those entries to the running instance of directory server

    However there is a workaround to include the schema dynamically through
    AbstractServerTest using the technique 2 as mentioned below

     @Override
     protected void configureDirectoryService() throws Exception
     {
        // usual configuration directory service you do

         // instantiate the reader
         LdifReader reader = new LdifReader();

         // parse the schema file present in LDIF format
         List<LdifEntry> entries = reader.parseLdifFile( "src/test/resources/custom-schema.ldif"
);

         // let the directory service inject them during startup
         directoryService.setTestEntries( entries );
     }

     You may wish to cache the parsed LDIF entries for performance reasons

HTH

Kiran Ayyagari

Juergen Weber wrote:
> Hi,
> 
> any updates to this? Anybody got a working sample using DS 1.5.4,
> AbstractServerTest and custom schemas?
> 
> Thx,
> Juergen
> 
> 
> Mark Derricutt wrote:
>> 'lo
>>
>> With the recent changes to AbstractServerTest in 1.5.4, how does one
>> register custom schemas now?
>>
>> Under 1.5.3 I was using:
>>
>>         Set<AbstractBootstrapSchema> schemas =
>> configuration.getBootstrapSchemas();
>>         schemas.add(new Smx3Schema());
>>         configuration.setBootstrapSchemas(schemas);
>>
>> where configuration came from the AbstractServerTest.  It looks like the
>> test harness has changed a bit.  I"m actually using TestNG to execute my
>> tests, rather than JUnit so hopefully theres still a way to handle this
>> easily.
>>
>> Mark
>> He who started looking at ldap integration testing at the wrong time..
>>
>> -- 
>> "It is easier to optimize correct code than to correct optimized code." --
>> Bill Harlan
>>
>>
> 

Mime
View raw message