mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

coulbeck
10.58.2006 8af1e5eb227ef16d40d47c08bd09c1bd2fccf134
Fix for Issue 574 -- JE test cases don't clean up after themselves.
3 files modified
30 ■■■■ changed files
opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java 10 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestEntryContainer.java 10 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestEnvManager.java 10 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java
@@ -30,6 +30,7 @@
import java.io.File;
import org.opends.server.InitialDirectoryServerFixture;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.Backend;
import org.opends.server.config.ConfigEntry;
import org.opends.server.core.DirectoryException;
@@ -46,6 +47,7 @@
 * BackendImpl Tester.
 */
public class TestBackendImpl extends JebTestCase {
  private File tempDir;
  private String homeDirName;
  private static final String ldifString =
@@ -70,9 +72,8 @@
  public void setUp() throws Exception {
    InitialDirectoryServerFixture.FACTORY.setUp();
    File tempFile = File.createTempFile("jebtest", "");
    tempFile.delete();
    homeDirName = tempFile.getAbsolutePath();
    tempDir = TestCaseUtils.createTemporaryDirectory("jebtest");
    homeDirName = tempDir.getAbsolutePath();
    final String s = ldifString.replaceAll("ds-cfg-backend-directory: db",
        "ds-cfg-backend-directory:: "
@@ -96,8 +97,7 @@
  public void tearDown() throws Exception {
    InitialDirectoryServerFixture.FACTORY.tearDown();
    File homeDir = new File(homeDirName);
    homeDir.delete();
    TestCaseUtils.deleteDirectory(tempDir);
  }
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestEntryContainer.java
@@ -35,6 +35,7 @@
import java.util.ArrayList;
import org.opends.server.SchemaFixture;
import org.opends.server.TestCaseUtils;
import org.opends.server.types.Entry;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.util.LDIFReader;
@@ -114,6 +115,7 @@
      + "cn;lang-en: Rodney Ogasawara\n"
      + "title;lang-en: Sales, Director\n" + "\n" + "";
  private File tempDir;
  private String homeDirName;
  private ArrayList<Entry> entryList;
@@ -131,9 +133,8 @@
    // This test suite depends on having the schema available.
    SchemaFixture.FACTORY.setUp();
    File tempFile = File.createTempFile("jebtest", "");
    tempFile.delete();
    homeDirName = tempFile.getAbsolutePath();
    tempDir = TestCaseUtils.createTemporaryDirectory("jebtest");
    homeDirName = tempDir.getAbsolutePath();
    // Convert the test LDIF string to a byte array
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
@@ -169,8 +170,7 @@
  public void tearDown() throws Exception {
    SchemaFixture.FACTORY.tearDown();
    File homeDir = new File(homeDirName);
    homeDir.delete();
    TestCaseUtils.deleteDirectory(tempDir);
  }
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestEnvManager.java
@@ -34,6 +34,7 @@
import org.testng.annotations.ExpectedExceptions;
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;
@@ -41,6 +42,7 @@
 * EnvManager Tester.
 */
public class TestEnvManager extends JebTestCase {
  private File tempDir;
  private String homeDirName;
  /**
@@ -51,9 +53,8 @@
   */
  @Configuration(beforeTestClass = true)
  public void setUp() throws Exception {
    File tempFile = File.createTempFile("jebtest", "");
    tempFile.delete();
    homeDirName = tempFile.getAbsolutePath();
    tempDir = TestCaseUtils.createTemporaryDirectory("jebtest");
    homeDirName = tempDir.getAbsolutePath();
  }
  /**
@@ -64,8 +65,7 @@
   */
  @Configuration(afterTestClass = true)
  public void tearDown() throws Exception {
    File homeDir = new File(homeDirName);
    homeDir.delete();
    TestCaseUtils.deleteDirectory(tempDir);
  }
  /**