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

smaguin
11.32.2007 66edb536cac039604fc458c6d8512316b7fabd04
new functional testsuite on plugins 
7 files added
2011 ■■■■■ changed files
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins.xml 51 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_cleanup.xml 74 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_entryUUID.xml 284 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_lastmod.xml 396 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_refint.xml 414 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_setup.xml 80 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_uniqueness.xml 712 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins.xml
New file
@@ -0,0 +1,51 @@
<?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, 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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="main_plugins"/>
  <function name="main_plugins">
    <sequence>
      <block name="'plugins'">
         <sequence>
           <script>
             CurrentTestPath['group']=STAXCurrentBlock
           </script>
          <call function="'testGroup_Preamble'" />
          <iterate var="_test" in="['setup','refint','uniqueness','lastmod','entryUUID','cleanup']" >
            <sequence>
              <import machine="STAF_LOCAL_HOSTNAME"
                      file="'%s/testcases/plugins/plugins_%s.xml' % (TESTS_DIR,_test)"/>
              <call function="'plugins_%s' % _test" />
            </sequence>
          </iterate>
          <call function="'testGroup_Postamble'" />
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_cleanup.xml
New file
@@ -0,0 +1,74 @@
<?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, 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
 !
 !      Portions Copyright 2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="plugins_cleanup"/>
  <function name="plugins_cleanup">
    <sequence>
      <block name="'cleanup'">
       <sequence>
          <block name="'Block DS Process Stop'">
          <!--- Stop DS -->
            <sequence>
              <message>
                'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
              </message>
              <call function="'StopDsWithScript'">
               { 'location'  : STAF_REMOTE_HOSTNAME,
                 'dsHost'    : DIRECTORY_INSTANCE_HOST,
                 'dsPort'    : DIRECTORY_INSTANCE_PORT,
                 'dsBindDN'  : DIRECTORY_INSTANCE_DN,
                 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
              </call>
              <call function="'checkRC'">
               { 'returncode' : RC ,
                 'result'     : STAXResult }
              </call>
            </sequence>
            <!--- End Block DS Process Stop -->
          </block>
          <block name="'Block Remove DS Topology'">
          <!-- Remove  the topology created for the test suite -->
            <sequence>
              <message>
               'Remove DS topology created for the Test Suite'
              </message>
              <call function="'removeTopology'"/>
              <call function="'checkRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
              </call>
            </sequence>
            <!-- End Block Remove DS Topology-->
          </block>
        </sequence>
      </block>
     </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_entryUUID.xml
New file
@@ -0,0 +1,284 @@
<?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, 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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="plugins_entryUUID"/>
  <function name="plugins_entryUUID" scope="local">
    <block name="STAXCurrentFunction">
    <sequence>
      <script>
        CurrentTestPath['suite']=STAXCurrentFunction
      </script>
      <call function="'testSuite_Preamble'" />
<!---
#@TestMarker          Plugin entryUUID
#@TestName            Plugin entryUUID
#@TestIssue             Check the plugin entryUUID
#@TestPreamble       none
#@TestStep              Enable the plugin entryUUID
#@TestStep              Disable  the virtual attribute entryUUID
#@TestStep              Add an entry
#@TestStep              Execute ldapsearch request to get entryUUID attribute
#@TestPostamble     none
#@TestResult           The test is passed if the attribute entryUUID is returned
-->
 <testcase name="getTestCaseName('Plugins entryUUID setup')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'-- Disable the virtual attribute entryUUID --'</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'     : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'         : 'set-virtual-attribute-prop' ,
        'objectType'            : 'attribute-name',
        'objectName'           : 'entryUUID',
        'optionsString'         : '--set enabled:false',
        'expectedRC'           : 0 }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker          Plugin entryUUID
#@TestName            Plugin entryUUID
#@TestIssue             Check the plugin entryUUID
#@TestPreamble       none
#@TestStep              Enable the plugin entryUUID
#@TestStep              Disable  the virtual attribute entryUUID
#@TestStep              Add an entry
#@TestStep              Execute ldapsearch request to get entryUUID attribute
#@TestPostamble     none
#@TestResult           The test is passed if the attribute entryUUID is returned
-->
 <testcase name="getTestCaseName('Plugins entryUUID enable')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'-- Activate the entryUUID plugin --'</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'Entry UUID',
        'optionsString'          : '--set enabled:true',
        'expectedRC'           : 0 }
    </call>
    <message>'######  Add an entry ###### '</message>
    <!-- Add an entry -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:testuser_entryuuid')
      listAttr.append('sn:testuser_entryuuid')
      listAttr.append('cn:testuser_entryuuid')
      listAttr.append('mail:testuser_entryuuid')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'  : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'        : 'uid=testuser_entryuuid,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes' : listAttr,
         'expectedRC'     :  0
       }
    </call>
    <!-- Check the plugin  -->
    <message>'######  Check the plugin entryUUID ###### '</message>
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
        'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'        : 'uid=testuser_entryuuid,%s' % DIRECTORY_INSTANCE_SFX,
        'dsFilter'            : 'objectclass=*' ,
        'dsScope'          : 'base',
        'attributes'          : 'entryUUID',
        'expectedRC'        :  0 }
    </call>
    <script>
      returnString = STAXResult[0][1]
    </script>
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString,
         'testString'      : 'entryUUID',
         'expectedResult'      : '1' }
    </call>
    <!-- Cleanup -->
    <message>'######  Cleanup ###### '</message>
    <message>'-- Delete the test entry --'</message>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'     : 'uid=testuser_entryuuid,%s' % DIRECTORY_INSTANCE_SFX,
      }
    </call>
    <message>'-- Disable the entryUUID plugin --'</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'       : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'           : 'set-plugin-prop' ,
        'objectType'              : 'plugin-name' ,
        'objectName'             : 'Entry UUID',
        'optionsString'           : '--set enabled:false',
        'expectedRC'             : 0 }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker          Plugin entryUUID
