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

Jean-Noel Rouvignac
19.49.2014 5be409c32375900b359ffabfb79cd117442eb6ea
OPENDJ-1602 New pluggable storage based backend

Various fixes for when running unit tests.

TestCaseUtils.java:
In clearJEBackend(), extracted method clearBackend() and added support for pluggable storage backend into it.
1 files modified
35 ■■■■ changed files
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java 35 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -878,7 +878,19 @@
   */
  public static void clearJEBackend(String backendId, String baseDN) throws Exception
  {
    final BackendImpl backend = (BackendImpl)DirectoryServer.getBackend(backendId);
    Backend<?> b = DirectoryServer.getBackend(backendId);
    if (clearBackend(b) && baseDN != null)
    {
      Entry e = createEntry(DN.valueOf(baseDN));
      DirectoryServer.getBackend(backendId).addEntry(e, null);
    }
  }
  private static boolean clearBackend(Backend<?> b)
  {
    if (b instanceof BackendImpl)
    {
      final BackendImpl backend = (BackendImpl) b;
    final RootContainer rootContainer = backend.getRootContainer();
    if (rootContainer != null)
    {
@@ -888,13 +900,26 @@
        assertEquals(ec.getHighestEntryID().longValue(), 0L);
      }
      rootContainer.resetNextEntryID();
      if (baseDN != null)
        return true;
      }
    }
    else if (b instanceof org.opends.server.backends.pluggable.BackendImpl)
      {
        Entry e = createEntry(DN.valueOf(baseDN));
        DirectoryServer.getBackend(backendId).addEntry(e, null);
      final org.opends.server.backends.pluggable.BackendImpl backend =
          (org.opends.server.backends.pluggable.BackendImpl) b;
      final org.opends.server.backends.pluggable.RootContainer rootContainer = backend.getRootContainer();
      if (rootContainer != null)
      {
        for (org.opends.server.backends.pluggable.EntryContainer ec : rootContainer.getEntryContainers())
        {
          ec.clear();
          // assertEquals(ec.getHighestEntryID().longValue(), 0L);
        }
        rootContainer.resetNextEntryID();
        return true;
      }
    }
    return false;
  }
  /**