<?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.
! Portions Copyright 2013 ForgeRock AS
! -->
<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'"/>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 2000,
}
</call>
<script>PORTS_I1_PORT = STAXResult</script>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 4000,
}
</call>
<script>PORTS_I1_ADMIN_PORT = STAXResult</script>
<call function="'getFreePort'">
{
'host' : STAF_REMOTE_HOSTNAME,
'port' : 3000,
}
</call>
<script>PORTS_I2_PORT = STAXResult</script>
<message>
'Got 3 free ports: %s, %s and %s' \
% (PORTS_I1_PORT, PORTS_I1_ADMIN_PORT, PORTS_I2_PORT)
</message>
<!--- Test Case information
#@TestMarker Setup-Uninstall ports Tests
#@TestName Setup-Uninstall: Ports:
bind-port
#@TestID bind-port
#@TestPurpose Setup a first instance to bind a port
#@TestPreamble
#@TestStep Setup a first instance to bind a port
#@TestPostamble
#@TestResult PASS if all steps ran without errors
-->
<testcase name="getTestCaseName('bind-port')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'Ports: Setup a first instance to bind a port'</message>
<script>
PORTS_I1_ROOT = '%s/%s' % (PORTS_I1_BASE, OPENDSNAME)
</script>
<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' \
% (DIRECTORY_INSTANCE_DIR, ZIPNAME, PORTS_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 --rootUserPassword kangourou %s' \
% licenseOption)
p.append('--ldapPort %s' % PORTS_I1_PORT)
p.append('--adminConnectorPort %s' % PORTS_I1_ADMIN_PORT)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Setup a first instance to bind a port',
'command' : c,
'arguments' : p,
'path' : PORTS_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/ports-install-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-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>
p = []
p.append('--cli --no-prompt --rootUserPassword kangourou')
p.append('--ldapPort %s %s' % (PORTS_I1_PORT, licenseOption))
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>
<!-- Remove and recreate the unzipped instance -->
<call function="'runSTAFCommand'">
{ 'name' : 'Delete directory containing unzipped OpenDS',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'DELETE',
'arguments' : 'ENTRY %s RECURSE CONFIRM' % ODS_UNZIPPED
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to remove files for this group at cleanup',
}
</call>
<call function="'runSTAFCommand'">
{ 'name' : 'Create directory to contain unzipped OpenDS',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'CREATE',
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % ODS_UNZIPPED
}
</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, ODS_UNZIPPED)
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to unzip OpenDS ZIP file',
}
</call>
<script>
p = []
p.append('--cli --no-prompt --rootUserPassword kangourou')
p.append('--ldapPort %s' % PORTS_I2_PORT)
p.append('--ldapsPort %s' % PORTS_I1_PORT)
p.append('--generateSelfSignedCertificate %s' % licenseOption)
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>
<!-- Remove and recreate the unzipped instance -->
<call function="'runSTAFCommand'">
{ 'name' : 'Delete directory containing unzipped OpenDS',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'DELETE',
'arguments' : 'ENTRY %s RECURSE CONFIRM' % ODS_UNZIPPED
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to remove files for this group at cleanup',
}
</call>
<call function="'runSTAFCommand'">
{ 'name' : 'Create directory to contain unzipped OpenDS',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'CREATE',
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % ODS_UNZIPPED
}
</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, ODS_UNZIPPED)
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to unzip OpenDS ZIP file',
}
</call>
<script>
p = []
p.append('--cli --no-prompt --rootUserPassword kangourou')
p.append('--ldapPort %s' % PORTS_I2_PORT)
p.append('--jmxPort %s %s' % (PORTS_I1_PORT, licenseOption))
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' and 'doNotStart'
options
Uninstall OpenDS
#@TestPostamble
#@TestResult PASS if all steps ran without errors
-->
<testcase name="getTestCaseName('ldap-port-conflict-nocheck')">
<sequence>
<script>
PORTS_I2_ROOT = '%s/%s' % (PORTS_I2_BASE, OPENDSNAME)
</script>
<call function="'testCase_Preamble'"/>
<message>'Ports: '</message>
<!-- 1. Setup options: baseDN baseDN sampleData -->
<message>'Prepare Open DS ZIP (in %s)' % PORTS_I2_ROOT</message>
<call function="'runSTAFCommand'">
{ 'name' : 'Create directory to contain I2',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'CREATE',
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % PORTS_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, PORTS_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' % PORTS_I1_PORT)
p.append('--rootUserPassword "kangourou" %s' % licenseOption)
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 I2 (port conflict but nocheck)',
'command' : c,
'arguments' : p,
'path' : PORTS_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/ports-setup-confl-nocheck-i2.txt' % OUT_GROUP,
}
</call>
<script>
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_I2_ROOT,
'expectedRC': 1,
'outputFile': '%s/ports-start-conflict-i2.txt' % OUT_GROUP,
}
</call>
<script>
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 I2',
'command' : c,
'arguments' : p,
'path' : PORTS_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/ports-uninstall-conflict-i2.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>
<!-- Remove and recreate the unzipped instance -->
<call function="'runSTAFCommand'">
{ 'name' : 'Delete directory containing unzipped OpenDS',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'DELETE',
'arguments' : 'ENTRY %s RECURSE CONFIRM' % ODS_UNZIPPED
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to remove files for this group at cleanup',
}
</call>
<call function="'runSTAFCommand'">
{ 'name' : 'Create directory to contain unzipped OpenDS',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'CREATE',
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % ODS_UNZIPPED
}
</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, ODS_UNZIPPED)
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to unzip OpenDS ZIP file',
}
</call>
<!-- This testcase is not relevant on Windows or as root user -->
<script>
from java.lang import System
if is_windows_platform(STAF_REMOTE_HOSTNAME) or get_system_uid() == "root":
skip=1
else:
skip=0
</script>
<if expr="skip == 0">
<sequence>
<script>
p = []
p.append('--cli --no-prompt --rootUserPassword kangourou')
p.append('--ldapPort 1 %s' % licenseOption)
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>
</sequence>
<else>
<sequence>
<message>'This testcase is not relevant on Windows or as root user'</message>
<tcstatus result="'pass'"/>
</sequence>
</else>
</if>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Setup-Uninstall ports Tests
#@TestName Setup-Uninstall: Ports:
uninstall
#@TestID uninstall
#@TestPurpose Uninstall the first instance
#@TestPreamble
#@TestStep Uninstall the first instance
#@TestPostamble
#@TestResult PASS if all steps ran without errors
-->
<testcase name="getTestCaseName('uninstall')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'Ports: Uninstall the first instance'</message>
<script>
PORTS_I1_ROOT = '%s/%s' % (PORTS_I1_BASE, OPENDSNAME)
</script>
<script>
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-i1.txt' % OUT_GROUP,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<call function="'testSuite_Postamble'"/>
</sequence>
</function>
</stax>