@Before
 public void prepareTestedInstance() throws Exception {
   LdapTestUtils.cleanAndSetup(
       contextSource,
       LdapUtils.newLdapName("ou=People"),
       new ClassPathResource("/setup_data.ldif"));
 }
Esempio n. 2
0
 /** @deprecated use {@link #startEmbeddedServer(int, String, String)} instead. */
 public static DirContext startApacheDirectoryServer(
     int port,
     String defaultPartitionSuffix,
     String defaultPartitionName,
     String principal,
     String credentials)
     throws NamingException {
   return LdapTestUtils.startApacheDirectoryServer(
       port, defaultPartitionSuffix, defaultPartitionName, principal, credentials, null);
 }
  @Before
  public void setUp() throws Exception {
    // Bind to the directory
    LdapContextSource contextSource = new LdapContextSource();
    contextSource.setUrl("ldap://127.0.0.1:" + PORT);
    contextSource.setUserDn("");
    contextSource.setPassword("");
    contextSource.setPooled(false);
    contextSource.afterPropertiesSet();

    // Create the Sprint LDAP template
    LdapTemplate template = new LdapTemplate(contextSource);

    // Clear out any old data - and load the test data
    LdapTestUtils.cleanAndSetup(
        template.getContextSource(), baseName, new ClassPathResource("testdata.ldif"));
  }
 @After
 public void cleanup() throws Exception {
   LdapTestUtils.clearSubContexts(contextSource, LdapUtils.newLdapName("ou=People"));
 }
 @AfterClass
 public static void tearDownClass() throws Exception {
   LdapTestUtils.shutdownEmbeddedServer();
 }
 @BeforeClass
 public static void setUpClass() throws Exception {
   // Start an LDAP server and import test data
   LdapTestUtils.startEmbeddedServer(PORT, baseName.toString(), "odm-test");
 }