schema_dynamic_tests.xml revision 75e4d72341a69fa125aeab6e326e49a5422a9eac
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
<!--
! 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, exclude this CDDL HEADER in each
! file and exclude 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 2008 Sun Microsystems, Inc.
! Portions Copyright 2013 ForgeRock AS
! -->
<stax>
<!-- Test case: Update Schema via a file -->
<!--
Place test-specific test information here.
The tag, TestMarker, must be the same as the tag, TestSuiteName.
#@TestMarker Dynamic Schema Tests
#@TestName Update via a file
#@TestIssue none
#@TestPurpose To make sure the schema can be updated by a file.
#@TestPreamble none
#@TestStep Create a task that will cause the server to
read one or two files into the schema.
Then try adding a new entry that uses the
added schema.
#@TestPostamble none
#@TestResult Success if OpenDS returns 0
-->
<function name="schema_dynamic_001" scope="local">
<testcase name="getTestCaseName('Update via File')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Schema: Dynamic Schema: Update via File'
</message>
<script>
__baseDN='dc=dynamic-schema-tests,dc=example,%s' % server.suffix
</script>
<call function="'runFunction'">
{ 'functionName' : 'addSchemaTask' ,
'functionMessage' : 'Add schema objects as a task.' ,
'functionException' : 'Tasks.SchemaException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'taskID' : '6' ,
'ldifFile' : '05-DynamicSchemaAdd.ldif' }
}
</call>
<call function="'runFunction'">
{ 'functionName' : 'addEntry' ,
'functionMessage' : 'Add an entry that uses this new schema.' ,
'functionException' : 'LDAP.AddException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'entryToBeAdded' : '%s/schema/ldifs/dynamic_schema1.ldif'
% remote.data }
}
</call>
<call function="'runFunction'">
{ 'functionName' : 'SearchObject' ,
'functionMessage' : 'Search for the entry just added and return addschema1AT.' ,
'functionException' : 'LDAP.SearchException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'dsBaseDN' : __baseDN ,
'dsFilter' : 'objectclass=addschema1OC' ,
'attributes' : 'addschema1AT' }
}
</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.SearchException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: LDAPSearch failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<catch exception="'STAXException.Tasks.SchemaException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Tasks Schema failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<call function="'testCase_Postamble'"/>
</finally>
</try>
</testcase>
</function>
<!-- Test case: Update Schema Over Protocol: Add schema object-->
<!--
Place test-specific test information here.
The tag, TestMarker, must be the same as the tag, TestSuiteName.
#@TestMarker Dynamic Schema Tests
#@TestName Update Over Protocol: Add schema object
#@TestIssue none
#@TestPurpose To verify the schema can be updated over protocol.
#@TestPreamble none
#@TestStep Update the schema over protocol adding
a new objectclass and attributes.
Then try adding a new entry that uses these
new attributes and objectclass.
#@TestPostamble none
#@TestResult Success if OpenDS returns 0
-->
<function name="schema_dynamic_002" scope="local">
<testcase name="getTestCaseName('Add Schema Object')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Schema: Update Over Protocol: Add Schema Object'
</message>
<script>
__baseDN='dc=dynamic-schema-tests-2,dc=example,%s' % server.suffix
</script>
<call function="'runFunction'">
{ 'functionName' : 'modifyEntry' ,
'functionMessage' : 'Modify an entry that uses this new schema.' ,
'functionException' : 'LDAP.ModifyException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'entryToBeModified' : '%s/schema/ldifs/updateSchema.ldif'
% remote.data }
}
</call>
<call function="'runFunction'">
{ 'functionName' : 'addEntry' ,
'functionMessage' : 'Add an entry that uses this new schema.' ,
'functionException' : 'LDAP.AddException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'entryToBeAdded' : '%s/schema/ldifs/dynamic_schema2.ldif'
% remote.data }
}
</call>
<call function="'runFunction'">
{ 'functionName' : 'SearchObject' ,
'functionMessage' : 'Search for the entry just added and return addschema2AT.' ,
'functionException' : 'LDAP.SearchException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'dsBaseDN' : __baseDN ,
'dsFilter' : 'objectclass=addschema2OC' ,
'attributes' : 'addschema2AT' }
}
</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>
<!-- Test case: Update Schema Over Protocol: Replace Schema Object -->
<!--
Place test-specific test information here.
The tag, TestMarker, must be the same as the tag, TestSuiteName.
#@TestMarker Dynamic Schema Tests
#@TestName Update Over Protocol: Replace Schema Object
#@TestIssue none
#@TestPurpose To verify attributes and objectclasses can be replaced over protocol.
#@TestPreamble none
#@TestStep Update the schema over protocol by replacing
an objectclass and attributes with new ones.
Then try adding a new entry that uses the replaced
attributes and objectclass, it should fail. Then try
adding an entry that uses the replacement objectclass and attributes.
#@TestPostamble none
#@TestResult Success if OpenDS returns 0
-->
<function name="schema_dynamic_003" scope="local">
<testcase name="getTestCaseName('Replace Schema Object')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Schema: Update Over Protocol: Replace Schema Object'
</message>
<script>
__baseDN='dc=dynamic-schema-tests-2,dc=example,%s' % server.suffix
</script>
<call function="'runFunction'">
{ 'functionName' : 'modifyEntry' ,
'functionMessage' : 'Modify an entry that uses this new schema.' ,
'functionException' : 'LDAP.ModifyException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'entryToBeModified' : '%s/schema/ldifs/updateSchema2.ldif'
% remote.data }
}
</call>
<call function="'runFunction'">
{ 'functionName' : 'addEntry' ,
'functionMessage' : 'Add an entry that uses this new schema.' ,
'functionException' : 'LDAP.AddException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'entryToBeAdded' : '%s/schema/ldifs/dynamic_schema4.ldif'
% remote.data }
}
</call>
<call function="'runFunction'">
{ 'functionName' : 'SearchObject' ,
'functionMessage' : 'Search for the entry just added and return addschema2AT.' ,
'functionException' : 'LDAP.SearchException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'dsBaseDN' : __baseDN ,
'dsFilter' : 'objectclass=addschema3OC' ,
'attributes' : 'addschema3AT' }
}
</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>
<!-- Test case: Update Schema Over Protocol: Remove Schema Object-->
<!--
Place test-specific test information here.
The tag, TestMarker, must be the same as the tag, TestSuiteName.
#@TestMarker Dynamic Schema Tests
#@TestName Update Over Protocol: Remove Schema Object
#@TestIssue none
#@TestPurpose To verify attributes and objectclasses can be removed over protocol.
#@TestPreamble none
#@TestStep Update the schema over protocol by removing
an objectclass and attributes.
Then try adding a new entry that uses these
removed attributes and objectclass, it should fail.
#@TestPostamble none
#@TestResult Success if OpenDS returns 0
-->
<function name="schema_dynamic_004" scope="local">
<testcase name="getTestCaseName('Remove Schema Object')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Schema: Update Over Protocol: Remove Schema Object'
</message>
<call function="'runFunction'">
{ 'functionName' : 'modifyEntry' ,
'functionMessage' : 'Modify an entry that uses this new schema.' ,
'functionException' : 'LDAP.ModifyException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'entryToBeModified' : '%s/schema/ldifs/updateSchema3.ldif'
% remote.data }
}
</call>
<call function="'runFunction'">
{ 'functionName' : 'addEntry' ,
'functionMessage' : 'Add an entry that uses the schema just removed.' ,
'functionException' : 'LDAP.AddException' ,
'functionArguments' : { 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'entryToBeAdded' : '%s/schema/ldifs/dynamic_schema3.ldif'
% remote.data,
'expectedRC' : 65 }
}
</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>
<!-- 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>