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

al_xipe
13.19.2007 e1c8a524cf81af215762d8bae27d73361b5db4b3
this commit includes some code refactoring but mainly code to support emma in the functional tests and the new XSL sheet for dynamic report drill down
15 files modified
1563 ■■■■ changed files
opends/tests/functional-tests/shared/functions/baselib.xml 27 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/dsadm.xml 260 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/ldap.xml 364 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/security.xml 241 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/topology.xml 26 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/utils.xml 186 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/staf-installer.xml 23 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/aci/aci.xml 4 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/indexes/indexes.xml 48 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/quickstart/quickstart.xml 33 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/runFuncTests.xml 221 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/runTestJob.xml 35 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/sample/sample.xml 81 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/client_auth/client_auth_setup.xml 2 ●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/security.xml 12 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/baselib.xml
@@ -26,7 +26,6 @@
 !      Portions Copyright 2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <function name="GetDirectoryServerVars">
    <function-prolog>
      This function gets variables associated with the Directory Server
@@ -47,11 +46,9 @@
    </function-map-args>
    <sequence>
      <script>
        mylocation=location
        mypath=dsPath
        DSInfo=directory_server_information()
      </script>
@@ -61,7 +58,8 @@
      <call function="'StartDsWithScript'">
        { 'location'  : mylocation,
          'dsPath'    : mypath,
          'dsSystemInfo' : 'true' }
          'dsSystemInfo' : 'true'
        }
      </call>
      <if expr="RC != 0">
@@ -69,9 +67,12 @@
          'Unable to obtain system information variables for %s %s.'  % (mylocation,mypath)
        </message>                 
      <else>
          <sequence>
            <message>
              'Processing [%s]' % STAXResult
            </message>
        <script>
          DSInfo.SystemList=STAXResult[1].split('\n')
              DSInfo.SystemList=STAXResult[0][1].split('\n')
          DSInfo.ServerDict['server version']= \
            DSInfo.getServerVersion(DSInfo.SystemList[0])
                    
@@ -98,16 +99,16 @@
          
          DSInfoServersDict[mypath]=DSInfo.ServerDict
        </script>
          </sequence>
      </else>
      </if>
      
      <!-- Obtain the secret variables for the system from start-ds -->
      <call function="'StartDsWithScript'">
        { 'location'    : mylocation,
          'dsPath'      : mypath,
          'dsBuildInfo' : 'true' }
          'dsBuildInfo' : 'true'
        }
      </call>
      <if expr="RC != 0">
@@ -115,9 +116,8 @@
          'Unable to obtain build information variables for %s %s.'  % (mylocation,mypath)
        </message>                 
      <else>
        <script>
          DSInfo.SystemList=STAXResult[1].split('\n')
            DSInfo.SystemList=STAXResult[0][1].split('\n')
                    
          for DSInfo.line in DSInfo.SystemList:
            DSInfo.key=DSInfo.line[0:DSInfo.line.find(':')].strip()
@@ -140,13 +140,8 @@
          DSInfo.ServerDict['debug build']= \
            DSInfo.getServerValueFromKey('Debug Build',DSInfo.SystemDict)            
        </script>
      </else>
      </if>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/shared/functions/dsadm.xml
@@ -137,19 +137,13 @@
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Setup DS Script'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Setup DS Script',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'path'      : dsPath
        }
      </call>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
@@ -321,18 +315,12 @@
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
            
      <process name="'Setup DS Script'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Setup DS Script',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams
        }
      </call>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
@@ -423,30 +411,22 @@
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      
      <process name="'Start DS Script'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'location'  : location
        }
      </call>
      <script>
        startRC=RC
        startResult=STAXResult
      </script>
      <call function="'checkRC'">
          { 'returncode' : startRC ,
            'result'     : startResult }
      </call>
     
      <return>startResult[0]</return>
      <return>startResult</return>
          
    </sequence>
    
@@ -670,17 +650,12 @@
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
            
      <process name="'Stop DS Script'">
        <location>'%s' % (location)</location>
        <command>'%s' % (STAFCmd)</command>
        <parms>'%s' % (STAFCmdParams)</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Stop DS Script',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams
        }
      </call>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
@@ -694,17 +669,14 @@
      This function generates a server jks certificate
    </function-prolog>
    <sequence>
      <process name="'Generate Server JKS Certificate'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/bin/keytool' % JAVA_HOME</command>
        <parms>'-genkey -alias server-cert -keyalg rsa -dname "cn=client,O=Sun Microsystems,C=US" -keystore "keystore" -storepass "servercert" -keypass "servercert"'</parms>
        <workdir>'%s/../config' % (OPENDS_BINPATH)</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Generate Server JKS Certificate',
          'command'   : '%s/bin/keytool' % JAVA_HOME,
          'arguments' : '-genkey -alias server-cert -keyalg rsa -dname "cn=client,O=Sun Microsystems,C=US" -keystore "keystore" -storepass "servercert" -keypass "servercert"',
          'path'      : '%s/../config' % (OPENDS_BINPATH),
          'location'  : STAF_REMOTE_HOSTNAME
        }
      </call>
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
@@ -717,17 +689,14 @@
      This function generates a server PKCS12 certificate
    </function-prolog>
    <sequence>
      <process name="'Generate Server PKCS12 Certificate'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/bin/keytool' % JAVA_HOME</command>
        <parms>'-genkey -alias server-cert -keyalg rsa -dname "cn=client,O=Sun Microsystems,C=US" -keystore "keystore" -storepass "servercert" -keypass "servercert" -storetype "PKCS12"'</parms>
        <workdir>'%s/../config' % (OPENDS_BINPATH)</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Generate Server PKCS12 Certificate',
          'command'   : '%s/bin/keytool' % JAVA_HOME,
          'arguments' : '-genkey -alias server-cert -keyalg rsa -dname "cn=client,O=Sun Microsystems,C=US" -keystore "keystore" -storepass "servercert" -keypass "servercert" -storetype "PKCS12"',
          'path'      : '%s/../config' % (OPENDS_BINPATH),
          'location'  : STAF_REMOTE_HOSTNAME
        }
      </call>
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
@@ -740,17 +709,14 @@
      This function self-signs a server JKS certificate
    </function-prolog>
    <sequence>
      <process name="'Self-Signs Server JKS Certificate'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/bin/keytool' % JAVA_HOME</command>
        <parms>'-selfcert -alias server-cert -keystore "keystore" -storepass "servercert"'</parms>
        <workdir>'%s/../config' % (OPENDS_BINPATH)</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Self-Signs Server JKS Certificate',
          'command'   : '%s/bin/keytool' % JAVA_HOME,
          'arguments' : '-selfcert -alias server-cert -keystore "keystore" -storepass "servercert"',
          'path'      : '%s/../config' % (OPENDS_BINPATH),
          'location'  : STAF_REMOTE_HOSTNAME
        }
      </call>
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
@@ -763,17 +729,14 @@
      This function self-signs a server PKCS12 certificate
    </function-prolog>
    <sequence>
      <process name="'Self-Signs Server PKCS12 Certificate'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/bin/keytool' % JAVA_HOME</command>
        <parms>'-selfcert -alias server-cert -keystore "keystore" -storepass "servercert" -storetype "PKCS12"'</parms>
        <workdir>'%s/../config' % (OPENDS_BINPATH)</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Self-Signs Server PKCS12 Certificate',
          'command'   : '%s/bin/keytool' % JAVA_HOME,
          'arguments' : '-selfcert -alias server-cert -keystore "keystore" -storepass "servercert" -storetype "PKCS12"',
          'path'      : '%s/../config' % (OPENDS_BINPATH),
          'location'  : STAF_REMOTE_HOSTNAME
        }
      </call>
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
@@ -828,17 +791,12 @@
      <message>
        '%s/import-ldif%s -l %s -n %s %s' % (dsBinPath,fileExt,ldifFile,backEnd,extraParams)
      </message>
      <process name="'Offline Import'">
        <location>'%s' % location </location>
        <command>'%s/import-ldif%s' % (dsBinPath,fileExt)</command>
        <parms>'-l %s -n %s %s' % (ldifFile,backEnd,extraParams)</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Offline Import',
          'command'   : '%s/import-ldif%s' % (dsBinPath,fileExt),
          'arguments' : '-l %s -n %s %s' % (ldifFile,backEnd,extraParams)
        }
      </call>
      <script>
        importRC=RC
        importResult=STAXResult
@@ -1073,18 +1031,12 @@
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
            
      <process name="'Offline Import Script'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Offline Import Script',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams
        }
      </call>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
@@ -1567,17 +1519,12 @@
      <message> 
        '%s/export-ldif%s -l %s -n %s %s' % (dsBinPath,fileExt,ldifFile,backEnd,extraParams)
      </message>
      <process name="'Ldif Export'">
        <location>'%s' % location </location>
        <command>'%s/export-ldif%s' % (dsBinPath,fileExt)</command>
        <parms>'-l %s -n %s %s' % (ldifFile,backEnd,extraParams)</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Ldif Export',
          'command'   : '%s/export-ldif%s' % (dsBinPath,fileExt),
          'arguments' : '-l %s -n %s %s' % (ldifFile,backEnd,extraParams)
        }
      </call>
      <script>
        exportRC=RC
        exportResult=STAXResult
