private static void setupldapServer ( ) throws Exception { ds = new InMemoryLDAPServer ( SUB_DN ) ; Entry entry = new Entry ( SUB_DN ) ; entry . addAttribute ( "objectclass" , "top" ) ; entry . addAttribute ( "objectclass" , "domain" ) ; ds . add ( entry ) ; /* * Add the partition entries. */ entry = new Entry ( "ou=Test,o=ibm,c=us" ) ; entry . addAttribute ( "objectclass" , "organizationalunit" ) ; entry . addAttribute ( "ou" , "Test" ) ; ds . add ( entry ) ; entry = new Entry ( USER_BASE_DN ) ; entry . addAttribute ( "objectclass" , "organizationalunit" ) ; entry . addAttribute ( "ou" , "Test" ) ; entry . addAttribute ( "ou" , "TestUsers" ) ; ds . add ( entry ) ; entry = new Entry ( BAD_USER_BASE_DN ) ; entry . addAttribute ( "objectclass" , "organizationalunit" ) ; entry . addAttribute ( "ou" , "BadUsers" ) ; ds . add ( entry ) ; entry = new Entry ( "ou=Dev,o=ibm,c=us" ) ; entry . addAttribute ( "objectclass" , "organizationalunit" ) ; entry . addAttribute ( "ou" , "Dev" ) ; ds . add ( entry ) ; entry = new Entry ( GROUP_BASE_DN ) ; entry . addAttribute ( "objectclass" , "organizationalunit" ) ; entry . addAttribute ( "ou" , "Dev" ) ; entry . addAttribute ( "ou" , "DevGroups" ) ; ds . add ( entry ) ; /* * Create the user and group. */ entry = new Entry ( USER_DN ) ; entry . addAttribute ( "objectclass" , "inetorgperson" ) ; entry . addAttribute ( "uid" , USER ) ; entry . addAttribute ( "sn" , USER ) ; entry . addAttribute ( "cn" , USER ) ; entry . addAttribute ( "userPassword" , "password" ) ; ds . add ( entry ) ; entry = new Entry ( BAD_USER_DN ) ; entry . addAttribute ( "objectclass" , "inetorgperson" ) ; entry . addAttribute ( "uid" , BAD_USER ) ; entry . addAttribute ( "sn" , BAD_USER ) ; entry . addAttribute ( "cn" , BAD_USER ) ; entry . addAttribute ( "userPassword" , "password" ) ; ds . add ( entry ) ; entry = new Entry ( GROUP_DN ) ; entry . addAttribute ( "objectclass" , "groupofnames" ) ; entry . addAttribute ( "cn" , GROUP ) ; entry . addAttribute ( "member" , USER_DN ) ; entry . addAttribute ( "member" , BAD_USER_DN ) ; ds . add ( entry ) ; }
Configure the embedded LDAP server .