| opends/tests/functional-tests/shared/data/clu/data/clu_start.ldif | ●●●●● patch | view | raw | blame | history | |
| opends/tests/functional-tests/shared/functions/dsadm.xml | ●●●●● patch | view | raw | blame | history | |
| opends/tests/functional-tests/testcases/clu/cluBase64.xml | ●●●●● patch | view | raw | blame | history | |
| opends/tests/functional-tests/testcases/clu/clu_setup.xml | ●●●●● patch | view | raw | blame | history | |
| opends/tests/functional-tests/testcases/clu/commands.xml | ●●●●● patch | view | raw | blame | history |
opends/tests/functional-tests/shared/data/clu/data/clu_start.ldif
@@ -23,6 +23,14 @@ # Portions Copyright 2006-2007 Sun Microsystems, Inc. # dn: dc=com dc: com objectclass: domain dn: dc=example,dc=com dc: example objectclass: domain dn: o=core tests,dc=example,dc=com o: core tests objectclass: top opends/tests/functional-tests/shared/functions/dsadm.xml
@@ -3070,5 +3070,220 @@ </function> <!-- This function shows server status using the status script --> <function name="StatusWithScript"> <function-prolog> This function shows server status using the status script </function-prolog> <function-map-args> <function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME"> <function-arg-description> Location of target host </function-arg-description> <function-arg-property name="type" value="hostname"/> </function-arg-def> <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)"> <function-arg-description> Pathname to installation root </function-arg-description> <function-arg-property name="type" value="filepath"/> </function-arg-def> <function-arg-def name="dsBindDN" type="optional"> <function-arg-description> Bind DN </function-arg-description> <function-arg-property name="type" value="DN"/> </function-arg-def> <function-arg-def name="dsBindPwd" type="optional"> <function-arg-description> Bind password </function-arg-description> <function-arg-property name="type" value="string"/> </function-arg-def> <function-arg-def name="dsHelp" type="optional"> <function-arg-description> Help option </function-arg-description> <function-arg-property name="help" value="option"/> </function-arg-def> </function-map-args> <sequence> <!-- Build the Command --> <script> STAFCmdParamsList=[] STAFCmdParams='' STAFCmdParamsList.append('-n') if dsPath: dsBinPath='%s/%s' % (dsPath,fileFolder) STAFCmd='%s/status%s' % (dsBinPath,fileExt) if dsBindDN: STAFCmdParamsList.append('-D "%s"' % dsBindDN) if dsBindPwd: STAFCmdParamsList.append('-w "%s"' % dsBindPwd) if dsHelp: STAFCmdParamsList.append('-H') STAFCmdParams=' '.join(STAFCmdParamsList) </script> <message> '%s %s' % (STAFCmd, STAFCmdParams) </message> <call function="'runCommand'"> { 'location' : location, 'name' : 'Status Script', 'command' : STAFCmd, 'arguments' : STAFCmdParams, 'path' : dsPath } </call> <call function="'checkRC'"> { 'returncode' : RC , 'result' : STAXResult } </call> </sequence> </function> <!-- This function executes the base64 encode decode utility with script --> <function name="Base64WithScript"> <function-prolog> This function executes the base64 encode decode utility with script </function-prolog> <function-map-args> <function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME"> <function-arg-description> Location of target host </function-arg-description> <function-arg-property name="type" value="hostname"/> </function-arg-def> <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)"> <function-arg-description> Pathname to installation root </function-arg-description> <function-arg-property name="type" value="filepath"/> </function-arg-def> <function-arg-def name="subcommand" type="required"> <function-arg-description> The subcommand for base64 (encode or decode) </function-arg-description> <function-arg-property name="type" value="string"/> </function-arg-def> <function-arg-def name="rawData" type="optional"> <function-arg-description> The raw data to be base64 encoded </function-arg-description> <function-arg-property name="type" value="string"/> </function-arg-def> <function-arg-def name="rawDataFile" type="optional"> <function-arg-description> The path to a file containing the raw data to be base64 encoded </function-arg-description> <function-arg-property name="type" value="filename"/> </function-arg-def> <function-arg-def name="toEncodedFile" type="optional"> <function-arg-description> The path to a file to which the base64-encoded data should be written </function-arg-description> <function-arg-property name="type" value="filename"/> </function-arg-def> <function-arg-def name="encodedData" type="optional"> <function-arg-description> The base64-encoded data to be decoded </function-arg-description> <function-arg-property name="type" value="string"/> </function-arg-def> <function-arg-def name="encodedDataFile" type="optional"> <function-arg-description> The path to a file containing the base64-encoded data to be decoded </function-arg-description> <function-arg-property name="type" value="filename"/> </function-arg-def> <function-arg-def name="toRawFile" type="optional"> <function-arg-description> The path to a file to which the raw base64-decoded data should be written </function-arg-description> <function-arg-property name="type" value="filename"/> </function-arg-def> <function-arg-def name="toolHelp" type="optional"> <function-arg-description> Help option </function-arg-description> <function-arg-property name="help" value="option"/> </function-arg-def> </function-map-args> <sequence> <!-- Build the Command --> <script> STAFCmdParamsList=[] STAFCmdParams='' if dsPath: dsBinPath='%s/%s' % (dsPath,fileFolder) STAFCmd='%s/base64%s' % (dsBinPath,fileExt) if subcommand: STAFCmdParamsList.append(subcommand) if rawData: STAFCmdParamsList.append('-d "%s"' % rawData) if rawDataFile: STAFCmdParamsList.append('-f "%s"' % rawDataFile) if toEncodedFile: STAFCmdParamsList.append('-o "%s"' % toEncodedFile) if encodedData: STAFCmdParamsList.append('-d "%s"' % encodedData) if encodedDataFile: STAFCmdParamsList.append('-f "%s"' % encodedDataFile) if toRawFile: STAFCmdParamsList.append('-o "%s"' % toRawFile) if toolHelp: STAFCmdParamsList.append('-H') STAFCmdParams=' '.join(STAFCmdParamsList) </script> <message> '%s %s' % (STAFCmd, STAFCmdParams) </message> <call function="'runCommand'"> { 'location' : location, 'name' : 'Base 64 %s Script' % subcommand, 'command' : STAFCmd, 'arguments' : STAFCmdParams, 'path' : dsPath } </call> <script> CmdRC=RC CmdResult=STAXResult </script> <call function="'checkRC'"> { 'returncode' : CmdRC , 'result' : CmdResult } </call> <return>CmdResult</return> </sequence> </function> </stax> opends/tests/functional-tests/testcases/clu/cluBase64.xml
New file @@ -0,0 +1,206 @@ <?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 ! ! Portions Copyright 2007 Sun Microsystems, Inc. ! --> <stax> <defaultcall function="main_cluBase64"/> <function name="main_cluBase64"> <sequence> <block name="'cluBase64'"> <sequence> <script> if not CurrentTestPath.has_key('group'): CurrentTestPath['group']='clu' CurrentTestPath['suite']=STAXCurrentBlock </script> <call function="'testSuite_Preamble'"/> <!--- Test Suite information #@TestSuiteName Clu: Base64 #@TestSuitePurpose Check the base64 command with common options #@TestSuiteID Clu Base64 Command #@TestSuiteGroup cluBase64 #@TestGroup clu #@TestScript cluBase64.xml #@TestHTMLLink http://opends.dev.java.net/ --> <import machine="STAF_LOCAL_HOSTNAME" file="'%s/testcases/clu/clu_setup.xml' % (TESTS_DIR)"/> <call function="'clu_setup'"> { 'startDS' : False, 'loadBackend' : False } </call> <!--- Test Case information #@TestMarker Clu Base64 Tests #@TestName Clu: Base64: Encode #@TestID Encode #@TestPurpose Verify that raw data can be base64 encoded. #@TestPreamble #@TestSteps #@TestPostamble #@TestResult Success if status returns 0 --> <testcase name="getTestCaseName('Encode')"> <sequence> <call function="'testCase_Preamble'"/> <message> 'Clu: Base64: Encode' </message> <call function="'Base64WithScript'"> { 'subcommand' : 'encode', 'rawData' : 'hello world' } </call> <!-- STAXResult is not always a list--> <script> try: RC,Result=STAXResult[0] except AttributeError,details: Result='AttributeError: can not parse STAXResult %s' % details RC='1' </script> <script> pattern=re.compile('aGVsbG8gd29ybGQ=') </script> <if expr="pattern.match(Result)"> <sequence> <message>'Base64 returns matching encoded data (%s)' % Result</message> <tcstatus result="'pass'"></tcstatus> </sequence> <else> <sequence> <message>'Base64 returns non matching data (%s)' % Result</message> <tcstatus result="'fail'"></tcstatus> </sequence> </else> </if> <call function="'testCase_Postamble'"/> </sequence> </testcase> <!--- Test Case information #@TestMarker Clu Base64 Tests #@TestName Clu: Base64: Decode #@TestID Decode #@TestPurpose Verify that base64 encoded data can be decoded. #@TestPreamble #@TestSteps #@TestPostamble #@TestResult Success if status returns 0 --> <testcase name="getTestCaseName('Decode')"> <sequence> <call function="'testCase_Preamble'"/> <message> 'Clu: Base64: Decode' </message> <call function="'Base64WithScript'"> { 'subcommand' : 'decode', 'encodedData' : 'aGVsbG8gd29ybGQ=' } </call> <!-- STAXResult is not always a list--> <script> try: RC,Result=STAXResult[0] except AttributeError,details: Result='AttributeError: can not parse STAXResult %s' % details RC='1' </script> <script> pattern=re.compile('hello world') </script> <if expr="pattern.match(Result)"> <sequence> <message>'Base64 returns matching decoded data (%s)' % Result</message> <tcstatus result="'pass'"></tcstatus> </sequence> <else> <sequence> <message>'Base64 returns non matching data (%s)' % Result</message> <tcstatus result="'fail'"></tcstatus> </sequence> </else> </if> <call function="'testCase_Postamble'"/> </sequence> </testcase> <import machine="STAF_LOCAL_HOSTNAME" file="'%s/testcases/clu/clu_cleanup.xml' % (TESTS_DIR)"/> <call function="'clu_cleanup'"> { 'stopDS' : False } </call> <call function="'testSuite_Postamble'"/> </sequence> </block> </sequence> </function> </stax> opends/tests/functional-tests/testcases/clu/clu_setup.xml
@@ -30,6 +30,21 @@ <defaultcall function="clu_setup"/> <function name="clu_setup"> <function-description> Setup the command line test suite </function-description> <function-map-args> <function-arg-def name="startDS" type="optional" default="True"> <function-arg-description> Start the Directory Server </function-arg-description> </function-arg-def> <function-arg-def name="loadBackend" type="optional" default="True"> <function-arg-description> Load the backend with user data </function-arg-description> </function-arg-def> </function-map-args> <sequence> @@ -37,8 +52,6 @@ <sequence> <block name="'Block Create DS Topology'"> <!-- Create the topology necessary to the test group/suite --> <sequence> @@ -47,20 +60,17 @@ </message> <call function="'createTopology'"> { 'initialiseInstance' : True } { 'initialiseInstance' : False } </call> <call function="'checkRC'"> { 'returncode' : RC , 'result' : STAXResult } { 'returncode' : RC , 'result' : STAXResult } </call> </sequence> <!--- End Block Create DS Topology --> </block> <if expr="startDS == True"> <block name="'Block DS Process Active'"> <!--- Start DS --> <sequence> @@ -85,11 +95,11 @@ </call> </sequence> <!--- End Block DS Process Active --> </block> </if> <block name="'Block DS Load Data'"> <if expr="loadBackend == True"> <!-- Load the data needed by the test suite --> <sequence> @@ -105,9 +115,7 @@ 'entryToBeAdded' : '%s/clu/data/clu_start.ldif' % logsRemoteDataDir } </call> <message> 'Add entries for cluSearch Tests' </message> <message>'Add entries for cluSearch Tests'</message> <call function="'addEntry'"> { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST , @@ -122,11 +130,9 @@ 'result' : STAXResult } </call> </sequence> <!-- End Block DS Load Data --> </block> </if> </sequence> </block> opends/tests/functional-tests/testcases/clu/commands.xml
@@ -59,6 +59,10 @@ file="'%s/testcases/clu/cluDelete.xml' % (TESTS_DIR)"/> <call function="'main_cluDelete'" /> --> <import machine="STAF_LOCAL_HOSTNAME" file="'%s/testcases/clu/cluBase64.xml' % (TESTS_DIR)"/> <call function="'main_cluBase64'" /> <call function="'testGroup_Postamble'"/> </sequence>