<?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 legal-notices/CDDLv1_0.txt
! or http://forgerock.org/license/CDDLv1.0.html.
! 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 legal-notices/CDDLv1_0.txt.
! 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-2009 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="clu_base64_checkbehavior"/>
<function name="clu_base64_checkbehavior">
<sequence>
<block name="'clu_base64_checkbehavior'">
<try>
<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'"/>
<call function="'common_setup'">
{
'quickStart' : False ,
'loadData' : True ,
'ldifFile' : '%s/clu/clu_start.ldif' % remote.data ,
'startServer' : True ,
'stopServer' : False ,
'allowPreEncodePassword' : True
}
</call>
<!--- 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>
</sequence>
<finally>
<sequence>
<!-- Test Suite Cleanup -->
<message>'Finally: Global CLU Cleanup.'</message>
<try>
<call function="'common_cleanup'" />
<catch exception="'STAFException'">
<sequence>
<message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
</sequence>
</catch>
<finally>
<call function="'testSuite_Postamble'"/>
</finally>
</try>
</sequence>
</finally>
</try>
</block>
</sequence>
</function>
</stax>