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

Jean-Noel Rouvignac
26.39.2015 eaf7376b3416d25dea0f00dd927a75385f21f354
Code cleanup
2 files modified
65 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java 60 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
@@ -795,16 +795,15 @@
  private EntryContainer createEntryContainer(WriteableStorage txn, DN baseDN) throws ConfigException
  {
    DN tempDN;
    try
    {
      tempDN = baseDN.child(DN.valueOf("dc=importTmp"));
      DN tempDN = baseDN.child(DN.valueOf("dc=importTmp"));
      return rootContainer.openEntryContainer(tempDN, txn);
    }
    catch (DirectoryException e)
    {
      throw new ConfigException(e.getMessageObject());
    }
    return rootContainer.openEntryContainer(tempDN, txn);
  }
  private void clearSuffix(EntryContainer entryContainer)
opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java
@@ -26,20 +26,19 @@
 */
package org.opends.server.types;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import java.util.ArrayList;
import static org.assertj.core.api.Assertions.*;
import static org.testng.Assert.*;
import java.util.ArrayList;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
/**
 * This class defines a set of tests for the org.opends.server.core.DN
@@ -66,14 +65,10 @@
        { "DC=COM", "dc=com", "DC=COM" },
        { "dc = com", "dc=com", "dc=com" },
        { " dc = com ", "dc=com", "dc=com" },
        { "dc=example,dc=com", "dc=example,dc=com",
            "dc=example,dc=com" },
        { "dc=example, dc=com", "dc=example,dc=com",
            "dc=example,dc=com" },
        { "dc=example ,dc=com", "dc=example,dc=com",
            "dc=example,dc=com" },
        { "dc =example , dc  =   com", "dc=example,dc=com",
            "dc=example,dc=com" },
        { "dc=example,dc=com", "dc=example,dc=com", "dc=example,dc=com" },
        { "dc=example, dc=com", "dc=example,dc=com", "dc=example,dc=com" },
        { "dc=example ,dc=com", "dc=example,dc=com", "dc=example,dc=com" },
        { "dc =example , dc  =   com", "dc=example,dc=com", "dc=example,dc=com" },
        { "givenName=John+cn=Doe,ou=People,dc=example,dc=com",
            "cn=doe+givenname=john,ou=people,dc=example,dc=com",
            "givenName=John+cn=Doe,ou=People,dc=example,dc=com" },
@@ -170,8 +165,7 @@
    TestCaseUtils.startServer();
    AttributeType dummy = DirectoryServer.getDefaultAttributeType(
        "x-test-integer-type", DirectoryServer
            .getDefaultIntegerSyntax());
        "x-test-integer-type", DirectoryServer.getDefaultIntegerSyntax());
    DirectoryServer.getSchema().registerAttributeType(dummy, true);
  }
@@ -303,8 +297,7 @@
  @Test(dataProvider = "testDNs")
  public void testValueOf(String rawDN, String normDN, String unused) throws Exception {
    DN dn = DN.valueOf(rawDN);
    StringBuilder normalizedDnString = new StringBuilder(normDN);
    assertEquals(dn.toNormalizedUrlSafeString(), normalizedDnString.toString());
    assertEquals(dn.toNormalizedUrlSafeString(), normDN);
  }
@@ -325,9 +318,7 @@
  @Test(dataProvider = "testDNs")
  public void testDecodeByteString(String rawDN, String normDN, String unused) throws Exception {
    DN dn = DN.decode(ByteString.valueOf(rawDN));
    StringBuilder normalizedDNString = new StringBuilder(normDN);
    assertEquals(dn.toNormalizedUrlSafeString(), normalizedDNString.toString());
    assertEquals(dn.toNormalizedUrlSafeString(), normDN);
  }
@@ -394,18 +385,7 @@
   */
  @Test(dataProvider = "illegalDNs", expectedExceptions = DirectoryException.class)
  public void testIllegalStringDNs(String dn) throws Exception {
    try {
      DN.valueOf(dn);
    } catch (DirectoryException e) {
      throw e;
    } catch (Exception e) {
      System.out.println("Illegal DN <" + dn
          + "> threw the wrong type of exception");
      throw e;
    }
    throw new RuntimeException("Illegal DN <" + dn
        + "> did not throw an exception");
    DN.valueOf(dn);
  }
@@ -422,19 +402,7 @@
  @Test(dataProvider = "illegalDNs", expectedExceptions = DirectoryException.class)
  public void testIllegalOctetStringDNs(String dn) throws Exception {
    ByteString octetString = ByteString.valueOf(dn);
    try {
      DN.decode(octetString);
    } catch (DirectoryException e) {
      throw e;
    } catch (Exception e) {
      System.out.println("Illegal DN <" + dn
          + "> threw the wrong type of exception");
      throw e;
    }
    throw new RuntimeException("Illegal DN <" + dn
        + "> did not throw an exception");
    DN.decode(octetString);
  }