#@TestName            Plugin entryUUID
#@TestIssue             Check the plugin entryUUID
#@TestPreamble       none
#@TestStep              Disable the plugin entryUUID
#@TestStep              Disable  the virtual attribute entryUUID
#@TestStep              Add an entry
#@TestStep              Execute ldapsearch request to get entryUUID attribute
#@TestPostamble     none
#@TestResult           The test is passed if the attribute entryUUID is not returned
-->
 <testcase name="getTestCaseName('Plugins entryUUID disable')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'-- Disable the entryUUID plugin --'</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'Entry UUID',
        'optionsString'          : '--set enabled:false',
        'expectedRC'           : 0 }
    </call>
    <!-- Add an entry -->
    <message>'######  Add an entry ###### '</message>
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:testuser_entryuuid')
      listAttr.append('sn:testuser_entryuuid')
      listAttr.append('cn:testuser_entryuuid')
      listAttr.append('mail:testuser_entryuuid')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'  : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'        : 'uid=testuser_entryuuid,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes' : listAttr,
         'expectedRC'     :  0
       }
    </call>
    <!-- The plugin is disabled. the attribute entryUUID should not be returned -->
    <message>'######  Check the plugin entryUUID ###### '</message>
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
          'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
          'dsBaseDN'        : 'uid=testuser_entryuuid,%s' % DIRECTORY_INSTANCE_SFX,
          'dsFilter'            : 'objectclass=*'   ,
          'dsScope'          : 'base',
          'attributes'        : 'entryUUID',
          'expectedRC'      :  0 }
    </call>
    <script>
      returnString = STAXResult[0][1]
    </script>
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString ,
         'testString'      : 'entryUUID',
         'expectedResult'      : '0' }
    </call>
    <message>'######  Cleanup ###### '</message>
    <message>'-- Delete the test entry --'</message>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'     : 'uid=testuser_entryuuid,%s' % DIRECTORY_INSTANCE_SFX,
      }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
 <call function="'testSuite_Postamble'" />
 </sequence>
 </block>
</function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_lastmod.xml
New file
@@ -0,0 +1,396 @@
<?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, 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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="plugins_lastmod"/>
  <function name="plugins_lastmod" scope="local">
   <block name="STAXCurrentFunction">
    <sequence>
      <script>
        CurrentTestPath['suite']=STAXCurrentFunction
      </script>
      <call function="'testSuite_Preamble'" />
<!---
#@TestMarker          Plugin lastmod
#@TestName            Plugin lastmod
#@TestIssue             Check the plugin lastmod for add operations
#@TestPreamble       none
#@TestStep              Add an entry
#@TestStep              Execute ldapsearch request to get createTimestamp attribute
#@TestPostamble     none
#@TestResult           The test is passed if the attribute createTimestamp is returned
-->
 <testcase name="getTestCaseName('Plugins lastmod enabled  for add operations')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <!-- Add an entry -->
    <message>'######  Add an entry  ###### '</message>
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:testuser_lastmod_enabled')
      listAttr.append('sn:testuser_lastmod_enabled')
      listAttr.append('cn:testuser_lastmod_enabled')
      listAttr.append('mail:testuser_lastmod_enabled')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'  : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'        : 'uid=testuser_lastmod_enabled,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes' : listAttr,
         'expectedRC'     :  0
       }
    </call>
    <message>'######  Check the plugin lastmod ###### '</message>
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
          'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
          'dsBaseDN'        : 'uid=testuser_lastmod_enabled,%s' % DIRECTORY_INSTANCE_SFX,
          'dsFilter'            : 'objectclass=*'   ,
          'dsScope'          : 'base',
          'attributes'        : 'createTimestamp',
          'expectedRC'      :  0 }
    </call>
    <script>
      returnString = STAXResult[0][1]
    </script>
   <!-- the attribute must  not be returned -->
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString ,
         'testString'      : 'createTimestamp',
         'expectedResult'      : '1' }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker          Plugin lastmod
