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

ludovicp
31.59.2010 2ce3837f88119be9e503f704f7fea31fda32420a
Improve shared and functional tests, as well as code coverage.
6 files modified
165 ■■■■■ changed files
opends/tests/staf-tests/functional-tests/testcases/dsml/dsml_setup.xml 38 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/setup/import.xml 10 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/ant/tests.xml 18 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/dsadm.xml 7 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/snmp.xml 46 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/topology.xml 46 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/dsml/dsml_setup.xml
@@ -558,13 +558,20 @@
                if WC_TYPE == 'tomcat':
                  destWebXml = os.path.join(WC_DIRECTORY, 'apache-%s-%s' % (WC_TYPE, WC_VERSION), 'webapps',
                                            'dsml', 'WEB-INF', 'web.xml')
                  destEmmaProp = os.path.join(WC_DIRECTORY, 'apache-%s-%s' % (WC_TYPE, WC_VERSION), 'webapps',
                                            'dsml', 'WEB-INF', 'classes', 'emma.properties')
                elif WC_TYPE == 'glassfish':
                  destWebXml = os.path.join(WC_DIRECTORY, 'glassfishv3', 'glassfish',
                                            'domains', 'domain1', 'applications',
                                            'dsml', 'WEB-INF', 'web.xml')
                  destEmmaProp = os.path.join(WC_DIRECTORY, 'glassfishv3', 'glassfish',
                                            'domains', 'domain1', 'applications',
                                            'dsml', 'WEB-INF', 'classes', 'emma.properties')
                elif WC_TYPE == 'sunwebserver':
                  destWebXml = os.path.join(WC_DIRECTORY, '%s-%s' % (WC_TYPE, WC_VERSION), 'https-%s' % STAF_REMOTE_HOSTNAME,
                                 'generated', STAF_REMOTE_HOSTNAME, 'dsml', 'WEB-INF', 'web.xml')
                  destEmmaProp = os.path.join(WC_DIRECTORY, '%s-%s' % (WC_TYPE, WC_VERSION), 'https-%s' % STAF_REMOTE_HOSTNAME,
                                 'generated', STAF_REMOTE_HOSTNAME, 'dsml', 'WEB-INF', 'classes', 'emma.properties')
                nbLoop = 10
                loopSleep = 1000 # 1000 millisecondes
@@ -603,6 +610,37 @@
                    'result'     : STAXResult
                    }
                  </call>
                  <script>
                    ecPath = os.path.join(remote.temp,'coverage',CurrentTestPath['group'],'coverage_dsml.ec')
                    coveragefh = open( '%s/emma_dsml.properties' % local.temp, 'w')
                    coveragefh.write( 'coverage.out.file=%s\n' % ecPath )
                    coveragefh.write( 'verbosity.level=silent\n')
                    coveragefh.write( 'coverage.out.merge=true\n')
                    coveragefh.close()
                  </script>
                  <message>
                    'PATH ORIG %s/emma_dsml.properties' % local.temp
                  </message>
                  <message>
                    'PATH DEST %s' % destEmmaProp
                  </message>
                  <call function="'copyFile'">
                    { 'location'   : STAXServiceMachine,
                      'remotehost' : '%s' % STAF_REMOTE_HOSTNAME,
                      'srcfile'    : '%s/emma_dsml.properties' % local.temp,
                      'destfile'   : destEmmaProp
                     }
                  </call>
                  <call function="'checktestRC'">
                    {
                    'returncode' : RC ,
                    'result'     : STAXResult
                    }
                  </call>
                  <call function="'stopWebcontainerWithScript'"/>
                  <call function="'startWebcontainerWithScript'"/>
                </sequence>
opends/tests/staf-tests/functional-tests/testcases/setup/import.xml
@@ -23,7 +23,7 @@
 !
 ! CDDL HEADER END
 !
 !      Copyright 2008-2009 Sun Microsystems, Inc.
 !      Copyright 2008-2010 Sun Microsystems, Inc.
 ! -->
<stax>
  
