On 3/13/07, Enrique Rodriguez <[EMAIL PROTECTED]> wrote:
Hi, Directory developers, What's the best way to add a subcontext under a new partition? The use case would be in an integration test, if I want to create partition "dc=example,dc=com" and then I want to create "ou=users" underneath that. Is the only way to create the partition, then use CoreContextFactory on that partition, then add a subcontext? Or can I programmatically add a subcontext directly to a partition somehow?
The server was designed to use JNDI as the API to perform CRUD operations on entires to reduce the learning curve with custom API's that we would devise. However there is a means to load entries into the server using convenience methods on the unit test classes. You can also refer to an LDIF in your project's respective resources area to be loaded after startup in the setUp() method. Is this what you're looking for? The issue I'm running into is that the Kerberos protocol provider
wants its base DN for principal searches to exist when it starts up using AbstractServerTest, for example if the base DN is "ou=users,dc=example,dc=com". I would create "dc=example,dc=com" as the 'example' partition. Then I need to add the "ou=users" subcontext.
Ahhh I see. In this case you can use the LDIF loading facility built into the server which will load an LDIF before starting the other services. If you remember we created this specifically for this chicken and egg problem that you have with the Krb5 service. Of course, the answer may be to modify the Kerberos provider to
lazy-load the store. On the first authentication request, it would then go look for the base DN. Something similar will need to happen for multi-realm capability, anyway.
Hmmm I see what you're saying but I think the LDIF loading mechanism will work for you. This is what we do with the default LDIF file that ships with the server. Take a look at these methods: MutableStartupConfiguration.setTestEntries() MutableServerStartupConfiguration.setLdifDirectory() The first will load entries programmatically. The second will load the LDIF files from a directory. HTH, Alex
