import-ldif.xml revision 4618
2852N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2887N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
2852N/A<!--
2852N/A ! CDDL HEADER START
2852N/A !
2852N/A ! The contents of this file are subject to the terms of the
2852N/A ! Common Development and Distribution License, Version 1.0 only
2852N/A ! (the "License"). You may not use this file except in compliance
2852N/A ! with the License.
2852N/A !
2852N/A ! You can obtain a copy of the license at
2852N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
2852N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
2852N/A ! See the License for the specific language governing permissions
2852N/A ! and limitations under the License.
2852N/A !
2852N/A ! When distributing Covered Code, include this CDDL HEADER in each
2852N/A ! file and include the License file at
2852N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
2852N/A ! add the following below this CDDL HEADER, with the fields enclosed
2852N/A ! by brackets "[]" replaced with your own identifying information:
2852N/A ! Portions Copyright [yyyy] [name of copyright owner]
2852N/A !
2852N/A ! CDDL HEADER END
2852N/A !
4347N/A ! Copyright 2007-2009 Sun Microsystems, Inc.
2938N/A! -->
2852N/A<stax>
2852N/A <defaultcall function="import-ldif"/>
2852N/A <function name="import-ldif" scope="local">
2852N/A <block name="STAXCurrentFunction">
4618N/A <try>
4618N/A <sequence>
4618N/A <script>
4618N/A CurrentTestPath['suite']=STAXCurrentFunction
4618N/A </script>
4618N/A <call function="'testSuite_Preamble'" />
4618N/A
4618N/A
4618N/A <!--- Test Suite information
4618N/A #@TestSuiteName Import Tasks
4618N/A #@TestSuitePurpose Validate the Import functionality in mode task
4618N/A #@TestSuiteID Import Tests
4618N/A #@TestSuiteGroup Import
4618N/A #@TestGroup tasks
4618N/A #@TestScript import_ldif.xml
4618N/A #@TestHTMLLink http://opends.dev.java.net/
4618N/A -->
3328N/A
4618N/A <call function="'common_setup'">
4618N/A {
4618N/A 'quickStart' : True ,
4618N/A 'startServer' : True ,
4618N/A 'stopServer' : False
2938N/A }
2938N/A </call>
4618N/A
4618N/A <!--- Test Case information
4618N/A #@TestMarker Import Tasks
4618N/A #@TestName Import task in synchronous mode
4618N/A #@TestPurpose Schedule a import in task mode to be executed immedialy in synchronous mode
4618N/A #@TestPreamble
4618N/A #@TestStep Execute a import-ldif in a task
4618N/A #@TestStep Execute manage-tasks output and check the Import task is returned
4618N/A #@TestStep Don't specify the -t option
4618N/A #@TestStep The task is scheduled for immediate execution and the script must wait the end of the import
4618N/A #@TestPostamble
4618N/A #@TestResult
4618N/A -->
4618N/A
4618N/A <testcase name="getTestCaseName('schedule import-ldif task for immediate execution in synchronous mode')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A
4618N/A <call function="'ImportLdifWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'dsLdifFile' : '%s/tasks/import.ldif' % remote.data,
4618N/A 'dsAppend' : ' ',
4618N/A 'dsBackEnd' : DIRECTORY_INSTANCE_BE}
4618N/A </call>
4618N/A
4618N/A <!-- manage-tasks -->
4618N/A <call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'dsQuiet' : ' '
4618N/A }
4618N/A </call>
3175N/A
4618N/A <script>
4618N/A returnString = STAXResult[0][1]
4618N/A </script>
4618N/A
4618N/A <call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Import',
4618N/A 'expectedResult' : '1' }
4618N/A </call>
4618N/A
4618N/A
4618N/A <!-- Check data are imported -->
4618N/A <call function="'checkImport'">
4618N/A { 'expectedEntries' : ['uid=scarter,dc=example,dc=com',
4618N/A 'uid=tmorris, dc=example,dc=com'],
4618N/A 'startDS' : 'False'
4618N/A }
4618N/A </call>
4618N/A
4618N/A <!-- Delete entries -->
4618N/A <call function="'DeleteEntry'">
4618N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
4618N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
4618N/A 'dsBaseDN' : 'uid=scarter,dc=example,dc=com' }
4618N/A </call>
4618N/A <call function="'DeleteEntry'">
4618N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
4618N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
4618N/A 'dsBaseDN' : 'uid=tmorris,dc=example,dc=com' }
4618N/A </call>
4618N/A
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A
4618N/A
4618N/A <!--- Test Case information
4618N/A
4618N/A #@TestMarker Import Tasks
4618N/A #@TestName Import task in asynchronous mode
4618N/A #@TestPurpose Schedule a import in task mode to be executed immedialy in asynchronous mode
4618N/A #@TestPreamble
4618N/A #@TestStep Execute a import-ldif in a task
4618N/A #@TestStep specify the -t option with the value 0
4618N/A #@TestStep The task is scheduled for immediate execution
4618N/A @TestStep The script returns immedialy after scheduling the task
4618N/A #@TestPostamble
4618N/A -->
4618N/A
4618N/A <testcase name="getTestCaseName('schedule import-ldif task for immediate execution in asynchronous mode')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A
4618N/A <call function="'ImportLdifWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'dsLdifFile' : '%s/tasks/import.ldif' % remote.data,
4618N/A 'dsAppend' : ' ',
4618N/A 'startTask' : '0',
4618N/A 'dsBackEnd' : DIRECTORY_INSTANCE_BE}
4618N/A </call>
4618N/A <call function="'Sleep'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME,
4618N/A 'sleepForMilliSeconds' : 40000 }
4618N/A </call>
4618N/A
4618N/A <!-- Check data are imported -->
4618N/A <call function="'checkImport'">
4618N/A { 'expectedEntries' : ['uid=scarter,dc=example,dc=com',
4618N/A 'uid=tmorris, dc=example,dc=com'],
4618N/A 'startDS' : 'False'
4618N/A }
4618N/A </call>
4618N/A
4618N/A <!-- Delete entries -->
4618N/A <call function="'DeleteEntry'">
4618N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
4618N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
4618N/A 'dsBaseDN' : 'uid=scarter,dc=example,dc=com' }
4618N/A </call>
4618N/A <call function="'DeleteEntry'">
4618N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
4618N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
4618N/A 'dsBaseDN' : 'uid=tmorris,dc=example,dc=com' }
4618N/A </call>
4618N/A
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A
4618N/A
4618N/A <!--- Test Case information
4618N/A
4618N/A #@TestMarker Import Tasks
4618N/A #@TestName Schedule a Import task
4618N/A #@TestPurpose Schedule a import in task mode
4618N/A #@TestPreamble
4618N/A #@TestStep Execute a import-ldif in a task
4618N/A @TestStep specify the -t option with the value non null to schedule an execution
4618N/A #@TestPostamble
4618N/A -->
4618N/A
4618N/A
4618N/A <testcase name="getTestCaseName('schedule import-ldif task for scheduled execution in asynchronous mode')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A
4618N/A <call function="'ImportLdifWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'dsLdifFile' : '%s/tasks/import.ldif' % remote.data,
4618N/A 'dsAppend' : ' ',
4618N/A 'startTask' : '20061212000000',
4618N/A 'dsBackEnd' : DIRECTORY_INSTANCE_BE}
4347N/A </call>
4618N/A
4618N/A <script>
4618N/A returnString = STAXResult[0][1]
4618N/A </script>
4618N/A
4618N/A <call function="'searchString'">
4618N/A { 'expectedString' : 'The specified start time \'20061212000000\' has already passed' ,
4618N/A 'returnString' : returnString ,
4618N/A 'knownIssue' : '3909' ,
4618N/A 'expectedRC' : '1' }
4618N/A </call>
4618N/A
4618N/A
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A
4618N/A <!--- Test Case information
4618N/A #@TestMarker Import Tasks
4618N/A #@TestName Schedule a recurring Import task
4618N/A #@TestPurpose Schedule a recurring Import in task mode
4618N/A #@TestPreamble
4618N/A #@TestStep Create a recurring Import in task mode
4618N/A #@TestStep specify the recurringTask option with the value
4618N/A #@TestStep non null to schedule a recurring execution
4618N/A #@TestPostamble
4618N/A #@TestResult
4618N/A -->
4618N/A
4618N/A <testcase name="getTestCaseName('schedule recurring import task')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A
4618N/A <!--- ReStart DS to clear the output of manage-tasks-->
4618N/A <call function="'StopDsWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME,
4618N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
4618N/A </call>
4618N/A
4618N/A <call function="'StartDsWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME }
4618N/A </call>
4618N/A
4618N/A <!--- Check that DS started -->
4618N/A <call function="'isAlive'">
4618N/A { 'noOfLoops' : 10 ,
4618N/A 'noOfMilliSeconds' : 2000
4618N/A }
4618N/A </call>
4618N/A
4618N/A <call function="'ImportLdifWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'dsLdifFile' : '%s/tasks/import.ldif' % remote.data,
4618N/A 'schedulePattern' : '"0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * *"',
4618N/A 'dsBackEnd' : DIRECTORY_INSTANCE_BE}
4618N/A </call>
4618N/A
4618N/A <!-- manage-tasks -->
4618N/A <call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'dsQuiet' : ' '
4618N/A }
4618N/A </call>
4618N/A
4618N/A <script>
4618N/A returnString = STAXResult[0][1]
4618N/A </script>
4618N/A
4618N/A <call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'ImportTask-',
4618N/A 'expectedResult' : '1' }
4618N/A </call>
4618N/A
4618N/A <call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Waiting on start time',
4618N/A 'expectedResult' : '1' }
4618N/A </call>
4618N/A
4618N/A <call function="'Sleep'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME,
4618N/A 'sleepForMilliSeconds' : 120000 }
4618N/A </call>
4618N/A
4618N/A <!-- manage-tasks -->
4618N/A <call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'dsQuiet' : ' '
4618N/A }
4618N/A </call>
4618N/A
4618N/A <script>
4618N/A returnString = STAXResult[0][1]
4618N/A </script>
4618N/A
4618N/A <call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'ImportTask-*',
4618N/A 'expectedResult' : '1' }
4618N/A </call>
4618N/A
4618N/A <call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Completed successfully',
4618N/A 'expectedResult' : '1' }
4618N/A </call>
4618N/A
4618N/A <call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Waiting on start time',
4618N/A 'expectedResult' : '1' }
4618N/A </call>
4618N/A
4618N/A <!-- cancel the recurring task ExportTask-* with manage-tasks -->
4618N/A <call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'dsCancel' : 'ImportTask-*',
4618N/A 'dsQuiet' : ' '
4618N/A }
4618N/A </call>
4618N/A
4618N/A <script>
4618N/A returnString = STAXResult[0][1]
4618N/A </script>
4618N/A
4618N/A <call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Task ImportTask-',
4618N/A 'expectedResult' : '1' }
4618N/A </call>
4618N/A
4618N/A <call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'canceled',
4618N/A 'expectedResult' : '1' }
4618N/A </call>
4618N/A
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A
4618N/A </sequence>
4618N/A <finally>
4161N/A <sequence>
4618N/A <!-- Test Suite Cleanup -->
4618N/A <message>'Finally: Tasks Cleanup.'</message>
4618N/A <try>
4618N/A <call function="'common_cleanup'" />
4618N/A <catch exception="'STAFException'">
4618N/A <sequence>
4618N/A <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
4618N/A </sequence>
4618N/A </catch>
4618N/A <finally>
4618N/A <call function="'testSuite_Postamble'"/>
4618N/A </finally>
4618N/A </try>
4161N/A </sequence>
4618N/A </finally>
4618N/A
4618N/A </try>
2938N/A </block>
2938N/A </function>
2852N/A</stax>