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

Fabio Pistolesi
12.37.2016 ec739b8d5f2d925494e7f9743b0d8c8a492c2071
Add confidential versions of backend unit tests

Run pluggable backend unit tests with confidentiality enabled for backend and indexes.
2 files added
2 files modified
86 ■■■■■ changed files
opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/EncryptedJETestCase.java 39 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/pdb/EncryptedPDBTestCase.java 39 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/pdb/PDBTestCase.java 4 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/EncryptedJETestCase.java
New file
@@ -0,0 +1,39 @@
/*
 * The contents of this file are subject to the terms of the Common Development and
 * Distribution License (the License). You may not use this file except in compliance with the
 * License.
 *
 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
 * specific language governing permission and limitations under the License.
 *
 * When distributing Covered Software, include this CDDL Header Notice in each file and include
 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2016 ForgeRock AS.
 */
package org.opends.server.backends.jeb;
import org.forgerock.opendj.server.config.server.JEBackendCfg;
import org.testng.annotations.Test;
import static org.mockito.Mockito.when;
/** Encrypted PDBBackend Tester. */
@Test
public class EncryptedJETestCase extends JETestCase
{
  @Override
  protected JEBackendCfg createBackendCfg()
  {
    JEBackendCfg backendCfg = super.createBackendCfg();
    when(backendCfg.getBackendId()).thenReturn("EncJETestCase");
    when(backendCfg.getDBDirectory()).thenReturn("EncJETestCase");
    when(backendCfg.isConfidentialityEnabled()).thenReturn(true);
    when(backendCfg.getCipherKeyLength()).thenReturn(128);
    when(backendCfg.getCipherTransformation()).thenReturn("AES/CBC/PKCS5Padding");
    return backendCfg;
  }
}
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
@@ -167,6 +167,10 @@
      when(indexCfg.getIndexEntryLimit()).thenReturn(4000);
      when(indexCfg.getSubstringLength()).thenReturn(6);
      when(backendCfg.getBackendIndex(index.getKey())).thenReturn(indexCfg);
      if (backendCfg.isConfidentialityEnabled())
      {
        when(indexCfg.isConfidentialityEnabled()).thenReturn(true);
      }
    }
    BackendVLVIndexCfg vlvIndexCfg = mock(BackendVLVIndexCfg.class);
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/pdb/EncryptedPDBTestCase.java
New file
@@ -0,0 +1,39 @@
/*
 * The contents of this file are subject to the terms of the Common Development and
 * Distribution License (the License). You may not use this file except in compliance with the
 * License.
 *
 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
 * specific language governing permission and limitations under the License.
 *
 * When distributing Covered Software, include this CDDL Header Notice in each file and include
 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2016 ForgeRock AS.
 */
package org.opends.server.backends.pluggable.pdb;
import org.forgerock.opendj.server.config.server.PDBBackendCfg;
import org.testng.annotations.Test;
import static org.mockito.Mockito.when;
/** Encrypted PDBBackend Tester. */
@Test
public class EncryptedPDBTestCase extends PDBTestCase
{
  @Override
  protected PDBBackendCfg createBackendCfg()
  {
    PDBBackendCfg backendCfg = super.createBackendCfg();
    when(backendCfg.getBackendId()).thenReturn("EncPDBTestCase");
    when(backendCfg.getDBDirectory()).thenReturn("EncPDBTestCase");
    when(backendCfg.isConfidentialityEnabled()).thenReturn(true);
    when(backendCfg.getCipherKeyLength()).thenReturn(128);
    when(backendCfg.getCipherTransformation()).thenReturn("AES/CBC/PKCS5Padding");
    return backendCfg;
  }
}
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/pdb/PDBTestCase.java
@@ -24,9 +24,7 @@
import org.opends.server.backends.pluggable.PluggableBackendImplTestCase;
import org.testng.annotations.Test;
/**
 * PDBBackend Tester.
 */
/** PDBBackend Tester. */
@Test
public class PDBTestCase extends PluggableBackendImplTestCase<PDBBackendCfg>
{