#@TestName            Plugin lastmod
#@TestIssue             Check the plugin lastmod for modify operations
#@TestPreamble       none
#@TestStep              Modify an entry
#@TestStep              Execute ldapsearch request to get modifyTimestamp attribute
#@TestPostamble     none
#@TestResult           The test is passed if the attribute modifyTimestamp is returned
-->
 <testcase name="getTestCaseName('Plugins lastmod enabled for modify operations')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <!-- Modify an entry -->
    <message>'######  Modify an entry ###### '</message>
    <call function="'modifyAnAttribute'">
          { 'dsInstanceHost'        :  DIRECTORY_INSTANCE_HOST ,
             'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
             'dsInstanceDn'       : DIRECTORY_INSTANCE_DN ,
             'dsInstancePswd'     : DIRECTORY_INSTANCE_PSWD ,
             'DNToModify'           :   'uid=testuser_lastmod_enabled,%s' % DIRECTORY_INSTANCE_SFX,
             'attributeName'        :  'description',
             'newAttributeValue'  : 'lastmod plugin for modify operations',
             'changetype' : 'add',
             'expectedRC'       :  0 }
    </call>
    <message>'######  Check the plugin lastmod ###### '</message>
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
          'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
          'dsBaseDN'        : 'uid=testuser_lastmod_enabled,%s' % DIRECTORY_INSTANCE_SFX,
          'dsFilter'            : 'objectclass=*'   ,
          'dsScope'          : 'base',
          'attributes'        : 'modifyTimestamp',
          'expectedRC'      :  0 }
    </call>
    <script>
      returnString = STAXResult[0][1]
    </script>
   <!-- the attribute must  be returned -->
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString ,
         'testString'      : 'modifyTimestamp',
         'expectedResult'      : '1' }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker          Plugin lastmod
#@TestName            Plugin lastmod
#@TestIssue             Disable the plugin lastmod for add operations
#@TestPreamble       none
#@TestStep              Disable the plugin lastmod
#@TestStep              Add an entry
#@TestStep              Execute ldapsearch request to get createTimestamp attribute
#@TestPostamble     none
#@TestResult           The test is passed if the attribute createTimestamp is not returned
-->
 <testcase name="getTestCaseName('Plugins lastmod disabled  for add operations')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'-- Disable the lastmod plugin --'</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'LastMod',
        'optionsString'          : '--set enabled:false',
        'expectedRC'           : 0 }
    </call>
    <!-- Add an entry -->
    <message>'######  Add an entry ###### '</message>
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:testuser_lastmod_disabled')
      listAttr.append('sn:testuser_lastmod_disabled')
      listAttr.append('cn:testuser_lastmod_disabled')
      listAttr.append('mail:testuser_lastmod_disabled')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'  : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'        : 'uid=testuser_lastmod_disabled,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes' : listAttr,
         'expectedRC'     :  0
       }
    </call>
    <message>'######  Check the plugin lastmod ###### '</message>
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
          'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
          'dsBaseDN'        : 'uid=testuser_lastmod_disabled,%s' % DIRECTORY_INSTANCE_SFX,
          'dsFilter'            : 'objectclass=*'   ,
          'dsScope'          : 'base',
          'attributes'        : 'createTimestamp',
          'expectedRC'      :  0 }
    </call>
    <script>
      returnString = STAXResult[0][1]
    </script>
    <!-- the attribute must  not be returned -->
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString ,
         'testString'      : 'createTimestamp',
         'expectedResult'      : '0' }
    </call>
    <message>'######  Cleanup  ###### '</message>
    <message>'-- Enable the lastmod plugin --'</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'LastMod',
        'optionsString'          : '--set enabled:true',
        'expectedRC'           : 0 }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker          Plugin lastmod
#@TestName            Plugin lastmod
#@TestIssue             Disable the plugin lastmod for modify operations
#@TestPreamble       none
#@TestStep              Disable the plugin lastmod
#@TestStep              modify an entry
#@TestStep              Execute ldapsearch request to get modifyTimestamp attribute
#@TestPostamble     none
#@TestResult           The test is passed if the attribute modifyTimestamp is not returned
-->
 <testcase name="getTestCaseName('Plugins lastmod disabled  for modify operations')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'-- Disable the lastmod plugin --'</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'LastMod',
        'optionsString'          : '--set enabled:false',
        'expectedRC'           : 0 }
    </call>
    <!-- Modify an entry -->
    <message>'######  Modify an entry ###### '</message>
    <call function="'modifyAnAttribute'">
          { 'dsInstanceHost'        :  DIRECTORY_INSTANCE_HOST ,
             'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
             'dsInstanceDn'       : DIRECTORY_INSTANCE_DN ,
             'dsInstancePswd'     : DIRECTORY_INSTANCE_PSWD ,
             'DNToModify'           :   'uid=testuser_lastmod_disabled,%s' % DIRECTORY_INSTANCE_SFX,
             'attributeName'        :  'description',
             'newAttributeValue'  : 'lastmod plugin for modify operations',
             'changetype' : 'add',
             'expectedRC'       :  0 }
    </call>
    <message>'######  Check the plugin lastmod ###### '</message>
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
          'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
          'dsBaseDN'        : 'uid=testuser_lastmod_disabled,%s' % DIRECTORY_INSTANCE_SFX,
          'dsFilter'            : 'objectclass=*'   ,
          'dsScope'          : 'base',
          'attributes'        : 'modifyTimestamp',
          'expectedRC'      :  0 }
    </call>
    <script>
      returnString = STAXResult[0][1]
    </script>
    <!-- the attribute must not be returned -->
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString ,
         'testString'      : 'modifyTimestamp',
         'expectedResult'      : '0' }
    </call>
    <message>'######  Cleanup ###### '</message>
    <message>'-- Enable the lastmod plugin --'</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'LastMod',
        'optionsString'          : '--set enabled:true',
        'expectedRC'           : 0 }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker          Plugin lastmod
