Browse Source

Class comment says it all - verify that directory server is configured correctlly.

1.0.x
Robert Sanders 21 years ago
parent
commit
99e6bfbde7
  1. 37
      sandbox/src/test/java/org/acegisecurity/providers/dao/ldap/DirSetupTestCase.java

37
sandbox/src/test/java/org/acegisecurity/providers/dao/ldap/DirSetupTestCase.java

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
package net.sf.acegisecurity.providers.dao.ldap;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
/** Tests to ensure the directory server we are running against is
* configured as expected.
*
* @author robert.sanders
*/
public class DirSetupTestCase extends BaseLdapTestCase {
/** Simply test the connection to the test LDAP server;
* if this test fails we know the server setup needs checked.
* @throws NamingException
*/
public void testConnection() throws NamingException {
Object obj = getClientContext().lookup("ou=users");
//System.out.println( obj );
assertNotNull( obj );
}
public void testSimpleUidUser() throws NamingException {
Attributes myAttrs = getClientContext().getAttributes("uid=one.user,ou=users");
assertEquals(8, myAttrs.size());
assertEquals("uid=one.user,ou=users,ou=system", myAttrs.get("dn").get() );
}
public void testSimpleCnUser() throws NamingException {
Attributes myAttrs = getClientContext().getAttributes("cn=user.two,ou=users");
assertEquals(8, myAttrs.size());
assertEquals("cn=user.two,ou=users,ou=system", myAttrs.get("dn").get() );
assertEquals("Two", myAttrs.get("givenName").get() );
}
}
Loading…
Cancel
Save