@@ -1857,17 +1804,13 @@
      <message>
        'backup%s -n %s -d %s %s' % (fileExt,backEnd,backupDir,extraParams)
      </message>
      <process name="'Offline Backup'">
        <location>'%s' % myLocation </location>
        <command>'%s/backup%s' % (dsBinPath,fileExt)</command>
        <parms>'-d %s -n %s %s' % (backupDir,backEnd,extraParams)</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
              ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Offline Backup',
          'location'  : myLocation,
          'command'   : '%s/backup%s' % (dsBinPath,fileExt),
          'arguments' : '-d %s -n %s %s' % (backupDir,backEnd,extraParams)
        }
      </call>
      <script>
        backupRC=RC
        backupResult=STAXResult
@@ -2111,17 +2054,13 @@
      <message>
        'restore%s -d %s %s' % (fileExt,backupDir,extraParams)
      </message>
      <process name="'Offline restore'">
        <location>'%s' % myLocation </location>
        <command>'%s/restore%s' % (dsBinPath,fileExt)</command>
        <parms>'-d %s %s' % (backupDir,extraParams)</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Offline Restore',
          'location'  : myLocation,
          'command'   : '%s/restore%s' % (dsBinPath,fileExt),
          'arguments' : '-d %s %s' % (backupDir,extraParams)
        }
      </call>
      <script>
        restoreRC=RC
        restoreResult=STAXResult
@@ -3183,17 +3122,14 @@
          </message>
          <!-- Search for task status -->
          <process name="'Search On line Import Task'">
            <location>'%s' % myLocation</location>
            <command>'%s' % STAFCmd</command>
            <parms>'%s' % STAFCmdParams</parms>
            <workdir>'%s' % dsBinPath</workdir>
            <envs>
              ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
            </envs>
            <stderr mode="'stdout'"/>
            <returnstdout/>
          </process>
          <call function="'runCommand'">
            { 'name'      : 'Search On line Import Task',
              'command'   : STAFCmd,
              'arguments' : STAFCmdParams,
              'location'  : myLocation
            }
          </call>
          
          <script>
            STAFCmdRC=RC
opends/tests/functional-tests/shared/functions/ldap.xml
@@ -87,7 +87,6 @@
        </function-arg-def>     
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
@@ -117,24 +116,13 @@
 
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Add Entry from ldif file'">
        <location>'%s' % mylocation</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'location'  : mylocation,
          'name'      : 'Add Entry From LDIF'
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -142,7 +130,8 @@
      <call function="'checktestRC'">
        { 'returncode' : STAXCode ,
          'result'     : STAXReason,
          'expected'   : expectedRC }
          'expected'   : expectedRC
        }
      </call>
      <return>
        STAXReason
@@ -150,6 +139,7 @@
    </sequence>
  </function>
  <!-- ldapmodify Function With Script-->
  <function name="ldapModifyWithScript">
    <function-prolog>
@@ -485,17 +475,13 @@
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
            
      <process name="'LDAP Modify Script'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'LDAP Modify Script',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'location'  : location
        }
      </call>
      
      <script>
        STAXCode=RC
@@ -512,6 +498,7 @@
    </sequence>
  </function>
  
  <function name="modifyEntry">
    <function-prolog>
      This function modifies an entry in the Directory Server
@@ -606,19 +593,13 @@
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Modify Entry from ldif file'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'location'  : location,
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'name'      : 'Modify Entry from ldif file'
        }
      </call>
      
      <script>
        STAXCode=RC
@@ -635,6 +616,7 @@
    </sequence>
  </function>
  <!-- ldapsearch Function With Script-->
  <function name="ldapSearchWithScript">
    <function-prolog>
@@ -1101,7 +1083,7 @@
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      
      <process name="'LDAP Search Script'">
      <process name="'LDAP Search Script to file'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
@@ -1129,6 +1111,7 @@
    </sequence>
  </function>
  
  <function name="SearchObject">
    <function-prolog>
      This function searches the Directory Server with optional arguments possible
@@ -1260,19 +1243,13 @@
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
            
      <process name="'Search Base Object'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'location'  : location,
          'name'      : 'ldapsearch'
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -1291,6 +1268,7 @@
  </function>
  <function name="SearchObjectNoPwd">
    <function-prolog>
      This function searches the Directory Server with optional arguments possible