#@TestName            Plugin lastmod
#@TestIssue             Cleanup
#@TestPreamble       none
#@TestStep              Delete entries
#@TestPostamble     none
#@TestResult           The test is passed if the entries are deleted
-->
 <testcase name="getTestCaseName('Plugins lastmod - cleanup')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'-- Delete the test entry --'</message>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'     : 'uid=testuser_lastmod_disabled,%s' % DIRECTORY_INSTANCE_SFX,
      }
    </call>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'     : 'uid=testuser_lastmod_enabled,%s' % DIRECTORY_INSTANCE_SFX,
      }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
 <call function="'testSuite_Postamble'" />
 </sequence>
 </block>
</function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_refint.xml
New file
@@ -0,0 +1,414 @@
<?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, 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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="plugins_refint"/>
  <function name="plugins_refint" scope="local">
    <block name="STAXCurrentFunction">
    <sequence>
      <script>
        CurrentTestPath['suite']=STAXCurrentFunction
      </script>
      <call function="'testSuite_Preamble'" />
<!--
#@TestMarker       Plugin referential integrity
#@TestName         Plugin referential integrity
#@TestIssue        Setup
#@TestPreamble     none
#@TestStep         Create Group
#@TestPostamble    none
#@TestResult       The test is passed if  the  creation is done
-->
 <testcase name="getTestCaseName('Setup')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Add user entries ###### '</message>
    <message>' '</message>
    <!-- Add an entry -->
    <iterate var="username" in="['user01','user02','user03','user4','user05']" >
       <sequence>
         <script>
           listAttr=[]
           listAttr.append('objectclass:top')
           listAttr.append('objectclass:organizationalperson')
           listAttr.append('objectclass:inetorgperson')
           listAttr.append('objectclass:person')
           listAttr.append('givenname:%s' % username)
           listAttr.append('cn:%s' % username)
           listAttr.append('description:%s' % username)
           listAttr.append('uid:%s' % username)
           listAttr.append('sn:%s' % username)
         </script>
         <call function="'addAnEntry'">
         { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
            'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
            'dsInstanceDn'        : DIRECTORY_INSTANCE_DN ,
            'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD ,
            'DNToAdd'             : 'cn=%s,%s' % (username,DIRECTORY_INSTANCE_SFX),
            'listAttributes'        : listAttr,
            'expectedRC'         :  0
          }
         </call>
      </sequence>
    </iterate>
    <message>'######  Add a static Group ###### '</message>
    <message>' '</message>
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectClass:domain')
      listAttr.append('dc:groups')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'  : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'        : 'dc=groups,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes' : listAttr,
         'expectedRC'     :  0
       }
    </call>
    <!-- Add a static group -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:groupofuniquenames')
      listAttr.append('description:this is the description of my_staticgroup')
      listAttr.append('cn:my_staticgroup')
      listAttr.append('uniqueMember:cn=user01,%s' % DIRECTORY_INSTANCE_SFX)
      listAttr.append('uniqueMember:cn=user02,%s' % DIRECTORY_INSTANCE_SFX)
      listAttr.append('uniqueMember:cn=user03,%s' % DIRECTORY_INSTANCE_SFX)
      listAttr.append('uniqueMember:cn=user04,%s' % DIRECTORY_INSTANCE_SFX)
      listAttr.append('uniqueMember:cn=user05,%s' % DIRECTORY_INSTANCE_SFX)
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'  : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'        : 'cn=my_staticgroup,dc=groups,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes' : listAttr,
         'expectedRC'     :  0
       }
    </call>
    <!-- Check the group configuration -->
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
          'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
          'dsBaseDN'        :  DIRECTORY_INSTANCE_SFX,
          'dsFilter'            : 'objectclass=groupOfUniqueNames'  ,
          'attributes'        : 'uniqueMember',
          'expectedRC'      :  0 }
    </call>
    <script>
      returnString = STAXResult[0][1]
    </script>
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString ,
         'testString'      : 'uniqueMember',
         'expectedResult'      : '1' }
    </call>
    <message>'######  Activate the referential integrity plugin. ###### '</message>
    <message>'  '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'Referential Integrity',
        'optionsString'          : '--set enabled:true',
        'expectedRC'           : 0 }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!--
