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

elocatel
23.11.2008 05984a7a633d96a7e5e53010d8a4464da5f94508
First commit of setup group: setup framework , and "general_options" tests

4 files added
546 ■■■■■ changed files
opends/tests/functional-tests/testcases/setup/_post.xml 100 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/setup/_pre.xml 118 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/setup/general_options.xml 232 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/setup/setup.xml 96 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/setup/_post.xml
New file
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/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, exclude this CDDL HEADER in each
 ! file and exclude 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
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="_post"/>
  <function name="_post">
    <sequence>
      <!--- Test Suite information
        #@TestSuiteName       Setup-Uninstall _post Tests
        #@TestSuitePurpose    cleanup after all suites of this group are done
        #@TestSuiteGroup      _post
        #@TestSuiteID         _post Tests
        #@TestGroup           Setup-Uninstall
        #@TestScript          _post.xml
        #@TestHTMLLink        http://opends.dev.java.net/
      -->
      <script>
        if not CurrentTestPath.has_key('group'):
          CurrentTestPath['group'] = 'setup'
        CurrentTestPath['suite'] = '_post'
      </script>
      <call function="'testSuite_Preamble'"/>
      <!--- Test Case information
        #@TestMarker          Setup-Uninstall environment setup
        #@TestName            Setup-Uninstall: _pre: cleanup
        #@TestID              cleanup
        #@TestPurpose         Remove the "ready-to-install" OpenDS created by
                              the _pre test suite
        #@TestPreamble
        #@TestStep            Recursive remove of unzipped OpenDS
        #@TestPostamble
        #@TestResult          PASS if all steps ran without errors
      -->
      <testcase name="getTestCaseName('cleanup')">
        <sequence>
          <call function="'testCase_Preamble'"/>
          <message>'Remove all files created by setup tests'</message>
          <call function="'runSTAFCommand'">
            { 'name'      :  'Delete directory containing unzipped OpenDS',
              'location'  :  STAXServiceMachine,
              'service'   :  'FS',
              'request'   :  'DELETE',
              'arguments' :  'ENTRY %s RECURSE CONFIRM' % OUT_GROUP
            }
          </call>
          <call function="'checktestRC'">
            { 'returncode' : RC,
              'expected'   : 0,
              'result'     : 'FAIL to remove files for this group at cleanup',
            }
          </call>
          <call function="'testCase_Postamble'"/>
        </sequence>
      </testcase>
      <call function="'testSuite_Postamble'"/>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/setup/_pre.xml
New file
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/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, exclude this CDDL HEADER in each
 ! file and exclude 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
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="_pre"/>
  <function name="_pre">
    <sequence>
      <!--- Test Suite information
        #@TestSuiteName       Setup-Uninstall _pre Tests
        #@TestSuitePurpose    setup minimal environment for the other
                              suites to execute gently
        #@TestSuiteGroup      _pre
        #@TestSuiteID         _pre Tests
        #@TestGroup           Setup-Uninstall
        #@TestScript          _pre.xml
        #@TestHTMLLink        http://opends.dev.java.net/
      -->
      <script>
        if not CurrentTestPath.has_key('group'):
          CurrentTestPath['group'] = 'setup'
        CurrentTestPath['suite'] = '_pre'
      </script>
      <call function="'testSuite_Preamble'"/>
      <!--- Test Case information
        #@TestMarker          Setup-Uninstall environment setup
        #@TestName            Setup-Uninstall: _pre: prepare_zip
        #@TestID              prepare_zip
        #@TestPurpose         Have a "ready-to-install" OpenDS for other
                              test cases
        #@TestPreamble
        #@TestStep            Copy then unzip a .ZIP OpenDS distribution
        #@TestPostamble
        #@TestResult          PASS if all steps ran without errors
      -->
      <testcase name="getTestCaseName('prepare_zip')">
        <sequence>
          <call function="'testCase_Preamble'"/>
          <message>'Prepare Open DS ZIP (in %s)' % ODS_UNZIPPED</message>
          <call function="'runSTAFCommand'">
            { 'name'      :  'Create directory to contain unzipped OpenDS',
              'location'  :  STAXServiceMachine,
              'service'   :  'FS',
              'request'   :  'CREATE',
              'arguments' :  'DIRECTORY %s FAILIFEXISTS' % ODS_UNZIPPED
            }
          </call>
          <call function="'checktestRC'">
            { 'returncode' : RC,
              'expected'   : 0,
              'result'     : 'FAIL to create directory',
            }
          </call>
          <call function="'runSTAFCommand'">
            { 'name'      :  'Extract OpenDS ZIP file',
              'location'  :  STAXServiceMachine,
              'service'   :  'ZIP',
              'request'   :  'UNZIP',
              'arguments' :  'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
                % (ZIPPATH, ZIPNAME, ODS_UNZIPPED)
            }
          </call>
          <call function="'checktestRC'">
            { 'returncode' : RC,
              'expected'   : 0,
              'result'     : 'FAIL to unzip OpenDS ZIP file',
            }
          </call>
          <call function="'testCase_Postamble'"/>
        </sequence>
      </testcase>
      <call function="'testSuite_Postamble'"/>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/setup/general_options.xml
