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

gary_williams
02.42.2007 92121c9ecf927fbf063b5a263e0a0dcf00bd5270
Issue 1306 make use of stax query job  to get results of each test case
1 files added
3 files modified
176 ■■■■ changed files
opendj-sdk/opends/tests/functional-tests/shared/functions/stafcmd.xml 66 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/functions/staxcmd.xml 65 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml 40 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/runFuncTests.xml 5 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/functions/stafcmd.xml
@@ -376,34 +376,34 @@
      </function-arg-def>      
    </function-map-args>
      <sequence>
    <sequence>
        <stafcmd name="'STAF Command: Create Folder'">
          <location>'%s' % location</location>
          <service>'fs'</service>
          <request>
            'CREATE DIRECTORY %s FULLPATH' % foldername
          </request>
        </stafcmd>
      <stafcmd name="'STAF Command: Create Folder'">
        <location>'%s' % location</location>
        <service>'fs'</service>
        <request>
          'CREATE DIRECTORY %s FULLPATH' % foldername
        </request>
      </stafcmd>
        <script>
          cmdRC=RC
          cmdResult=STAFResult
        </script>
        <call function="'checkRC'">
            { 'returncode' : cmdRC ,
              'result'     : cmdResult }
        </call>
      <script>
        cmdRC=RC
        cmdResult=STAFResult
      </script>
      <call function="'checkRC'">
          { 'returncode' : cmdRC ,
            'result'     : cmdResult }
      </call>
        <return>cmdRC</return>
      </sequence>
      <return>cmdRC</return>
    </sequence>
    </function>
  </function>
    <function name="queryLogs">
  <function name="queryLogs">
    <function-prolog>
        Queries the staf logs from startfrom point
@@ -436,16 +436,16 @@
      </function-arg-def> 
    </function-map-args>
      <sequence>
        <stafcmd name="'STAF Command: Log Query for Test Case Log.'">
          <location>'%s' % location</location>
          <service>'log'</service>
          <request>'QUERY ALL MACHINE %s LOGNAME %s FROM %s TO %s' % (location,logname,startfrom,endat)</request>
        </stafcmd>
      </sequence>
    <sequence>
      <stafcmd name="'STAF Command: Log Query for Test Case Log.'">
        <location>'%s' % location</location>
        <service>'log'</service>
        <request>'QUERY ALL MACHINE %s LOGNAME %s FROM %s TO %s' % (location,logname,startfrom,endat)</request>
      </stafcmd>
    </sequence>
    </function>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/shared/functions/staxcmd.xml
New file
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<stax>
  <function name="queryTestcase">
    <function-prolog>Queries the current testcase</function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine">
        <function-arg-description>
          Location of target host
        </function-arg-description>
        <function-arg-property name="type" value="hostname" />
      </function-arg-def>
    </function-map-args>
    <sequence>
      <script>
        STAXRequest='QUERY JOB %s TESTCASE "%s"' % (STAXJobID,STAXCurrentTestcase)
      </script>
      <stafcmd name="'STAX Command: Test Case Query for %s' % STAXCurrentTestcase">
        <location>'%s' % location</location>
        <service>'stax'</service>
        <request>'%s' % STAXRequest</request>
      </stafcmd>
      <call function="'checkRC'">
        { 'returncode' : RC , 'result' : STAFResult }
      </call>
      <return>RC</return>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml
@@ -50,11 +50,11 @@
            <message log="1">
              'Success: RC=%s, Result=Ok' % (returncode)
            </message>
            <else>
              <message log="1">
                'Success: RC=%s, Result=%s' % (returncode,result)
              </message>
            </else>
          <else>
            <message log="1">
              'Success: RC=%s, Result=%s' % (returncode,result)
            </message>
          </else>
          </if>
        </sequence>
        <else>
@@ -341,6 +341,27 @@
    </function-prolog>
    <function-no-args />
    <sequence>
      <call function="'queryTestcase'" />
      <script>
        if STAFResult.has_key('numPasses'):
          numPass=int(STAFResult['numPasses'])
        else:
          numPass=int(0)
        if STAFResult.has_key('numFails'):
          numFail=int(STAFResult['numFails'])
        else:
          numFail=int(0)
      </script>
      <if expr="numFail &gt; 0">
        <message>'## Test Verdict: FAIL ##'</message>
      <else>
        <message>'## Test Verdict: PASS ##'</message>
      </else>
      </if>
      <call function="'testCase_EndBanner'" />
    </sequence>
  </function>
@@ -370,7 +391,7 @@
      </script>
          
      <message>
        '### %s/%s suite preamble ###' % (ThisGroupName,ThisSuiteName)
        '#### %s/%s suite preamble ####' % (ThisGroupName,ThisSuiteName)
      </message>
        
    </sequence>
@@ -397,7 +418,7 @@
      </script>
    
      <message>
        '### %s/%s suite postamble ###' % (ThisGroupName,ThisSuiteName)
        '#### %s/%s suite postamble ####' % (ThisGroupName,ThisSuiteName)
      </message>
      <!-- Start time of test suite -->      
@@ -444,7 +465,7 @@
        ThisGroupName=CurrentTestPath['group']          
      </script>
      
      <message>'### %s group preamble ###' % ThisGroupName</message>
      <message>'##### %s group preamble #####' % ThisGroupName</message>
      
    </sequence>
  </function>
@@ -463,7 +484,7 @@
          ThisGroupName='unknown-group'
      </script>
      
      <message>'### %s group postamble ###' % ThisGroupName</message>
      <message>'##### %s group postamble #####' % ThisGroupName</message>
      
      <script>
        if CurrentTestPath.has_key('group'):
@@ -541,7 +562,6 @@
        testlogfh=open(logfile,'w')
      </script>
           
      <message>'Writing query result'</message>
      <iterate var="element" in="queryresult">
        <script>
          level=element['level'] 
opendj-sdk/opends/tests/functional-tests/testcases/runFuncTests.xml
@@ -41,6 +41,9 @@
        file="'%s/stafcmd.xml' % (TESTS_FUNCTIONS_DIR)" />
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/staxcmd.xml' % (TESTS_FUNCTIONS_DIR)" />
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/dsadm.xml' % (TESTS_FUNCTIONS_DIR)" />
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
@@ -105,7 +108,7 @@
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/security/security.xml' % (TESTS_DIR)" />
      <call function="'main_security'" />
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/aci/aci.xml' % (TESTS_DIR)" />
      <call function="'main_aci'" />