@@ -1351,20 +1329,13 @@
      </function-arg-def>
    </function-map-args>
    <sequence>
      <message>
          'ldapsearch%s -h %s -p %s -D "%s" %s -b "%s" "%s"' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,extraParams,dsBaseDN,dsFilter)
      </message>
      <process name="'Search Base Object No Password'">
        <location>'%s' % location </location>
        <command>'%s/ldapsearch%s' % (dsBinPath,fileExt)</command>
        <parms>'-h %s -p %s -D "%s" %s -b "%s" "%s"' % (dsInstanceHost,dsInstancePort,dsInstanceDn,extraParams,dsBaseDN,dsFilter)</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'" >
        { 'name'      : 'Search Base Object No Password',
          'command'   : '%s/ldapsearch%s' % (dsBinPath,fileExt),
          'arguments' : '-h %s -p %s -D "%s" %s -b "%s" "%s"' % (dsInstanceHost,dsInstancePort,dsInstanceDn,extraParams,dsBaseDN,dsFilter),
          'location'  : location
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -1380,6 +1351,7 @@
    </sequence>
  </function>
  
  <function name="AnonSearchObject">
    <function-prolog>
      This function searches the Directory Server anonymously with optional arguments possible
@@ -1435,20 +1407,13 @@
        </function-arg-def>     
    </function-map-args>
    <sequence>
      <message>
        'ldapsearch%s -h %s -p %s %s -b "%s" "%s"' % (fileExt,dsInstanceHost,dsInstancePort,extraParams,dsBaseDN,dsFilter)
      </message>
      <process name="'Anonymous Search Base Object'">
        <location>'%s' % location </location>
        <command>'%s/ldapsearch%s' % (dsBinPath,fileExt)</command>
        <parms>'-h %s -p %s %s -b "%s" "%s"' % (dsInstanceHost,dsInstancePort,extraParams,dsBaseDN,dsFilter)</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'" >
        { 'name'      : 'Anonymous Search Base Object',
          'location'  : location,
          'command'   : '%s/ldapsearch%s' % (dsBinPath,fileExt),
          'arguments' : '-h %s -p %s %s -b "%s" "%s"' % (dsInstanceHost,dsInstancePort,extraParams,dsBaseDN,dsFilter)
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -1464,6 +1429,7 @@
    </sequence>
  </function>
  
    <!-- ldapdelete Function With Script-->
  <function name="ldapDeleteWithScript">
    <function-prolog>
@@ -1761,18 +1727,13 @@
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
            
      <process name="'LDAP Delete Script'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'LDAP Delete Script',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'location'  : location
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -1788,6 +1749,7 @@
    </sequence>
  </function>
  
  <function name="DeleteEntry">
    <function-prolog>
      This function an entry in the Directory Server
@@ -1884,19 +1846,13 @@
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
            
      <process name="'Delete Object'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Delete Object',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'location'  : location
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -1913,6 +1869,7 @@
    
  </function>
  <!-- ldapcompare Function With Script-->
  <function name="ldapCompareWithScript">
    <function-prolog>
@@ -2215,22 +2172,13 @@
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'LDAP Compare Script'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'" >
        { 'name'      : 'LDAP Compare Script',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'location'  : location
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -2246,6 +2194,7 @@
    </sequence>
  </function>
  
  <function name="compareEntry">
    <function-prolog>
      This function compares the attribute and value an entry to the Directory Server
@@ -2345,23 +2294,13 @@
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Compare Object'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'" >
        { 'name'      : 'Compare Object',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'location'  : location
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -2400,6 +2339,7 @@
              
  </function>
  
  <!-- ldappasswordmodify Function With Script-->
  <function name="ldapPasswordModifyWithScript">
    <function-prolog>
@@ -2644,21 +2584,13 @@
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'LDAP Password Modify Script'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'" >
        { 'name'      : 'LDAP Password Modify Script',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'location'  : location
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -2674,6 +2606,7 @@
    </sequence>
  </function>
  
    <!-- Modify an attribute -->
  <function name="modifyAnAttribute">
    <function-prolog>
@@ -2812,21 +2745,16 @@
        STAFCmdParams=' '.join(STAFCmdParamsList)
                 
        STAFCmd='modifyAnAttribute' 
    </script>
      <process name="'Modify An Attribut value'">
        <location>'%s' % location</location>
        <command>'java'</command>
        <workdir>'%s' % TESTS_JAVA_DIR</workdir>
          <parms>'%s %s' % (STAFCmd,STAFCmdParams)</parms>
        <envs>
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'" >
        { 'name'      : 'Modify An Attribute value',
          'command'   : 'java',
          'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
          'location'  : location,
          'path'      : TESTS_JAVA_DIR,
          'env'       : ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR]
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -2850,63 +2778,54 @@
      This function modifies an entry in the Directory Server
    </function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Location of target host
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
        <function-arg-description>
          Pathname to installation root
        </function-arg-description>
        <function-arg-property name="type" value="filepath"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Directory server hostname or IP address
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>      
      <function-arg-def name="dsInstancePort" type="required">
         <function-arg-description>
          Directory server port number
        </function-arg-description>       
        <function-arg-property name="type" value="Port number"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="required">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def> 
      <function-arg-def name="dsInstancePswd" type="required">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>          
       <function-arg-def name="DNToAdd" type="required">
        <function-arg-description>
          DN to add
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="listAttributes" type="required">
        <function-arg-description>
          Attributes to add
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="expectedRC" type="optional" default="0">
        <function-arg-description>
          expected value. Default is 0
@@ -2914,19 +2833,15 @@
      </function-arg-def>   
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
      
      <!-- Build the Command -->
        # build the command
        STAFCmdParamsList=[]
        STAFCmdParams=''    
        STAFCmd=''              
        </script>
     <!-- Set common ldap arguments -->      
      <call function="'_ldapCommonArgs'"/>
@@ -2935,31 +2850,21 @@
        STAFCmdParamsList.append('-v "%s"' % anAttributeToAdd)
    </script>
    </iterate>
      <script>
        if DNToAdd:
          STAFCmdParamsList.append('-d "%s"' % DNToAdd)
        STAFCmdParams=' '.join(STAFCmdParamsList)
        STAFCmd='addAnEntry' 
     </script>
      <process name="'Add a new  entry'">
        <location>'%s' % location</location>
        <command>'java'</command>
        <workdir>'%s' % TESTS_JAVA_DIR</workdir>
          <parms>'%s %s' % (STAFCmd,STAFCmdParams)</parms>
        <envs>
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'" >
        { 'name'      : 'Add New Entry',
          'command'   : 'java',
          'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
          'location'  : location,
          'env'       : ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR],
          'path'      : TESTS_JAVA_DIR
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -2969,13 +2874,10 @@
          'result'     : STAXReason,
          'expected'   : expectedRC }
      </call>
      <return>
        STAXReason
      </return>
    </sequence>
  </function>
  
@@ -2991,80 +2893,67 @@
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
        <function-arg-description>
          Pathname to installation root
        </function-arg-description>
        <function-arg-property name="type" value="filepath"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Directory server hostname or IP address
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>      
      <function-arg-def name="dsInstancePort" type="required">
        <function-arg-description>
          Directory server port number
        </function-arg-description>       
        <function-arg-property name="type" value="Port number"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="required">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def> 
      <function-arg-def name="dsInstancePswd" type="required">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>          
       <function-arg-def name="DNToModify" type="required">
        <function-arg-description>
          DN to modify
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="newRDN" type="optional">
        <function-arg-description>
          new rdn name : ie uid=jdoe_bis
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
        <function-arg-def name="deleteOldRDN" type="optional">
        <function-arg-description>
          1 : delete old rdn, 0 do not delete old rdn, default value is 1
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="expectedRC" type="optional" default="0">
        <function-arg-description>
          Expected return code value. Default value is 0
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>          
      </function-arg-def>       
    </function-map-args>
    <sequence>
    
      <!-- Local variables -->
      <script>
        mylocation=location
      <!-- Build the Command -->
        #Build the Command
        STAFCmdParamsList=[]
        STAFCmdParams=''    
        STAFCmd=''              
@@ -3072,9 +2961,7 @@
          
     <!-- Set common ldap arguments -->      
      <call function="'_ldapCommonArgs'"/>
      <script>
        if DNToModify:
          STAFCmdParamsList.append('-d "%s"' % DNToModify)
@@ -3087,20 +2974,16 @@
        STAFCmdParams=' '.join(STAFCmdParamsList)
                 
        STAFCmd='modifyDn' 
    </script>
      <process name="'Modify DN'">
        <location>'%s' % location</location>
        <command>'java'</command>
        <workdir>'%s' % TESTS_JAVA_DIR</workdir>
          <parms>'%s %s' % (STAFCmd,STAFCmdParams)</parms>
        <envs>
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'" >
        { 'name'      : 'Modify DN',
          'command'   : 'java',
          'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
          'location'  : location,
          'env'       : ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR],
          'path'      : TESTS_JAVA_DIR
        }
      </call>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
@@ -3115,9 +2998,4 @@
      </return>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/shared/functions/security.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../stax.dtd">
<!DOCTYPE stax SYSTEM "../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
@@ -26,12 +26,9 @@
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
    <!-- **************************************************** -->
    <!--                       generate a certificate                            -->
    <!-- **************************************************** -->   
 <function name="genCertificate">
    <function-prolog>
      This function generates a server certificate
@@ -85,25 +82,22 @@
          dsConfigPath='%s/config' % (dsPath)
          dsBinPath='%s/%s' % (dsPath,fileFolder)    
    </script>
    <message>'keytool -genkey -alias %s -keyalg rsa -dname "%s" -keystore %s -storepass %s -keypass %s -storetype %s ' % (certAlias,dname,keystore,storepass,keypass,storetype)</message>
      <process name="'Generate a Certificate'">
        <location>'%s' % location</location>
        <command>'%s/bin/keytool' % JAVA_HOME</command>
        <parms>'-genkey -alias %s -keyalg rsa -dname "%s" -keystore %s -storepass %s -keypass %s -storetype %s ' % (certAlias,dname,keystore,storepass,keypass,storetype)</parms>
        <workdir>'%s' % dsConfigPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'Generate a Certificate',
          'location'  : location,
          'command'   : '%s/bin/keytool' % JAVA_HOME,
          'arguments' : '-genkey -alias %s -keyalg rsa -dname "%s" -keystore %s -storepass %s -keypass %s -storetype %s ' % (certAlias,dname,keystore,storepass,keypass,storetype),
          'path'      : dsConfigPath
        }
      </call>
     <script>
         STAXCode=RC
         STAXReason=STAXResult
       </script>
       <call function="'checktestRC'">
         { 'returncode' : STAXCode ,
           'result'     : STAXReason }
           'result'     : STAXReason
        }
       </call>
       <return>STAXReason</return>
    </sequence>
@@ -113,7 +107,6 @@
<!-- **************************************************** -->
<!--                       Self signed a certificate                            -->
<!-- **************************************************** -->
  <function name="SelfSignCertificate">
  <function-prolog>
      This function self-signs a certificate
@@ -163,40 +156,36 @@
          dsBinPath='%s/%s' % (dsPath,fileFolder)    
  </script>
            
  <message>'keytool -selfcert -alias %s -keystore "%s" -keypass "%s" -storepass "%s" -storetype "%s" ' % (certAlias,keystore,keypass,storepass,storetype)</message>
      <process name="'Generate a Self-Signs Server Certificate'">
        <location>'%s' % location</location>
        <command>'%s/bin/keytool' % JAVA_HOME</command>
        <parms>'-selfcert -alias %s -keystore "%s"  -keypass "%s" -storepass "%s" -storetype "%s" ' % (certAlias,keystore,keypass,storepass,storetype)</parms>
        <workdir>'%s' % dsConfigPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'" >
        { 'name'      : 'Generate a Self-Signs Server Certificate',
          'location'  : location,
          'command'   : '%s/bin/keytool' % JAVA_HOME,
          'arguments' : '-selfcert -alias %s -keystore "%s"  -keypass "%s" -storepass "%s" -storetype "%s" ' % (certAlias,keystore,keypass,storepass,storetype),
          'path'      : dsConfigPath
        }
      </call>
      <script>
         STAXCode=RC
         STAXReason=STAXResult
       </script>
       <call function="'checktestRC'">
         { 'returncode' : STAXCode ,
           'result'     : STAXReason }
          'result'     : STAXReason
        }
       </call>
       <return>STAXReason</return>  
    </sequence>
  </function>
<!-- **************************************************** -->
<!--                       Export  a certificate                                 -->
<!-- **************************************************** -->   
<function name="ExportCertificate">
    <function-prolog>
      This function exports a certificate
    </function-prolog>
<function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Location of target host
@@ -240,7 +229,6 @@
    </function-map-args>
    <sequence>
  <!-- Local variables -->
    <script>
       if dsPath:
@@ -253,18 +241,14 @@
          STAFCmdParams='-%s' % (format)
    </script>   
    
<message>'keytool -export -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s %s' % (certAlias,outputfile,keystore,storepass,storetype,STAFCmdParams)</message>
      <process name="'Export a Certificate'">
        <location>'%s' % location</location>
        <command>'%s/bin/keytool' % JAVA_HOME</command>
        <parms>'-export -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s %s' % (certAlias,outputfile,keystore,storepass,storetype,STAFCmdParams)</parms>
        <workdir>'%s' % dsConfigPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'       : 'Export a Certificate',
          'location'   : location,
          'command'    : '%s/bin/keytool' % JAVA_HOME,
          'arguments'  : '-export -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s %s' % (certAlias,outputfile,keystore,storepass,storetype,STAFCmdParams),
          'path'       : dsConfigPath
        }
      </call>
      <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -277,16 +261,15 @@
    </sequence>
  </function>
<!-- **************************************************** -->
<!--                       Import  a certificate                                  -->
<!-- **************************************************** -->
<function name="ImportCertificate">
    <function-prolog>
      This function imports a certificate
    </function-prolog>
<function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Location of target host
@@ -330,43 +313,38 @@
       if dsPath:
          dsConfigPath='%s/config' % (dsPath)
          dsBinPath='%s/%s' % (dsPath,fileFolder)    
    </script>   
            
<message>'keytool -import -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s -noprompt' % (certAlias,inputfile,keystore,storepass,storetype)</message>
      <process name="'Import a Certificate'">
        <location>'%s' % location</location>
        <command>'%s/bin/keytool' % JAVA_HOME</command>
        <parms>'-import  -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s -noprompt' % (certAlias,inputfile,keystore,storepass,storetype)</parms>
        <workdir>'%s' % dsConfigPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'        : 'Import a Certificate',
          'location'    : location,
          'command'     : '%s/bin/keytool' % JAVA_HOME,
          'arguments'   : '-import  -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s -noprompt' % (certAlias,inputfile,keystore,storepass,storetype),
          'path'        : dsConfigPath
        }
      </call>
      <script>
         STAXCode=RC
         STAXReason=STAXResult
       </script>
       <call function="'checktestRC'">
         { 'returncode' : STAXCode ,
           'result'     : STAXReason }
          'result'     : STAXReason
        }
       </call>
       <return>STAXReason</return>  
    </sequence>
  </function>