New file
@@ -0,0 +1,232 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/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, exclude this CDDL HEADER in each
 ! file and exclude 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
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="general_options"/>
  <function name="general_options">
    <sequence>
      <!--- Test Suite information
        #@TestSuiteName       Setup-Uninstall general_options Tests
        #@TestSuitePurpose    Test the general options of both setup and
                              uninstall commands. General options include
                              'help', 'version', ...
        #@TestSuiteGroup      general_options
        #@TestSuiteID         general_options Tests
        #@TestGroup           Setup-Uninstall
        #@TestScript          general_options.xml
        #@TestHTMLLink        http://opends.dev.java.net/
      -->
      <script>
        if not CurrentTestPath.has_key('group'):
          CurrentTestPath['group'] = 'setup'
        CurrentTestPath['suite'] = 'general_options'
      </script>
      <call function="'testSuite_Preamble'"/>
      <!--- Test Case information
        #@TestMarker          Setup-Uninstall General options
        #@TestName            Setup-Uninstall: general_options:
                              setup_uninstall_version
        #@TestID              setup_uninstall_version
        #@TestPurpose         Test the 'version' option of the commands
        #@TestPreamble
        #@TestStep            Test 'version' option of setup command
                              Test 'version' option of uninstall command
        #@TestPostamble
        #@TestResult          PASS if all steps ran without errors
      -->
      <testcase name="getTestCaseName('setup_uninstall_version')">
        <sequence>
          <call function="'testCase_Preamble'"/>
          <message>'Setup Uninstall: Version option'</message>
          <script>
            setupCmd    = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
            setupParams = '--version'
          </script>
          <message>'%s %s' % (setupCmd, setupParams)</message>
          <call function="'runCommand'">
            { 'location'  : STAXServiceMachine,
              'name'      : 'Launch setup command to get DS version',
              'command'   : setupCmd,
              'arguments' : setupParams,
              'path'      : ODS_UNZIPPED,
              'expectedRC': 0,
              'outputPath': OUT_GROUP,
              'outputFile': 'go-setup-version.txt',
            }
          </call>
          <script>
            grepFile = '%s/go-setup-version.txt' % OUT_GROUP
          </script>
          <call function="'grep'">
            { 'location'  : STAXServiceMachine,
              'filename'  : grepFile,
              'testString': 'OpenDS Directory Server',
              'expectedRC': 0,
            }
          </call>
          <script>
            uninstallCmd = '%s/%s/uninstall%s' % (ODS_UNZIPPED, \
              OPENDSNAME, fileExt)
            uninstallParams = '--version'
          </script>
          <message>'%s %s' % (uninstallCmd, uninstallParams)</message>
          <call function="'runCommand'">
            { 'location'  : STAXServiceMachine,
              'name'      : 'Launch uninstall command to get DS version',
              'command'   : uninstallCmd,
              'arguments' : uninstallParams,
              'path'      : ODS_UNZIPPED,
              'expectedRC': 0,
              'outputPath': OUT_GROUP,
              'outputFile': 'go-uninstall-version.txt',
            }
          </call>
          <script>
            grepFile = '%s/go-uninstall-version.txt' % OUT_GROUP
          </script>
          <call function="'grep'">
            { 'location'  : STAXServiceMachine,
              'filename'  : grepFile,
              'testString': 'OpenDS Directory Server',
              'expectedRC': 0,
            }
          </call>
          <call function="'testCase_Postamble'"/>
        </sequence>
      </testcase>
      <!--- Test Case information
        #@TestMarker          Setup-Uninstall General options
        #@TestName            Setup-Uninstall: general_options:
                              setup_uninstall_help
        #@TestID              setup_uninstall_help
        #@TestPurpose         Test the 'help' option of the commands
        #@TestPreamble
        #@TestStep            Test 'help' option of setup command
                              Test 'help' option of uninstall command
        #@TestPostamble
        #@TestResult          PASS if all steps ran without errors
      -->
      <testcase name="getTestCaseName('setup_uninstall_help')">
        <sequence>
          <call function="'testCase_Preamble'"/>
          <message>'Setup Uninstall: Help option'</message>
          <script>
            setupCmd    = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
            setupParams = '--help'
          </script>
          <message>'%s %s' % (setupCmd, setupParams)</message>
          <call function="'runCommand'">
            { 'location'  : STAXServiceMachine,
              'name'      : 'Launch setup command to get its help',
              'command'   : setupCmd,
              'arguments' : setupParams,
              'path'      : ODS_UNZIPPED,
              'expectedRC': 0,
              'outputPath': OUT_GROUP,
              'outputFile': 'go-setup-help.txt',
            }
          </call>
          <script>
            grepFile = '%s/go-setup-help.txt' % OUT_GROUP
          </script>
          <call function="'grep'">
            { 'location'  : STAXServiceMachine,
              'filename'  : grepFile,
              'testString': 'Usage',
              'expectedRC': 0,
            }
          </call>
          <script>
            uninstallCmd = '%s/%s/uninstall%s' % (ODS_UNZIPPED, \
              OPENDSNAME, fileExt)
            uninstallParams = '--help'
          </script>
          <message>'%s %s' % (uninstallCmd, uninstallParams)</message>
          <call function="'runCommand'">
            { 'location'  : STAXServiceMachine,
              'name'      : 'Launch uninstall command to get its help',
              'command'   : uninstallCmd,
              'arguments' : uninstallParams,
              'path'      : ODS_UNZIPPED,
              'expectedRC': 0,
              'outputPath': OUT_GROUP,
              'outputFile': 'go-uninstall-help.txt',
            }
          </call>
          <script>
            grepFile = '%s/go-uninstall-help.txt' % OUT_GROUP
          </script>
          <call function="'grep'">
            { 'location'  : STAXServiceMachine,
              'filename'  : grepFile,
              'testString': 'Usage',
              'expectedRC': 0,
            }
          </call>
          <call function="'testCase_Postamble'"/>
        </sequence>
      </testcase>
      <call function="'testSuite_Postamble'"/>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/setup/setup.xml
