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

Christophe Sovant
06.54.2013 f766331ec709a20c2abefd97ee945c5d6b8cc179
[Opendj-169] CR-1257 Add new schema testcase for issue OPENDSDJ-169
6 files added
2 files modified
339 ■■■■■ changed files
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema5.ldif 33 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema6.ldif 33 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema7.ldif 30 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema8.ldif 30 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema4.ldif 36 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema5.ldif 36 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic.xml 2 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic_tests.xml 139 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema5.ldif
New file
@@ -0,0 +1,33 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying * information:
#      Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#      Copyright 2013 ForgeRock AS
#
dn: cn=schema5,dc=dynamic-schema-tests-2,dc=example,dc=com
objectclass: top
objectclass: person
objectclass: addschema4OC
cn: schema5
sn: test5
addschema4AT: attr4
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema6.ldif
New file
@@ -0,0 +1,33 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying * information:
#      Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#      Copyright 2013 ForgeRock AS
#
dn: cn=schema6,dc=dynamic-schema-tests-2,dc=example,dc=com
objectclass: top
objectclass: person
objectclass: addschema5OC
cn: schema6
sn: test6
addschema4AT: attr4
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema7.ldif
New file
@@ -0,0 +1,30 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying * information:
#      Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#      Copyright 2013 ForgeRock AS
#
dn: cn=schema5,dc=dynamic-schema-tests-2,dc=example,dc=com
changetype: modify
add: addschema5AT
addschema5AT: attr5
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema8.ldif
New file
@@ -0,0 +1,30 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying * information:
#      Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#      Copyright 2013 ForgeRock AS
#
dn: cn=schema6,dc=dynamic-schema-tests-2,dc=example,dc=com
changetype: modify
add: addschema5AT
addschema5AT: attr5
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema4.ldif
New file
@@ -0,0 +1,36 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying information:
#      Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#      Copyright 2013 ForgeRock AS
#
dn: cn=schema
changetype:modify
add: attributeTypes
attributeTypes: ( addschema4at-oid NAME 'addschema4AT' )
-
add: objectClasses
objectClasses: ( addschema4oc-oid NAME 'addschema4OC' SUP person MAY addschema4AT )
-
add: objectClasses
objectClasses: ( addschema5oc-oid NAME 'addschema5OC' SUP addschema4OC )
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema5.ldif
New file
@@ -0,0 +1,36 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying information:
#      Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#      Copyright 2013 ForgeRock AS
#
dn: cn=schema
changetype:modify
add: attributeTypes
attributeTypes: ( addschema5at-oid NAME 'addschema5AT' )
-
delete: objectClasses
objectClasses: ( addschema4oc-oid NAME 'addschema4OC' SUP person MAY addschema4AT )
-
add: objectClasses
objectClasses: ( addschema4oc-oid NAME 'addschema4OC' SUP person MAY ( addschema4AT $ addschema5AT ) )
opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic.xml
@@ -24,6 +24,7 @@
 ! CDDL HEADER END
 !
 !      Copyright 2008-2009 Sun Microsystems, Inc.
 !      Portions Copyright 2013 ForgeRock AS
 ! -->
<stax>
  <defaultcall function="main_schema_dynamic"/>
@@ -83,6 +84,7 @@
                  testsList.append('schema_dynamic_002')
                  testsList.append('schema_dynamic_003')
                  testsList.append('schema_dynamic_004')
                  testsList.append('schema_dynamic_005')
                </script>
                <!-- Execute the Tests -->
opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic_tests.xml
@@ -24,6 +24,7 @@
 ! CDDL HEADER END
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 !      Portions Copyright 2013 ForgeRock AS
 ! -->
<stax>
@@ -391,7 +392,143 @@
          <call function="'testCase_Postamble'"/>
        </finally>
      </try>
    </testcase>
    </testcase>
  </function>
<!-- Test case: Modifying Existing Custom Objectclass -->
<!--
    Place test-specific test information here.
    The tag, TestMarker, must be the same as the tag, TestSuiteName.
    #@TestMarker                Dynamic Schema Tests
    #@TestName                  Modifying Existing Custom Objectclass
    #@TestIssue                 None
    #@TestPurpose               To verify modification of custom objectclasses is dynamic.
    #@TestPreamble              none
    #@TestStep                  Modify an existing custom objectclass by adding a new
                                custom attribute (optional attribute).
                                Then try adding to an entry (which require the custom objectclass)
                                this new custom attributes, it should works.
    #@TestPostamble             none
    #@TestResult                Success if OpenDS returns 0