#@TestMarker       Plugin referential integrity
#@TestName         Referential integrity check on GROUPS
#@TestPreamble    none
#@TestStep           Delete a user
#@TestStep           Check that the references to the deleted user are gone.
#@TestStep           Check that the references to an existing user are still present.
#@TestPostamble    none
#@TestResult         all steps must be success
-->
 <testcase name="getTestCaseName('Referential integrity on groups with default referential-integrity-attribute-type')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Delete an user entry###### '</message>
    <message>' '</message>
    <!-- Delete an entry -->
    <call function="'DeleteEntry'">
     { 'dsInstanceHost'    : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'    : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'        : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'            :  'cn=user01,%s' % (DIRECTORY_INSTANCE_SFX),
      }
    </call>
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
          'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
          'dsBaseDN'        :  DIRECTORY_INSTANCE_SFX,
          'dsFilter'            : 'objectclass=groupOfUniqueNames'  ,
          'attributes'        : 'uniquemember',
          'expectedRC'      :  0 }
    </call>
    <script>
      returnString = STAXResult[0][1]
    </script>
    <message>'references to the delete user must be gone ' </message>
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString ,
         'testString'      : 'user01',
         'expectedResult'      : '0' }
    </call>
    <message>'references to an existing user must be still present' </message>
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString ,
         'testString'      : 'user02',
         'expectedResult'      : '1' }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!--
#@TestMarker       Plugin referential integrity
#@TestName         Referential integrity check on GROUPS after a change of configuration
#@TestPreamble    none
#@TestStep           Check change of the referential-integrity-attribute-type attribute is dynamic
#@TestStep           Delete the user02
#@TestStep           Check that the references to the deleted user are still present
#@TestPostamble    none
#@TestResult         all steps must be success
-->
 <testcase name="getTestCaseName('Check the change of the referential-integrity-attribute-type attribute')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Remove the attribute uniquemember from the list of referential-integrity-attribute-type ###### '</message>
    <message>'  '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'Referential Integrity',
        'optionsString'          : '--remove referential-integrity-attribute-type:uniquemember',
        'expectedRC'           : 0 }
    </call>
    <!-- Delete an entry -->
    <message>'######  Delete an user entry###### '</message>
    <message>' '</message>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost'    : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'    : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'        : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'            :  'cn=user02,%s' % (DIRECTORY_INSTANCE_SFX),
      }
    </call>
    <!-- Check the new configuration is applied -->
    <message>'Check the new configuration is applied'</message>
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
          'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
          'dsBaseDN'        :  DIRECTORY_INSTANCE_SFX,
          'dsFilter'            : 'objectclass=groupOfUniqueNames'  ,
          'attributes'        : 'uniquemember',
          'expectedRC'      :  0 }
    </call>
    <script>
      returnString = STAXResult[0][1]
    </script>
    <message>'The references to the delete user must be still present ' </message>
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString ,
         'testString'      : 'user02',
         'expectedResult'      : '1' }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!--
#@TestMarker       Plugin referential integrity
#@TestName         Referential integrity check on GROUPS is disabled
#@TestPreamble    none
#@TestStep           Disable the referential integrity plugin
#@TestStep           Delete the user03
#@TestStep           Check that the references to the deleted user are still present
#@TestPostamble    none
#@TestResult         all steps must be success
-->
 <testcase name="getTestCaseName('Referential integrity on groups is disabled')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Disable the referential integrity plugin. ###### '</message>
    <message>'  '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'Referential Integrity',
        'optionsString'          : '--set enabled:false',
        'expectedRC'           : 0 }
    </call>
    <message>'######  Set the list of referential-integrity-attribute-type ###### '</message>
    <message>'  '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'Referential Integrity',
        'optionsString'          : '--set referential-integrity-attribute-type:uniquemember --set referential-integrity-attribute-type:member',
        'expectedRC'           : 0 }
    </call>
    <!-- Delete an entry -->
    <message>'######  Delete an user entry###### '</message>
    <message>' '</message>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost'    : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'    : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'        : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'            :  'cn=user03,%s' % (DIRECTORY_INSTANCE_SFX),
      }
    </call>
    <!-- Check the new configuration is applied -->
    <message>'Check the new configuration is applied'</message>
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
          'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
          'dsBaseDN'        :  DIRECTORY_INSTANCE_SFX,
          'dsFilter'            : 'objectclass=groupOfUniqueNames'  ,
          'attributes'        : 'uniquemember',
          'expectedRC'      :  0 }
    </call>
    <script>
      returnString = STAXResult[0][1]
    </script>
    <message>'The references to the delete user must be still present ' </message>
    <call function="'searchStringForSubstring'">
      { 'returnString'     : returnString ,
         'testString'      : 'user03',
         'expectedResult'      : '1' }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
 <call function="'testSuite_Postamble'" />
 </sequence>
 </block>
