import-ldif.xml revision 4347
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">
2938N/A <sequence>
2938N/A <script>
2938N/A CurrentTestPath['suite']=STAXCurrentFunction
2938N/A </script>
2938N/A <call function="'testSuite_Preamble'" />
2938N/A
2938N/A
2938N/A <!--- Test Suite information
3175N/A #@TestSuiteName Import Tasks
3175N/A #@TestSuitePurpose Validate the Import functionality in mode task
3175N/A #@TestSuiteID Import Tests
3175N/A #@TestSuiteGroup Import
3175N/A #@TestGroup tasks
3175N/A #@TestScript import_ldif.xml
2852N/A #@TestHTMLLink http://opends.dev.java.net/
2852N/A -->
2852N/A
2852N/A
2938N/A <!--- Test Case information
3175N/A #@TestMarker Import Tasks
3175N/A #@TestName Import task in synchronous mode
3175N/A #@TestPurpose Schedule a import in task mode to be executed immedialy in synchronous mode
2852N/A #@TestPreamble
3175N/A #@TestStep Execute a import-ldif in a task
3328N/A #@TestStep Execute manage-tasks output and check the Import task is returned
3175N/A #@TestStep Don't specify the -t option
3175N/A #@TestStep The task is scheduled for immediate execution and the script must wait the end of the import
2852N/A #@TestPostamble
2852N/A #@TestResult
2852N/A -->
2852N/A
2938N/A <testcase name="getTestCaseName('schedule import-ldif task for immediate execution in synchronous mode')">
2938N/A <sequence>
2938N/A <call function="'testCase_Preamble'"/>
2938N/A
2938N/A <call function="'ImportLdifWithScript'">
3853N/A { 'location' : STAF_REMOTE_HOSTNAME ,
3853N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
3853N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
3853N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
3853N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
3853N/A 'dsLdifFile' : '%s/tasks/import.ldif' % remote.data,
3853N/A 'dsAppend' : ' ',
3853N/A 'dsBackEnd' : DIRECTORY_INSTANCE_BE}
2938N/A </call>
3328N/A
3328N/A <!-- manage-tasks -->
3328N/A <call function="'manage-tasks'">
3328N/A { 'location' : STAF_REMOTE_HOSTNAME ,
3328N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
3328N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
3328N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
3328N/A 'dsQuiet' : ' '
3328N/A }
3328N/A </call>
3328N/A
3328N/A <script>
3328N/A returnString = STAXResult[0][1]
3328N/A </script>
3328N/A
3328N/A <call function="'searchStringForSubstring'">
3328N/A { 'returnString' : returnString,
3328N/A 'testString' : 'Import',
3328N/A 'expectedResult' : '1' }
3328N/A </call>
3328N/A
2938N/A
2938N/A <!-- Check data are imported -->
2938N/A <call function="'checkImport'">
2938N/A { 'expectedEntries' : ['uid=scarter,dc=example,dc=com',
2938N/A 'uid=tmorris, dc=example,dc=com'],
2938N/A 'startDS' : 'False'
2938N/A }
2938N/A </call>
2938N/A
2938N/A <!-- Delete entries -->
2938N/A <call function="'DeleteEntry'">
2938N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
3175N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
3175N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
3175N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
3175N/A 'dsBaseDN' : 'uid=scarter,dc=example,dc=com' }
2938N/A </call>
2938N/A <call function="'DeleteEntry'">
3175N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
3175N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
3175N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
3175N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
2938N/A 'dsBaseDN' : 'uid=tmorris,dc=example,dc=com' }
2938N/A </call>
2938N/A
2938N/A <call function="'testCase_Postamble'"/>
2938N/A </sequence>
2938N/A </testcase>
2938N/A
2938N/A
2938N/A <!--- Test Case information
3175N/A
3175N/A #@TestMarker Import Tasks
3175N/A #@TestName Import task in asynchronous mode
3175N/A #@TestPurpose Schedule a import in task mode to be executed immedialy in asynchronous mode
2852N/A #@TestPreamble
3175N/A #@TestStep Execute a import-ldif in a task
3175N/A #@TestStep specify the -t option with the value 0
3175N/A #@TestStep The task is scheduled for immediate execution
3175N/A @TestStep The script returns immedialy after scheduling the task
3175N/A #@TestPostamble
3175N/A -->
2852N/A
2938N/A <testcase name="getTestCaseName('schedule import-ldif task for immediate execution in asynchronous mode')">
2938N/A <sequence>
2938N/A <call function="'testCase_Preamble'"/>
2938N/A
2938N/A <call function="'ImportLdifWithScript'">
3853N/A { 'location' : STAF_REMOTE_HOSTNAME ,
3853N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
3853N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
3853N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
3853N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
3853N/A 'dsLdifFile' : '%s/tasks/import.ldif' % remote.data,
3853N/A 'dsAppend' : ' ',
3853N/A 'startTask' : '0',
3853N/A 'dsBackEnd' : DIRECTORY_INSTANCE_BE}
2938N/A </call>
2938N/A <call function="'Sleep'">
2938N/A { 'location' : STAF_REMOTE_HOSTNAME,
3328N/A 'sleepForMilliSeconds' : 40000 }
2938N/A </call>
2938N/A
2938N/A <!-- Check data are imported -->
2938N/A <call function="'checkImport'">
2938N/A { 'expectedEntries' : ['uid=scarter,dc=example,dc=com',
2938N/A 'uid=tmorris, dc=example,dc=com'],
2938N/A 'startDS' : 'False'
2938N/A }
2938N/A </call>
2938N/A
2938N/A <!-- Delete entries -->
2938N/A <call function="'DeleteEntry'">
3175N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
2938N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
3175N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
2938N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
3175N/A 'dsBaseDN' : 'uid=scarter,dc=example,dc=com' }
2938N/A </call>
2938N/A <call function="'DeleteEntry'">
3175N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
2938N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
3175N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
2938N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
3175N/A 'dsBaseDN' : 'uid=tmorris,dc=example,dc=com' }
2938N/A </call>
2938N/A
2938N/A <call function="'testCase_Postamble'"/>
2938N/A </sequence>
2938N/A </testcase>
2938N/A
2938N/A
3175N/A <!--- Test Case information
3175N/A
3175N/A #@TestMarker Import Tasks
3175N/A #@TestName Schedule a Import task
3175N/A #@TestPurpose Schedule a import in task mode
2937N/A #@TestPreamble
3175N/A #@TestStep Execute a import-ldif in a task
3175N/A @TestStep specify the -t option with the value non null to schedule an execution
3175N/A #@TestPostamble
3175N/A -->
3175N/A
2937N/A
2938N/A <testcase name="getTestCaseName('schedule import-ldif task for scheduled execution in asynchronous mode')">
2938N/A <sequence>
2938N/A <call function="'testCase_Preamble'"/>
2938N/A
2938N/A <call function="'ImportLdifWithScript'">
3853N/A { 'location' : STAF_REMOTE_HOSTNAME ,
3853N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
3853N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
3853N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
3853N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
3853N/A 'dsLdifFile' : '%s/tasks/import.ldif' % remote.data,
3853N/A 'dsAppend' : ' ',
3853N/A 'startTask' : '20061212000000',
3853N/A 'dsBackEnd' : DIRECTORY_INSTANCE_BE}
2938N/A </call>
4347N/A
4347N/A <script>
4347N/A returnString = STAXResult[0][1]
4347N/A </script>
4347N/A
4347N/A <call function="'searchString'">
4347N/A { 'expectedString' : 'The specified start time \'20061212000000\' has already passed' ,
4347N/A 'returnString' : returnString ,
4347N/A 'knownIssue' : '3909' ,
4347N/A 'expectedRC' : '1' }
4347N/A </call>
4347N/A
2938N/A
2938N/A <call function="'testCase_Postamble'"/>
2938N/A </sequence>
4161N/A </testcase>
4161N/A
4161N/A <!--- Test Case information
4161N/A #@TestMarker Import Tasks
4161N/A #@TestName Schedule a recurring Import task
4161N/A #@TestPurpose Schedule a recurring Import in task mode
4161N/A #@TestPreamble
4161N/A #@TestStep Create a recurring Import in task mode
4161N/A #@TestStep specify the recurringTask option with the value
4161N/A #@TestStep non null to schedule a recurring execution
4161N/A #@TestPostamble
4161N/A #@TestResult
4161N/A -->
4161N/A
4161N/A <testcase name="getTestCaseName('schedule recurring import task')">
4161N/A <sequence>
4161N/A <call function="'testCase_Preamble'"/>
4161N/A
4161N/A <!--- ReStart DS to clear the output of manage-tasks-->
4161N/A <call function="'StopDsWithScript'">
4161N/A { 'location' : STAF_REMOTE_HOSTNAME,
4161N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
4161N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4161N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
4161N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
4161N/A </call>
4161N/A
4161N/A <call function="'StartDsWithScript'">
4161N/A { 'location' : STAF_REMOTE_HOSTNAME }
4161N/A </call>
4161N/A
4347N/A <!--- Check that DS started -->
4347N/A <call function="'isAlive'">
4347N/A { 'noOfLoops' : 10 ,
4347N/A 'noOfMilliSeconds' : 2000
4347N/A }
4347N/A </call>
4347N/A
4161N/A <call function="'ImportLdifWithScript'">
4161N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4161N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4161N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4161N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4161N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4161N/A 'dsLdifFile' : '%s/tasks/import.ldif' % remote.data,
4161N/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 * * * *"',
4161N/A 'dsBackEnd' : DIRECTORY_INSTANCE_BE}
4161N/A </call>
4161N/A
4161N/A <!-- manage-tasks -->
4161N/A <call function="'manage-tasks'">
4161N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4161N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4161N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4161N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4161N/A 'dsQuiet' : ' '
4161N/A }
4161N/A </call>
4161N/A
4161N/A <script>
4161N/A returnString = STAXResult[0][1]
4161N/A </script>
4161N/A
4161N/A <call function="'searchStringForSubstring'">
4161N/A { 'returnString' : returnString,
4161N/A 'testString' : 'ImportTask-',
4161N/A 'expectedResult' : '1' }
4161N/A </call>
4161N/A
4161N/A <call function="'searchStringForSubstring'">
4161N/A { 'returnString' : returnString,
4161N/A 'testString' : 'Waiting on start time',
4161N/A 'expectedResult' : '1' }
4161N/A </call>
4161N/A
4161N/A <call function="'Sleep'">
4161N/A { 'location' : STAF_REMOTE_HOSTNAME,
4161N/A 'sleepForMilliSeconds' : 120000 }
4161N/A </call>
4161N/A
4161N/A <!-- manage-tasks -->
4161N/A <call function="'manage-tasks'">
4161N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4161N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4161N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4161N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4161N/A 'dsQuiet' : ' '
4161N/A }
4161N/A </call>
4161N/A
4161N/A <script>
4161N/A returnString = STAXResult[0][1]
4161N/A </script>
4161N/A
4161N/A <call function="'searchStringForSubstring'">
4161N/A { 'returnString' : returnString,
4161N/A 'testString' : 'ImportTask-*',
4161N/A 'expectedResult' : '1' }
4161N/A </call>
4161N/A
4161N/A <call function="'searchStringForSubstring'">
4161N/A { 'returnString' : returnString,
4161N/A 'testString' : 'Completed successfully',
4161N/A 'expectedResult' : '1' }
4161N/A </call>
4161N/A
4161N/A <call function="'searchStringForSubstring'">
4161N/A { 'returnString' : returnString,
4161N/A 'testString' : 'Waiting on start time',
4161N/A 'expectedResult' : '1' }
4161N/A </call>
4161N/A
4161N/A <!-- cancel the recurring task ExportTask-* with manage-tasks -->
4161N/A <call function="'manage-tasks'">
4161N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4161N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4161N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4161N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4161N/A 'dsCancel' : 'ImportTask-*',
4161N/A 'dsQuiet' : ' '
4161N/A }
4161N/A </call>
4161N/A
4161N/A <script>
4161N/A returnString = STAXResult[0][1]
4161N/A </script>
4161N/A
4161N/A <call function="'searchStringForSubstring'">
4161N/A { 'returnString' : returnString,
4161N/A 'testString' : 'Task ImportTask-',
4161N/A 'expectedResult' : '1' }
4161N/A </call>
4161N/A
4161N/A <call function="'searchStringForSubstring'">
4161N/A { 'returnString' : returnString,
4161N/A 'testString' : 'canceled',
4161N/A 'expectedResult' : '1' }
4161N/A </call>
4161N/A
4161N/A <call function="'testCase_Postamble'"/>
4161N/A </sequence>
4161N/A </testcase>
4161N/A
2938N/A
2938N/A <call function="'testSuite_Postamble'" />
2938N/A </sequence>
2938N/A </block>
2938N/A </function>
2852N/A</stax>