<!-- **************************************************** -->
<!--                      get MD5 and SHA1 values                          -->
<!-- **************************************************** -->   
<function name="getFingerprint">
    <function-prolog>
      This function returns the fingerprint MD5 or SHA1
    </function-prolog>
   <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Location of target host
@@ -399,33 +377,28 @@
     </function-arg-def>
    </function-map-args>
    <sequence>
  <!-- Local variables -->
    <script>
       if dsPath:
          dsConfigPath='%s/config' % (dsPath)
          dsBinPath='%s/%s' % (dsPath,fileFolder)    
    </script>           
      <message>' -keystore "%s"  -storepass "%s"  -alias "%s" -list -v' % (keystore,storepass,certAlias)</message>
      <process name="'getFingerprint'">
        <location>'%s' % location</location>
        <command>'%s/bin/keytool' % JAVA_HOME</command>
        <parms>' -list -v -keystore "%s"  -storepass "%s"  -alias "%s"' % (keystore,storepass,certAlias)</parms>
       <workdir>'%s' % dsConfigPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'runCommand'">
        { 'name'      : 'getFingerprint',
          'location'  : location,
          'command'   : '%s/bin/keytool' % JAVA_HOME,
          'arguments' : ' -list -v -keystore "%s"  -storepass "%s"  -alias "%s"' % (keystore,storepass,certAlias),
          'path'      : dsConfigPath
        }
      </call>
      <script>
         STAXCode=RC
         STAXReason=STAXResult
       </script>
       <call function="'checktestRC'">
         { 'returncode' : STAXCode ,
           'result'     : STAXReason }
          'result'     : STAXReason
        }
       </call>
       <return>STAXReason</return>    
    </sequence>
@@ -435,8 +408,6 @@
<!-- ################################################## --> 
<!--  configure SSL  -->
<!-- ################################################## -->     
  <function name="configureSSL">
    <function-prolog>
      This function makes the configuration changes for SSL
@@ -503,13 +474,11 @@
      </function-arg-def>                
    </function-map-args>
    <sequence>
      <!--- configure Key Manager Provider -->
      <message>
       'Configure Key Manager Provider'
      </message>
      <call function="'dsconfig'">
      { 'location'                   : location ,
        'dsPath'                     : dsPath ,
@@ -521,7 +490,8 @@
        'objectType'        : 'manager-name' ,
        'objectName'        :  keystoreType,
        'optionsString'        :  '--set key-store-file:config/keystore --reset key-store-pin-file --set key-store-pin:%s --set enabled:true' % keystorePin,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>
  
      <!--- configure Trust Manager Provider -->
@@ -529,7 +499,6 @@
         'Configure Trust Manager Provider'
      </message>
      <call function="'dsconfig'">
      { 'location'                   : location ,
        'dsPath'                     : dsPath ,
@@ -541,10 +510,10 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : 'Blind Trust',
        'optionsString'        : '--set enabled:true' ,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>     
      <!--- Enable LDAPS Connection Handler -->
      <message>
       'Enabling LDAPS Connection Handler - Keystore type'
@@ -570,17 +539,16 @@
        'objectType'             : 'handler-name' ,
        'objectName'            : 'LDAPS Connection Handler',
        'optionsString'        :  optionsString,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>             
    </sequence>
  </function>
<!-- ################################################## --> 
<!--  configureTLS -->
<!-- ################################################## -->     
  <function name="configureTLS">
    <function-prolog>
      This function makes the configuration changes for startTLS
@@ -647,14 +615,11 @@
      </function-arg-def>
    </function-map-args>
      <sequence>
      <!--- configure Key Manager Provider -->
      <message>
       'Configure Key Manager Provider'
      </message>
      <call function="'dsconfig'">
      { 'location'                   : location ,
        'dsPath'                     : dsPath ,
@@ -666,7 +631,8 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : keystoreType,
        'optionsString'        :  '--set key-store-file:config/keystore --reset key-store-pin-file --set key-store-pin:%s --set enabled:true' % keystorePin,
        'expectedRC'            : 0 }
          'expectedRC'      : 0
        }
    </call>
  
      <!--- configure Trust Manager Provider -->
@@ -686,7 +652,8 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : 'Blind Trust',
        'optionsString'        : '--set enabled:true' ,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
      </call>       
        <!--- Enable StartTLS -->
@@ -702,7 +669,6 @@
          optionsString='%s %s %s %s' % (option1,option2,option3,option4)    
      </script>         
           
      <call function="'dsconfig'">
      { 'location'                   : location ,
        'dsPath'                     : dsPath ,
@@ -714,20 +680,16 @@
        'objectType'        : 'handler-name' ,
        'objectName'        : 'LDAP Connection Handler',
        'optionsString'        :  optionsString,
        'expectedRC'            : 0 }
        'expectedRC'     : 0
      }
    </call>             
    </sequence>
  </function>
<!-- ################################################## --> 
<!--  configure SSL  and TLS -->
<!-- ################################################## -->     
  <function name="configureSSL_TLS">
    <function-prolog>
      This function makes the configuration changes for SSL and TLS
@@ -794,8 +756,6 @@
      </function-arg-def>                
    </function-map-args>
    <sequence>
      <!--- configure Key Manager Provider -->
      <message>
       'Configure Key Manager Provider'
@@ -812,7 +772,8 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : keystoreType,
        'optionsString'        :  '--set key-store-file:config/keystore --reset key-store-pin-file  --set key-store-pin:%s --set enabled:true' % keystorePin,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>
  
      <!--- configure Trust Manager Provider -->
