<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
! 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
! 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 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="directory_manager"/>
<function name="directory_manager">
<sequence>
<!--- Test Suite information
#@TestSuiteName Setup-Uninstall directory_manager Tests
#@TestSuitePurpose Test the various options regarding the creation
of the directory manager at setup time (DN,
password, ...
#@TestSuiteGroup directory_manager
#@TestSuiteID directory_manager Tests
#@TestGroup Setup-Uninstall
#@TestScript directory_manager.xml
#@TestHTMLLink http://opends.dev.java.net/
-->
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group'] = 'setup'
CurrentTestPath['suite'] = 'directory_manager'
</script>
<call function="'testSuite_Preamble'"/>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 5000,
}
</call>
<script>DM_I1_PORT = STAXResult</script>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 5444,
}
</call>
<script>DM_I1_ADMIN_PORT = STAXResult</script>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 6000,
}
</call>
<script>DM_I2_PORT = STAXResult</script>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 6444,
}
</call>
<script>DM_I2_ADMIN_PORT = STAXResult</script>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 6500,
}
</call>
<script>DM_I3_PORT = STAXResult</script>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 6544,
}
</call>
<script>DM_I3_ADMIN_PORT = STAXResult</script>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 7000,
}
</call>
<script>DM_I1_REPLICATION_PORT = STAXResult</script>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 8000,
}
</call>
<script>DM_I2_REPLICATION_PORT = STAXResult</script>
<message>
'Got these free ports: %s, %s, %s, %s, %s, %s, %s and %s' % \
(DM_I1_PORT, DM_I1_ADMIN_PORT, DM_I2_PORT, DM_I2_ADMIN_PORT, \
DM_I3_PORT, DM_I3_ADMIN_PORT, DM_I1_REPLICATION_PORT, \
DM_I2_REPLICATION_PORT)
</message>
<!--- Test Case information
#@TestMarker Setup-Uninstall Directory Manager options
#@TestName Setup-Uninstall: directory_manager:
setup_uninstall_directory_manager_pwd
#@TestID setup_uninstall_directory_manager_pwd
#@TestPurpose Test "directory manager" related setup options
#@TestPreamble
#@TestStep Setup OpenDS instance 1 using specific DM options
Setup OpenDS instance 2 using specific DM options
Setup replication between 1 and 2 on suffix o=o1
Backup instances 1 and 2
Uninstall instance 1 with specific options
Uninstall instance 2 with specific options
#@TestPostamble
#@TestResult PASS if all steps ran without errors
-->
<testcase name="getTestCaseName('setup_uninstall_directory_manager_pwd')">
<sequence>
<script>
DM_I1_ROOT = '%s/%s' % (DM_I1_BASE, OPENDSNAME)
DM_I2_ROOT = '%s/%s' % (DM_I2_BASE, OPENDSNAME)
</script>
<call function="'testCase_Preamble'"/>
<message>'Setup Uninstall: Directory manager options'</message>
<!-- 1. Setup I1: rootUserPassword "kangourou" -->
<message>'Prepare Open DS ZIP (in %s)' % DM_I1_ROOT</message>
<call function="'runSTAFCommand'">
{ 'name' : 'Create directory to contain I1',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'CREATE',
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % DM_I1_BASE
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to create directory',
}
</call>
<call function="'runSTAFCommand'">
{ 'name' : 'Extract OpenDS ZIP file',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'ZIP',
'request' : 'UNZIP',
'arguments' : 'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
% (DIRECTORY_INSTANCE_DIR, ZIPNAME, DM_I1_BASE)
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to unzip OpenDS ZIP file',
}
</call>
<script>
p = []
p.append('--cli --no-prompt --ldapPort %s' % (DM_I1_PORT))
p.append('--adminConnectorPort %s' % DM_I1_ADMIN_PORT)
p.append('--rootUserPassword "kangourou" %s' % licenseOption)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch setup command for I1',
'command' : c,
'arguments' : p,
'path' : DM_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-setup-i1.txt' % OUT_GROUP,
}
</call>
<!-- 2. Setup I2: rootUserDN "cn=DM" rootUserPassword "kangourou" -->
<message>'Prepare Open DS ZIP (in %s)' % DM_I2_ROOT</message>
<call function="'runSTAFCommand'">
{ 'name' : 'Create directory to contain I2',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'CREATE',
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % DM_I2_BASE
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to create directory',
}
</call>
<call function="'runSTAFCommand'">
{ 'name' : 'Extract OpenDS ZIP file',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'ZIP',
'request' : 'UNZIP',
'arguments' : 'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
% (DIRECTORY_INSTANCE_DIR, ZIPNAME, DM_I2_BASE)
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to unzip OpenDS ZIP file',
}
</call>
<script>
p = []
p.append('--cli --no-prompt --ldapPort %s' % (DM_I2_PORT))
p.append('--adminConnectorPort %s' % DM_I2_ADMIN_PORT)
p.append('--rootUserDN "cn=DM" --rootUserPassword "kangourou" %s' \
% licenseOption)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch setup command for I2',
'command' : c,
'arguments' : p,
'path' : DM_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-setup-i2.txt' % OUT_GROUP,
}
</call>
<!-- 3. Configure replication between I1 and I2 on o=o1. Global Admin
is setup -->
<message>'Configure replication between I1 - I2 on o=o1'</message>
<script>
p = []
p.append('create-backend --bindDN "cn=directory manager"')
p.append('--bindPassword kangourou')
p.append('--trustAll --port %s' % DM_I1_ADMIN_PORT)
p.append('--backend-name o1 --type local-db --no-prompt')
p.append('--set enabled:true --set writability-mode:enabled')
p.append('--set base-dn:"o=o1"')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Create backend on I1',
'command' : c,
'arguments' : p,
'path' : DM_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-create-backend-i1.txt' % OUT_GROUP,
}
</call>
<script>
p = []
p.append('create-backend --bindDN "cn=DM" --bindPassword kangourou')
p.append('--trustAll --port %s' % DM_I2_ADMIN_PORT)
p.append('--backend-name o1')
p.append('--type local-db --no-prompt --set enabled:true')
p.append('--set writability-mode:enabled --set base-dn:"o=o1"')
p.append('')
p.append('')
p.append('')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Create backend on I2',
'command' : c,
'arguments' : p,
'path' : DM_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-create-backend-i2.txt' % OUT_GROUP,
}
</call>
<script>
c = '%s/%s/import-ldif%s' % (DM_I1_ROOT, fileFolder, fileExt)
p = []
p.append('--bindDN "cn=directory manager" --bindPassword kangourou')
p.append('--trustAll --port %s --backendID o1' % DM_I1_ADMIN_PORT)
p.append('--ldifFile %s' % DM_O1_LDIF)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Import data on I1',
'command' : c,
'arguments' : p,
'path' : DM_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-import-ldif-i1.txt' % OUT_GROUP,
}
</call>
<script>
c = '%s/%s/dsreplication%s' % (DM_I1_ROOT, fileFolder, fileExt)
p = []
p.append('enable --trustAll --host1 %s' % STAF_REMOTE_HOSTNAME)
p.append('--bindDN1 "cn=directory manager"')
p.append('--bindPassword1 kangourou')
p.append('--port1 %s' % DM_I1_ADMIN_PORT)
p.append('--replicationPort1 %s' % DM_I1_REPLICATION_PORT)
p.append('--host2 %s --bindDN2 "cn=DM"' % STAF_REMOTE_HOSTNAME)
p.append('--bindPassword2 kangourou')
p.append('--port2 %s' % DM_I2_ADMIN_PORT)
p.append('--replicationPort2 %s' % DM_I2_REPLICATION_PORT)
p.append('-I admin -w secret12')
p.append('--baseDN "o=o1" --no-prompt')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Enable I1 - I2 replication',
'command' : c,
'arguments' : p,
'path' : DM_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-enable-repl.txt' % OUT_GROUP,
}
</call>
<script>
c = '%s/%s/dsreplication%s' % (DM_I1_ROOT, fileFolder, fileExt)
p = []
p.append('initialize -I admin -w secret12 --baseDN "o=o1"')
p.append('--hostSource %s' % STAF_REMOTE_HOSTNAME)
p.append('--portSource %s' % DM_I1_ADMIN_PORT)
p.append('--hostDestination %s' % STAF_REMOTE_HOSTNAME)
p.append('--portDestination %s' % DM_I2_ADMIN_PORT)
p.append('--no-prompt --trustAll')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Initialize I1 - I2 replication',
'command' : c,
'arguments' : p,
'path' : DM_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-initialize-repl.txt' % OUT_GROUP,
}
</call>
<!-- 4. Backup I1 and I2 and copy LDIF files in I1 and I2 -->
<message>'Backup I1 and I2 - copy LDIF files in I1 and I2'</message>
<script>
p = []
p.append('--trustAll --backendID o1 --port %s' % DM_I1_ADMIN_PORT)
p.append('--bindDN "cn=directory manager"')
p.append('--bindPassword "kangourou"')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Backup I1',
'command' : c,
'arguments' : p,
'path' : DM_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-backup-i1.txt' % OUT_GROUP,
}
</call>
<script>
p = []
p.append('--trustAll --backendID o1 --port %s' % DM_I2_ADMIN_PORT)
p.append('--bindDN "cn=DM" --bindPassword "kangourou"')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Backup I2',
'command' : c,
'arguments' : p,
'path' : DM_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-backup-i2.txt' % OUT_GROUP,
}
</call>
<script>
ldifFile = '%s' % DM_O1_LDIF
</script>
<message>'Copy LDIF file in I1'</message>
<call function="'copyFile'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'srcfile' : ldifFile,
'destfile' : ldifNewFile,
'remotehost' : STAF_REMOTE_HOSTNAME
}
</call>
<script>
ldifFile = '%s' % DM_O1_LDIF
</script>
<message>'Copy LDIF file in I2'</message>
<call function="'copyFile'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'srcfile' : ldifFile,
'destfile' : ldifNewFile,
'remotehost' : STAF_REMOTE_HOSTNAME
}
</call>
<!-- 5. Uninstall I1: referencedHostTestcase adminUID bindPassword
configuration-files databases log-files server-libraries -->
<message>'Uninstall I1'</message>
<script>
p = []
p.append('--cli --no-prompt --trustAll')
p.append('--adminUID admin --bindPassword secret12')
p.append('--configuration-files')
p.append('--databases')
p.append('--log-files')
p.append('--server-libraries')
p.append('--referencedHostName %s' % STAF_REMOTE_HOSTNAME)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Uninstall I1',
'command' : c,
'arguments' : p,
'path' : DM_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-uninstall-i1.txt' % OUT_GROUP,
}
</call>
<!-- 6. Uninstall I2: <no credentials given> -->
<message>'Uninstall I2, no credentials given'</message>
<script>
p = []
p.append('--cli --no-prompt --trustAll')
p.append('--remove-all')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Uninstall I2 (should fail)',
'command' : c,
'arguments' : p,
'path' : DM_I2_ROOT,
'expectedRC': 2,
'outputFile': '%s/dm-uninstall-i2-fail.txt' % OUT_GROUP,
}
</call>
<!-- 7. Uninstall I2: referencedHostTestcase adminUID bindPassword
backup-files ldif-files -->
<message>'Uninstall I2'</message>
<script>
p = []
p.append('--cli --no-prompt --trustAll')
p.append('--adminUID admin --bindPassword secret12')
p.append('--backup-files')
p.append('--ldif-files')
p.append('--referencedHostName %s' % STAF_REMOTE_HOSTNAME)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Uninstall I2 (should pass)',
'command' : c,
'arguments' : p,
'path' : DM_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-uninstall-i2-pass.txt' % OUT_GROUP,
}
</call>
<call function="'checkFileExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<call function="'checkFileExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<call function="'checkFileNotExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<call function="'checkFileNotExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<call function="'checkFileNotExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<call function="'checkFileNotExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<call function="'checkFileNotExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<call function="'checkFileNotExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<script>
if is_windows_platform(STAF_REMOTE_HOSTNAME):
subDir='bat'
else:
subDir='bin'
</script>
<call function="'checkFileExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
'file' : '%s/%s' % (DM_I2_ROOT, subDir)
}
</call>
<call function="'checkFileExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<call function="'checkFileExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<call function="'checkFileExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Setup-Uninstall Directory Manager options
#@TestName Setup-Uninstall: directory_manager:
dirmgr_pwd_and_resetup
#@TestID dirmgr_pwd_and_resetup
#@TestPurpose Test "directory manager" related setup options
(error case)
#@TestPreamble
#@TestStep Setup OpenDS instance specifying a wrong
path for password file (lead to error)
Setup OpenDS instance in quiet mode
Uninstall instance
#@TestPostamble
#@TestResult PASS if all steps ran without errors
-->
<testcase name="getTestCaseName('dirmgr_pwd_and_resetup')">
<sequence>
<script>
DM_I3_ROOT = '%s/%s' % (DM_I3_BASE, OPENDSNAME)
</script>
<call function="'testCase_Preamble'"/>
<message>'Setup: Directory manager password error'</message>
<!-- 1. Setup options: rootUserDN "cn=DM" rootUserPasswordFile
<message>'Prepare Open DS ZIP (in %s)' % DM_I1_ROOT</message>
<call function="'runSTAFCommand'">
{ 'name' : 'Create directory to contain I3',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'CREATE',
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % DM_I3_BASE
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to create directory',
}
</call>
<call function="'runSTAFCommand'">
{ 'name' : 'Extract OpenDS ZIP file',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'ZIP',
'request' : 'UNZIP',
'arguments' : 'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
% (DIRECTORY_INSTANCE_DIR, ZIPNAME, DM_I3_BASE)
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to unzip OpenDS ZIP file',
}
</call>
<script>
p = []
p.append('--cli --no-prompt --rootUserDN "cn=DM"')
p.append('--adminConnectorPort %s' % DM_I3_ADMIN_PORT)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch setup command for I3 (should fail)',
'command' : c,
'arguments' : p,
'path' : DM_I3_ROOT,
'expectedRC': 2,
'outputFile': '%s/dm-setup-i3-fail.txt' % OUT_GROUP,
}
</call>
<!-- 2. Setup options: rootUserDN "cn=DM" rootUserPasswordFile
<message>'Setup'</message>
<script>
p = []
p.append('--cli --no-prompt --rootUserDN "cn=DM" --quiet %s' \
% licenseOption)
p.append('--rootUserPasswordFile %s' % DM_PASSWD_FILE)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch setup command for I3',
'command' : c,
'arguments' : p,
'path' : DM_I3_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-setup-i3-pass.txt' % OUT_GROUP,
}
</call>
<!-- 3. Setup options: relaunch setup command -->
<message>'Setup options: relaunch setup command'</message>
<script>
p = []
p.append('--cli --no-prompt --rootUserDN "cn=DM"')
p.append('--rootUserPassword "kangourou"')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Re-launch setup command for I3 (should fail)',
'command' : c,
'arguments' : p,
'path' : DM_I3_ROOT,
'expectedRC': 3,
'outputFile': '%s/dm-re-setup-i3.txt' % OUT_GROUP,
}
</call>
<!-- 4. Uninstall options: -->
<script>
p = []
p.append('--cli --no-prompt --trustAll')
p.append('--remove-all')
p.append('--referencedHostName %s' % STAF_REMOTE_HOSTNAME)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Uninstall I3',
'command' : c,
'arguments' : p,
'path' : DM_I3_ROOT,
'expectedRC': 0,
'outputFile': '%s/dm-uninstall-i3.txt' % OUT_GROUP,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<call function="'testSuite_Postamble'"/>
</sequence>
</function>
</stax>