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

Christophe Sovant
26.31.2013 340c70e3cb0ba52c4abd70eceb7b4bbfb877d35c
CR-1739 Fix replication mode and one tasks testcase on Windows
4 files modified
71 ■■■■■ changed files
opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml 2 ●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/ant/build.properties 6 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/environment.xml 61 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/tests/config.py.stubs 2 ●●● patch | view | raw | blame | history
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")
  
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'
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
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}'