</function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_setup.xml
New file
@@ -0,0 +1,80 @@
<?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, 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
 !
 !      Portions Copyright 2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="plugins_setup"/>
  <function name="plugins_setup">
    <sequence>
      <block name="'setup'">
      <sequence>
        <block name="'Block Create DS Topology'">
          <!-- Create the topology necessary to the test group/suite -->
          <sequence>
              <message>
                 'Create DS topology as described in config.py'
              </message>
                <call function="'createTopology'">
                  { 'initialiseInstance' : True }
                </call>
                <call function="'checkRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
                </call>
          </sequence>
          <!--- End Block Create DS Topology -->
        </block>
        <block name="'Block DS Process Active'">
        <!--- Start DS -->
          <sequence>
           <message>
            'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
           </message>
           <!--- Start DS -->
           <call function="'StartDsWithScript'">
             { 'location'  : STAF_REMOTE_HOSTNAME }
           </call>
           <call function="'checkRC'">
            { 'returncode' : RC ,
              'result'     : STAXResult }
           </call>
           <!--- Check that DS started -->
           <call function="'isAlive'">
            { 'noOfLoops'        : 5 ,
              'noOfMilliSeconds' : 2000 }
           </call>
          </sequence>
          <!--- End Block DS Process Active -->
        </block>
      </sequence>
      </block>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/plugins/plugins_uniqueness.xml
New file
@@ -0,0 +1,712 @@
<?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, 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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="plugins_uniqueness"/>
  <function name="plugins_uniqueness" scope="local">
    <block name="STAXCurrentFunction">
    <sequence>
      <script>
        CurrentTestPath['suite']=STAXCurrentFunction
      </script>
      <call function="'testSuite_Preamble'" />
<!---
#@TestMarker       Plugin uniqueness
#@TestName         Plugin uniqueness
#@TestIssue        Setup
#@TestPreamble     none
#@TestStep         Create the user entries used for the test
#@TestPostamble    none
#@TestResult       The test is passed if  the  creation is done
-->
 <testcase name="getTestCaseName('Setup')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Add an user entry ###### '</message>
    <message>' '</message>
    <!--  This entry is used as a reference -->
    <!-- Add an entry -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:testuser_uniqueness')
      listAttr.append('sn:testuser_uniqueness')
      listAttr.append('cn:testuser_uniqueness')
      listAttr.append('mail:testuser_uniqueness@sun')
      listAttr.append('description:mydescription1')
      listAttr.append('description:mydescription2')
      listAttr.append('telephoneNumber:1 2 3 4')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'  : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'        : 'uid=testuser_uniqueness,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes' : listAttr,
         'expectedRC'     :  0
       }
    </call>
    <call function="'SearchObject'">
     { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN,
          'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
          'dsBaseDN'        : 'uid=testuser_uniqueness,%s' % DIRECTORY_INSTANCE_SFX,
          'dsFilter'            : 'objectclass=*'   ,
          'dsScope'          : 'base',
          'expectedRC'      :  0 }
    </call>
    <message>'######  Activate the uniqueness plugin. ###### '</message>
    <message>'  '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'UID Unique Attribute',
        'optionsString'          : '--set enabled:true',
        'expectedRC'           : 0 }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker       Plugin uniqueness
#@TestName         Plugin uniqueness
#@TestIssue        Check the plugin uniqueness  with the unique-attribute-type  uid
#@TestPreamble     none
#@TestStep         Keep the default configuration ( ie, unique-attribute-type = uid )
#@TestStep          Check we can't add an entry with the same uid as the user entry reference
#@TestPostamble    none
#@TestResult       The test is passed if  the  creation is refused
-->
 <testcase name="getTestCaseName('Enabled with unique-attribute-type defined to uid')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Add an entry with an uid already present in the DIT  ###### '</message>
    <message>'--- The creation must be refused to ensure the uniqueness of the attributes uid '</message>
    <message>'  '</message>
    <!-- Add an entry -->
    <!--The uid  testuser_uniqueness already exist in the DIT.  the Add must be refused with the error 19 -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:testuser_uniqueness')
      listAttr.append('sn:testuser_uniqueness')
      listAttr.append('cn:testuser_uniqueness')
    </script>
   <call function="'addAnEntry'">
      { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'          : 'uid=testuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes'     : listAttr,
         'expectedRC'      :  19
       }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker        Plugin uniqueness
#@TestName          Plugin uniqueness
#@TestIssue         Check the plugin uniqueness with the unique-attribute-type mail
#@TestPreamble      none
#@TestStep          set the unique-attribute-type to mail
#@TestStep          Check we can't add an entry with the same mail as the user entry reference
#@TestPostamble     none
#@TestResult        The test is passed if  the  creation is refused
-->
 <testcase name="getTestCaseName('Enabled with unique-attribute-type defined to mail')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Set the unique-attribute-type to mail  ###### '</message>
    <message>' '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'UID Unique Attribute',
        'optionsString'          : '--set unique-attribute-type:mail',
        'expectedRC'           : 0 }
    </call>
    <message>'######  Add an entry containing a mail already present in the DIT ###### '</message>
    <!-- Add an entry -->
    <!-- the Add must be refused with the error 19 -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:newtestuser_uniqueness')
      listAttr.append('sn:newtestuser_uniqueness')
      listAttr.append('cn:newtestuser_uniqueness')
      listAttr.append('mail:testuser_uniqueness@sun')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'       : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'             : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes'        : listAttr,
         'expectedRC'         :  19
       }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker        Plugin uniqueness