@@ -820,7 +781,6 @@
         'Configure Trust Manager Provider'
      </message>
      <call function="'dsconfig'">
      { 'location'                   : location ,
        'dsPath'                     : dsPath ,
@@ -832,7 +792,8 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : 'Blind Trust',
        'optionsString'        : '--set enabled:true' ,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>     
        
@@ -861,7 +822,8 @@
        'objectType'        : 'handler-name' ,
        'objectName'        : 'LDAPS Connection Handler',
        'optionsString'        :  optionsString,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>             
     
    <!--- Enable StartTLS -->
@@ -888,9 +850,9 @@
        'objectType'        : 'handler-name' ,
        'objectName'        : 'LDAP Connection Handler',
        'optionsString'        :  optionsString,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>                     
    </sequence>
  </function>
    
@@ -898,7 +860,6 @@
<!-- ################################################## --> 
<!-- Unconfigure SSL -->
<!-- ################################################## --> 
  <function name="unconfigureSSL">
    <function-prolog>
      This function reverses the configuration changes for SSL
@@ -954,9 +915,6 @@
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!--- Disable LDAPS Connection Handler -->
      <message>
         'Disabling LDAPS Connection Handler'
@@ -973,15 +931,14 @@
        'objectType'        : 'handler-name' ,
        'objectName'        : 'LDAPS Connection Handler',
        'optionsString'        :  '--set enabled:false',
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>             
        
      <!--- Disable SSL Trust Manager Provider -->
      <message>
         'Disabling SSL Trust Manager Provider'
      </message>
      <call function="'dsconfig'">
      { 'location'                   : location ,
        'dsPath'                     : dsPath ,
@@ -993,10 +950,9 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : 'Blind Trust',
        'optionsString'        : '--set enabled:false' ,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
      </call>       
      <!--- Disable Key Manager Provider -->
      <message>
         'Disabling Key Manager Provider'
@@ -1013,16 +969,16 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : keystoreType,
        'optionsString'        :  '--set enabled:false',
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>
    </sequence>
  </function>
    
<!-- ################################################## --> 
<!--  unconfigureTLS -->
<!-- ################################################## -->     
  <function name="unconfigureTLS">
    <function-prolog>
      This function reverses the configuration changes for startTLS
@@ -1078,8 +1034,6 @@
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!--- Disable StartTLS -->
      <message>
       'Disabling StartTLS'
@@ -1096,14 +1050,14 @@
        'objectType'        : 'handler-name' ,
        'objectName'        : 'LDAP Connection Handler',
        'optionsString'        :  ' --set allow-start-tls:false',
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>             
      <!--- Disable SSL Trust Manager Provider -->
      <message>
         'Disabling SSL Trust Manager Provider'
      </message>
      <call function="'dsconfig'">
      { 'location'                   : location ,
        'dsPath'                     : dsPath ,
@@ -1115,10 +1069,10 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : 'Blind Trust',
        'optionsString'        : '--set enabled:false' ,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
      </call>       
        
      <!--- Disable Key Manager Provider -->
      <message>
         'Disabling Key Manager Provider'
@@ -1135,16 +1089,16 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : keystoreType,
        'optionsString'        :  '--set enabled:false',
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>
      </sequence>
    </function>
<!-- ################################################## --> 
<!-- Unconfigure SSL and TLS -->
<!-- ################################################## --> 
  <function name="unconfigureSSL_TLS">
    <function-prolog>
      This function reverses the configuration changes for SSL and TLS
@@ -1200,9 +1154,6 @@
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!--- Disable LDAPS Connection Handler -->
      <message>
         'Disabling LDAPS Connection Handler'
@@ -1219,15 +1170,14 @@
        'objectType'        : 'handler-name' ,
        'objectName'        : 'LDAPS Connection Handler',
        'optionsString'        :  '--set enabled:false',
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>             
        
      <!--- Disable StartTLS -->
      <message>
       'Disabling StartTLS'
      </message>
     <call function="'dsconfig'">
      { 'location'                   : location ,
        'dsPath'                     : dsPath ,
@@ -1239,7 +1189,8 @@
        'objectType'        : 'handler-name' ,
        'objectName'        : 'LDAP Connection Handler',
        'optionsString'        :  ' --set allow-start-tls:false',
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>             
                
      <!--- Disable SSL Trust Manager Provider -->
@@ -1247,7 +1198,6 @@
         'Disabling SSL Trust Manager Provider'
      </message>
      <call function="'dsconfig'">
      { 'location'                   : location ,
        'dsPath'                     : dsPath ,
@@ -1259,10 +1209,10 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : 'Blind Trust',
        'optionsString'        : '--set enabled:false' ,
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
      </call>       
        
      <!--- Disable Key Manager Provider -->
      <message>
         'Disabling Key Manager Provider'
@@ -1279,10 +1229,9 @@
        'objectType'        : 'manager-name' ,
        'objectName'        : keystoreType,
        'optionsString'        :  '--set enabled:false',
        'expectedRC'            : 0 }
          'expectedRC'     : 0
        }
    </call>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/shared/functions/topology.xml
@@ -399,23 +399,23 @@
      
      <!-- configure the coverage dump file -->
      <script>
        mylog='::coverage: begin\n'
        emmaprops = '%s/%s/classes/emma.properties' % (dsDir,OPENDSNAME)
        group='emma'
        if CurrentTestPath['group']:
          group=CurrentTestPath['group'].strip()
        if os.path.exists('%s' % emmaprops):
          mylog+='::coverage: setting %s/%s.coverage to file %s\n' % (TMPDIR,group,emmaprops)
          coveragefh = open(emmaprops,'w')
          coveragefh.write('coverage.out.file=%s/%s.coverage\n' % (TMPDIR,group) )
        mylog="::coverage - checking for %s/lib/emma.jar\n" % dsPath
        if os.path.exists('%s/lib/emma.jar' % dsPath):
          mylog+="  ::coverage on\n"
          if not os.path.exists('%s/coverage' % TMPDIR):
            os.mkdir('%s/coverage' % TMPDIR)
            mylog+="    ::mkdir %s/coverage on\n" % TMPDIR
          if not os.path.exists('%s/coverage/%s' % (TMPDIR,CurrentTestPath['group'])):
            os.mkdir('%s/coverage/%s' % (TMPDIR,CurrentTestPath['group']))
            mylog+="    ::mkdir %s/coverage/%s on\n" % (TMPDIR,CurrentTestPath['group'])
          mylog+="  ::writing to %s/classes/emma.properties" % dsPath
          coveragefh = open( '%s/classes/emma.properties' % dsPath, 'w' )
          coveragefh.write( 'coverage.out.file=%s/coverage/%s/coverage.ec\n' % (TMPDIR,CurrentTestPath['group']) )
          coveragefh.close()
          
      </script>
      <message>
        '%s' % mylog
      </message>
      <message>mylog</message>
      <!--- Set up DS -->
      <message>
        'Set up DS on %s : %s/%s' % (dsHost,dsDir,OPENDSNAME)
opends/tests/functional-tests/shared/functions/utils.xml
@@ -434,13 +434,6 @@
    </function-prolog>
    <function-no-args />
    <sequence>
      <script>
        testcaseStartTime=strftime("%Y%m%d@%H:%M:%S",localtime())
        myLog = open('%s/my.log' % TMPDIR, 'a')
        myLog.seek(0,2)
        myLog.write('%s - starting testcase: %s\n' % (testcaseStartTime, STAXCurrentTestcase ) )
        myLog.close()
      </script>
      <message level="'start'">'testcase: %s' % STAXCurrentTestcase</message>
      <message>'****************************************************'</message>
      <message>'*** STARTING TEST CASE %s.' % STAXCurrentTestcase</message>
@@ -467,6 +460,9 @@
    </function-prolog>
    <function-no-args />
      <sequence>
        <script>
          testcaseStartTime=strftime("%Y%m%d@%H:%M:%S",localtime())
        </script>
        <call function="'testCase_StartBanner'" />
    </sequence>
  </function>
@@ -528,7 +524,7 @@
      </call>
      <script>
        class Test:
          def __init__(self, group, suite, fullname, start, stop, failures):
          def __init__(self, group, suite, fullname, start, stop, failures, successes):
            self.log=''
            self.group=group
            self.suite=suite
@@ -540,6 +536,9 @@
            self.name=''.join(tmp)
            self.duration = 0
            if failures == 0:
              if successes == 0:
                self.result='inconclusive'
              else:
              self.result='pass'
            else:
              self.result='fail'
@@ -560,15 +559,17 @@
            return xml
            
          def appendLog(self, log):
            self.log +='          %s&lt;br /&gt;\n' % log
            log=log.replace('&lt;','')
            log=log.replace('&gt;','')
            self.log +='          %s\n' % log
            
          def getName(self):
            return self.name
         
        thisTest = Test(CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentTestcase, testcaseStartTime,testcaseEndTime,numFail)
        thisTest = Test(CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentTestcase, testcaseStartTime,testcaseEndTime,numFail,numPass)
            
        doLog = False
        testlog=open('%s/test.log' % TMPDIR,'a')
        testlog=open('%s/tests-log.xml' % TMPDIR,'a')
        testlog.seek(0,2)
        # loop through the log lines
@@ -618,18 +619,6 @@
          
        ThisGroupName=CurrentTestPath['group']  
        ThisSuiteName=CurrentTestPath['suite']
        mylog='::coverage: begin\n'
        if os.path.exists('%s/classes' % dsPath):
          mylog+='::coverage: setting %s/%s.coverage to file %s/classes/emma.properties\n' % (TMPDIR,CurrentTestPath['group'],dsPath)
          coveragefh = open( '%s/classes/emma.properties' % dsPath, 'w' )
          coveragefh.write( 'coverage.out.file=%s/%s.coverage\n' % (TMPDIR,CurrentTestPath['group']) )
          coveragefh.close()
          coveragefh = open( '%s/classes/emma.properties' % dsPath, 'r' )
          mylog+='::coverage:contents: %s' % coveragefh.read()
          coveragefh.close()
      </script>
      <!-- Start time of test suite -->      
@@ -703,17 +692,35 @@
    </function-prolog>
    <function-no-args />
    <sequence>
      <!-- Take the values from the current test path -->     
      <script>
        if not CurrentTestPath.has_key('group'):
          CurrentTestPath['group']='unknown-group'
        
        ThisGroupName=CurrentTestPath['group']
        # NOTE: the same code lives in topology.xml
        #       the reason for that is that the topology is created AFTER the
        #       first test group has started (as part of the first setup)
        #       the following groups are going to use the same topology
        mylog="::coverage - checking for %s/lib/emma.jar\n" % dsPath
        if os.path.exists('%s/lib/emma.jar' % dsPath):
          mylog+="  ::coverage on\n"
          if not os.path.exists('%s/coverage' % TMPDIR):
            os.mkdir('%s/coverage' % TMPDIR)
            mylog+="    ::mkdir %s/coverage on\n" % TMPDIR
          if not os.path.exists('%s/coverage/%s' % (TMPDIR,CurrentTestPath['group'])):
            os.mkdir('%s/coverage/%s' % (TMPDIR,CurrentTestPath['group']))
            mylog+="    ::mkdir %s/coverage/%s on\n" % (TMPDIR,CurrentTestPath['group'])
          mylog+="  ::writing to %s/classes/emma.properties" % dsPath
          coveragefh = open( '%s/classes/emma.properties' % dsPath, 'w' )
          coveragefh.write( 'coverage.out.file=%s/coverage/%s/coverage.ec\n' % (TMPDIR,CurrentTestPath['group']) )
          coveragefh.close()
      </script>
      <message>
        mylog
      </message>
      <message>'##### %s group preamble #####' % ThisGroupName</message>
    </sequence>
  </function>
@@ -729,15 +736,76 @@
          ThisGroupName=CurrentTestPath['group']
        else:
          ThisGroupName='unknown-group'
        coverage='N/A'
      </script>
      
      <message>'##### %s group postamble #####' % ThisGroupName</message>
      
      <if expr="os.path.exists('%s/lib/emma.jar' % dsPath)">
        <sequence>
          <call function="'runCommand'">
            { 'name'      : 'Generate coverage xml report for test group %s' % CurrentTestPath['group'],
              'command'   : 'java',
              'arguments' : ' -Xms64M -Xmx512M -cp %s/lib/emma.jar emma report -r xml,html -in %s/coverage.em,%s/coverage/%s/coverage.ec -Dreport.xml.out.file=%s/coverage/%s/coverage.xml -Dreport.html.out.file=%s/coverage/%s/coverage.html -sp %s/../../../src' % (dsPath,dsPath,TMPDIR,CurrentTestPath['group'],TMPDIR,CurrentTestPath['group'],TMPDIR,CurrentTestPath['group'],TMPDIR),
              'path'      : TMPDIR
            }
          </call>
          <script>
            from java.io import FileInputStream
            from javax.xml.transform.stream import StreamSource
            from javax.xml.transform.stream import StreamResult
            from javax.xml.parsers import DocumentBuilderFactory
            from org.w3c.dom import *
            factory = DocumentBuilderFactory.newInstance()
            builder = factory.newDocumentBuilder()
            input = FileInputStream("%s/coverage/%s/coverage.xml" % (TMPDIR,CurrentTestPath['group']))
            document = builder.parse(input)
            dom = document.getDocumentElement()
            coverageNodes = dom.getElementsByTagName("all").item(0).getChildNodes()
            for coverageNodeIndex in range(coverageNodes.getLength()):
              thisNode = coverageNodes.item(coverageNodeIndex)
              if thisNode.getNodeName() == 'coverage':
                thisNodeAttributes = thisNode.getAttributes()
                if thisNodeAttributes.getNamedItem("type").getNodeValue() == 'block, %':
                  rawCoverage = thisNodeAttributes.getNamedItem("value").getNodeValue()
                  coverage = rawCoverage.split('%')[0]
            testlog=open('%s/tests-log.xml' % TMPDIR,'a')
            testlog.seek(0,2)
            testlog.write("      &lt;group&gt;\n")
            testlog.write("        &lt;name&gt;\n")
            testlog.write("          %s\n" % CurrentTestPath['group'])
            testlog.write("        &lt;/name&gt;\n")
            testlog.write("        &lt;coverage&gt;\n")
            testlog.write("          %s\n" % coverage)
            testlog.write("        &lt;/coverage&gt;\n")
            testlog.write("      &lt;/group&gt;\n")
            testlog.close()
          </script>
        </sequence>
        <else>
          <script>
            testlog=open('%s/tests-log.xml' % TMPDIR,'a')
            testlog.seek(0,2)
            testlog.write("      &lt;group&gt;\n")
            testlog.write("        &lt;name&gt;\n")
            testlog.write("          %s\n" % CurrentTestPath['group'])
            testlog.write("        &lt;/name&gt;\n")
            testlog.write("        &lt;coverage&gt;\n")
            testlog.write("          N/A\n")
            testlog.write("        &lt;/coverage&gt;\n")
            testlog.write("      &lt;/group&gt;\n")
            testlog.close()
          </script>
        </else>
      </if>
      <script>
        if CurrentTestPath.has_key('group'):
          del CurrentTestPath['group']
      </script>
    </sequence>
  </function>
  
@@ -1068,12 +1136,12 @@
          the command to run
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="path" type="optional" default="'%s' % dsPath">
      <function-arg-def name="path" type="optional" default="'%s' % dsBinPath">
        <function-arg-description>
          the path where the command is to be run from
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="argmunents" type="optional" default="''">
      <function-arg-def name="arguments" type="optional" default="''">
        <function-arg-description>
          the path where the command is to be found
        </function-arg-description>
@@ -1093,29 +1161,67 @@
          Which machine should the command be executed on
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="name"
                        default="'Run a system command'"
                        type="optional">
        <function-arg-description>
          The name to give the process (only matters in the STAX Monitor really)
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="stripOutput" default="True" type="optional">
        <function-arg-description>
          A boolean (use True or False here, case matters) to enable disable
          stripping the output of a command
          TODO: consider allowing passing a function name to enable custom
                output manipulation (overkill?)
        </function-arg-description>
        <function-arg-property name="type" value="enum">
          <function-arg-property-description>
            This argument can only have boolean values
          </function-arg-property-description>
          <function-arg-property-data type="choice" value="True"/>
          <function-arg-property-data type="choice" value="False"/>
        </function-arg-property>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <message>
        '%s' % command
        'Running command:\n %s %s\nenv: %s\nworkdir: %s' % (command,arguments,env,path)
      </message>
            
      <process name="'run a system command'">
        <location>'%s' % location</location>
        <command>'%s' % command</command>
        <parms>'%s' % arguments</parms>
        <workdir>'%s' % path</workdir>
        <envs>
          '%s' % env
        </envs>
      <process name="name">
        <location>location</location>
        <command>command</command>
        <parms>arguments</parms>
        <workdir>path</workdir>
        <envs>env</envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <message level="'info'">
        'Command returned:\n%s' % STAXResult[0][1]
      </message>
      <script>
        STAXResult.replace('EMMA: collecting runtime coverage data ...\n','')
        def dig(var):
          try:
            if var.__class__==[].__class__:
              for i in range(len(var)):
                var[i]=dig(var[i])
              return var
            else:
              if var.__class__==''.__class__:
                return re.compile(r'EMMA:.*\n').sub('',var)
              else:
                return var
          except TypeError:
            return 'could not evaluate the following component: %s' % var
        if stripOutput == True:
          STAXResult=dig(STAXResult)
      </script>
      <return>
        [ RC , STAXResult ]
        STAXResult
      </return>
    </sequence>
  </function>
opends/tests/functional-tests/staf-installer.xml
@@ -682,7 +682,7 @@
      </then>
    </if>
  </target>
  <target name="run-my-tests-default-plan" depends="run-my-tests-define">
  <target name="run-my-tests-default-plan" depends="run-my-tests-define" unless="custom-suites.on">
    <delete file="${test.plan.default}"/>
    <foreach list="${test.plan.list}" param="test" target="run-my-tests-default-plan-add"/>
  </target>
@@ -826,11 +826,11 @@
  </target>
  
  <target name="coverage-report" if="coverage.on">
    <delete dir="${staf.tmp.dir}/coverage" />
    <mkdir dir="${staf.tmp.dir}/coverage" />
    <delete dir="${staf.tmp.dir}/coverage/all" />
    <mkdir dir="${staf.tmp.dir}/coverage/all" />
    <emma enabled="${coverage.on}" >
      <report >
        <infileset dir="${staf.tmp.dir}" includes="**/*.em,**/*.coverage" />
        <infileset dir="${staf.tmp.dir}" includes="**/*.em,**/*.ec" />
        <sourcepath>
          <dirset dir="${project.home}" >
@@ -838,7 +838,7 @@
          </dirset>
        </sourcepath>
        <html outfile="${staf.tmp.dir}/coverage/index.html"
        <html outfile="${staf.tmp.dir}/coverage/all/index.html"
              columns="name, method, line"
              sort="+line, +name"
              metrics="line:80"
@@ -1024,7 +1024,7 @@
        </and>
      </condition>
      <available file="${daily.package}" property="daily.package.downloaded"/>
      <available file="testcases/run-custom-suites.dat" property="custom-suites.on" />
      <available file="${staf.install.dir}" 
                type="dir" 
                property="staf.installed" />
@@ -1170,14 +1170,11 @@
  </target>
  
  <target name="generate-report">
    <tstamp>
      <format property="tstamp.today" pattern="yyyyMMdd"/>
    </tstamp>
    <fileset id="resultxml" file="${tstamp.today}-*/**/reports/results.xml" />
    <delete file="${staf.tmp.dir}/my-report.html"/>
    <xslt processor="trax"
          in="C:\Users\arnaud\.hudson\jobs\opends-vista-functional-tests\workspace\opends\tests\functional-run\tmp\20070726-234928\Windows-x86-jvm1.5\reports\results.xml"
          out="${staf.tmp.dir}/results.html"
          style="shared/xsl/gen-alltests-report.xsl">
          in="${staf.tmp.dir}/tests-log.xml"
          out="${staf.tmp.dir}/my-report.html"
          style="shared/xsl/my-report.xsl">
    </xslt>
  </target>
</project>
opends/tests/functional-tests/testcases/aci/aci.xml
@@ -45,7 +45,7 @@
          <call function="'testGroup_Preamble'"/>
                                                                
   
          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
<!--          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
            file="'%s/testcases/aci/global_acis.xml' % (TESTS_DIR)"/>
          <call function="'global_acis'" />
  
@@ -112,7 +112,7 @@
          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
            file="'%s/testcases/aci/aci_effective_rights.xml' % (TESTS_DIR)"/>
          <call function="'aci_effective_rights'" />
  -->
          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
            file="'%s/testcases/aci/aci_import.xml' % (TESTS_DIR)"/>
          <call function="'aci_import'" />
opends/tests/functional-tests/testcases/indexes/indexes.xml
@@ -34,7 +34,7 @@
          CurrentTestPath={'group':'indexes','suite':'indexes'}
          envAlreadyLoaded='true'
          _setupSteps=['testGroup_Preamble','testSuite_Preamble','indexes_setup']
          _testSteps=['indexes_search','indexes_modify','indexes_add','indexes_remove']
          _testSteps=['indexes_search','indexes_add','indexes_remove']
          _cleanupSteps=['indexes_cleanup','testSuite_Postamble','testGroup_Postamble']
        </script>
        <!---
@@ -334,6 +334,52 @@
    </block>
  </function>
  <function name="indexes_vlv_add">
    <!--
      This test does a bunch of searches on the
      and then verifies that it worked
      #@TestMarker                indexes
      #@TestName                  indexes_remove
      #@TestIssue                 TODO: look up the issue in issue tracker
      #@TestPurpose               Check if the user can remove indexes
      #@TestPreamble              none
      #@TestStep                  iterate through filters prior to removing index
      #@TestStep                  remove index
      #@TestStep                  iterate through filters after to removing index
      #@TestPostamble             none
      #@TestResult                Success if entry are indexed as expected
    -->
    <block name="'Entry_Limit'">
      <sequence>
        <try>
          <sequence>
            <call function="'loopThroughFilters'">
              { 'filters' : 'before-entry-limit' }
            </call>
            <call function="'runFunction'">
              { 'functionName'      : 'modifyIndex'                                ,
                'functionException' : 'LDAP.ModifyIndexException'                  ,
                'functionFailureTC' : '%s: %s: %s' % (CurrentTestPath['group'], CurrentTestPath['suite'], STAXCurrentBlock),
                'functionMessage'   : 'Modify index entry limit on attribute uid'  ,
                'functionArguments' : { 'operation'          : 'set'               ,
                                        'indexAttribute'     : 'uid'               ,
                                        'indexProperty'      : 'index-entry-limit' ,
                                        'indexPropertyValue' : '3'
                                      }
              }
            </call>
            <call function="'loopThroughFilters'">
              { 'filters' : 'after-entry-limit' }
            </call>
          </sequence>
          <catch exception="'STAXException.LDAP.RemoveIndexException'">
            <message log="1" level="'fatal'">'Fatal Error: Failed to remove index for attribute l'</message>
          </catch>
        </try>
      </sequence>
    </block>
  </function>
  
  <function name="loopThroughFilters" scope="local">
    <function-map-args>
opends/tests/functional-tests/testcases/quickstart/quickstart.xml
@@ -26,26 +26,14 @@
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="main_quickstart"/>
  <function name="main_quickstart">
    <sequence>
      <block name="'quickstart'">
        <sequence>
          <!--- Start DS -->
          <message>
            'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
          </message>
          <call function="'StartDsWithScript'">
           { 'location'  : STAF_REMOTE_HOSTNAME }
          </call>
          <call function="'checkRC'">
             { 'returncode' : RC ,
               'result'     : STAXResult }
@@ -60,44 +48,35 @@
          <message>
             'Quickstart: Adding quickstart entries'
          </message>
          <call function="'addEntry'">
            { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
              'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
              'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
              'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
              'entryToBeAdded'   : '%s/quickstart/quickstart.ldif' % logsRemoteDataDir }
            'entryToBeAdded'   : '%s/quickstart/quickstart.ldif' % logsRemoteDataDir
          }
          </call>
          <call function="'checkRC'">
              { 'returncode' : RC ,
                'result'     : STAXResult }
          </call>
          
          <!--- Stop DS -->
          <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 }
            'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
          }
          </call>
          
          <call function="'checkRC'">
              { 'returncode' : RC ,
                'result'     : STAXResult }
            'result'     : STAXResult
          }
          </call>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/runFuncTests.xml