New file
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/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, exclude this CDDL HEADER in each
 ! file and exclude 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
 !
 !      Copyright 2008 Sun Microsystems, Inc.
! -->
<stax>
  <defaultcall function="main_setup"/>
  <function name="main_setup">
    <sequence>
      <block name="'setup'">
        <sequence>
          <!--- Test Group information
            #@TestGroupName          Setup tests
            #@TestGroupPurpose       Test the tools commands.
          -->
          <script>
            CurrentTestPath['group'] = 'setup'
            OUT_GROUP    = '%s/setup' % logsTempDir
            ODS_UNZIPPED = '%s/unzipped' % OUT_GROUP
          </script>
          <call function="'testGroup_Preamble'"/>
          <call function="'runSTAFCommand'">
            { 'name'      :  'Create directory for this group',
              'location'  :  STAXServiceMachine,
              'service'   :  'FS',
              'request'   :  'CREATE',
              'arguments' :  'DIRECTORY %s FAILIFEXISTS' % OUT_GROUP
            }
          </call>
          <script>
            testList = []
            testList.append(['.','_pre'])
            testList.append(['.','general_options'])
#            testList.append(['.','directory_manager'])
#            testList.append(['.','import'])
#            testList.append(['.','incompatible_options'])
#            testList.append(['.','security'])
#            testList.append(['.','ports'])
#            testList.append(['.','misc'])
            testList.append(['.','_post'])
          </script>
          <iterate var="_test" in="testList">
            <sequence>
              <import machine="STAF_LOCAL_HOSTNAME"
                      file="'%s/testcases/setup/%s/%s.xml' %
                      (TESTS_DIR,_test[0],_test[1])"/>
              <call function="'%s' % _test[1]" />
            </sequence>
          </iterate>
          <call function="'testGroup_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>