コード例 #1
0
  /**
   * @param ldifFile to create.
   * @param webXml web.xml for queries
   * @throws Exception On test failure.
   */
  @Parameters({"createEntry10", "webXml"})
  @BeforeClass(groups = {"servlettest"})
  public void createLdapEntry(final String ldifFile, final String webXml) throws Exception {
    final String ldif = TestUtil.readFileIntoString(ldifFile);
    testLdapEntry = TestUtil.convertLdifToEntry(ldif);

    Ldap ldap = TestUtil.createSetupLdap();
    ldap.create(testLdapEntry.getDn(), testLdapEntry.getLdapAttributes().toAttributes());
    ldap.close();
    ldap = TestUtil.createLdap();
    while (!ldap.compare(
        testLdapEntry.getDn(), new SearchFilter(testLdapEntry.getDn().split(",")[0]))) {
      Thread.sleep(100);
    }
    ldap.close();

    this.ldifServletRunner = new ServletRunner(new File(webXml));
    this.dsmlServletRunner = new ServletRunner(new File(webXml));
  }
コード例 #2
0
 /** @throws Exception On test failure. */
 @AfterClass(groups = {"servlettest"})
 public void deleteLdapEntry() throws Exception {
   final Ldap ldap = TestUtil.createSetupLdap();
   ldap.delete(testLdapEntry.getDn());
   ldap.close();
 }