From 683fffb9395a9b43df5935090162c25d17ba4725 Mon Sep 17 00:00:00 2001
From: elocatel <elocatel@localhost>
Date: Fri, 16 May 2008 12:46:55 +0000
Subject: [PATCH] Initial version of the entire setup suite
---
opends/tests/functional-tests/testcases/setup/misc.xml | 206 +++
opends/tests/functional-tests/testcases/setup/ports.xml | 388 +++++++
opends/tests/functional-tests/testcases/setup/directory_manager.xml | 749 ++++++++++++++
opends/tests/functional-tests/testcases/setup/_post.xml | 2
opends/tests/functional-tests/testcases/setup/security.xml | 920 +++++++++++++++++
opends/tests/functional-tests/testcases/setup/incompatible_options.xml | 266 +++++
opends/tests/functional-tests/testcases/setup/general_options.xml | 28
opends/tests/functional-tests/testcases/setup/import.xml | 502 +++++++++
opends/tests/functional-tests/testcases/setup/setup.xml | 14
opends/tests/functional-tests/testcases/setup/_pre.xml | 19
10 files changed, 3,072 insertions(+), 22 deletions(-)
diff --git a/opends/tests/functional-tests/testcases/setup/_post.xml b/opends/tests/functional-tests/testcases/setup/_post.xml
index a52a025..d94c575 100644
--- a/opends/tests/functional-tests/testcases/setup/_post.xml
+++ b/opends/tests/functional-tests/testcases/setup/_post.xml
@@ -71,7 +71,7 @@
<call function="'runSTAFCommand'">
{ 'name' : 'Delete directory containing unzipped OpenDS',
- 'location' : STAXServiceMachine,
+ 'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'DELETE',
'arguments' : 'ENTRY %s RECURSE CONFIRM' % OUT_GROUP
diff --git a/opends/tests/functional-tests/testcases/setup/_pre.xml b/opends/tests/functional-tests/testcases/setup/_pre.xml
index fd81be6..5479eb0 100644
--- a/opends/tests/functional-tests/testcases/setup/_pre.xml
+++ b/opends/tests/functional-tests/testcases/setup/_pre.xml
@@ -70,9 +70,24 @@
<call function="'testCase_Preamble'"/>
<message>'Prepare Open DS ZIP (in %s)' % ODS_UNZIPPED</message>
+ <message>
+ 'setup: create DS topology as described in config.py'
+ </message>
+
+ <call function="'createTopology'">
+ { 'initialiseInstance' : False }
+ </call>
+
+ <call function="'checktestRC'">
+ {
+ 'returncode' : RC ,
+ 'result' : STAXResult
+ }
+ </call>
+
<call function="'runSTAFCommand'">
{ 'name' : 'Create directory to contain unzipped OpenDS',
- 'location' : STAXServiceMachine,
+ 'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'CREATE',
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % ODS_UNZIPPED
@@ -88,7 +103,7 @@
<call function="'runSTAFCommand'">
{ 'name' : 'Extract OpenDS ZIP file',
- 'location' : STAXServiceMachine,
+ 'location' : STAF_REMOTE_HOSTNAME,
'service' : 'ZIP',
'request' : 'UNZIP',
'arguments' : 'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
diff --git a/opends/tests/functional-tests/testcases/setup/directory_manager.xml b/opends/tests/functional-tests/testcases/setup/directory_manager.xml
new file mode 100644
index 0000000..5fd2db5
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/setup/directory_manager.xml
@@ -0,0 +1,749 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
+<!--
+ ! 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
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, exclude this CDDL HEADER in each
+ ! file and exclude the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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' : 6000,
+ }
+ </call>
+ <script>DM_I2_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' : 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 and %s' % \
+ (DM_I1_PORT, DM_I2_PORT, DM_I3_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&2 on suffix o=o1
+ Backup instances 1&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_BASE = '%s/dm_i1' % (OUT_GROUP)
+ DM_I1_ROOT = '%s/%s' % (DM_I1_BASE, OPENDSNAME)
+ DM_I2_BASE = '%s/dm_i2' % (OUT_GROUP)
+ DM_I2_ROOT = '%s/%s' % (DM_I2_BASE, OPENDSNAME)
+ DM_O1_LDIF = '%s/setup/dm-o1.ldif' % logsRemoteDataDir
+ </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' \
+ % (ZIPPATH, ZIPNAME, DM_I1_BASE)
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to unzip OpenDS ZIP file',
+ }
+ </call>
+
+ <script>
+ c = '%s/setup%s' % (DM_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt --ldapPort %s' % (DM_I1_PORT))
+ p.append('--rootUserPassword "kangourou"')
+ 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' \
+ % (ZIPPATH, ZIPNAME, DM_I2_BASE)
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to unzip OpenDS ZIP file',
+ }
+ </call>
+
+ <script>
+ c = '%s/setup%s' % (DM_I2_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt --ldapPort %s' % (DM_I2_PORT))
+ p.append('--rootUserDN "cn=DM" --rootUserPassword "kangourou"')
+ 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 & I2 on o=o1. Global Admin
+ is setup -->
+ <message>'Configure replication between I1 - I2 on o=o1'</message>
+ <script>
+ c = '%s/bin/dsconfig%s' % (DM_I1_ROOT, fileExt)
+ p = []
+ p.append('create-backend --bindDN "cn=directory manager"')
+ p.append('--bindPassword kangourou --port %s' % (DM_I1_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>
+ c = '%s/bin/dsconfig%s' % (DM_I2_ROOT, fileExt)
+ p = []
+ p.append('create-backend --bindDN "cn=DM" --bindPassword kangourou')
+ p.append('--port %s --backend-name o1' % DM_I2_PORT)
+ 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/bin/import-ldif%s' % (DM_I1_ROOT, fileExt)
+ p = []
+ p.append('--bindDN "cn=directory manager" --bindPassword kangourou')
+ p.append('--port %s --backendID o1' % DM_I1_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/bin/dsreplication%s' % (DM_I1_ROOT, fileExt)
+ p = []
+ p.append('enable --host1 %s' % STAF_REMOTE_HOSTNAME)
+ p.append('--bindDN1 "cn=directory manager"')
+ p.append('--bindPassword1 kangourou')
+ p.append('--port1 %s' % DM_I1_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_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/bin/dsreplication%s' % (DM_I1_ROOT, 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_PORT)
+ p.append('--hostDestination %s' % STAF_REMOTE_HOSTNAME)
+ p.append('--portDestination %s' % DM_I2_PORT)
+ p.append('--no-prompt')
+ 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 & I2 and copy LDIF files in I1 & I2 -->
+ <message>'Backup I1 and I2 - copy LDIF files in I1 and I2'</message>
+ <script>
+ c = '%s/bin/backup%s' % (DM_I1_ROOT, fileExt)
+ p = []
+ p.append('--backendID o1 --port %s' % DM_I1_PORT)
+ p.append('--bindDN "cn=directory manager"')
+ p.append('--bindPassword "kangourou"')
+ p.append('--backupDirectory %s/bak' % DM_I1_ROOT)
+ 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>
+ c = '%s/bin/backup%s' % (DM_I2_ROOT, fileExt)
+ p = []
+ p.append('--backendID o1 --port %s' % DM_I2_PORT)
+ p.append('--bindDN "cn=DM" --bindPassword "kangourou"')
+ p.append('--backupDirectory %s/bak' % DM_I2_ROOT)
+ 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>
+ ldifDir = '%s/ldif' % (DM_I1_ROOT)
+ ldifFile = '%s' % DM_O1_LDIF
+ </script>
+
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Copy LDIF file in I1',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'COPY',
+ 'arguments' : 'FILE %s TODIRECTORY %s' % (ldifFile, ldifDir)
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to copy LDIF file for I1',
+ }
+ </call>
+
+ <script>
+ ldifDir = '%s/ldif' % (DM_I2_ROOT)
+ ldifFile = '%s' % DM_O1_LDIF
+ </script>
+
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Copy LDIF file in I2',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'COPY',
+ 'arguments' : 'FILE %s TODIRECTORY %s' % (ldifFile, ldifDir)
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to copy LDIF file for I2',
+ }
+ </call>
+
+ <!-- 5. Uninstall I1: referencedHostTestcase adminUID bindPassword
+ configuration-files databases log-files server-libraries -->
+ <message>'Uninstall I1'</message>
+ <script>
+ c = '%s/uninstall%s' % (DM_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ 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>
+ c = '%s/uninstall%s' % (DM_I2_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ 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>
+ c = '%s/uninstall%s' % (DM_I2_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ 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'">
+ { 'file' : '%s/bak' % DM_I1_ROOT }
+ </call>
+ <call function="'checkFileExists'">
+ { 'file' : '%s/ldif' % DM_I1_ROOT }
+ </call>
+ <call function="'checkFileNotExists'">
+ { 'file' : '%s/bin' % DM_I1_ROOT }
+ </call>
+ <call function="'checkFileNotExists'">
+ { 'file' : '%s/config' % DM_I1_ROOT }
+ </call>
+ <call function="'checkFileNotExists'">
+ { 'file' : '%s/db' % DM_I1_ROOT }
+ </call>
+ <call function="'checkFileNotExists'">
+ { 'file' : '%s/logs' % DM_I1_ROOT }
+ </call>
+
+ <call function="'checkFileNotExists'">
+ { 'file' : '%s/bak' % DM_I2_ROOT }
+ </call>
+ <call function="'checkFileNotExists'">
+ { 'file' : '%s/ldif' % DM_I2_ROOT }
+ </call>
+ <call function="'checkFileExists'">
+ { 'file' : '%s/bin' % DM_I2_ROOT }
+ </call>
+ <call function="'checkFileExists'">
+ { 'file' : '%s/config' % DM_I2_ROOT }
+ </call>
+ <call function="'checkFileExists'">
+ { 'file' : '%s/db' % DM_I2_ROOT }
+ </call>
+ <call function="'checkFileExists'">
+ { 'file' : '%s/logs' % DM_I2_ROOT }
+ </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_BASE = '%s/dm_i3' % (OUT_GROUP)
+ DM_I3_ROOT = '%s/%s' % (DM_I3_BASE, OPENDSNAME)
+ DM_PASSWD_FILE = '%s/setup/pwd.ldif' % logsRemoteDataDir
+ </script>
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Setup: Directory manager password error'</message>
+
+
+ <!-- 1. Setup options: rootUserDN "cn=DM" rootUserPasswordFile
+ "/does/not/exist" -->
+ <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' \
+ % (ZIPPATH, ZIPNAME, DM_I3_BASE)
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to unzip OpenDS ZIP file',
+ }
+ </call>
+
+ <script>
+ c = '%s/setup%s' % (DM_I3_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt --rootUserDN "cn=DM"')
+ p.append('--rootUserPasswordFile %s/does-not-exist.txt' % OUT_GROUP)
+ 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
+ "/does/exist" quiet -->
+ <message>'Setup'</message>
+ <script>
+ c = '%s/setup%s' % (DM_I3_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt --rootUserDN "cn=DM" --quiet')
+ 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>
+ c = '%s/setup%s' % (DM_I3_ROOT, fileExt)
+ 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>
+ c = '%s/uninstall%s' % (DM_I3_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ 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>
diff --git a/opends/tests/functional-tests/testcases/setup/general_options.xml b/opends/tests/functional-tests/testcases/setup/general_options.xml
index 6fbe5d5..e30027b 100644
--- a/opends/tests/functional-tests/testcases/setup/general_options.xml
+++ b/opends/tests/functional-tests/testcases/setup/general_options.xml
@@ -79,12 +79,13 @@
<message>'%s %s' % (setupCmd, setupParams)</message>
<call function="'runCommand'">
- { 'location' : STAXServiceMachine,
+ { 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch setup command to get DS version',
'command' : setupCmd,
'arguments' : setupParams,
'path' : ODS_UNZIPPED,
- 'outputFile': '%s/go-setup-version.txt' % OUT_GROUP
+ 'expectedRC': 0,
+ 'outputFile': '%s/go-setup-version.txt' % OUT_GROUP,
}
</call>
@@ -93,7 +94,7 @@
</script>
<call function="'grep'">
- { 'location' : STAXServiceMachine,
+ { 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'OpenDS Directory Server'
}
@@ -107,12 +108,13 @@
<message>'%s %s' % (uninstallCmd, uninstallParams)</message>
<call function="'runCommand'">
- { 'location' : STAXServiceMachine,
+ { 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch uninstall command to get DS version',
'command' : uninstallCmd,
'arguments' : uninstallParams,
'path' : ODS_UNZIPPED,
- 'outputFile': '%s/go-uninstall-version.txt' % OUT_GROUP
+ 'expectedRC': 0,
+ 'outputFile': '%s/go-uninstall-version.txt' % OUT_GROUP,
}
</call>
@@ -121,7 +123,7 @@
</script>
<call function="'grep'">
- { 'location' : STAXServiceMachine,
+ { 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'OpenDS Directory Server'
}
@@ -158,12 +160,13 @@
<message>'%s %s' % (setupCmd, setupParams)</message>
<call function="'runCommand'">
- { 'location' : STAXServiceMachine,
+ { 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch setup command to get its help',
'command' : setupCmd,
'arguments' : setupParams,
'path' : ODS_UNZIPPED,
- 'outputFile': '%s/go-setup-help.txt' % OUT_GROUP
+ 'expectedRC': 0,
+ 'outputFile': '%s/go-setup-help.txt' % OUT_GROUP,
}
</call>
@@ -172,7 +175,7 @@
</script>
<call function="'grep'">
- { 'location' : STAXServiceMachine,
+ { 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'Usage'
}
@@ -186,12 +189,13 @@
<message>'%s %s' % (uninstallCmd, uninstallParams)</message>
<call function="'runCommand'">
- { 'location' : STAXServiceMachine,
+ { 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch uninstall command to get its help',
'command' : uninstallCmd,
'arguments' : uninstallParams,
'path' : ODS_UNZIPPED,
- 'outputFile': '%s/go-uninstall-help.txt' % OUT_GROUP
+ 'expectedRC': 0,
+ 'outputFile': '%s/go-uninstall-help.txt' % OUT_GROUP,
}
</call>
@@ -200,7 +204,7 @@
</script>
<call function="'grep'">
- { 'location' : STAXServiceMachine,
+ { 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'Usage'
}
diff --git a/opends/tests/functional-tests/testcases/setup/import.xml b/opends/tests/functional-tests/testcases/setup/import.xml
new file mode 100644
index 0000000..21a8e5e
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/setup/import.xml
@@ -0,0 +1,502 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
+<!--
+ ! 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
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, exclude this CDDL HEADER in each
+ ! file and exclude the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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="import"/>
+
+ <function name="import">
+
+ <sequence>
+
+ <!--- Test Suite information
+ #@TestSuiteName Setup-Uninstall import Tests
+ #@TestSuitePurpose Test all options of the setup command relative
+ to initial data generation and data import
+ (ie: all options that feed DS with data at setup
+ time)
+ #@TestSuiteGroup import
+ #@TestSuiteID import Tests
+ #@TestGroup Setup-Uninstall
+ #@TestScript import.xml
+ #@TestHTMLLink http://opends.dev.java.net/
+ -->
+
+ <script>
+ if not CurrentTestPath.has_key('group'):
+ CurrentTestPath['group'] = 'setup'
+ CurrentTestPath['suite'] = 'import'
+ </script>
+
+ <call function="'testSuite_Preamble'"/>
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 5500,
+ }
+ </call>
+ <script>IMP_I1_PORT = STAXResult</script>
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 5600,
+ }
+ </call>
+ <script>IMP_I2_PORT = STAXResult</script>
+
+ <message>
+ 'Got these free ports: %s, %s' % (IMP_I1_PORT, IMP_I2_PORT)
+ </message>
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall Import options
+ #@TestName Setup-Uninstall: import:
+ setup_uninstall_import_sample
+ #@TestID setup_uninstall_import_sample
+ #@TestPurpose Test the ability of the setup command to
+ generate and import LDAP entries
+ #@TestPreamble
+ #@TestStep Unzip OpenDS distribution
+ Setup OpenDS with 2 suffixes and generate 5
+ entries per suffix
+ Check entries are here
+ Uninstall OpenDS
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('setup_uninstall_import_sample')">
+ <sequence>
+
+ <script>
+ IMP_I1_BASE = '%s/imp_i1' % (OUT_GROUP)
+ IMP_I1_ROOT = '%s/%s' % (IMP_I1_BASE, OPENDSNAME)
+ </script>
+
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Setup Uninstall: Sample data options'</message>
+
+ <!-- 1. Setup options: baseDN baseDN sampleData -->
+ <message>'Prepare Open DS ZIP (in %s)' % IMP_I1_ROOT</message>
+
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Create directory to contain I1',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'CREATE',
+ 'arguments' : 'DIRECTORY %s FAILIFEXISTS' % IMP_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' \
+ % (ZIPPATH, ZIPNAME, IMP_I1_BASE)
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to unzip OpenDS ZIP file',
+ }
+ </call>
+
+ <script>
+ c = '%s/setup%s' % (IMP_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt --ldapPort %s' % (IMP_I1_PORT))
+ p.append('--rootUserPassword "kangourou"')
+ p.append('--baseDN "o=o1"')
+ p.append('--baseDN "o=o2"')
+ p.append('--sampleData 5')
+ 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' : IMP_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/imp-setup-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- Check StartTLS is refused -->
+ <call function="'ldapSearchWithScript'">
+ { 'dsInstancePort' : IMP_I1_PORT,
+ 'dsInstanceDn' : "cn=Directory Manager",
+ 'dsInstancePswd' : "kangourou",
+ 'dsBaseDN' : "o=o2",
+ 'dsFilter' : 'dn=*',
+ 'expectedRC' : 52,
+ 'dsUseStartTLS' : 'True',
+ }
+ </call>
+
+ <!-- Check Data have been generated under o=o1 -->
+ <message>'Check Data have been generated under o=o1'</message>
+ <call function="'ldapSearchWithScript'">
+ { 'dsInstancePort' : IMP_I1_PORT,
+ 'dsInstanceDn' : "cn=Directory Manager",
+ 'dsInstancePswd' : "kangourou",
+ 'dsBaseDN' : "o=o1",
+ 'dsFilter' : 'objectclass=*',
+ 'dsAttributes' : 'dn',
+ 'expectedRC' : 0,
+ }
+ </call>
+
+ <call function="'CheckMatches'">
+ {
+ 'string2find' : 'dn',
+ 'mainString' : STAXResult[0][1],
+ 'nbExpected' : 7,
+ 'caseSensitive' : 'True'
+ }
+ </call>
+
+ <!-- Check Data have been generated under o=o2 -->
+ <message>'Check Data have been generated under o=o2'</message>
+ <call function="'ldapSearchWithScript'">
+ { 'dsInstancePort' : IMP_I1_PORT,
+ 'dsInstanceDn' : "cn=Directory Manager",
+ 'dsInstancePswd' : "kangourou",
+ 'dsBaseDN' : "o=o2",
+ 'dsFilter' : 'objectclass=*',
+ 'dsAttributes' : 'dn',
+ 'expectedRC' : 0,
+ }
+ </call>
+
+ <call function="'CheckMatches'">
+ {
+ 'string2find' : 'dn',
+ 'mainString' : STAXResult[0][1],
+ 'nbExpected' : 7,
+ 'caseSensitive' : 'True'
+ }
+ </call>
+
+ <!-- 2. Uninstall options: quiet forceOnError remove-all-->
+ <message>'Uninstall options: quiet forceOnError remove-all'</message>
+ <script>
+ c = '%s/uninstall%s' % (IMP_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ p.append('--quiet --forceOnError --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 I1',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : IMP_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/imp-uninstall-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+
+ </sequence>
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall Import options
+ #@TestName Setup-Uninstall: import:
+ import_reject_skip
+ #@TestID import_reject_skip
+ #@TestPurpose Test the ability of the setup command to
+ import LDAP entries and manage rejected and
+ skipped entries
+ #@TestPreamble
+ #@TestStep Unzip OpenDS distribution
+ Setup OpenDS with a LDIF file to import, and
+ files for rejected and skipped entries
+ Check skipped & rejected entries
+ Stop OpenDS
+ Uninstall OpenDS
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('import_reject_skip')">
+ <sequence>
+
+ <script>
+ IMP_I2_BASE = '%s/imp_i2' % (OUT_GROUP)
+ IMP_I2_ROOT = '%s/%s' % (IMP_I2_BASE, OPENDSNAME)
+
+ IMP_LDIF_FILE = '%s/setup/imp-o1.ldif' % logsRemoteDataDir
+ IMP_SKIP_FILE = '%s/imp-skip.ldif' % (OUT_GROUP)
+ IMP_REJECT_FILE = '%s/imp-reject.ldif' % (OUT_GROUP)
+ </script>
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Setup and Import: Reject / Skip entries'</message>
+
+
+ <!-- 1. Setup options: baseDN "o=o1" ldifFile rejectFile
+ skipFile verbose -->
+ <message>'Prepare Open DS ZIP (in %s)' % IMP_I2_ROOT</message>
+
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Create directory to contain I2',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'CREATE',
+ 'arguments' : 'DIRECTORY %s FAILIFEXISTS' % IMP_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' \
+ % (ZIPPATH, ZIPNAME, IMP_I2_BASE)
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to unzip OpenDS ZIP file',
+ }
+ </call>
+
+ <script>
+ c = '%s/setup%s' % (IMP_I2_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt --rootUserDN "cn=DM"')
+ p.append('--rootUserPassword "kangourou"')
+ p.append('--ldapPort %s' % IMP_I2_PORT)
+ p.append('--baseDN "o=o1"')
+ p.append('--ldifFile %s' % IMP_LDIF_FILE)
+ p.append('--rejectFile %s' % IMP_REJECT_FILE)
+ p.append('--skipFile %s' % IMP_SKIP_FILE)
+ p.append('--verbose')
+ 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' : IMP_I2_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/imp-setup-i2.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Get content of reject file',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'GET',
+ 'arguments' : 'FILE %s TEXT' % IMP_REJECT_FILE
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to get content of reject file ',
+ }
+ </call>
+
+ <call function="'CheckMatches'">
+ {
+ 'string2find' : 'violates',
+ 'mainString' : STAFResult,
+ 'nbExpected' : 4,
+ 'caseSensitive' : 'True'
+ }
+ </call>
+
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Get content of skip file',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'GET',
+ 'arguments' : 'FILE %s TEXT' % IMP_SKIP_FILE
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to get content of skip file ',
+ }
+ </call>
+
+ <call function="'CheckMatches'">
+ {
+ 'string2find' : 'Skipping',
+ 'mainString' : STAFResult,
+ 'nbExpected' : 1,
+ 'caseSensitive' : 'True'
+ }
+ </call>
+
+ <call function="'ldapSearchWithScript'">
+ { 'dsInstancePort' : IMP_I2_PORT,
+ 'dsInstanceDn' : "cn=DM",
+ 'dsInstancePswd' : "kangourou",
+ 'dsBaseDN' : "o=o1",
+ 'dsFilter' : 'objectclass=*',
+ 'dsAttributes' : 'dn',
+ 'expectedRC' : 0,
+ }
+ </call>
+
+ <call function="'CheckMatches'">
+ {
+ 'string2find' : 'dn',
+ 'mainString' : STAXResult[0][1],
+ 'nbExpected' : 2,
+ 'caseSensitive' : 'True'
+ }
+ </call>
+
+ <!-- 2. Stop DS -->
+ <message>'Stop DS'</message>
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'dsPath' : '%s' % IMP_I2_ROOT,
+ 'dsPort' : IMP_I2_PORT,
+ 'dsBindDN' : 'cn=DM',
+ 'dsBindPwd' : 'kangourou',
+ }
+ </call>
+
+ <!-- 3. Uninstall options: verbose forceOnError remove-all
+ noPropertiesFile -->
+ <message>
+ 'Uninstall opts: verbose forceOnError remove-all noPropertiesFile'
+ </message>
+ <script>
+ c = '%s/uninstall%s' % (IMP_I2_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt --noPropertiesFile')
+ p.append('--verbose --forceOnError --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 I2',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : IMP_I2_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/imp-uninstall-i2.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- Do some post-uninstall checks -->
+ <message>'Do some post-uninstall checks'</message>
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Get content of skip file',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'LIST',
+ 'arguments' : 'DIRECTORY %s' % IMP_I2_ROOT
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to get content of install directory',
+ }
+ </call>
+
+ <script>
+ nb = len(STAFResult)
+ ct = (STAFResult[0] == 'lib')
+ a = ' '
+ </script>
+
+ <call function="'checktestRC'">
+ { 'returncode' : nb,
+ 'result' : a,
+ 'expected' : 1
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : ct,
+ 'result' : a,
+ 'expected' : 1
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+ </testcase>
+
+ <call function="'testSuite_Postamble'"/>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/setup/incompatible_options.xml b/opends/tests/functional-tests/testcases/setup/incompatible_options.xml
new file mode 100644
index 0000000..51688b8
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/setup/incompatible_options.xml
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
+<!--
+ ! 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
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, exclude this CDDL HEADER in each
+ ! file and exclude the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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="incompatible_options"/>
+
+ <function name="incompatible_options">
+
+ <sequence>
+
+ <!--- Test Suite information
+ #@TestSuiteName Setup-Uninstall incompatible_options Tests
+ #@TestSuitePurpose Test incompatibilities between options of
+ both setup and uninstall commands. In other words,
+ if 2 incompatible options are specified on the
+ same command line, the command should fail
+ #@TestSuiteGroup incompatible_options
+ #@TestSuiteID incompatible_options Tests
+ #@TestGroup Setup-Uninstall
+ #@TestScript incompatible_options.xml
+ #@TestHTMLLink http://opends.dev.java.net/
+ -->
+
+ <script>
+ if not CurrentTestPath.has_key('group'):
+ CurrentTestPath['group'] = 'setup'
+ CurrentTestPath['suite'] = 'incompatible_options'
+ </script>
+
+ <call function="'testSuite_Preamble'"/>
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall incompatible_options Tests
+ #@TestName Setup-Uninstall: incompatible_options:
+ inc_base_ldif
+ #@TestID inc_base_ldif
+ #@TestPurpose Check that 'addBaseEntry' and 'ldifFile' setup
+ options cannot be specified together
+ #@TestPreamble
+ #@TestStep Setup OpenDS with 'addBaseEntry' and 'ldifFile'
+ options, and check for error
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('inc_base_ldif')">
+ <sequence>
+
+ <script>
+ INC_LDIF_FILE = '%s/setup/inc-options.ldif' % logsRemoteDataDir
+ </script>
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Incompatible Options: addBaseEntry ldifFile'</message>
+
+ <script>
+ c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
+ p = []
+ p.append('--cli --no-prompt --ldapPort 10000')
+ p.append('--rootUserPassword "kangourou"')
+ p.append('--baseDN "o=o1"')
+ p.append('--addBaseEntry')
+ p.append('--ldifFile %s' % INC_LDIF_FILE)
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch setup command',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : ODS_UNZIPPED,
+ 'expectedRC': 2,
+ 'outputFile': '%s/inc-base-ldif-setup.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall incompatible_options Tests
+ #@TestName Setup-Uninstall: incompatible_options:
+ inc_base_data
+ #@TestID inc_base_data
+ #@TestPurpose Check that 'addBaseEntry' and 'sampleData' setup
+ options cannot be specified together
+ #@TestPreamble
+ #@TestStep Setup OpenDS with 'addBaseEntry' and 'sampleData'
+ options, and check for error
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('inc_base_data')">
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Incompatible Options: addBaseEntry sampleData'</message>
+
+ <script>
+ c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
+ p = []
+ p.append('--cli --no-prompt --ldapPort 10000')
+ p.append('--rootUserPassword "kangourou"')
+ p.append('--baseDN "o=o1"')
+ p.append('--addBaseEntry')
+ p.append('--sampleData 10')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch setup command',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : ODS_UNZIPPED,
+ 'expectedRC': 2,
+ 'outputFile': '%s/inc-base-data-setup.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall Incompatible options
+ #@TestName Setup-Uninstall: incompatible_options:
+ inc_ldif_data
+ #@TestID inc_ldif_data
+ #@TestPurpose Check that 'ldifFile' and 'sampleData' setup
+ options cannot be specified together
+ #@TestPreamble
+ #@TestStep Setup OpenDS with 'ldifFile' and
+ 'sampleData' options, and check for error
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('inc_ldif_data')">
+ <sequence>
+
+ <script>
+ INC_LDIF_FILE = '%s/setup/inc-options.ldif' % logsRemoteDataDir
+ </script>
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Incompatible Options: ldifFile sampleData'</message>
+
+ <script>
+ c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
+ p = []
+ p.append('--cli --no-prompt --ldapPort 10000')
+ p.append('--rootUserPassword "kangourou"')
+ p.append('--baseDN "o=o1"')
+ p.append('--ldifFile %s' % INC_LDIF_FILE)
+ p.append('--sampleData 10')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch setup command',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : ODS_UNZIPPED,
+ 'expectedRC': 2,
+ 'outputFile': '%s/inc-ldif-data-setup.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall Incompatible options
+ #@TestName Setup-Uninstall: incompatible_options:
+ inc_userpwd_userpwdfile
+ #@TestID inc_userpwd_userpwdfile
+ #@TestPurpose Check that 'rootUserPassword' and
+ 'rootUserPasswordFile' setup options cannot
+ be specified together
+ #@TestPreamble
+ #@TestStep Setup OpenDS with 'rootUserPassword' and
+ 'rootUserPasswordFile' options, and check
+ for error
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('inc_userpwd_userpwdfile')">
+ <sequence>
+
+ <script>
+ INC_USER_PWD_FILE = '%s/setup/pwd.ldif' % logsRemoteDataDir
+ </script>
+
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Incompatible Options: rootUserPasswordFile rootUserPassword'
+ </message>
+
+ <script>
+ c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
+ p = []
+ p.append('--cli --no-prompt --ldapPort 10000')
+ p.append('--rootUserPassword "kangourou"')
+ p.append('--rootUserPasswordFile %s' % INC_USER_PWD_FILE)
+ p.append('--baseDN "o=o1"')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch setup command',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : ODS_UNZIPPED,
+ 'expectedRC': 2,
+ 'outputFile': '%s/inc-userpwd-userpwdfile.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+ </testcase>
+
+ <call function="'testSuite_Postamble'"/>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/setup/misc.xml b/opends/tests/functional-tests/testcases/setup/misc.xml
new file mode 100644
index 0000000..9359dac
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/setup/misc.xml
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
+<!--
+ ! 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
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, exclude this CDDL HEADER in each
+ ! file and exclude the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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="misc"/>
+
+ <function name="misc">
+
+ <sequence>
+
+ <!--- Test Suite information
+ #@TestSuiteName Setup-Uninstall misc Tests
+ #@TestSuitePurpose Test miscelaneous setup/uninstall commands
+ that do not fit into any other test suite
+ #@TestSuiteGroup misc
+ #@TestSuiteID misc Tests
+ #@TestGroup Setup-Uninstall
+ #@TestScript misc.xml
+ #@TestHTMLLink http://opends.dev.java.net/
+ -->
+
+ <script>
+ if not CurrentTestPath.has_key('group'):
+ CurrentTestPath['group'] = 'setup'
+ CurrentTestPath['suite'] = 'misc'
+ </script>
+
+ <call function="'testSuite_Preamble'"/>
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 7500,
+ }
+ </call>
+ <script>MISC_I1_PORT = STAXResult</script>
+
+ <message>
+ 'Got this free port: %s' % MISC_I1_PORT
+ </message>
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall Misc tests
+ #@TestName Setup-Uninstall: Misc:
+ misc
+ #@TestID misc
+ #@TestPurpose Launch buggy setup & uninstall commands and check
+ that they are rejected
+ #@TestPreamble
+ #@TestStep Unzip OpenDS ZIP delivery
+ Setup OpenDS with unexisting option
+ Check for error
+ Setup OpenDS with no options
+ Check for error
+ Uninstall an uninstalled OpenDS
+ Check for error
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('misc')">
+ <sequence>
+
+ <script>
+ MISC_I1_BASE = '%s/misc_i1' % (OUT_GROUP)
+ MISC_I1_ROOT = '%s/%s' % (MISC_I1_BASE, OPENDSNAME)
+ </script>
+
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Setup Uninstall: Command errors'</message>
+
+ <!-- 1. Setup options: baseDN baseDN sampleData -->
+ <message>'++ Setup options: baseDN baseDN sampleData'</message>
+ <message>'Prepare Open DS ZIP (in %s)' % MISC_I1_ROOT</message>
+
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Create directory to contain I1',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'CREATE',
+ 'arguments' : 'DIRECTORY %s FAILIFEXISTS' % MISC_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' \
+ % (ZIPPATH, ZIPNAME, MISC_I1_BASE)
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to unzip OpenDS ZIP file',
+ }
+ </call>
+
+ <script>
+ c = '%s/setup%s' % (MISC_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ p.append('--rootUserPassword "kangourou"')
+ p.append('--doesNotExist')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch (buggy) setup command for I1',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : MISC_I1_ROOT,
+ 'expectedRC': 2,
+ 'outputFile': '%s/misc-setup1-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <script>
+ c = '%s/setup%s' % (MISC_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch (another buggy) setup command for I1',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : MISC_I1_ROOT,
+ 'expectedRC': 2,
+ 'outputFile': '%s/misc-setup2-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <script>
+ c = '%s/uninstall%s' % (MISC_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ p.append('--removeAll')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch uninstall command for (uninstalled) I1',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : MISC_I1_ROOT,
+ 'expectedRC': 2,
+ 'outputFile': '%s/misc-uninstall-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+ </testcase>
+
+ <call function="'testSuite_Postamble'"/>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/setup/ports.xml b/opends/tests/functional-tests/testcases/setup/ports.xml
new file mode 100644
index 0000000..5e4103b
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/setup/ports.xml
@@ -0,0 +1,388 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
+<!--
+ ! 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
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, exclude this CDDL HEADER in each
+ ! file and exclude the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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="ports"/>
+
+ <function name="ports">
+
+ <sequence>
+
+ <!--- Test Suite information
+ #@TestSuiteName Setup-Uninstall ports Tests
+ #@TestSuitePurpose Test all port relative setup and uninstall
+ options (port conflict, access right on port,
+ ...)
+ #@TestSuiteGroup ports
+ #@TestSuiteID ports Tests
+ #@TestGroup Setup-Uninstall
+ #@TestScript ports.xml
+ #@TestHTMLLink http://opends.dev.java.net/
+ -->
+
+ <script>
+ if not CurrentTestPath.has_key('group'):
+ CurrentTestPath['group'] = 'setup'
+ CurrentTestPath['suite'] = 'ports'
+ </script>
+
+ <call function="'testSuite_Preamble'"/>
+
+ <script>
+ STAF_PORT = 6500
+ </script>
+
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 3000,
+ }
+ </call>
+ <script>FREE_PORT_1 = STAXResult</script>
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 4000,
+ }
+ </call>
+ <script>FREE_PORT_2 = STAXResult</script>
+
+ <message>
+ 'Got 2 free ports: %s and %s' % (FREE_PORT_1, FREE_PORT_2)
+ </message>
+
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall ports Tests
+ #@TestName Setup-Uninstall: Ports:
+ ldap-port-conflict
+ #@TestID ldap-port-conflict
+ #@TestPurpose Setup OpenDS, specifying a used LDAP port
+ #@TestPreamble
+ #@TestStep Setup OpenDS, specifying a used LDAP port
+ Check for error
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('ldap-port-conflict')">
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Ports: LDAP port conflict'</message>
+
+ <script>
+ c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
+ p = []
+ p.append('--cli --no-prompt --rootUserPassword kangourou')
+ p.append('--ldapPort %s' % STAF_PORT)
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch setup command with LDAP port conflict',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : ODS_UNZIPPED,
+ 'expectedRC': 2,
+ 'outputFile': '%s/ports-setup-ldap-conflict.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+ </sequence>
+ </testcase>
+
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall ports Tests
+ #@TestName Setup-Uninstall: Ports:
+ ldaps-port-conflict
+ #@TestID ldaps-port-conflict
+ #@TestPurpose Setup OpenDS, specifying a used LDAPS port
+ #@TestPreamble
+ #@TestStep Setup OpenDS, specifying a used LDAPS port
+ Check for error
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('ldaps-port-conflict')">
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Ports: LDAPS port conflict'</message>
+
+ <script>
+ c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
+ p = []
+ p.append('--cli --no-prompt --rootUserPassword kangourou')
+ p.append('--ldapPort %s' % FREE_PORT_1)
+ p.append('--ldapsPort %s' % STAF_PORT)
+ p.append('--generateSelfSignedCertificate')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch setup command with LDAPS port conflict',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : ODS_UNZIPPED,
+ 'expectedRC': 2,
+ 'outputFile': '%s/ports-setup-ldaps-conflict.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+ </sequence>
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall ports Tests
+ #@TestName Setup-Uninstall: Ports:
+ jmx-port-conflict
+ #@TestID jmx-port-conflict
+ #@TestPurpose Setup OpenDS, specifying a used JMX port
+ #@TestPreamble
+ #@TestStep Setup OpenDS, specifying a used JMX port
+ Check for error
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('jmx-port-conflict')">
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Ports: JMX port conflict'</message>
+
+ <script>
+ c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
+ p = []
+ p.append('--cli --no-prompt --rootUserPassword kangourou')
+ p.append('--ldapPort %s' % FREE_PORT_1)
+ p.append('--jmxPort %s' % STAF_PORT)
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch setup command with JMX port conflict',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : ODS_UNZIPPED,
+ 'expectedRC': 2,
+ 'outputFile': '%s/ports-setup-jmx-conflict.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+ </sequence>
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall ports Tests
+ #@TestName Setup-Uninstall: Ports:
+ ldap-port-conflict-nocheck
+ #@TestID ldap-port-conflict-nocheck
+ #@TestPurpose Setup OpenDS, disabling the LDAP port check
+ #@TestPreamble
+ #@TestStep Unzip OpenDS ZIP distribution
+ Setup OpenDS with 'skipPortCheck' & 'doNotStart'
+ options
+ Uninstall OpenDS
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('ldap-port-conflict-nocheck')">
+ <sequence>
+
+ <script>
+ PORTS_I1_BASE = '%s/ports_i1' % (OUT_GROUP)
+ PORTS_I1_ROOT = '%s/%s' % (PORTS_I1_BASE, OPENDSNAME)
+ </script>
+
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Ports: '</message>
+
+ <!-- 1. Setup options: baseDN baseDN sampleData -->
+ <message>'Prepare Open DS ZIP (in %s)' % PORTS_I1_ROOT</message>
+
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Create directory to contain I1',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'CREATE',
+ 'arguments' : 'DIRECTORY %s FAILIFEXISTS' % PORTS_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' \
+ % (ZIPPATH, ZIPNAME, PORTS_I1_BASE)
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to unzip OpenDS ZIP file',
+ }
+ </call>
+
+ <script>
+ c = '%s/setup%s' % (PORTS_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt --ldapPort %s' % (STAF_PORT))
+ p.append('--rootUserPassword "kangourou"')
+ p.append('--skipPortCheck --doNotStart --noPropertiesFile')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Setup command for I1 (port conflict but nocheck)',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : PORTS_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/ports-setup-confl-nocheck-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <script>
+ c = '%s/bin/start-ds%s' % (PORTS_I1_ROOT, fileExt)
+ p = []
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'start DS (will raise port conflict)',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : PORTS_I1_ROOT,
+ 'expectedRC': 1,
+ 'outputFile': '%s/ports-start-conflict-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <script>
+ c = '%s/uninstall%s' % (PORTS_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ p.append('--quiet --forceOnError --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 I1',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : PORTS_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/ports-uninstall-conflict-i1.txt' % OUT_GROUP,
+ }
+ </call>
+ <call function="'testCase_Postamble'"/>
+
+
+ </sequence>
+ </testcase>
+
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall ports Tests
+ #@TestName Setup-Uninstall: Ports:
+ ldap-port-unauthorized
+ #@TestID ldap-port-unauthorized
+ #@TestPurpose Setup OpenDS, specifying a forbidden LDAP port
+ #@TestPreamble
+ #@TestStep Setup OpenDS with forbidden port number
+ Check for error
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('ldap-port-unauthorized')">
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+ <message>'Ports: Unauthorized LDAP port'</message>
+
+ <script>
+ c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
+ p = []
+ p.append('--cli --no-prompt --rootUserPassword kangourou')
+ p.append('--ldapPort 1')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch setup command with unauthorized LDAP port',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : ODS_UNZIPPED,
+ 'expectedRC': 2,
+ 'outputFile': '%s/ports-unauthorized-ldap.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+ </sequence>
+ </testcase>
+
+ <call function="'testSuite_Postamble'"/>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/setup/security.xml b/opends/tests/functional-tests/testcases/setup/security.xml
new file mode 100644
index 0000000..86b0538
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/setup/security.xml
@@ -0,0 +1,920 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
+<!--
+ ! 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
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, exclude this CDDL HEADER in each
+ ! file and exclude the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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="security"/>
+
+ <function name="security">
+
+ <sequence>
+
+ <!--- Test Suite information
+ #@TestSuiteName Setup-Uninstall security Tests
+ #@TestSuitePurpose Test all secuirty related options of the
+ setup and uninstall commands
+ #@TestSuiteGroup security
+ #@TestSuiteID security Tests
+ #@TestGroup Setup-Uninstall
+ #@TestScript security.xml
+ #@TestHTMLLink http://opends.dev.java.net/
+ -->
+
+ <script>
+ if not CurrentTestPath.has_key('group'):
+ CurrentTestPath['group'] = 'setup'
+ CurrentTestPath['suite'] = 'security'
+ </script>
+
+ <call function="'testSuite_Preamble'"/>
+
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 8500,
+ }
+ </call>
+ <script>SEC_I1_PORT = STAXResult</script>
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 8520,
+ }
+ </call>
+ <script>SEC_I1_SPORT = STAXResult</script>
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 8540,
+ }
+ </call>
+ <script>SEC_I1_REPL_PORT = STAXResult</script>
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 8600,
+ }
+ </call>
+ <script>SEC_I2_PORT = STAXResult</script>
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 8620,
+ }
+ </call>
+ <script>SEC_I2_SPORT = STAXResult</script>
+
+ <call function="'getFreePort'">
+ {
+ 'host' : STAF_REMOTE_HOSTNAME,
+ 'port' : 8640,
+ }
+ </call>
+ <script>SEC_I2_REPL_PORT = STAXResult</script>
+
+ <message>
+ 'Got these free ports for I1: %s, %s, %s' % (SEC_I1_PORT, \
+ SEC_I1_SPORT, SEC_I1_REPL_PORT)
+ 'Got these free ports for I2: %s, %s, %s' % (SEC_I2_PORT, \
+ SEC_I2_SPORT, SEC_I2_REPL_PORT)
+ </message>
+
+
+
+ <!--- Test Case information
+ #@TestMarker Setup-Uninstall Security tests
+ #@TestName Setup-Uninstall: Security:
+ security_starttls_ssl
+ #@TestID security_starttls_ssl
+ #@TestPurpose Test security related options of setup/uninstall
+ #@TestPreamble
+ #@TestStep Setup I1, with SSL
+ Setup I2, with StartTLS
+ Create o=o1 on I1 & I2, and import data on I1
+ Setup replication I1 - I2
+ Check SSL works OK on I1 and I2
+ Check StartTLS not-OK on I1
+ Check StartTLS OK on I2
+ Export server certs I1 & I2
+ Create new JKS keystore and import I1 & I2 certs
+ Uninstall I1, using new keystore
+ Uninstall I2
+ #@TestPostamble
+ #@TestResult PASS if all steps ran without errors
+ -->
+ <testcase name="getTestCaseName('security_starttls_ssl')">
+ <sequence>
+
+ <script>
+ DM_DN = 'cn=DM'
+ DM_PW = 'secret12'
+ DM_PW_FILE = '%s/setup/pwd-security.ldif' % logsRemoteDataDir
+
+ KEYTOOL = '%s/bin/keytool%s' % (JAVA_HOME, fileExt)
+ SEC_I1_BASE = '%s/sec_i1' % (OUT_GROUP)
+ SEC_I1_ROOT = '%s/%s' % (SEC_I1_BASE, OPENDSNAME)
+ SEC_I2_BASE = '%s/sec_i2' % (OUT_GROUP)
+ SEC_I2_ROOT = '%s/%s' % (SEC_I2_BASE, OPENDSNAME)
+ MY_KEYSTORE = '%s/ks' % OUT_GROUP
+ SEC_O1_LDIF = '%s/setup/sec-o1.ldif' % logsRemoteDataDir
+ </script>
+
+ <call function="'checkFileExists'">
+ { 'file' : KEYTOOL }
+ </call>
+
+ <!-- 1.1. Setup I1 -->
+ <message>'++ Setup of I1'</message>
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Create directory to contain I1',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'CREATE',
+ 'arguments' : 'DIRECTORY %s FAILIFEXISTS' % SEC_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' \
+ % (ZIPPATH, ZIPNAME, SEC_I1_BASE)
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to unzip OpenDS ZIP file',
+ }
+ </call>
+
+ <script>
+ c = '%s/setup%s' % (SEC_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt --ldapPort %s' % (SEC_I1_PORT))
+ p.append('--ldapsPort %s' % SEC_I1_SPORT)
+ p.append('--rootUserDN "%s"' % DM_DN)
+ p.append('--rootUserPassword "%s"' % DM_PW)
+ p.append('--generateSelfSignedCertificate')
+ 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' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-setup-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 1.2. Check I1 -->
+ <message>'++ Check status of I1'</message>
+ <script>
+ c = '%s/bin/status%s' % (SEC_I1_ROOT, fileExt)
+ p = []
+ p.append('--no-prompt')
+ p.append('--bindDN "%s" --bindPassword "%s"' % (DM_DN, DM_PW))
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch status command for I1',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-status-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <script>
+ grepFile = '%s/sec-status-i1.txt' % OUT_GROUP
+ </script>
+
+ <call function="'grep'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'filename' : grepFile,
+ 'testString': 'Server Run Status: Started',
+ 'expectedRC': 0,
+ }
+ </call>
+
+ <!-- 1.3. Check config/keystore -->
+ <message>'++ Check file config/keystore exists'</message>
+ <script>
+ ks = '%s/config/keystore' % SEC_I1_ROOT
+ </script>
+
+ <call function="'checkFileExists'">
+ { 'file' : ks }
+ </call>
+
+ <!-- 1.4. Check StartTLS non-enablement -->
+ <message>'++ Check StartTLS is disabled'</message>
+ <script>
+ ent = 'cn=LDAP Connection Handler,cn=Connection Handlers,cn=config'
+ </script>
+
+ <call function="'ldapSearchWithScript'">
+ { 'dsInstancePort' : SEC_I1_PORT,
+ 'dsInstanceDn' : DM_DN,
+ 'dsInstancePswd' : DM_PW,
+ 'dsBaseDN' : ent,
+ 'dsFilter' : 'objectclass=*',
+ 'dsAttributes' : 'ds-cfg-allow-start-tls',
+ 'expectedRC' : 0,
+ 'outputPath' : OUT_GROUP,
+ 'outputFile' : 'sec-ldapsearch-i1.txt',
+ }
+ </call>
+
+ <script>
+ grepFile = '%s/sec-ldapsearch-i1.txt' % OUT_GROUP
+ </script>
+
+ <call function="'grep'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'filename' : grepFile,
+ 'testString': 'ds-cfg-allow-start-tls: false',
+ 'expectedRC': 0,
+ }
+ </call>
+
+ <!-- 2.1. Setup I2 -->
+ <message>'++ Setup I2'</message>
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Create directory to contain I2',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'CREATE',
+ 'arguments' : 'DIRECTORY %s FAILIFEXISTS' % SEC_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' \
+ % (ZIPPATH, ZIPNAME, SEC_I2_BASE)
+
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to unzip OpenDS ZIP file',
+ }
+ </call>
+
+ <script>
+ c = '%s/setup%s' % (SEC_I2_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt --ldapPort %s' % (SEC_I2_PORT))
+ p.append('--ldapsPort %s' % SEC_I2_SPORT)
+ p.append('--rootUserDN "%s"' % DM_DN)
+ p.append('--rootUserPassword "%s"' % DM_PW)
+ p.append('--generateSelfSignedCertificate --enableStartTLS')
+ 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' : SEC_I2_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-setup-i2.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 2.2. Check I2 -->
+ <message>'++ Check status of I2'</message>
+ <script>
+ c = '%s/bin/status%s' % (SEC_I2_ROOT, fileExt)
+ p = []
+ p.append('--no-prompt')
+ p.append('--bindDN "%s" --bindPassword "%s"' % (DM_DN, DM_PW))
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Launch status command for I2',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-status-i2.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <script>
+ grepFile = '%s/sec-status-i2.txt' % OUT_GROUP
+ </script>
+
+ <call function="'grep'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'filename' : grepFile,
+ 'testString': 'Server Run Status: Started',
+ 'expectedRC': 0,
+ }
+ </call>
+
+ <!-- 2.3. Check config/keystore -->
+ <message>'++ Check file config/keystore exists'</message>
+ <script>
+ ks = '%s/config/keystore' % SEC_I2_ROOT
+ </script>
+
+ <call function="'checkFileExists'">
+ { 'file' : ks }
+ </call>
+
+ <!-- 2.4. Check StartTLS enablement -->
+ <message>'++ Check StartTLS is enabled on I2'</message>
+ <script>
+ ent = 'cn=LDAP Connection Handler,cn=Connection Handlers,cn=config'
+ </script>
+
+ <call function="'ldapSearchWithScript'">
+ { 'dsInstancePort' : SEC_I2_PORT,
+ 'dsInstanceDn' : DM_DN,
+ 'dsInstancePswd' : DM_PW,
+ 'dsBaseDN' : ent,
+ 'dsFilter' : 'objectclass=*',
+ 'dsAttributes' : 'ds-cfg-allow-start-tls',
+ 'expectedRC' : 0,
+ 'outputPath' : OUT_GROUP,
+ 'outputFile' : 'sec-ldapsearch-i2.txt',
+ }
+ </call>
+
+ <script>
+ grepFile = '%s/sec-ldapsearch-i2.txt' % OUT_GROUP
+ </script>
+
+ <call function="'grep'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'filename' : grepFile,
+ 'testString': 'ds-cfg-allow-start-tls: true',
+ 'expectedRC': 0,
+ }
+ </call>
+
+ <!-- 3.1. Config: create backend I1 -->
+ <message>'++ create backend on I1'</message>
+ <script>
+ c = '%s/bin/dsconfig%s' % (SEC_I1_ROOT, fileExt)
+ p = []
+ p.append('create-backend --bindDN "%s"' % DM_DN)
+ p.append('--bindPassword "%s" --port %s' % (DM_PW, SEC_I1_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' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-create-backend-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 3.2. Config: create backend I2 -->
+ <message>'++ create backend on I2'</message>
+ <script>
+ c = '%s/bin/dsconfig%s' % (SEC_I2_ROOT, fileExt)
+ p = []
+ p.append('create-backend --bindDN "%s"' % DM_DN)
+ p.append('--bindPassword "%s" --port %s' % (DM_PW, SEC_I2_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 I2',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : SEC_I2_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-create-backend-i2.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 3.3. Import data I1 -->
+ <message>'++ Import data on I1'</message>
+ <script>
+ c = '%s/bin/import-ldif%s' % (SEC_I1_ROOT, fileExt)
+ p = []
+ p.append('--bindDN "%s" --bindPassword "%s"' % (DM_DN, DM_PW))
+ p.append('--port %s --backendID o1' % SEC_I1_PORT)
+ p.append('--ldifFile %s' % SEC_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' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-import-ldif-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 3.4. Enable replication I1-I2 -->
+ <message>'++ Enable replication I1-I2'</message>
+ <script>
+ c = '%s/bin/dsreplication%s' % (SEC_I1_ROOT, fileExt)
+ p = []
+ p.append('enable --host1 %s' % STAF_REMOTE_HOSTNAME)
+ p.append('--bindDN1 "%s"' % DM_DN)
+ p.append('--bindPassword1 "%s"' % DM_PW)
+ p.append('--port1 %s' % SEC_I1_PORT)
+ p.append('--replicationPort1 %s' % SEC_I1_REPL_PORT)
+ p.append('--host2 %s --bindDN2 "%s"' % (STAF_REMOTE_HOSTNAME, DM_DN))
+ p.append('--bindPassword2 "%s"' % DM_PW)
+ p.append('--port2 %s' % (SEC_I2_PORT))
+ p.append('--replicationPort2 %s' % SEC_I2_REPL_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' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-enable-repl.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 3.5. Initialize replication -->
+ <message>'++ Initialize replication I1-I2'</message>
+ <script>
+ c = '%s/bin/dsreplication%s' % (SEC_I1_ROOT, fileExt)
+ p = []
+ p.append('initialize -I admin -w secret12 --baseDN "o=o1"')
+ p.append('--hostSource %s' % STAF_REMOTE_HOSTNAME)
+ p.append('--portSource %s' % SEC_I1_PORT)
+ p.append('--hostDestination %s' % STAF_REMOTE_HOSTNAME)
+ p.append('--portDestination %s' % SEC_I2_PORT)
+ p.append('--no-prompt')
+ 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' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-initialize-repl.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 4.1. Check SSL I1 -->
+ <message>'++ Check SSL I1'</message>
+ <script>
+ c = '%s/bin/ldapsearch%s' % (SEC_I1_ROOT, fileExt)
+ p = []
+ p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
+ p.append('--port %s' % SEC_I1_SPORT)
+ p.append('--trustAll --useSSL')
+ p.append('--baseDN "cn=user_2,o=o1"')
+ p.append('--searchScope base "(objectClass=*)"')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'SSL Search on I1',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-ldapsearch-ssl-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <script>
+ grepFile = '%s/sec-ldapsearch-ssl-i1.txt' % OUT_GROUP
+ </script>
+
+ <call function="'grep'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'filename' : grepFile,
+ 'testString': 'dn: cn=user_2,o=o1',
+ 'expectedRC': 0,
+ }
+ </call>
+
+ <!-- 4.2. Check SSL I2 -->
+ <message>'++ Check SSL I2'</message>
+ <script>
+ c = '%s/bin/ldapsearch%s' % (SEC_I2_ROOT, fileExt)
+ p = []
+ p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
+ p.append('--port %s' % SEC_I2_SPORT)
+ p.append('--trustAll --useSSL')
+ p.append('--baseDN "cn=user_2,o=o1"')
+ p.append('--searchScope base "(objectClass=*)"')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'SSL Search on I2',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : SEC_I2_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-ldapsearch-ssl-i2.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <script>
+ grepFile = '%s/sec-ldapsearch-ssl-i2.txt' % OUT_GROUP
+ </script>
+
+ <call function="'grep'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'filename' : grepFile,
+ 'testString': 'dn: cn=user_2,o=o1',
+ 'expectedRC': 0,
+ }
+ </call>
+
+ <!-- 4.3. Check not-StartTLS I1 -->
+ <message>'++ Check not-StartTLS I1'</message>
+ <script>
+ c = '%s/bin/ldapsearch%s' % (SEC_I1_ROOT, fileExt)
+ p = []
+ p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
+ p.append('--port %s' % SEC_I1_PORT)
+ p.append('--trustAll --useStartTLS')
+ p.append('--baseDN "cn=user_2,o=o1"')
+ p.append('--searchScope base "(objectClass=*)"')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'StartTLS Search on I1',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : SEC_I1_ROOT,
+ 'expectedRC': 52,
+ 'outputFile': '%s/sec-ldapsearch-starttls-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 4.4. Check StartTLS I2 -->
+ <message>'++ Check StartTLS OK on I2'</message>
+ <script>
+ c = '%s/bin/ldapsearch%s' % (SEC_I2_ROOT, fileExt)
+ p = []
+ p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
+ p.append('--port %s' % SEC_I2_PORT)
+ p.append('--trustAll --useStartTLS')
+ p.append('--baseDN "cn=user_2,o=o1"')
+ p.append('--searchScope base "(objectClass=*)"')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'StartTLS Search on I2',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : SEC_I2_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-ldapsearch-starttls-i2.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <script>
+ grepFile = '%s/sec-ldapsearch-starttls-i2.txt' % OUT_GROUP
+ </script>
+
+ <call function="'grep'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'filename' : grepFile,
+ 'testString': 'dn: cn=user_2,o=o1',
+ 'expectedRC': 0,
+ }
+ </call>
+
+ <!-- 5.1. Export server cert I1 -->
+ <message>'++ Export server cert I1'</message>
+ <script>
+ CERT1_FILE = '%s/cert1' % OUT_GROUP
+ KEYSTORE1_FILE = '%s/config/keystore' % SEC_I1_ROOT
+ KEYSTORE1_PIN_FILE = '%s/config/keystore.pin' % SEC_I1_ROOT
+ </script>
+
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Get content of keystore.pin file for I1',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'GET',
+ 'arguments' : 'FILE %s TEXT' % KEYSTORE1_PIN_FILE
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to get content of keystore.pin file',
+ }
+ </call>
+
+ <script>
+ KEYSTORE1_PIN = STAFResult[:-1]
+ </script>
+
+ <script>
+ c = '%s' % KEYTOOL
+ p = []
+ p.append('-export -keystore %s' % KEYSTORE1_FILE)
+ p.append('-storepass "%s"' % KEYSTORE1_PIN)
+ p.append('-alias server-cert -file %s' % CERT1_FILE)
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Export I1 server cert',
+ 'command' : KEYTOOL,
+ 'arguments' : p,
+ 'path' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-export-cert-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 5.2. Export server cert I2 -->
+ <message>'++ Export server cert I2'</message>
+ <script>
+ CERT2_FILE = '%s/cert2' % OUT_GROUP
+ KEYSTORE2_FILE = '%s/config/keystore' % SEC_I2_ROOT
+ KEYSTORE2_PIN_FILE = '%s/config/keystore.pin' % SEC_I2_ROOT
+ </script>
+
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Get content of keystore.pin file for I2',
+ 'location' : STAF_REMOTE_HOSTNAME,
+ 'service' : 'FS',
+ 'request' : 'GET',
+ 'arguments' : 'FILE %s TEXT' % KEYSTORE2_PIN_FILE
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC,
+ 'expected' : 0,
+ 'result' : 'FAIL to get content of keystore.pin file',
+ }
+ </call>
+
+ <script>
+ KEYSTORE2_PIN = STAFResult[:-1]
+ </script>
+
+ <script>
+ c = '%s' % KEYTOOL
+ p = []
+ p.append('-export -keystore %s' % KEYSTORE2_FILE)
+ p.append('-storepass "%s"' % KEYSTORE2_PIN)
+ p.append('-alias server-cert -file %s' % CERT2_FILE)
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Export I2 server cert',
+ 'command' : KEYTOOL,
+ 'arguments' : p,
+ 'path' : SEC_I2_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-export-cert-i2.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 5.3. Create new JKS keystore with I1 cert -->
+ <message>'++ Create new JKS keystore with I1 cert'</message>
+ <script>
+ c = '%s' % KEYTOOL
+ p = []
+ p.append('-import -storetype JKS -keystore %s' % MY_KEYSTORE)
+ p.append('-file %s' % CERT1_FILE)
+ p.append('-storepass secret12 -alias server-cert1')
+ p.append('-noprompt')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Import I1 cert in new JKS keystore',
+ 'command' : KEYTOOL,
+ 'arguments' : p,
+ 'path' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-import-cert-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 5.4. Import cert I2 -->
+ <message>'++ Import cert on I2'</message>
+ <script>
+ c = '%s' % KEYTOOL
+ p = []
+ p.append('-import -storetype JKS -keystore %s' % MY_KEYSTORE)
+ p.append('-file %s' % CERT2_FILE)
+ p.append('-storepass secret12 -alias server-cert2')
+ p.append('-noprompt')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Import I2 cert in new JKS keystore',
+ 'command' : KEYTOOL,
+ 'arguments' : p,
+ 'path' : SEC_I2_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-import-cert-i2.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 6.1. Uninstall I1 (should fail: incompatible options) -->
+ <message>'++ Uninstall I1 (should fail)'</message>
+ <script>
+ c = '%s/uninstall%s' % (SEC_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ p.append('--adminUID admin --bindPassword %s' % DM_PW)
+ p.append('--useSSL --useStartTLS --remove-all')
+ p.append('--trustStorePath %s' % MY_KEYSTORE)
+ p.append('--trustStorePassword secret12')
+ 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' : SEC_I1_ROOT,
+ 'expectedRC': 2,
+ 'outputFile': '%s/sec-uninstall1-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+
+ <!-- 6.2. Uninstall I1 -->
+ <message>'++ Uninstall I1'</message>
+ <script>
+ c = '%s/uninstall%s' % (SEC_I1_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ p.append('--adminUID admin --bindPassword %s' % DM_PW)
+ p.append('--useSSL --remove-all')
+ p.append('--trustStorePath %s' % MY_KEYSTORE)
+ p.append('--trustStorePassword secret12')
+ 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' : SEC_I1_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-uninstall2-i1.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <!-- 6.3. Uninstall I2 -->
+ <message>'++ Uninstall I2'</message>
+ <script>
+ c = '%s/uninstall%s' % (SEC_I2_ROOT, fileExt)
+ p = []
+ p.append('--cli --no-prompt')
+ p.append('--adminUID admin --bindPasswordFile %s' % DM_PW_FILE)
+ p.append('--useStartTLS --remove-all')
+ p.append('--trustAll')
+ p = ' '.join(p)
+ </script>
+
+ <message>'%s %s' % (c, p)</message>
+ <call function="'runCommand'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'name' : 'Uninstall I2',
+ 'command' : c,
+ 'arguments' : p,
+ 'path' : SEC_I2_ROOT,
+ 'expectedRC': 0,
+ 'outputFile': '%s/sec-uninstall-i2.txt' % OUT_GROUP,
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+ </testcase>
+
+ <call function="'testSuite_Postamble'"/>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/setup/setup.xml b/opends/tests/functional-tests/testcases/setup/setup.xml
index d4e4aea..244a2ad 100644
--- a/opends/tests/functional-tests/testcases/setup/setup.xml
+++ b/opends/tests/functional-tests/testcases/setup/setup.xml
@@ -50,7 +50,7 @@
<call function="'runSTAFCommand'">
{ 'name' : 'Create directory for this group',
- 'location' : STAXServiceMachine,
+ 'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'CREATE',
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % OUT_GROUP
@@ -61,12 +61,12 @@
testList = []
testList.append(['.','_pre'])
testList.append(['.','general_options'])
-# testList.append(['.','directory_manager'])
-# testList.append(['.','import'])
-# testList.append(['.','incompatible_options'])
-# testList.append(['.','security'])
-# testList.append(['.','ports'])
-# testList.append(['.','misc'])
+ testList.append(['.','directory_manager'])
+ testList.append(['.','import'])
+ testList.append(['.','incompatible_options'])
+ testList.append(['.','security'])
+ testList.append(['.','ports'])
+ testList.append(['.','misc'])
testList.append(['.','_post'])
</script>
--
Gitblit v1.10.0