@@ -26,81 +26,77 @@
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="main" />
  <function name="main">
    <sequence>
      <!--- Load the environment for the test suite execution -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/environment.xml' % (TESTS_FUNCTIONS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
      <call function="'loadEnvironment'" />  
      <!-- The Functional Tests -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/security/security.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/security/security.xml' % TESTS_DIR" />
      <!--
      <call function="'main_security'" />
      -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/aci/aci.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/aci/aci.xml' % TESTS_DIR" />
      <!--
      <call function="'main_aci'" />
      -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/privileges/privileges.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/privileges/privileges.xml' % TESTS_DIR" />
      <!--
      <call function="'main_privileges'" />
      -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/backends/backends.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/backends/backends.xml' % TESTS_DIR" />
      <!--
      <call function="'main_backends'" />
      --> 
      
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/clu/commands.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/clu/commands.xml' % TESTS_DIR" />
      <!--
      <call function="'main_commands'" />
      -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/core/core.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/core/core.xml' % TESTS_DIR" />
      <!--
      <call function="'main_core'" />
      -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/schema/schema.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/schema/schema.xml' % TESTS_DIR" />
      <!--
      <call function="'main_schema'" />
      -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/replication/replication.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/replication/replication.xml' % TESTS_DIR" />
      <!--
      <call function="'main_replication'" />                    
      -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/indexes/indexes.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/indexes/indexes.xml' % TESTS_DIR" />
      <!--
      <call function="'indexes'" />
      -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/groups/groups.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/groups/groups.xml' % TESTS_DIR" />
      <!--
      <call function="'main_groups'" />
      -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/sample/sample.xml' % (TESTS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/testcases/sample/sample.xml' % TESTS_DIR" />
      <script>
        class functionToRun:
          def __init__(self, name):
