1873N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2887N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
1873N/A<!--
1873N/A ! CDDL HEADER START
1873N/A !
1873N/A ! The contents of this file are subject to the terms of the
1873N/A ! Common Development and Distribution License, Version 1.0 only
1873N/A ! (the "License"). You may not use this file except in compliance
1873N/A ! with the License.
1873N/A !
1873N/A ! You can obtain a copy of the license at
1873N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
1873N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
1873N/A ! See the License for the specific language governing permissions
1873N/A ! and limitations under the License.
1873N/A !
1873N/A ! When distributing Covered Code, include this CDDL HEADER in each
1873N/A ! file and include the License file at
1873N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1873N/A ! add the following below this CDDL HEADER, with the fields enclosed
1873N/A ! by brackets "[]" replaced with your own identifying information:
1873N/A ! Portions Copyright [yyyy] [name of copyright owner]
1873N/A !
1873N/A ! CDDL HEADER END
1873N/A !
3215N/A ! Copyright 2007-2008 Sun Microsystems, Inc.
6184N/A ! Portions Copyright 2013 ForgeRock AS
1873N/A ! -->
1873N/A<stax>
3949N/A <defaultcall function="main_sample" />
3949N/A
3949N/A <function name="main_sample">
3949N/A
3816N/A <function-list-args>
3816N/A <function-required-arg name="STAXParentID"/>
3816N/A </function-list-args>
3949N/A
1873N/A <sequence>
3949N/A
3949N/A <block name="'sample'">
3949N/A
3949N/A <sequence>
3949N/A <!--- Load the job environment for the test group execution -->
3949N/A <import machine="STAF_LOCAL_HOSTNAME"
3949N/A file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR"/>
3949N/A <call function="'loadJobEnvironment'">
3949N/A { 'parent' : STAXParentID }
3949N/A </call>
3816N/A
3949N/A <script>
3949N/A CurrentTestPath['group']= 'sample'
3949N/A envAlreadyLoaded='true'
3949N/A </script>
3949N/A
3949N/A <!---
3949N/A #@TestSuiteName Sample
3949N/A #@TestSuitePurpose Illustrate how to easily contribute functional tests
3949N/A #@TestSuiteGroup Sample
3949N/A #@TestScript aci_add_entry.xml
3949N/A -->
3949N/A
3949N/A <!-- Try/catch/finally structure are a handy way to alter the execution
1873N/A flow of a suite in front of unexpected conditions
3949N/A -->
3949N/A <try>
3949N/A <!-- this is an example of how to loop through a list of functions to
3949N/A run instead of duplicating calls
2055N/A -->
3949N/A <sequence>
3949N/A <iterate in="['testGroup_Preamble','testSuite_Preamble','sample_setup']" var="setupStep">
3949N/A <!-- the sequence tag is superfluous here since there is only a
3949N/A single instruction to execute within the iterate block
3949N/A -->
3949N/A <call function="setupStep" />
3949N/A </iterate>
3949N/A <iterate in="['sample_test','knownIssue_test','passing_test','inconclusive_test','failing_test']" var="testStep">
3949N/A <!-- the sequence tag is superfluous here since there is only a
3949N/A single instruction to execute within the iterate block
3949N/A -->
3949N/A <call function="testStep" />
3949N/A </iterate>
3949N/A </sequence>
3949N/A <catch exception="'STAFException.Topology.CreationException'">
3949N/A <!-- it is a good idea to make sure that the messages getting
3949N/A sent to the gui also make their way in the logs for easier
1873N/A after-the-fact log mining. Use log="1" wherever it makes sense
3949N/A Setting the log level to an appropriate value will also make
1873N/A troubleshooting and debugging easier.
1873N/A Level values can be (among others):
1873N/A . fatal
1873N/A . error
1873N/A . warning
1873N/A . info
1873N/A . trace
1873N/A . debug
3949N/A -->
3949N/A <message log="1" level="'fatal'">'Could not create the topology. Bailing out.'</message>
3949N/A </catch>
3949N/A <catch exception="'STAXException.Topology.StartException'">
3949N/A <message log="1" level="'fatal'">'Could not start at least one server in the topology. Bailing out.'</message>
3949N/A </catch>
3949N/A <finally>
3949N/A <iterate in="['sample_cleanup','testSuite_Postamble','testGroup_Postamble']" var="testStep">
3949N/A <call function="testStep" />
3949N/A </iterate>
3949N/A </finally>
3949N/A </try>
3949N/A
3949N/A </sequence>
3949N/A </block>
1873N/A </sequence>
1873N/A </function>
1873N/A
1873N/A <!-- the test -->
1873N/A <function name="sample_test">
1873N/A <!---
1873N/A Place test-specific test information here.
1873N/A The tag, TestMarker, must be the same as the tag, TestSuiteName.
1873N/A #@TestMarker Sample
1873N/A #@TestName sample_test
1873N/A #@TestIssue xyz
1873N/A #@TestPurpose Illustrate how to issue a query on OpenDS
1873N/A #@TestPreamble none
1873N/A #@TestStep Fetch all the entries in the server
1873N/A #@TestPostamble none
1873N/A #@TestResult Success if OpenDS returns 0
1873N/A -->
2311N/A <block name="STAXCurrentFunction">
2055N/A <sequence>
2055N/A <script>
2055N/A CurrentTestPath['suite']= 'search'
2055N/A </script>
2311N/A <testcase name="getTestCaseName(STAXCurrentFunction)">
2055N/A <sequence>
2055N/A <call function="'testCase_Preamble'" />
2055N/A <call function="'SearchObject'">
2055N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
2055N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
2055N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
2055N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
2055N/A 'dsBaseDN' : DIRECTORY_INSTANCE_SFX ,
2055N/A 'dsFilter' : 'objectclass=*' }
2055N/A </call>
2055N/A <call function="'testCase_Postamble'" />
2055N/A </sequence>
2055N/A </testcase>
2055N/A </sequence>
2055N/A </block>
2055N/A </function>
2278N/A
2278N/A <!-- the test -->
2278N/A <function name="knownIssue_test">
2278N/A <!---
2278N/A Place test-specific test information here.
2278N/A The tag, TestMarker, must be the same as the tag, TestSuiteName.
2278N/A #@TestMarker Sample
2278N/A #@TestName sample_test
2278N/A #@TestIssue xyz
2278N/A #@TestPurpose Illustrate how to issue a query on OpenDS
2278N/A #@TestPreamble none
2278N/A #@TestStep Fetch all the entries in the server
2278N/A #@TestPostamble none
2278N/A #@TestResult Success if OpenDS returns 0
2278N/A -->
2311N/A <block name="STAXCurrentFunction">
2278N/A <sequence>
2278N/A <script>
2278N/A CurrentTestPath['suite']= 'search'
2278N/A </script>
2311N/A <testcase name="getTestCaseName(STAXCurrentFunction)">
2278N/A <sequence>
2278N/A <call function="'testCase_Preamble'" />
2278N/A <!-- search for an entry that does not exist -->
2278N/A <call function="'SearchObject'">
2278N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
2278N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
2278N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
2278N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
2278N/A 'dsBaseDN' : DIRECTORY_INSTANCE_SFX ,
3951N/A 'dsFilter' : 'wrongfilter' ,
6184N/A 'knownIssue' : 'xyz' }
2278N/A </call>
2278N/A <call function="'testCase_Postamble'" />
2278N/A </sequence>
2278N/A </testcase>
2278N/A </sequence>
2278N/A </block>
2278N/A </function>
2055N/A
2055N/A <!-- the dummy failing test -->
2055N/A <function name="failing_test">
2055N/A <!---
2055N/A Place test-specific test information here.
2055N/A The tag, TestMarker, must be the same as the tag, TestSuiteName.
2055N/A #@TestMarker Sample
2055N/A #@TestName failing_test
2055N/A #@TestIssue xyz
2055N/A #@TestPurpose Illustrate how to issue a query on OpenDS
2055N/A #@TestPreamble none
2055N/A #@TestStep Fetch all the entries in the server
2055N/A #@TestPostamble none
2055N/A #@TestResult Success if OpenDS returns 0
2055N/A -->
2311N/A <block name="STAXCurrentFunction">
1873N/A <sequence>
2055N/A <script>
2055N/A CurrentTestPath['suite']= 'dummy'
2055N/A </script>
2311N/A <testcase name="getTestCaseName(STAXCurrentFunction)">
2055N/A <sequence>
2055N/A <call function="'testCase_Preamble'" />
2055N/A <tcstatus result="'fail'" />
2055N/A <call function="'testCase_Postamble'" />
2055N/A </sequence>
2055N/A </testcase>
1873N/A </sequence>
2055N/A </block>
2055N/A </function>
2055N/A
2311N/A <!-- the dummy inconclusive test -->
2311N/A <function name="inconclusive_test">
2311N/A <!---
2311N/A Place test-specific test information here.
2311N/A The tag, TestMarker, must be the same as the tag, TestSuiteName.
2311N/A #@TestMarker Sample
2311N/A #@TestName passing_test
2311N/A #@TestIssue xyz
2311N/A #@TestPurpose Illustrate how to issue a query on OpenDS
2311N/A #@TestPreamble none
2311N/A #@TestStep Fetch all the entries in the server
2311N/A #@TestPostamble none
2311N/A #@TestResult Success if OpenDS returns 0
2311N/A -->
2311N/A <block name="STAXCurrentFunction">
2311N/A <sequence>
2311N/A <script>
2311N/A CurrentTestPath['suite']= 'dummy'
2311N/A </script>
2311N/A <testcase name="getTestCaseName(STAXCurrentFunction)">
2311N/A <sequence>
2311N/A <call function="'testCase_Preamble'" />
2311N/A <call function="'testCase_Postamble'" />
2311N/A </sequence>
2311N/A </testcase>
2311N/A </sequence>
2311N/A </block>
2311N/A </function>
2055N/A <!-- the dummy passing test -->
2055N/A <function name="passing_test">
2055N/A <!---
2055N/A Place test-specific test information here.
2055N/A The tag, TestMarker, must be the same as the tag, TestSuiteName.
2055N/A #@TestMarker Sample
2055N/A #@TestName passing_test
2055N/A #@TestIssue xyz
2055N/A #@TestPurpose Illustrate how to issue a query on OpenDS
2055N/A #@TestPreamble none
2055N/A #@TestStep Fetch all the entries in the server
2055N/A #@TestPostamble none
2055N/A #@TestResult Success if OpenDS returns 0
2055N/A -->
2311N/A <block name="STAXCurrentFunction">
2055N/A <sequence>
2055N/A <script>
2055N/A CurrentTestPath['suite']= 'dummy'
2055N/A </script>
2311N/A <testcase name="getTestCaseName(STAXCurrentFunction)">
2055N/A <sequence>
2055N/A <call function="'testCase_Preamble'" />
2055N/A <tcstatus result="'pass'" />
2055N/A <call function="'testCase_Postamble'" />
2055N/A </sequence>
2055N/A </testcase>
2055N/A </sequence>
2055N/A </block>
1873N/A </function>
1873N/A
1873N/A <!-- Setup the instance for sample test -->
1873N/A <function name="sample_setup">
1873N/A <sequence>
1873N/A <call function="'runFunction'">
1873N/A { 'functionName' : 'createTopology' ,
1873N/A 'functionMessage' : 'Create DS topology as described in config.py',
1873N/A 'functionException' : 'Topology.CreationException' ,
1873N/A 'functionArguments' : { 'initialiseInstance' : True }
1873N/A }
1873N/A </call>
1873N/A <call function="'runFunction'">
1875N/A { 'functionName' : 'StartDsWithScript' ,
1873N/A 'functionMessage' : 'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT) ,
1873N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME }
1873N/A }
1873N/A </call>
1873N/A <call function="'runFunction'">
1873N/A { 'functionName' : 'isAlive' ,
1873N/A 'functionMessage' : 'Checking if the server is available' ,
1873N/A 'functionException' : 'Topology.StartException' ,
4153N/A 'functionArguments' : { 'noOfLoops' : 10 ,
1873N/A 'noOfMilliSeconds' : 2000 }
1873N/A }
1873N/A </call>
1873N/A </sequence>
1873N/A </function>
1873N/A
1873N/A <!-- cleanup after the test -->
1873N/A <function name="sample_cleanup">
1873N/A <sequence>
1873N/A <call function="'runFunction'">
1873N/A { 'functionName' : 'StopDsWithScript' ,
1873N/A 'functionMessage' : 'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT),
3853N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME ,
3853N/A 'dsHost' : DIRECTORY_INSTANCE_HOST ,
3853N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
3853N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN ,
3853N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
1873N/A }
1873N/A </call>
1873N/A <call function="'runFunction'">
1873N/A { 'functionName' : 'removeTopology',
1873N/A 'functionMessage' : 'Remove DS topology created for the Test Suite'
1873N/A }
1873N/A </call>
1873N/A </sequence>
1873N/A </function>
1873N/A
1873N/A</stax>