From f8dc4c7113770034d05c9e610dd54a26ff121c72 Mon Sep 17 00:00:00 2001
From: andrug <andrug@localhost>
Date: Mon, 07 Apr 2008 13:30:50 +0000
Subject: [PATCH] avoid error when several copy on the same folder

---
 opendj-sdk/opends/tests/system-tests/phases/main_run_lib.xml |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/tests/system-tests/phases/main_run_lib.xml b/opendj-sdk/opends/tests/system-tests/phases/main_run_lib.xml
index bc49ddd..4739f77 100644
--- a/opendj-sdk/opends/tests/system-tests/phases/main_run_lib.xml
+++ b/opendj-sdk/opends/tests/system-tests/phases/main_run_lib.xml
@@ -140,14 +140,32 @@
       <!--== Get the list of hosts for each instance ==-->
       <script>
         _list = []
+        _i = 0
         _listName = []
         for instance in instances:
           if instance.getHost() not in _listName:
             _listName.append(instance.getHost())
-            _list.append(instance)
+            _list.append([_i,instance])
+            _i += 1
       </script>
-      <paralleliterate in="_list" var="instance">
+      <paralleliterate in="_list" var="element">
         <sequence>
+          <script>
+            id = element[0]
+            instance = element[1]
+          </script>
+          <!-- Parrallel copy, all instances except instance 0 wait 1 sec -->
+          <!-- This prevent copying the same folder in case of NFS        -->
+          <if expr="id != 0">
+            <call function="'sleep'">
+              {
+                'sleepForMilliSeconds'  : '1000',
+                'silentMode' : 'TRUE',
+                'fileFd' : NO_FILE
+              }
+            </call>
+          </if>
+          
           <call function="'createFolder'">
             { 'location'   : instance.getHost(),
               'foldername' : LOCAL_TESTS_DIR,
@@ -218,17 +236,34 @@
       <!--== 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(client)
+            _list.append([_i,client])
+            _i += 1
       </script>
-      <paralleliterate in="_list" var="client">
+      <paralleliterate in="_list" var="element">
         <sequence>
           <if expr="runScheduler == 'true' or runConfiguration == 'true'">
             <sequence>
               <script>
+                id = element[0]
+                instance = 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'  : '1000',
+                    'silentMode' : 'TRUE',
+                    'fileFd' : NO_FILE
+                  }
+                </call>
+              </if>
+              <script>
                 fullHostName = '%s%s' % (client.getHost(),DOMAIN[0])
               </script>
               <!-- Copy shared clients -->

--
Gitblit v1.10.0