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

Chris Ridd
30.49.2015 f157e19aea0407f268de1631cb7b6b60be27aa0a
CR-6457 OPENDJ-453: use correct schema definitions for attributeTypes/objectClasses/etc
1 files renamed
2 files modified
390 ■■■■■ changed files
opendj-server-legacy/resource/schema/00-core.ldif 23 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java 346 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/types/DITStructureRuleTestCase.java 21 ●●●● patch | view | raw | blame | history
opendj-server-legacy/resource/schema/00-core.ldif
@@ -21,7 +21,7 @@
#
#
#      Copyright 2006-2010 Sun Microsystems, Inc.
#      Portions Copyright 2011-2014 ForgeRock AS
#      Portions Copyright 2011-2015 ForgeRock AS
#      Portions Copyright 2013-2014 Manuel Gaupp
#
#
@@ -198,16 +198,20 @@
  EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
  SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation
  X-ORIGIN 'RFC 4512' )
attributeTypes: ( 2.5.21.5 NAME 'attributeTypes' EQUALITY caseIgnoreMatch
attributeTypes: ( 2.5.21.5 NAME 'attributeTypes'
  EQUALITY objectIdentifierFirstComponentMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.3 USAGE directoryOperation
  X-ORIGIN 'RFC 4512' )
attributeTypes: ( 2.5.21.6 NAME 'objectClasses' EQUALITY caseIgnoreMatch
attributeTypes: ( 2.5.21.6 NAME 'objectClasses'
  EQUALITY objectIdentifierFirstComponentMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.37 USAGE directoryOperation
  X-ORIGIN 'RFC 4512' )
attributeTypes: ( 2.5.21.4 NAME 'matchingRules' EQUALITY caseIgnoreMatch
attributeTypes: ( 2.5.21.4 NAME 'matchingRules'
  EQUALITY objectIdentifierFirstComponentMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.30 USAGE directoryOperation
  X-ORIGIN 'RFC 4512' )
attributeTypes: ( 2.5.21.8 NAME 'matchingRuleUse' EQUALITY caseIgnoreMatch
attributeTypes: ( 2.5.21.8 NAME 'matchingRuleUse'
  EQUALITY objectIdentifierFirstComponentMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.31 USAGE directoryOperation
  X-ORIGIN 'RFC 4512' )
attributeTypes: ( 2.5.21.9 NAME 'structuralObjectClass' EQUALITY objectIdentifierMatch
@@ -234,13 +238,16 @@
attributeTypes: ( 1.3.6.1.4.1.1466.101.120.16 NAME 'ldapSyntaxes'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.54 USAGE directoryOperation
  X-ORIGIN 'RFC 4512' )
attributeTypes: ( 2.5.21.1 NAME 'dITStructureRules' EQUALITY caseIgnoreMatch
attributeTypes: ( 2.5.21.1 NAME 'dITStructureRules'
  EQUALITY IntegerFirstComponentMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 USAGE directoryOperation
  X-ORIGIN 'RFC 4512' )
attributeTypes: ( 2.5.21.7 NAME 'nameForms' EQUALITY caseIgnoreMatch
attributeTypes: ( 2.5.21.7 NAME 'nameForms'
  EQUALITY objectIdentifierFirstComponentMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.35 USAGE directoryOperation
  X-ORIGIN 'RFC 4512' )
attributeTypes: ( 2.5.21.2 NAME 'dITContentRules' EQUALITY caseIgnoreMatch
attributeTypes: ( 2.5.21.2 NAME 'dITContentRules'
  EQUALITY objectIdentifierFirstComponentMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.16 USAGE directoryOperation
  X-ORIGIN 'RFC 4512' )
attributeTypes: ( 0.9.2342.19200300.100.1.25 NAME ( 'dc' 'domainComponent' )
opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
@@ -743,6 +743,7 @@
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-J", "1.2.840.113556.1.4.1413",
      "-f", path
    };
@@ -793,6 +794,7 @@
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-J", "1.2.840.113556.1.4.1413",
      "-f", path
    };
@@ -1707,6 +1709,7 @@
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-J", "1.2.840.113556.1.4.1413",
      "-f", path
    };
@@ -2326,6 +2329,7 @@
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-J", "1.2.840.113556.1.4.1413",
      "-f", path
    };
@@ -3151,6 +3155,7 @@
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-J", "1.2.840.113556.1.4.1413",
      "-f", path
    };
@@ -4206,6 +4211,7 @@
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-J", "1.2.840.113556.1.4.1413",
      "-f", path
    };
@@ -4774,6 +4780,8 @@
    assertTrue(schemaFile.exists());
  }
  /**
   * Tests the behavior of the schema backend when attempting to replace an
   * existing matching rule use.
@@ -4810,6 +4818,7 @@
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-J", "1.2.840.113556.1.4.1413",
      "-f", path
    };
@@ -5155,6 +5164,342 @@
    assertNull(mru);
  }
  /**
   * Tests the behavior of the schema backend when attempting to add another
   * value to attributeTypes that matches an existing one using the correct
   * matching rules.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testAttributeTypesMatchingRule()
         throws Exception
  {
    String path = TestCaseUtils.createTempFile(
         "dn: cn=schema",
         "changetype: modify",
         "add: attributeTypes",
         "attributeTypes: ( testattributetypesmatchingrule-oid " +
              "NAME 'testAttributeTypesMatchingRule' " +
              "EQUALITY booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: attributeTypes",
         "attributeTypes: ( testattributetypesmatchingrule-oid " +
              "NAME 'testAttributeTypesMatchingRule' " +
              "EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " +
              "X-ORIGIN 'SchemaBackendTestCase' )");
    String attrName = "testattributetypesmatchingrule";
    assertFalse(DirectoryServer.getSchema().hasAttributeType(attrName));
    String[] args =
    {
      "-h", "127.0.0.1",
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-f", path
    };
    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 20);
  }
  /**
   * Tests the behavior of the schema backend when attempting to add another
   * value to objectClasses that matches an existing one using the correct
   * matching rules.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testObjectClassesMatchingRule()
         throws Exception
  {
    String path = TestCaseUtils.createTempFile(
         "dn: cn=schema",
         "changetype: modify",
         "add: objectClasses",
         "objectClasses: ( testobjectclassesmatchingrule-oid " +
              "NAME 'testObjectClassesMatchingRule' " +
              "SUP top STRUCTURAL MAY cn " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: objectClasses",
         "objectClasses: ( testobjectclassesmatchingrule-oid " +
              "NAME 'testObjectClassesMatchingRule' " +
              "SUP top AUXILIARY MAY mail " +
              "X-ORIGIN 'SchemaBackendTestCase' )");
    String objectClassName = "testobjectclassesmatchingrule";
    assertFalse(DirectoryServer.getSchema().hasObjectClass(objectClassName));
    String[] args =
    {
      "-h", "127.0.0.1",
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-f", path
    };
    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 20);
  }
  /**
   * Tests the behavior of the schema backend when attempting to add another
   * value to nameForms that matches an existing one using the correct
   * matching rules.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testNameFormsMatchingRule()
         throws Exception
  {
    String path = TestCaseUtils.createTempFile(
         "dn: cn=schema",
         "changetype: modify",
         "add: objectClasses",
         "objectClasses: ( testnameformsmatchingruleoc-oid " +
              "NAME 'testNameFormsMatchingRuleOC' " +
              "SUP top STRUCTURAL MAY ( cn $ mail ) " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: nameForms",
         "nameForms: ( testnameformsmatchingrule-oid " +
              "NAME 'testNameFormsMatchingRule' " +
              "OC testNameFormsMatchingRuleOC MUST mail " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: nameForms",
         "nameForms: ( testnameformsmatchingrule-oid " +
              "NAME 'testNameFormsMatchingRule' " +
              "OC testNameFormsMatchingRuleOC MUST cn " +
              "X-ORIGIN 'SchemaBackendTestCase' )");
    String nameFormName = "testnameformsmatchingrule";
    assertFalse(DirectoryServer.getSchema().hasNameForm(nameFormName));
    String[] args =
    {
      "-h", "127.0.0.1",
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-f", path
    };
    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 20);
  }
  /**
   * Tests the behavior of the schema backend when attempting to add another
   * value to dITContentRules that matches an existing one using the correct
   * matching rules.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testDitContentRulesMatchingRule()
         throws Exception
  {
    String path = TestCaseUtils.createTempFile(
         "dn: cn=schema",
         "changetype: modify",
         "add: objectClasses",
         "objectClasses: ( testditcontentrulesmatchingrule-oid " +
              "NAME 'testDitContentRulesMatchingRuleOC' " +
              "SUP top STRUCTURAL MAY ( cn $ mail ) " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: dITContentRules",
         "dITContentRules: ( testditcontentrulesmatchingrule-oid " +
              "NAME 'testDitContentRulesMatchingRule' " +
              "MUST mail " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: dITContentRules",
         "dITContentRules: ( testditcontentrulesmatchingrule-oid " +
              "NAME 'testDitContentRulesMatchingRule' " +
              "MUST cn " +
              "X-ORIGIN 'SchemaBackendTestCase' )");
    String objectClassName = "testditcontentrulesmatchingruleoc";
    assertNull(DirectoryServer.getSchema().getObjectClass(objectClassName));
    String[] args =
    {
      "-h", "127.0.0.1",
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-f", path
    };
    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 20);
  }
  /**
   * Tests the behavior of the schema backend when attempting to add another
   * value to dITStructureRules that matches an existing one using the correct
   * matching rules.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testDitStructureRulesMatchingRule()
         throws Exception
  {
    String path = TestCaseUtils.createTempFile(
         "dn: cn=schema",
         "changetype: modify",
         "add: objectClasses",
         "objectClasses: ( testditstructurerulesmatchingruleoc1-oid " +
              "NAME 'testDitStructureRulesMatchingRuleOC1' " +
              "SUP top STRUCTURAL MAY ( cn $ mail ) " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: objectClasses",
         "objectClasses: ( testditstructurerulesmatchingruleoc2-oid " +
              "NAME 'testDitStructureRulesMatchingRuleOC2' " +
              "SUP top STRUCTURAL MAY ( cn $ mail ) " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: nameForms",
         "nameForms: ( testditstructurerulesmatchingrulenf1-oid " +
              "NAME 'testDitStructureRulesMatchingRuleNF1' " +
              "OC testDitStructureRulesMatchingRuleOC1 MUST mail " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: nameForms",
         "nameForms: ( testditstructurerulesmatchingrulenf2-oid " +
              "NAME 'testDitStructureRulesMatchingRuleNF2' " +
              "OC testDitStructureRulesMatchingRuleOC2 MUST mail " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: dITStructureRules",
         "dITStructureRules: ( 999666 " +
              "NAME 'testDitStructureRulesMatchingRule' " +
              "FORM testDitStructureRulesMatchingRuleNF1 " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: dITStructureRules",
         "dITStructureRules: ( 999666 " +
              "NAME 'testDitStructureRulesMatchingRule' " +
              "FORM testDitStructureRulesMatchingRuleNF2 " +
              "X-ORIGIN 'SchemaBackendTestCase' )");
    String objectClassName = "testditcontentrulesmatchingruleoc1";
    assertNull(DirectoryServer.getSchema().getObjectClass(objectClassName));
    String[] args =
    {
      "-h", "127.0.0.1",
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-f", path
    };
    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 20);
  }
  /**
   * Tests the behavior of the schema backend when attempting to add another
   * value to matchingRuleUse that matches an existing one using the correct
   * matching rules.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testMatchingRuleUseMatchingRule()
         throws Exception
  {
    String path = TestCaseUtils.createTempFile(
         "dn: cn=schema",
         "changetype: modify",
         "add: attributeTypes",
         "attributeTypes: ( testmatchingruleusematchingruleat1-oid " +
              "NAME 'testMatchingRuleUseMatchingRuleAT1' " +
              "EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: attributeTypes",
         "attributeTypes: ( testmatchingruleusematchingruleat2-oid " +
              "NAME 'testMatchingRuleUseMatchingRuleAT2' " +
              "EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: matchingRuleUse",
         "matchingRuleUse: ( booleanMatch " +
              "NAME 'testMatchingRuleUseMatchingRule' " +
              "APPLIES testMatchingRuleUseMatchingRuleAT1 " +
              "X-ORIGIN 'SchemaBackendTestCase' )",
         "",
         "dn: cn=schema",
         "changetype: modify",
         "add: matchingRuleUse",
         "matchingRuleUse: ( booleanMatch " +
              "NAME 'testMatchingRuleUseMatchingRule' " +
              "APPLIES testMatchingRuleUseMatchingRuleAT2 " +
              "X-ORIGIN 'SchemaBackendTestCase' )");
    String attrName = "testmatchingruleusematchingruleat1";
    assertNull(DirectoryServer.getSchema().getAttributeType(attrName));
    String[] args =
    {
      "-h", "127.0.0.1",
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-f", path
    };
    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 20);
  }
  /**
   * This test case covers the problem identified in issue #1318.  In that
   * issue, a problem arose if the following elements occurred in the following
@@ -5455,4 +5800,3 @@
    assertFalse(alerts.isEmpty());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/types/DITStructureRuleTestCase.java
File was renamed from opendj-server-legacy/src/test/java/org/opends/server/types/DITContentRuleTestCase.java
@@ -36,9 +36,9 @@
/**
 * This class provides a set of test cases for virtual attributes.
 * This class provides a set of test cases for DIT Structure Rules
 */
public class DITContentRuleTestCase
public class DITStructureRuleTestCase
       extends TypesTestCase
{
@@ -59,13 +59,13 @@
  /**
   * Tests the addition of a new DITConentRule with a conflicting
   * Tests the addition of a new DITContentRule with a conflicting
   * rule identifier.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testInvalidDITContentRule()
  public void testInvalidDITStructureRule()
         throws Exception
  {
    String filePath = TestCaseUtils.createTempFile(
@@ -83,6 +83,7 @@
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D","cn=directory manager",
      "-w","password",
      "-J", "1.2.840.113556.1.4.1413",
      "-a",
      "-f", filePath
    };
@@ -94,13 +95,13 @@
  /**
   * Tests the addition of new DITContentRules with unique rule ids.
   * Tests the addition of new DITStructureRules with unique rule ids.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test(dependsOnMethods = {"org.opends.server.types."+
  "DITContentRuleTestCase.testInvalidDITContentRule"})
  public void testValidDITRContentRules()
  "DITStructureRuleTestCase.testInvalidDITStructureRule"})
  public void testValidDITStructureRules()
         throws Exception
  {
    String filePath = TestCaseUtils.createTempFile(
@@ -135,13 +136,13 @@
  /**
   * Cleans up the DITContentRules.
   * Cleans up the DITStructureRules.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test(dependsOnMethods = {"org.opends.server.types."+
  "DITContentRuleTestCase.testValidDITRContentRules"})
  public void cleanUpDITRContentRules()
  "DITStructureRuleTestCase.testValidDITStructureRules"})
  public void cleanUpDITStructureRules()
         throws Exception
  {
    String filePath = TestCaseUtils.createTempFile(