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