-->
  <function name="schema_dynamic_005" scope="local">
    <testcase name="getTestCaseName('Modifying Existing Custom Objectclass')">
      <try>
        <sequence>
          <call function="'testCase_Preamble'"/>
          <message>
             'Schema: Modifying Existing Custom Objectclass'
          </message>
          <!-- Add attribute addschema4AT -->
          <!-- Add objectclass addschema4OC with optional attribute addschema4AT -->
          <!-- Add objectclass addschema5OC with inherits from objectclass addschema4OC -->
          <call function="'runFunction'">
            { 'functionName'      : 'modifyEntry',
              'functionMessage'   : 'Add two custom objectclasses (with inheritance) and add a custom attribute to the parent one.',
              'functionException' : 'LDAP.ModifyException'               ,
              'functionArguments' : { 'dsInstanceHost'    : server.host ,
                                      'dsInstancePort'    : server.port ,
                                      'dsInstanceDn'      : server.dn ,
                                      'dsInstancePswd'    : server.password ,
                                      'entryToBeModified' : '%s/schema/ldifs/updateSchema4.ldif'
                                                            % remote.data }
            }
          </call>
          <!-- Add entry which depends on objectclass addschema4OC -->
          <call function="'runFunction'">
            { 'functionName'      : 'addEntry',
              'functionMessage'   : 'Add an entry that uses the parent custom objectclass.',
              'functionException' : 'LDAP.AddException',
              'functionArguments' : { 'dsInstanceHost' : server.host ,
                                      'dsInstancePort' : server.port ,
                                      'dsInstanceDn'   : server.dn ,
                                      'dsInstancePswd' : server.password ,
                                      'entryToBeAdded' : '%s/schema/ldifs/dynamic_schema5.ldif'
                                                          % remote.data}
            }
          </call>
          <!-- Add entry which depends on objectclass addschema5OC -->
          <call function="'runFunction'">
            { 'functionName'      : 'addEntry',
              'functionMessage'   : 'Add an entry that uses the child custom objectclass.',
              'functionException' : 'LDAP.AddException',
              'functionArguments' : { 'dsInstanceHost' : server.host ,
                                      'dsInstancePort' : server.port ,
                                      'dsInstanceDn'   : server.dn ,
                                      'dsInstancePswd' : server.password ,
                                      'entryToBeAdded' : '%s/schema/ldifs/dynamic_schema6.ldif'
                                                          % remote.data}
            }
          </call>
          <!-- Add attribute addschema5AT -->
          <!-- Add attribute addschema5AT (as optional) to the objectclass addschema4OC -->
          <call function="'runFunction'">
            { 'functionName'      : 'modifyEntry',
              'functionMessage'   : 'Add a second custom attribute to the parent custom objectclass.',
              'functionException' : 'LDAP.ModifyException',
              'functionArguments' : { 'dsInstanceHost'    : server.host ,
                                      'dsInstancePort'    : server.port ,
                                      'dsInstanceDn'      : server.dn ,
                                      'dsInstancePswd'    : server.password ,
                                      'entryToBeModified' : '%s/schema/ldifs/updateSchema5.ldif'
                                                            % remote.data }
            }
          </call>
          <!-- Modify entry which depends on objectclass addschema4OC by adding attribute addschema5AT -->
          <call function="'runFunction'">
            { 'functionName'      : 'modifyEntry',
              'functionMessage'   : 'Modify entry which depends on the parent custom objectclass by adding the new custom attribute.',
              'functionArguments' : { 'dsInstanceHost'    : server.host ,
                                      'dsInstancePort'    : server.port ,
                                      'dsInstanceDn'      : server.dn ,
                                      'dsInstancePswd'    : server.password ,
                                      'entryToBeModified' : '%s/schema/ldifs/dynamic_schema7.ldif'
                                                            % remote.data }
            }
          </call>
           <!-- Modify entry which depends on objectclass addschema5OC by adding attribute addschema5AT -->
          <call function="'runFunction'">
            { 'functionName'      : 'modifyEntry',
              'functionMessage'   : 'Modify entry which depends on the child custom objectclass by adding the new custom attribute.',
              'functionException' : 'LDAP.ModifyException',
              'functionArguments' : { 'dsInstanceHost'    : server.host ,
                                      'dsInstancePort'    : server.port ,
                                      'dsInstanceDn'      : server.dn ,
                                      'dsInstancePswd'    : server.password ,
                                      'entryToBeModified' : '%s/schema/ldifs/dynamic_schema8.ldif'
                                                            % remote.data }
            }
          </call>
        </sequence>
        <catch exception="'STAXException.LDAP.AddException'" typevar="eType" var="eInfo">
          <message log="1" level="'fatal'">
            '%s: LDAPAdd failed. eInfo(%s)' % (eType,eInfo)
          </message>
        </catch>
        <catch exception="'STAXException.LDAP.ModifyException'" typevar="eType" var="eInfo">
          <message log="1" level="'fatal'">
            '%s: LDAPModify failed. eInfo(%s)' % (eType,eInfo)
          </message>
        </catch>
        <catch exception="'STAXException.LDAP.SearchException'" typevar="eType" var="eInfo">
          <message log="1" level="'fatal'">
            '%s: LDAPSearch failed. eInfo(%s)' % (eType,eInfo)
          </message>
        </catch>
        <finally>
          <call function="'testCase_Postamble'"/>
        </finally>
      </try>
    </testcase>
  </function>
</stax>