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

smaguin
20.36.2007 7a1306e1d47c6670482a0ff673e469346a7054cf
Add restartDn function 
1 files modified
197 ■■■■■ changed files
opends/tests/functional-tests/shared/functions/dsadm.xml 197 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/dsadm.xml
@@ -666,85 +666,138 @@
    </sequence>
  </function>
  <function name="genServerJKSCert">
  <!-- This function restart DS using the stop-ds script -->
  <function name="RestartDs">
    <function-prolog>
      This function generates a server jks certificate
    </function-prolog>
      This function restarts a Directory Server
    </function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine">
        <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="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsHost"  type="optional" default="'%s' % DIRECTORY_INSTANCE_HOST">
        <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="dsPort" type="optional" default="'%s' % DIRECTORY_INSTANCE_PORT">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="port"/>
      </function-arg-def>
      <function-arg-def name="dsBindDN" type="optional" default="'%s' % DIRECTORY_INSTANCE_DN">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsBindPwd" type="optional" default="'%s' % DIRECTORY_INSTANCE_PSWD">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="dsBindPwdFile" type="optional">
        <function-arg-description>
          Bind password file
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
       </function-arg-def>
      <function-arg-def name="extraParams" type="optional" default="''">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <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>
      <!-- Build the Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          dsBinPath='%s/%s' % (dsPath,fileFolder)
          STAFCmd='%s/stop-ds%s' % (dsBinPath,fileExt)
        if dsHost:
          STAFCmdParamsList.append('-h %s' % dsHost)
        if dsPort:
          STAFCmdParamsList.append('-p %s' % dsPort)
        if dsBindDN:
          STAFCmdParamsList.append('-D "%s"' % dsBindDN)
        if dsBindPwd:
          STAFCmdParamsList.append('-w "%s"' % dsBindPwd)
        if dsBindPwdFile:
          STAFCmdParamsList.append('-j "%s"' % dsBindPwdFile)
        STAFCmdParamsList.append('-R')
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'restart DS'">
        <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>
       <!-- Wait for DS to start -->
       <call function="'isAlive'">
            { 'location'         : location,
              'dsPath'           : dsPath,
              'dsInstanceHost'   : dsHost ,
              'dsInstancePort'   : dsPort ,
              'dsInstanceDn'     : dsBindDN ,
              'dsInstancePswd'   : dsBindPwd ,
              'noOfLoops'        : 5 ,
              'noOfMilliSeconds' : 2000 }
       </call>
          <!--
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
              -->
    </sequence>
  </function>
  <function name="genServerPKCS12Cert">
    <function-prolog>
      This function generates a server PKCS12 certificate
    </function-prolog>
    <sequence>
      <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 }
      </call>
    </sequence>
  </function>
  <function name="selfSignServerJKSCert">
    <function-prolog>
      This function self-signs a server JKS certificate
    </function-prolog>
    <sequence>
      <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 }
      </call>
    </sequence>
  </function>
  <function name="selfSignServerPKCS12Cert">
    <function-prolog>
      This function self-signs a server PKCS12 certificate
    </function-prolog>
    <sequence>
      <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 }
      </call>
    </sequence>
  </function>
  <!-- Import LDIF file Function -->
  <function name="importLdif">