@@ -109,6 +105,11 @@
          def getName(self):
            return self.name
          
        testlog=open('%s/tests-log.xml' % TMPDIR,'w')
        testlog.write('&lt;qa&gt;\n')
        testlog.write('  &lt;functional-tests&gt;\n')
        testlog.write('    &lt;results&gt;\n')
        testlog.close()
          
        suitesFileName='%s/testcases/run-custom-suites.dat' % TESTS_DIR
        
@@ -124,11 +125,171 @@
      <iterate var="function" in="functionsToRun">
        <sequence>
          <message>'calling function [%s]' % function.getName()</message>
          <call function="'%s' % function.getName()" />
          <call function="function.getName()" />
        </sequence>
      </iterate>
      <!-- in this section we'll compute the coverage for all the tests
           if coverage is turned on
           so far I could only get through this on either machines with a lot
           of memory or small sets of tests
      -->
      <if expr="os.path.exists('%s/lib/emma.jar' % dsPath)">
        <sequence>
          <script>
            coverageFiles=''
            for group in os.listdir('%s/coverage/' % TMPDIR):
              coverageFiles+='%s/coverage/%s/coverage.ec' % (TMPDIR,group)
          </script>
          <call function="'runCommand'">
              { 'name'      : 'Generate global coverage xml report',
                'command'   : 'java',
                'arguments' : ' -Xms64M -Xmx1024M -cp %s/lib/emma.jar emma report -r xml,html -in %s/coverage.em,%s -Dreport.xml.out.file=%s/coverage/coverage.xml -Dreport.html.out.file=%s/coverage/coverage.html -sp %s/../../../src' % (dsPath,dsPath,coverageFiles,TMPDIR,TMPDIR,TMPDIR),
                'path'      : TMPDIR
              }
          </call>
          <script>
            from java.io import FileInputStream
            from javax.xml.transform.stream import StreamSource
            from javax.xml.transform.stream import StreamResult
            from javax.xml.parsers import DocumentBuilderFactory
            from org.w3c.dom import *
            factory = DocumentBuilderFactory.newInstance()
            builder = factory.newDocumentBuilder()
            input = FileInputStream("%s/coverage/coverage.xml" % TMPDIR)
            document = builder.parse(input)
            dom = document.getDocumentElement()
            coverageNodes = dom.getElementsByTagName("all").item(0).getChildNodes()
            for coverageNodeIndex in range(coverageNodes.getLength()):
              thisNode = coverageNodes.item(coverageNodeIndex)
              if thisNode.getNodeName() == 'coverage':
                thisNodeAttributes = thisNode.getAttributes()
                if thisNodeAttributes.getNamedItem("type").getNodeValue() == 'block, %':
                  rawCoverage = thisNodeAttributes.getNamedItem("value").getNodeValue()
                  coverage = rawCoverage.split('%')[0]
            testlog=open('%s/tests-log.xml' % TMPDIR,'a')
            testlog.seek(0,2)
            testlog.write("      &lt;all&gt;\n")
            testlog.write("        &lt;coverage&gt;\n")
            testlog.write("          %s\n" % coverage)
            testlog.write("        &lt;/coverage&gt;\n")
            testlog.write("      &lt;/all&gt;\n")
            testlog.close()
          </script>
        </sequence>
        <else>
          <script>
            testlog=open('%s/tests-log.xml' % TMPDIR,'a')
            testlog.seek(0,2)
            testlog.write("      &lt;all&gt;\n")
            testlog.write("        &lt;coverage&gt;\n")
            testlog.write("          N/A\n")
            testlog.write("        &lt;/coverage&gt;\n")
            testlog.write("      &lt;/all&gt;\n")
            testlog.close()
          </script>
        </else>
      </if>
      <!-- here goes the section where we get the product's info -->
      <call function="'GetVar'">
        { 'location'  : STAF_REMOTE_HOSTNAME,
          'type'      : 'shared',
          'variable'  : 'Job%s_ServerInfo' % STAXJobID
        }
      </call>
      <if expr="RC != 0">
        <script>
          STAFResult='{}'
        </script>
      </if>
      <!-- Build the Servers Information Dictionary -->
      <script>
        ServersInfoDict=eval(STAFResult)
        ServerVersion='unknown'
        ServerBuildId='unknown'
        ServerJavaVersion='unknown'
        ServerJavaVendor='unknown'
        ServerJVMVersion='unknown'
        ServerJVMVendor='unknown'
        ServerSystemOS='unknown'
        ServerSystemName='unknown'
        ServerSvnRevision='unknown'
        if ServersInfoDict.has_key('%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)):
          ServerInfoDict=ServersInfoDict['%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)]
          ServerInfoKey='server version'
          if ServerInfoDict.has_key(ServerInfoKey):
            ServerVersion=ServerInfoDict[ServerInfoKey]
          ServerInfoKey='server buildid'
          if ServerInfoDict.has_key(ServerInfoKey):
            ServerBuildId=ServerInfoDict[ServerInfoKey]
          ServerInfoKey='java version'
          if ServerInfoDict.has_key(ServerInfoKey):
            ServerJavaVersion=ServerInfoDict[ServerInfoKey]
          ServerInfoKey='java vendor'
          if ServerInfoDict.has_key(ServerInfoKey):
            ServerJavaVendor=ServerInfoDict[ServerInfoKey]
          ServerInfoKey='jvm version'
          if ServerInfoDict.has_key(ServerInfoKey):
            ServerJVMVersion=ServerInfoDict[ServerInfoKey]
          ServerInfoKey='jvm vendor'
          if ServerInfoDict.has_key(ServerInfoKey):
            ServerJVMVendor=ServerInfoDict[ServerInfoKey]
          ServerInfoKey='system os'
          if ServerInfoDict.has_key(ServerInfoKey):
            ServerSystemOS=ServerInfoDict[ServerInfoKey]
          ServerInfoKey='system name'
          if ServerInfoDict.has_key(ServerInfoKey):
            ServerSystemName=ServerInfoDict[ServerInfoKey]
          ServerInfoKey='svn revision'
          if ServerInfoDict.has_key(ServerInfoKey):
            ServerSvnRevision=ServerInfoDict[ServerInfoKey]
        else:
          ServerInfoDict='No key found (%s/%s)' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
        testlog=open('%s/tests-log.xml' % TMPDIR,'a')
        testlog.seek(0,2)
        testlog.write('    &lt;/results&gt;\n')
        testlog.write('    &lt;identification&gt;\n')
        testlog.write('      &lt;version&gt;\n')
        testlog.write('        %s\n' % ServerVersion)
        testlog.write('      &lt;/version&gt;\n')
        testlog.write('      &lt;buildid&gt;\n')
        testlog.write('        %s\n' % ServerBuildId)
        testlog.write('      &lt;/buildid&gt;\n')
        testlog.write('      &lt;revision&gt;\n')
        testlog.write('        %s\n' % ServerSvnRevision)
        testlog.write('      &lt;/revision&gt;\n')
        testlog.write('      &lt;platform&gt;\n')
        testlog.write('        %s\n' % ServerSystemOS)
        testlog.write('      &lt;/platform&gt;\n')
        testlog.write('      &lt;jvm-version&gt;\n')
        testlog.write('        %s\n' % ServerJVMVersion)
        testlog.write('      &lt;/jvm-version&gt;\n')
        testlog.write('      &lt;jvm-vendor&gt;\n')
        testlog.write('        %s\n' % ServerJVMVendor)
        testlog.write('      &lt;/jvm-vendor&gt;\n')
        testlog.write('    &lt;/identification&gt;\n')
        testlog.write('  &lt;/functional-tests&gt;\n')
        testlog.write('&lt;/qa&gt;\n')
        testlog.close()
      </script>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/runTestJob.xml
@@ -27,13 +27,9 @@
 ! -->
<stax>
  <defaultcall function="start_job"/>
  <function name="start_job">
    <sequence>
      <script>
        STAXLogMessage = 1
      </script>
@@ -59,8 +55,8 @@
      </if>
      <!--- Import required shared xml libraries -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/stafcmd.xml' % (TESTS_FUNCTIONS_DIR)" />
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/stafcmd.xml' % TESTS_FUNCTIONS_DIR" />
        
      <!--
        dirty workaround because utils.xml now depends on environment.xml
@@ -78,7 +74,8 @@
      <call function="'GetVar'">
        { 'location'  : STAF_REMOTE_HOSTNAME,
          'type'      : 'shared',
          'variable'  : 'Job%s_ServerInfo' % STAXSubJobID }
          'variable'  : 'Job%s_ServerInfo' % STAXSubJobID
        }
      </call>
      <if expr="RC != 0">
@@ -179,7 +176,8 @@
      <call function="'GetVar'">
        { 'location'  : STAF_REMOTE_HOSTNAME,
          'type'      : 'shared',
          'variable'  : 'Job%s_LogsDir' % STAXSubJobID }
          'variable'  : 'Job%s_LogsDir' % STAXSubJobID
        }
      </call>
      <if expr="RC == 0">