@@ -482,8 +482,12 @@
          </call>
          <script>
            nb = len(STAFResult)
            ct = (STAFResult[0] == 'lib')
            res = STAFResult
            if 'coverage.ec' in res:
              res.remove('coverage.ec')
            nb = len(res)
            ct = (res[0] == 'lib')
            a = ' '
          </script>
opends/tests/staf-tests/shared/ant/tests.xml
@@ -462,8 +462,10 @@
    <java classpath="${temp.dir}/coverage-instr/dsml/WEB-INF/lib/emma.jar"
          classname="emma" fork="true">
        <jvmarg value="-Demma.metadata.out.file=${temp.dir}/coverage-instr/dsml/WEB-INF/lib/coverage.em" />
        <jvmarg value="-Demma.metadata.out.file=${temp.dir}/coverage-instr/opends/${opends.name}/coverage.em" />
        <arg value="instr" />
        <arg value="-merge" />
        <arg value="yes" />
        <arg value="-m" />
        <arg value="overwrite" />
        <arg value="-ix" />
@@ -483,23 +485,19 @@
      <matches string="${product.name}" pattern="^OpenDS ."/>
      <then>
        <!-- The war file is not in the opends archive, so we need to repackage the war file -->
        <zip basedir="${temp.dir}/coverage-instr/dsml" destfile="${opends.dir}/${opends.name}-DSML.war">
        <zipfileset dir="${temp.dir}/coverage-instr/dsml"
                    includes="WEB-INF/**,META-INF/**"/>
        </zip>
        <zip basedir="${temp.dir}/coverage-instr/dsml" destfile="${opends.dir}/${opends.name}-DSML.war"/>
      </then>
      <else>
        <!-- The war file is in the opends archive, so we need to replace the war file -->
        <delete file="${temp.dir}/coverage-instr/opends/${opends.name}/addons/DSML.war"/>
        <zip basedir="${temp.dir}/coverage-instr/dsml" destfile="${temp.dir}/coverage-instr/opends/${opends.name}/addons/DSML.war">
        <zipfileset dir="${temp.dir}/coverage-instr/dsml"
                    includes="WEB-INF/**,META-INF/**"/>
        </zip>
        <zip basedir="${temp.dir}/coverage-instr/dsml" destfile="${temp.dir}/coverage-instr/opends/${opends.name}/addons/DSML.war"/>
      </else>
    </if>
    <!-- Repackage OpenDS the product with coverage enabled scripts -->
    <zip basedir="${temp.dir}/coverage-instr/opends" destfile="${opends.dir}/${opends.name}.zip">
    <zip basedir="${temp.dir}/coverage-instr/opends"
         destfile="${opends.dir}/${opends.name}.zip"
         excludes="${opends.name}/setup,${opends.name}/uninstall,${opends.name}/upgrade,${opends.name}/bin/*,${opends.name}/lib/*.sh">
    <zipfileset dir="${temp.dir}/coverage-instr/opends"
                includes="${opends.name}/setup,${opends.name}/uninstall,${opends.name}/upgrade,${opends.name}/bin/*,${opends.name}/lib/*.sh"
                filemode="755" dirmode="755" />
opends/tests/staf-tests/shared/functions/dsadm.xml
@@ -322,17 +322,12 @@
          </script>
          <call function="'createFolder'">
            { 'location'   : STAF_REMOTE_HOSTNAME,
            { 'location'   : STAXServiceMachine,
              'foldername' : resultsCoveragePath
            }
          </call>
          <call function="'createFolder'">
            { 'location'   : STAF_REMOTE_HOSTNAME,
              'foldername' : resultsPath
            }
          </call>
          <call function="'createFolder'">
            { 'location'   : STAF_REMOTE_HOSTNAME,
              'foldername' : remoteCoveragePath
            }
          </call>
opends/tests/staf-tests/shared/functions/snmp.xml
@@ -118,6 +118,26 @@
    </function-map-args>
    <sequence>
      <!-- Check if 'emma.jar' exists -->
      <call function="'GetEntry'">
        {
        'location'  : STAF_REMOTE_HOSTNAME ,
        'entry'     : '%s/%s/lib/emma.jar' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME) ,
        'attribute' : 'TYPE'
        }
      </call>
      <if expr="RC != 48">
        <!-- 'emma.jar' exists -->
        <script>
          emma_jarfile='%s/%s/lib/emma.jar' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
        </script>
        <else>
          <script>
            emma_jarfile=None
          </script>
        </else>
      </if>
      <!-- Build the command -->
      <script>
        STAFCmdParamsList=[]