#@TestName          Plugin uniqueness
#@TestIssue         Check the plugin uniqueness with several unique-attribute-type
#@TestPreamble      none
#@TestStep          set the unique-attribute-type to mail and telephonenumber
#@TestStep          Check we can't add an entry with the same mail as the user entry reference
#@TestStep          Check we can't add an entry with the same telephonenumber as the user entry reference
#@TestPostamble     none
#@TestResult        The test is passed if  the  creation is refused
-->
 <testcase name="getTestCaseName('Enabled with unique-attribute-type defined to mail and telephoneNumber')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Set the unique-attribute-type to mail  and telephoneNumber ###### '</message>
    <message>' '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'UID Unique Attribute',
        'optionsString'          : '--set unique-attribute-type:mail --set unique-attribute-type:telephoneNumber',
        'expectedRC'           : 0 }
    </call>
    <message>'######  Add an entry containing a mail already present in the DIT ###### '</message>
    <!-- Add an entry -->
    <!-- the Add must be refused with the error 19 -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:newtestuser_uniqueness')
      listAttr.append('sn:newtestuser_uniqueness')
      listAttr.append('cn:newtestuser_uniqueness')
      listAttr.append('mail:testuser_uniqueness@sun')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'       : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'             : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes'        : listAttr,
         'expectedRC'         :  19
       }
    </call>
    <message>'######  Add an entry containing a telephoneNumber already present in the DIT ###### '</message>
    <!-- Add an entry -->
    <!-- the Add must be refused with the error 19 -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:newtestuser_uniqueness')
      listAttr.append('sn:newtestuser_uniqueness')
      listAttr.append('cn:newtestuser_uniqueness')
      listAttr.append('telephoneNumber:1 2 3 4')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'       : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'             : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes'        : listAttr,
         'expectedRC'         :  19
       }
    </call>
    <message>'######  Add an entry containing a telephoneNumber not present in the DIT ###### '</message>
    <!-- Add an entry -->
    <!-- the Add must be accepted -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:newtestuser_uniqueness')
      listAttr.append('sn:newtestuser_uniqueness')
      listAttr.append('cn:newtestuser_uniqueness')
      listAttr.append('telephoneNumber:1 2 3 4 5')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'       : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'             : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes'        : listAttr,
         'expectedRC'         :  0
       }
    </call>
    <!-- cleanup -->
    <message>'######  Cleanup ###### '</message>
    <message>' '</message>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'     :  'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
      }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker         Plugin uniqueness
#@TestName           Plugin uniqueness
#@TestIssue          Check the plugin ensures the uniqueness of the attributes multi  valued
#@TestPreamble       none
#@TestStep           set the unique-attribute-type to description
#@TestStep          Check we can't add an entry with the same description as the user entry reference
#@TestStep           the attribute description is multi-valued
#@TestPostamble      none
#@TestResult         The test is passed if  the  creation is refused
-->
 <testcase name="getTestCaseName('Check uniqueness of attributes mutil-valued')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Set the unique-attribute-type to description ###### '</message>
    <message>' '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'UID Unique Attribute',
        'optionsString'          : '--set unique-attribute-type:description',
        'expectedRC'           : 0 }
    </call>
    <message>'######  Add an entry containing a description already present in the DIT ###### '</message>
    <!-- Add an entry -->
    <!-- the Add must be refused with the error 19 -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:newtestuser_uniqueness')
      listAttr.append('sn:newtestuser_uniqueness')
      listAttr.append('cn:newtestuser_uniqueness')
      listAttr.append('description:mydescription2')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'       : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'             : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes'        : listAttr,
         'expectedRC'         :  19
       }
    </call>
    <message>'######  Add an entry containing a description not present in the DIT ###### '</message>
    <!-- Add an entry -->
    <!-- the Add must be accepted -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:newtestuser_uniqueness')
      listAttr.append('sn:newtestuser_uniqueness')
      listAttr.append('cn:newtestuser_uniqueness')
      listAttr.append('description:mydescription')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'       : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'             : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes'        : listAttr,
         'expectedRC'         :  0
       }
    </call>
    <!-- cleanup -->
    <message>'######  Cleanup ###### '</message>
    <message>' '</message>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'     :  'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
      }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker        Plugin uniqueness
