From f766331ec709a20c2abefd97ee945c5d6b8cc179 Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Wed, 06 Feb 2013 09:54:54 +0000
Subject: [PATCH] [Opendj-169] CR-1257 Add new schema testcase for issue OPENDSDJ-169
---
opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic_tests.xml | 139 +++++++++++++++++++++++
opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic.xml | 2
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema5.ldif | 33 +++++
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema6.ldif | 33 +++++
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema7.ldif | 30 +++++
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema5.ldif | 36 ++++++
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema4.ldif | 36 ++++++
opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema8.ldif | 30 +++++
8 files changed, 338 insertions(+), 1 deletions(-)
diff --git a/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema5.ldif b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema5.ldif
new file mode 100644
index 0000000..cc6b81f
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema5.ldif
@@ -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
+
diff --git a/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema6.ldif b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema6.ldif
new file mode 100644
index 0000000..4d39b58
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema6.ldif
@@ -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
+
diff --git a/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema7.ldif b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema7.ldif
new file mode 100644
index 0000000..4094299
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema7.ldif
@@ -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
+
diff --git a/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema8.ldif b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema8.ldif
new file mode 100644
index 0000000..f60cdea
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/dynamic_schema8.ldif
@@ -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
+
diff --git a/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema4.ldif b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema4.ldif
new file mode 100644
index 0000000..bbc5f0f
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema4.ldif
@@ -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 )
+
diff --git a/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema5.ldif b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema5.ldif
new file mode 100644
index 0000000..288903d
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/shared/data/schema/ldifs/updateSchema5.ldif
@@ -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 ) )
+
diff --git a/opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic.xml b/opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic.xml
index 01ed628..cdd3279 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic.xml
+++ b/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 -->
diff --git a/opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic_tests.xml
index ceef8e0..16faf13 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/schema/dynamic/schema_dynamic_tests.xml
+++ b/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>
--
Gitblit v1.10.0