Hey Guys,
I'm testing out adding a partition for
dc=apache,dc=org in RC1.
I added it right beneath dc=example,dc=com in the
server.xml file.
When I try to create a context beneath
dc=example,dc=com
no problemo, the unit test runs smooth.
However, when running it for dc=apache,dc=org, not so
smooth.
Originally I took the dc=apache,dc=org entry from the
"Partition" documentation. I had to change the Spring
class attribute (Which I updated in the documentation)
to match the one used in the dc=example,
configuration, otherwise the server complained during
startup in debug mode.
I also changed the indexAttributes elements to match
the ones in dc=example.
Now I make the corresponding changes in the unit test,
aaaand fire it up! All red. Actually I don't even
get a red, just the console in Eclipse.
I looked through the configuration file, to see if
there was some other element that was making the
dc=example partition work. I could not find one. Is
there one?
Here is the dc=apache configuration element I added
(Including the example one just for reference):
<bean id="examplePartitionConfiguration"
class="org.apache.directory.server.core.configuration.MutableDirectoryPartitionConfiguration">
<property
name="name"><value>example</value></property>
<property
name="suffix"><value>dc=example,dc=com</value></property>
<property name="indexedAttributes">
<set>
<value>dc</value>
<value>ou</value>
<value>objectClass</value>
<value>krb5PrincipalName</value>
<value>uid</value>
</set>
</property>
<property name="contextEntry">
<value>
objectClass: top
objectClass: domain
objectClass: extensibleObject
dc: example
</value>
</property>
</bean>
<!-- Additional ContextPartitionConfiguration -->
<bean id="apachePartitionConfiguration"
class="org.apache.directory.server.core.configuration.MutableDirectoryPartitionConfiguration">
<property
name="name"><value>apache</value></property>
<property
name="suffix"><value>dc=apache,dc=org</value></property>
<property name="indexedAttributes">
<set>
<value>dc</value>
<value>ou</value>
<value>objectClass</value>
<value>krb5PrincipalName</value>
<value>uid</value>
</set>
<property name="contextEntry">
<value>
objectClass: top
objectClass: domain
objectClass: extensibleObject
dc: apache
</value>
</property>
</bean>
And here is the unit test code:
package com.pyramidetechnologies.webapp.mdc;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import junit.framework.TestCase;
public class TestNewContextSetup extends TestCase {
public DirContext authenticate() {
try {
Hashtable<String, String> env = new
Hashtable<String, String>();
// Set up the environment for creating the initial
context
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,
"ldap://localhost:389/dc=apache,dc=org");
// Authenticate as S. User and password "mysecret"
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL,
"uid=admin,ou=system");
env.put(Context.SECURITY_CREDENTIALS, "secret");
DirContext ctx = new InitialDirContext(env);
ctx.createSubcontext("[EMAIL PROTECTED]");
ctx.destroySubcontext("[EMAIL PROTECTED]");
return ctx;
} catch (NamingException e) {
e.printStackTrace();
return null;
}
}
public void testAddContext() throws NamingException {
DirContext ctx=authenticate();
Name ole = null;
//ctx.destroySubcontext("pyramide technologies");
//ctx.bind(ole,
ctx.lookup("[EMAIL PROTECTED]"));
//ctx.destroySubcontext("[EMAIL PROTECTED]");
}
}
Any idea on what I'm missing?
Thanks,
- Ole
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com