#@TestName          Plugin uniqueness
#@TestIssue         Check the plugin uniqueness matchs the scope configured
#@TestPreamble      none
#@TestStep          set the unique-attribute-type to description
#@TestStep          set the unique-attribute-base-dn
#@TestStep          Check we can't add an entry under the restricted scope
#@TestStep          Check we can add an entry outside the restricted scope
#@TestPostamble     none
#@TestResult        The test is passed is the plugin respectes the restricted scope
  -->
 <testcase name="getTestCaseName('Restrict the scope of the plugin')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Set the unique-attribute-base-dn  to dc=example,%s ###### ' % DIRECTORY_INSTANCE_SFX</message>
    <message>' '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'UID Unique Attribute',
        'optionsString'          : '--set unique-attribute-type:description  --set unique-attribute-base-dn:dc=example,%s' % DIRECTORY_INSTANCE_SFX,
        'expectedRC'           : 0 }
    </call>
    <message>'######  Add an entry under dc=example,%s ###### ' % DIRECTORY_INSTANCE_SFX</message>
    <!-- Add an entry -->
    <!-- the Add must be accepted -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:newtestuser_uniqueness')
      listAttr.append('sn:newtestuser_uniqueness')
      listAttr.append('cn:newtestuser_uniqueness')
      listAttr.append('description:mydescription2')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'       : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'             : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes'        : listAttr,
         'expectedRC'         :  0
       }
    </call>
    <message>'######  Add an entry under  %s  ###### ' % DIRECTORY_INSTANCE_SFX</message>
    <!-- Add an entry -->
    <!-- the Add must be refused with the error 19 -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:newtestuser_uniqueness')
      listAttr.append('sn:newtestuser_uniqueness')
      listAttr.append('cn:newtestuser_uniqueness')
      listAttr.append('description:mydescription2')
    </script>
    <call function="'addAnEntry'">
      { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'       : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'             : 'uid=newtestuser_uniqueness,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes'        : listAttr,
         'expectedRC'         :  0
       }
    </call>
    <!-- cleanup -->
    <message>'######  Cleanup ###### '</message>
    <message>' '</message>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'     :  'uid=newtestuser_uniqueness,%s' % DIRECTORY_INSTANCE_SFX,
      }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker            Plugin uniqueness
#@TestName              Plugin uniqueness
#@TestIssue             Disable  the plugin uniqueness  with the uniqu
#@TestStep              Disable the plugin uniqueness
#@TestStep              Keep the default configuration ( ie, unique-attribute-type = uid )
#@TestStep              Add an entry  containing a uid value already present in the DIT
#@TestPostamble         none
#@TestResult            The test is passed if  the  creation is accepted
-->
 <testcase name="getTestCaseName('Disabled with unique-attribute-type defined to uid')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <message>'######  Disable the uniqueness plugin ###### '</message>
    <message>' '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'UID Unique Attribute',
        'optionsString'          : '--set enabled:false',
        'expectedRC'           : 0 }
    </call>
    <message>'######  Add an entry ###### '</message>
    <message>'-- The creation must be  accepted '</message>
    <!-- Add an entry -->
    <!-- The add must be accepted -->
    <script>
      listAttr = []
      listAttr.append('objectclass:top')
      listAttr.append('objectclass:organizationalperson')
      listAttr.append('objectclass:inetorgperson')
      listAttr.append('objectclass:person')
      listAttr.append('givenname:testuser_uniqueness')
      listAttr.append('sn:testuser_uniqueness')
      listAttr.append('cn:testuser_uniqueness')
      listAttr.append('uid:testuser_uniqueness')
    </script>
   <call function="'addAnEntry'">
      { 'dsInstanceHost'  : DIRECTORY_INSTANCE_HOST ,
         'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
         'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
         'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
         'DNToAdd'        : 'uid=testuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
         'listAttributes' : listAttr,
         'expectedRC'     :  0
       }
    </call>
    <!-- cleanup -->
    <message>'######  Cleanup ###### '</message>
    <message>' '</message>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'     : 'uid=testuser_uniqueness,dc=example,%s' %  DIRECTORY_INSTANCE_SFX,
      }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
<!---
#@TestMarker         Plugin uniqueness
#@TestName           Plugin uniqueness
#@TestIssue          Cleanup
#@TestPreamble       none
#@TestStep           delete the user entries
#@TestPostamble      none
#@TestResult         The test is passed if  the  delete are done
-->
 <testcase name="getTestCaseName('Cleanup')">
  <sequence>
    <call function="'testCase_Preamble'"/>
    <call function="'DeleteEntry'">
     { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
        'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
        'dsBaseDN'     : 'uid=testuser_uniqueness,%s' % DIRECTORY_INSTANCE_SFX,
      }
    </call>
    <message>'######  Desactivate the uniqueness plugin. ###### '</message>
    <message>'  '</message>
    <call function="'dsconfig'">
      { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
        'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
        'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
        'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
        'subcommand'          : 'set-plugin-prop' ,
        'objectType'             : 'plugin-name' ,
        'objectName'            : 'UID Unique Attribute',
        'optionsString'          : '--set enabled:false',
        'expectedRC'           : 0 }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>
 <call function="'testSuite_Postamble'" />
 </sequence>
 </block>
</function>
</stax>