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

andrug
23.09.2008 d6025ba9973f42c8e462fe0799d7e34fa239d541
avoid staf exception when clients object list is empty
3 files modified
228 ■■■■ changed files
opends/tests/system-tests/phases/main_run.xml 8 ●●●● patch | view | raw | blame | history
opends/tests/system-tests/phases/main_run_lib.xml 196 ●●●● patch | view | raw | blame | history
opends/tests/system-tests/phases/parser/parser.xml 24 ●●●●● patch | view | raw | blame | history
opends/tests/system-tests/phases/main_run.xml
@@ -353,8 +353,12 @@
      
      
      
      <!-- ============ scheduler ==================================== -->
      <if expr="runScheduler == 'true' and ERR_NUM_TOTAL == 0">
      <!-- ============ SCHEDULER ==================================== -->
      <!--== Get the enabled clients list from all modules ==-->
      <call function="'getEnabledClients'">{'scheduler':scheduler}</call>
      <script>clients = STAXResult </script>
      <if expr="runScheduler == 'true' and ERR_NUM_TOTAL == 0
                and len(clients) > 0">
        <sequence>
          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
            file="'%s/phases/scheduler/scheduler.xml' % (TESTS_DIR)"/>
opends/tests/system-tests/phases/main_run_lib.xml
@@ -209,94 +209,98 @@
      <call function="'getEnabledClients'">{'scheduler':scheduler}</call>
      <script>clients = STAXResult </script>
      
      <!--======= Create instance log dir on instance's host =====-->
      <paralleliterate in="clients" var="client">
      <if expr="len(clients) > 0">
        <sequence>
          <call function="'createFolder'">
            { 'location'   : client.getHost(),
              'foldername' : client.getLogDir(),
              'fileFd'     : NO_FILE
            }
          </call>
          <call function="'createFolder'">
            { 'location'   : client.getHost(),
              'foldername' : LOG_TMP_DIR,
              'fileFd'     : NO_FILE
            }
          </call>
        </sequence>
      </paralleliterate>
      <!--====== Copy framework files needed to client hosts ======-->
      <!-- Copy framework one time per host even if several        -->
      <!-- client on same host                                     -->
      <!--== Get the list of hosts for each client              ===-->
      <script>
        _list = []
        _i = 0
        _listName = []
        for client in clients:
          if client.getHost() not in _listName:
            _listName.append(client.getHost())
            _list.append([_i,client])
            _i += 1
      </script>
      <paralleliterate in="_list" var="element">
        <sequence>
          <if expr="runScheduler == 'true' or runConfiguration == 'true'">
          <!--======= Create instance log dir on instance's host =====-->
          <paralleliterate in="clients" var="client">
            <sequence>
              <script>
                id = element[0]
                client = element[1]
              </script>
              <!-- Parrallel copy, all instances except client 0 wait 1 sec -->
              <!-- This prevent copying the same folder in case of NFS      -->
              <if expr="id != 0">
                <call function="'sleep'">
                  {
                    'sleepForMilliSeconds'  : '2000',
                    'silentMode' : 'TRUE',
                    'fileFd' : NO_FILE
                  }
                </call>
              </if>
              <!-- Copy shared clients -->
              <call function="'copyFolder'">
              {
                'remoteHost'    : '%s%s' % (client.getHost(),DOMAIN[0]),
                'fromDirectory' : '%s/clients' % TESTS_DIR,
                'toDirectory'   : '%s/clients' % LOCAL_TESTS_DIR,
                'fileFd'        : NO_FILE
              }
              </call>
              <!-- Copy clients that are under the scenario directory -->
              <call function="'isFile'">
              {
                'location' : STAXServiceMachine,
                'fileName' : '%s/scenario/%s/clients' % \
                             (TESTS_DIR,DIR_NAME),
              }
              </call>
              <script>
                fileExist = STAXResult
              </script>
              <if expr="fileExist == TRUE">
                <call function="'copyFolder'">
                {
                  'remoteHost'    : '%s%s' % (client.getHost(),DOMAIN[0]),
                  'fromDirectory' : '%s/scenario/%s/clients' % \
                                    (TESTS_DIR,DIR_NAME),
                  'toDirectory'   : '%s/scenario/%s/clients' % \
                                    (LOCAL_TESTS_DIR,DIR_NAME),
                  'fileFd'        : NO_FILE
              <call function="'createFolder'">
                { 'location'   : client.getHost(),
                  'foldername' : client.getLogDir(),
                  'fileFd'     : NO_FILE
                }
                </call>
              </call>
              <call function="'createFolder'">
                { 'location'   : client.getHost(),
                  'foldername' : LOG_TMP_DIR,
                  'fileFd'     : NO_FILE
                }
              </call>
            </sequence>
          </paralleliterate>
          <!--====== Copy framework files needed to client hosts ======-->
          <!-- Copy framework one time per host even if several        -->
          <!-- client on same host                                     -->
          <!--== Get the list of hosts for each client              ===-->
          <script>
            _list = []
            _i = 0
            _listName = []
            for client in clients:
              if client.getHost() not in _listName:
                _listName.append(client.getHost())
                _list.append([_i,client])
                _i += 1
          </script>
          <paralleliterate in="_list" var="element">
            <sequence>
              <if expr="runScheduler == 'true' or runConfiguration == 'true'">
                <sequence>
                  <script>
                    id = element[0]
                    client = element[1]
                  </script>
                  <!-- Parrallel copy, all instances except             -->
                  <!-- client 0 wait 1 sec. This prevent copying        -->
                  <!-- the same folder in case of NFS                   -->
                  <if expr="id != 0">
                    <call function="'sleep'">
                      {
                        'sleepForMilliSeconds'  : '2000',
                        'silentMode' : 'TRUE',
                        'fileFd' : NO_FILE
                      }
                    </call>
                  </if>
                  <!-- Copy shared clients -->
                  <call function="'copyFolder'">
                  {
                    'remoteHost'    : '%s%s' % (client.getHost(),DOMAIN[0]),
                    'fromDirectory' : '%s/clients' % TESTS_DIR,
                    'toDirectory'   : '%s/clients' % LOCAL_TESTS_DIR,
                    'fileFd'        : NO_FILE
                  }
                  </call>
                  <!-- Copy clients that are under the scenario directory -->
                  <call function="'isFile'">
                  {
                    'location' : STAXServiceMachine,
                    'fileName' : '%s/scenario/%s/clients' % \
                                 (TESTS_DIR,DIR_NAME),
                  }
                  </call>
                  <script>
                    fileExist = STAXResult
                  </script>
                  <if expr="fileExist == TRUE">
                    <call function="'copyFolder'">
                    {
                      'remoteHost'    : '%s%s' % (client.getHost(),DOMAIN[0]),
                      'fromDirectory' : '%s/scenario/%s/clients' % \
                                        (TESTS_DIR,DIR_NAME),
                      'toDirectory'   : '%s/scenario/%s/clients' % \
                                        (LOCAL_TESTS_DIR,DIR_NAME),
                      'fileFd'        : NO_FILE
                    }
                    </call>
                  </if>
                </sequence>
              </if>
            </sequence>
          </if>
          </paralleliterate>
        </sequence>
      </paralleliterate>
      </if>
      
      <message log="1">
        '== Found %s Error(s) during this phase' % (ERR_NUM[0])
@@ -393,19 +397,21 @@
      <call function="'getEnabledClients'">{'scheduler':scheduler}</call>
      <script>clients = STAXResult </script>
      
      <iterate in="clients" var="client">
        <sequence>
          <call function="'copyFolder'">
            { 'location'      : client.getHost(),
              'remoteHost'    : STAXServiceMachine,
              'fromDirectory' : client.getLogDir(),
              'toDirectory'   : client.getLogDir(),
              'fileFd'        : NO_FILE
            }
          </call>
        </sequence>
      </iterate>
      <if expr="len(clients) > 0">
        <iterate in="clients" var="client">
          <sequence>
            <call function="'copyFolder'">
              { 'location'      : client.getHost(),
                'remoteHost'    : STAXServiceMachine,
                'fromDirectory' : client.getLogDir(),
                'toDirectory'   : client.getLogDir(),
                'fileFd'        : NO_FILE
              }
            </call>
          </sequence>
        </iterate>
      </if>
      
      <!--== Copy xsl file needed to read the report ==-->
      <call function="'copyFile'">
opends/tests/system-tests/phases/parser/parser.xml
@@ -142,14 +142,22 @@
      <!--== Get the enabled clients list from all modules ==-->
      <call function="'getEnabledClients'">{'scheduler':scheduler}</call>
      <script>clients = STAXResult </script>
      <paralleliterate in="clients" var="client">
        <sequence>
          <script>
            client.setLogDir('%s/client_%s_id%s' % \
            (LOG_DIR,client.getName(),client.getId()))
          </script>
        </sequence>
      </paralleliterate>
      <if expr="len(clients) > 0">
        <paralleliterate in="clients" var="client">
          <sequence>
            <script>
              client.setLogDir('%s/client_%s_id%s' % \
              (LOG_DIR,client.getName(),client.getId()))
            </script>
          </sequence>
        </paralleliterate>
      <else>
        <script>
          msg = '%s\nWARNING : client list is empty,' % msg
          msg = '%s check clients are defined and modules are enabled\n' % msg
        </script>
      </else>
      </if>
      
      
      <!--=================================================================-->