@@ -255,16 +253,12 @@
          statusValueDict={}
          if level == 'Start':
            tcpattern=re.compile("(Testcase): (.*)")
            tcmatch = tcpattern.search(message)
            if tcmatch:
              tctype=tcmatch.group(1)
              tcname=tcmatch.group(2)
              if testDict.has_key(tcname):
                for key in testDict[tcname].keys():
                  value=testDict[tcname][key]
                  startValueDict[key]=value
@@ -286,9 +280,7 @@
              tctype=tcmatch.group(1)
              tcname=tcmatch.group(2)
              tctime=tcmatch.group(3)
              if testDict.has_key(tcname):
                for key in testDict[tcname].keys():
                  value=testDict[tcname][key]
                  stopValueDict[key]=value
@@ -461,14 +453,15 @@
  
        source = StreamSource(FileInputStream("%s" % xmlfile))
        result = StreamResult(FileOutputStream("%s" % htmlfile))
        # the original report
        transformer.transform(source, result)      
        #the new report transformation
        TransformerFactory.newInstance().newTemplates(StreamSource(FileInputStream("%s/xsl/my-report.xsl" % TESTS_SHARED_DIR))).newTransformer().transform(StreamSource(FileInputStream("%s/tests-log.xml" % TMPDIR)), StreamResult(FileOutputStream("%s/my-report.html" % TMPDIR)))
      </script>
      <if expr="SEND_MAIL_AFTER_TEST_RUN == 'TRUE'">
        <sequence>
          <message>
            'Sending Email Test Report to %s.' % SEND_MAIL_TO
          </message>
@@ -503,19 +496,15 @@
            </message>
          </else>
          </if>
        </sequence>
      </if>
      <!-- fixMe: Copy the html results file to TMPDIR for Hudson -->
      <call function="'copyFile'">
        { 'srcfile'    : htmlfile,
          'destfile'   : '%s/results.html' % (TMPDIR) }
          'destfile'   : '%s/results.html' % TMPDIR
        }
      </call>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/sample/sample.xml
@@ -30,7 +30,7 @@
  <function name="sample">
    <sequence>
      <script>
        CurrentTestPath={ 'group' : 'sample', 'suite' : 'sample' }
        CurrentTestPath['group']= 'sample'
        envAlreadyLoaded='true'
      </script>
      
@@ -48,12 +48,20 @@
        <!-- this is an example of how to loop through a list of functions to 
             run instead of duplicating calls 
         -->
        <iterate in="['testGroup_Preamble','testSuite_Preamble','sample_setup','sample_test']" var="testStep">
         <sequence>
          <iterate in="['testGroup_Preamble','testSuite_Preamble','sample_setup']" var="setupStep">
            <!-- the sequence tag is superfluous here since there is only a
                 single instruction to execute within the iterate block
             -->
            <call function="'%s' % setupStep" />
          </iterate>
          <iterate in="['passing_test']" var="testStep">
          <!-- the sequence tag is superfluous here since there is only a 
               single instruction to execute within the iterate block 
           -->
          <call function="'%s' % testStep" />
        </iterate>
        </sequence>
        <catch exception="'STAFException.Topology.CreationException'">
          <!-- it is a good idea to make sure that the messages getting
               sent to the gui also make their way in the logs for easier 
@@ -96,7 +104,12 @@
      #@TestPostamble             none
      #@TestResult                Success if OpenDS returns 0
    -->
    <testcase name="'%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentFunction)">
    <block name="'sample_test'">
      <sequence>
        <script>
          CurrentTestPath['suite']= 'search'
        </script>
        <testcase name="'%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentBlock)">
      <sequence>
        <call function="'testCase_Preamble'" />
        <call function="'SearchObject'">
@@ -110,6 +123,68 @@
        <call function="'testCase_Postamble'" />
      </sequence>
    </testcase>
      </sequence>
    </block>
  </function>
  <!-- the dummy failing test -->
  <function name="failing_test">
    <!---
      Place test-specific test information here.
      The tag, TestMarker, must be the same as the tag, TestSuiteName.
      #@TestMarker                Sample
      #@TestName                  failing_test
      #@TestIssue                 xyz
      #@TestPurpose               Illustrate how to issue a query on OpenDS
      #@TestPreamble              none
      #@TestStep                  Fetch all the entries in the server
      #@TestPostamble             none
      #@TestResult                Success if OpenDS returns 0
    -->
    <block name="'failing_test'">
      <sequence>
        <script>
          CurrentTestPath['suite']= 'dummy'
        </script>
        <testcase name="'%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentBlock)">
          <sequence>
            <call function="'testCase_Preamble'" />
            <tcstatus result="'fail'" />
            <call function="'testCase_Postamble'" />
          </sequence>
        </testcase>
      </sequence>
    </block>
  </function>
  <!-- the dummy passing test -->
  <function name="passing_test">
    <!---
      Place test-specific test information here.
      The tag, TestMarker, must be the same as the tag, TestSuiteName.
      #@TestMarker                Sample
      #@TestName                  passing_test
      #@TestIssue                 xyz
      #@TestPurpose               Illustrate how to issue a query on OpenDS
      #@TestPreamble              none
      #@TestStep                  Fetch all the entries in the server
      #@TestPostamble             none
      #@TestResult                Success if OpenDS returns 0
    -->
    <block name="'passing_test'">
      <sequence>
        <script>
          CurrentTestPath['suite']= 'dummy'
        </script>
        <testcase name="'%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentBlock)">
          <sequence>
            <call function="'testCase_Preamble'" />
            <tcstatus result="'pass'" />
            <call function="'testCase_Postamble'" />
          </sequence>
        </testcase>
      </sequence>
    </block>
  </function>
  
  <!-- Setup the instance for sample test -->
opends/tests/functional-tests/testcases/security/client_auth/client_auth_setup.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../shared/stax.dtd">
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
opends/tests/functional-tests/testcases/security/security.xml
@@ -26,17 +26,10 @@
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="main_security"/>
  <function name="main_security">
    <sequence>
      <block name="'security'">
        <sequence>
          <script>
            CurrentTestPath['group']='security'
          </script>
@@ -94,11 +87,6 @@
          <call function="'testGroup_Postamble'"/>
        
        </sequence>
      </block>
    </sequence>
  </function>
</stax>