@@ -169,8 +189,7 @@
        snmpPath='%s/snmp' % remote.java
        jdmk_jarfile='%s/jdmkrt.jar' % snmpPath
        emma_jarfile='%s/%s/lib/emma.jar' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
        if os.path.exists(emma_jarfile):
        if emma_jarfile:
          cp = 'CLASSPATH=%s%s%s%s%s%s.' \
          % (opends_jarfile,separator,jdmk_jarfile,separator,emma_jarfile,separator)
        else:
@@ -289,6 +308,26 @@
    </function-map-args>
    <sequence>
      <!-- Check if 'emma.jar' exists -->
      <call function="'GetEntry'">
        {
        'location'  : STAF_REMOTE_HOSTNAME ,
        'entry'     : '%s/%s/lib/emma.jar' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME) ,
        'attribute' : 'TYPE'
        }
      </call>
      <if expr="RC != 48">
        <!-- 'emma.jar' exists -->
        <script>
          emma_jarfile='%s/%s/lib/emma.jar' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
        </script>
        <else>
          <script>
            emma_jarfile=None
          </script>
        </else>
      </if>
      <!-- Build the command -->
      <script>
        STAFCmdParamsList=[]
@@ -337,8 +376,7 @@
        snmpPath='%s/snmp' % remote.java
        jdmk_jarfile='%s/jdmkrt.jar' % snmpPath
        emma_jarfile='%s/%s/lib/emma.jar' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
        if os.path.exists(emma_jarfile):
        if emma_jarfile:
          cp = 'CLASSPATH=%s%s%s%s%s%s.' \
          % (opends_jarfile,separator,jdmk_jarfile,separator,emma_jarfile,separator)
        else:
opends/tests/staf-tests/shared/functions/topology.xml
@@ -754,9 +754,19 @@
        }
      </call>
      
      <!--- Install DS Copy zip file -->
      <!-- Check if DS Copy zip exists -->
      <call function="'GetEntry'">
        {
        'location'  : dsHost,
        'entry'     : '%s/%s' % (dsDir,ZIPNAME),
        'attribute' : 'TYPE'
        }
      </call>
      <if expr="RC == 48">
        <sequence>
          <!--- Copy DS Copy zip file -->
      <message>
        'Copy DS zip archive %s/%s to %s' % (local.temp,ZIPNAME,dsHost)
            'Copy DS zip archive %s/%s to %s' % (ZIPPATH,ZIPNAME,dsHost)
      </message>
      <call function="'copyFile'">
        { 'srcfile'    : '%s/%s' % (ZIPPATH,ZIPNAME),
@@ -764,6 +774,13 @@
          'remotehost' : dsHost
        }
      </call>
        </sequence>
        <else>
          <message>
            'DS zip archive %s/%s already exists, nothing to do' % (dsDir,ZIPNAME)
          </message>
        </else>
      </if>
      
       <!--- Install DS Extract zip file -->
      <message>
@@ -1847,31 +1864,6 @@
          'filename' : '%s/testdata.zip' % dsDir 
        }
      </call>
      <!--- Delete OPENDS zip file on remote host-->
      <message>
        'Delete OPENDS zip file %s/%s' % (dsDir,ZIPNAME)
      </message>
      <call function="'deleteFile'">
        { 'location' : dsHost,
          'filename' : '%s/%s' % (dsDir,ZIPNAME) }
      </call>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult
        }
      </call>
      <if expr="returncode == 0">
        <message>
          'Instance removed.'
        </message>
        <else>
          <message>
            'Failed to remove instance.'
          </message>
        </else>
      </if>
    </sequence>
  </function>