From 340c70e3cb0ba52c4abd70eceb7b4bbfb877d35c Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Sun, 26 May 2013 21:31:36 +0000
Subject: [PATCH] CR-1739 Fix replication mode and one tasks testcase on Windows

---
 opends/tests/staf-tests/shared/functions/environment.xml                |   61 ------------------------------
 opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml |    2 
 opends/tests/staf-tests/shared/tests/config.py.stubs                    |    2 
 opends/tests/staf-tests/shared/ant/build.properties                     |    6 +-
 4 files changed, 6 insertions(+), 65 deletions(-)

diff --git a/opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml b/opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml
index 2d8e0cb..c03d7eb 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml
@@ -212,7 +212,7 @@
                 import java.text.SimpleDateFormat
   
                 cal = java.util.Calendar.getInstance()
-                cal.add(java.util.Calendar.SECOND,120)
+                cal.add(java.util.Calendar.SECOND,240)
   
                 dateFormat = java.text.SimpleDateFormat("yyyyMMddHHmmss")
   
diff --git a/opends/tests/staf-tests/shared/ant/build.properties b/opends/tests/staf-tests/shared/ant/build.properties
index b4c9f62..1cc26ac 100644
--- a/opends/tests/staf-tests/shared/ant/build.properties
+++ b/opends/tests/staf-tests/shared/ant/build.properties
@@ -22,7 +22,7 @@
 #
 #
 #      Copyright 2007-2010 Sun Microsystems, Inc.
-#      Portions Copyright 2011 ForgeRock AS
+#      Portions Copyright 2011-2013 ForgeRock AS
 
 
 ######
@@ -121,5 +121,5 @@
 tests.os.string=${os.name}
 tests.jvm.string=${java.version}(${sun.arch.data.model} bits)
 original.archive=${default.opends.dir}/${default.opends.name}.zip
-replication.split=
-replication.eclmode=
+replication.split='false'
+replication.eclmode='n/a'
diff --git a/opends/tests/staf-tests/shared/functions/environment.xml b/opends/tests/staf-tests/shared/functions/environment.xml
index dea95c1..57cc419 100755
--- a/opends/tests/staf-tests/shared/functions/environment.xml
+++ b/opends/tests/staf-tests/shared/functions/environment.xml
@@ -24,7 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2007-2010 Sun Microsystems, Inc.
- !      Portions Copyright 2011 ForgeRock AS.
+ !      Portions Copyright 2011-2013 ForgeRock AS.
  ! -->
 <stax>
   
@@ -178,65 +178,6 @@
         MultimasterSync = 'Multimaster Synchronization'
         MultimasterType = 'multimaster'
 
-        # TODO: this test flow for replication tests needs moving out to configuration
-        # Replication execution mode variables: if not defined, set "random"
-        # values:
-        #   (day of the month % 4) == 0 --> (split servers, eclmode n/a)
-        #   (day of the month % 4) == 1 --> (don't split, opends eclmode)
-        #   (day of the month % 4) == 2 --> (don't split, draft eclmode)
-        #   (day of the month % 4) == 3 --> (don't split, eclmode n/a)
-        import time
-        monthday          = time.localtime()[2]
-        rewriteConfigFile = False
-        
-        if REPLICATION_SPLIT_SERVERS == '':
-          rewriteConfigFile = True
-          oldSplitConfig    = """REPLICATION_SPLIT_SERVERS     = ''"""
-          if monthday % 4 == 0:
-            REPLICATION_SPLIT_SERVERS = 'true'
-          else:
-            REPLICATION_SPLIT_SERVERS = 'false'        
-          newSplitConfig    = """REPLICATION_SPLIT_SERVERS     = '%s'""" % \
-                              REPLICATION_SPLIT_SERVERS
-        else:
-          newSplitConfig    = """REPLICATION_SPLIT_SERVERS     = '%s'""" % \
-                              REPLICATION_SPLIT_SERVERS
-          oldSplitConfig    = newSplitConfig
-        
-        if REPLICATION_ECL_MODE == '':
-          rewriteConfigFile = True
-          oldEclmodeConfig = """REPLICATION_ECL_MODE          = ''"""
-          if monthday % 4 == 1:
-            REPLICATION_ECL_MODE = 'opends'
-          elif monthday % 4 == 2:
-            REPLICATION_ECL_MODE = 'draft'
-          else:
-            REPLICATION_ECL_MODE = 'n/a'
-          newEclmodeConfig  = """REPLICATION_ECL_MODE          = '%s'""" % \
-                              REPLICATION_ECL_MODE
-        else:
-          newEclmodeConfig  = """REPLICATION_ECL_MODE          = '%s'""" % \
-                              REPLICATION_ECL_MODE
-          oldEclmodeConfig  = newEclmodeConfig 
-
-        
-        # Rewrite the randomly chosen variables in config.py file
-        if rewriteConfigFile == True :
-          import re
-          splitRegEx   = re.compile(oldSplitConfig)
-          eclmodeRegEx = re.compile(oldEclmodeConfig)
-
-          configFile   = STAXJobScriptFiles[0]
-          configInput  = open(configFile, 'r')
-          c0           = configInput.read()
-          c1           = splitRegEx.sub(newSplitConfig, c0)
-          content      = eclmodeRegEx.sub(newEclmodeConfig, c1)
-          configInput.close()
-        
-          configOutput = open(configFile,'w')
-          configOutput.write(content)
-          configOutput.close()
-
         # Create staf objects
         LOCAL_STAF_ROOT  = test_env.staf(STAF_LOCAL_HOSTNAME).root
         REMOTE_STAF_ROOT = test_env.staf(STAF_REMOTE_HOSTNAME).root
diff --git a/opends/tests/staf-tests/shared/tests/config.py.stubs b/opends/tests/staf-tests/shared/tests/config.py.stubs
index 6b5679e..158b7be 100644
--- a/opends/tests/staf-tests/shared/tests/config.py.stubs
+++ b/opends/tests/staf-tests/shared/tests/config.py.stubs
@@ -56,7 +56,7 @@
 DIRECTORY_INSTANCE_SFX        = 'dc=com'
 DIRECTORY_INSTANCE_BE         = 'userRoot'
 REPLICATION_CONFIG_DIR        = '${tests.run.dir}/${tests.run.time}/config'
-REPLICATION_SPLIT_SERVERS     = 'false'
+REPLICATION_SPLIT_SERVERS     = '${replication.split}'
 REPLICATION_ECL_MODE          = '${replication.eclmode}'
 JAVA_HOME                     = '${remote.javahome}'
 LOCAL_JAVA_HOME               = '${local.javahome}'

--
Gitblit v1.10.0