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

andrug
20.00.2008 26a43f09a64bd00265348996cac1443b36d4d645
ping staf on hosts to avoid staf exception
3 files modified
113 ■■■■ changed files
opendj-sdk/opends/tests/system-tests/phases/parser/parser.xml 8 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/system-tests/phases/scheduler/scheduler.xml 42 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/system-tests/phases/shared/functions/stafcmd.xml 63 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/system-tests/phases/parser/parser.xml
@@ -71,6 +71,10 @@
      <!--========  Set some attributes to add in instance objects   ======-->
      <paralleliterate in="instances" var="instance">
        <sequence>
          <call function="'pingStaf'">
            { 'targetHost' : instance.getHost(),
              'fileFd'     : NO_FILE}
          </call>
          <call function="'getOSvariables'">
            { 'hostname' : instance.getHost() }
          </call>
@@ -145,6 +149,10 @@
      <if expr="len(clients) > 0">
        <paralleliterate in="clients" var="client">
          <sequence>
            <call function="'pingStaf'">
              { 'targetHost' : client.getHost(),
                'fileFd'     : NO_FILE}
            </call>
            <script>
              client.setLogDir('%s/client_%s_id%s' % \
              (LOG_DIR,client.getName(),client.getId()))
opendj-sdk/opends/tests/system-tests/phases/scheduler/scheduler.xml
@@ -530,23 +530,37 @@
          
          <if expr="workingDir != NOT_DEFINED">
            <sequence>
              <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
                      file="'%s/%s.xml' % (workingDir,client.getName())"/>
              <call function="'%s' % client.getName()">
              {
                'workingDir' : workingDir,
                'client'     : client,
                'instances'  : instances,
                'duration'   : duration,
                'suffix'     : suffix,
                'outFile'    : outFile,
                'fileFd'     : fileFd
              }
              <!-- Check that staf is running on the client -->
              <call function="'pingStaf'">
                { 'targetHost' : client.getHost(),
                  'fileFd'     : fileFd}
              </call>
              <script>
                errNum = STAXResult
                timerKilled = FALSE
                pingRC = STAXResult[0]
              </script>
              <if expr="pingRC == 0">
                <sequence>
                  <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
                          file="'%s/%s.xml' % (workingDir,client.getName())"/>
                  <call function="'%s' % client.getName()">
                  {
                    'workingDir' : workingDir,
                    'client'     : client,
                    'instances'  : instances,
                    'duration'   : duration,
                    'suffix'     : suffix,
                    'outFile'    : outFile,
                    'fileFd'     : fileFd
                  }
                  </call>
                  <script>errNum = STAXResult</script>
                </sequence>
              <else>
                <!-- staf does not answer ping on client host -->
                <script> errNum = 1 </script>
              </else>
              </if>
              <script>timerKilled = FALSE</script>
            </sequence>
          </if>
          
opendj-sdk/opends/tests/system-tests/phases/shared/functions/stafcmd.xml
@@ -26,6 +26,69 @@
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <function name="pingStaf" scope="local">
    <function-prolog>
      This function ping staf daemon on remoteHost
    </function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional"
                                        default="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="targetHost" type="required">
        <function-arg-description>
          The name of the host to be ping
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="fileFd" type="required">
        <function-arg-description>
          file descriptor to write message in
        </function-arg-description>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <call function="'writeStartTagOperation'">
      { 'tagName' : 'pingStaf',
        'fileFd'  : fileFd }
      </call>
      <call function="'writeMessage'">
       { 'content'  : 'Ping staf on machine %s' % targetHost,
         'fileFd'   : fileFd }
      </call>
      <stafcmd name="'STAF Command: Copy File'">
        <location>'%s' % location</location>
        <service>'ping'</service>
        <request>'PING MACHINE %s' % targetHost </request>
      </stafcmd>
      <script>
        cmdRC=RC
        cmdResult=STAFResult
      </script>
      <call function="'checkRC'">
        { 'returncode' : cmdRC,
          'result'     : cmdResult,
          'fileFd'     : fileFd }
      </call>
      <if expr="cmdRC != 0">
        <script>errMsg = 'Can not ping staf on %s' % targetHost </script>
      <else>
        <script>errMsg = 'Can ping staf on %s' % targetHost </script>
      </else>
      </if>
      <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
      <return>
        [ cmdRC , errMsg ]
      </return>
    </sequence>
  </function>
  <function name="copyFile" scope="local">
    <function-prolog>
      This function copies a source file to destination file to host