clu_base64_checkbehavior.xml revision d81978a0815d5b8a75633c35e3e1f8708d36f017
<?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="clu_base64_checkbehavior"/>
<function name="clu_base64_checkbehavior">
<sequence>
<block name="'clu_base64_checkbehavior'">
<sequence>
<!--- Test Suite information
#@TestSuiteName base64 check behavior tests
#@TestSuitePurpose Test the results of the base64 command.
#@TestSuiteGroup base64 check behavior tests
#@TestScript clu_base64_checkbehavior.xml
-->
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group'] = 'clu'
CurrentTestPath['suite'] = STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<!--- Test Case information
#@TestMarker base64 check behavior tests
#@TestName base64: encode option
#@TestIssue none
#@TestPurpose Test base64 encode option.
#@TestPreamble none
#@TestStep Do an base64 with encode option.
#@TestPostamble none
#@TestResult Success if base64 returns 0.
-->
<testcase name="getTestCaseName('base64: encode option')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'base64: encode option'
</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 log="1">
'SUCCESS: RC=%s, Results %s' % (RC,Result)
</message>
<tcstatus result="'pass'"></tcstatus>
</sequence>
<else>
<sequence>
<message log="1" level="'Error'">
'ERROR : RC=%s, Result=%s' % (RC,Result)
</message>
<tcstatus result="'fail'"></tcstatus>
</sequence>
</else>
</if>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker base64 check behavior tests
#@TestName base64: decode
#@TestIssue none
#@TestPurpose Test base64 decode option.
#@TestPreamble none
#@TestStep Do an base64 with decode option.
#@TestPostamble none
#@TestResult Success if base64 returns 0.
-->
<testcase name="getTestCaseName('base64: decode option')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'base64: decode option'
</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 log="1">
'SUCCESS: RC=%s, Results %s' % (RC,Result)
</message>
<tcstatus result="'pass'"></tcstatus>
</sequence>
<else>
<sequence>
<message log="1" level="'Error'">
'ERROR : RC=%s, Result=%s' % (RC,Result)
</message>
<tcstatus result="'fail'"></tcstatus>
</sequence>
</else>
</if>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
</function>
</stax>