From ea9da534847c609d20e31be9771c8a8621cf2d08 Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Fri, 14 Mar 2008 14:16:37 +0000
Subject: [PATCH] Add testsuite for make-ldif, list-backends and encode-password tools
---
opends/tests/functional-tests/shared/data/clu/encoded_password.ref | 1
opends/tests/shared/functions/tools.xml | 4
opends/tests/functional-tests/testcases/clu/clu.xml | 5
opends/tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml | 367 ++++++++++++++++
opends/tests/functional-tests/testcases/clu/clu_encode-password_checkbehavior.xml | 535 ++++++++++++++++++++++++
opends/tests/functional-tests/shared/data/clu/make-ldif_template.ref | 23 +
opends/tests/functional-tests/testcases/clu/clu_list-backends_checkbehavior.xml | 358 ++++++++++++++++
opends/tests/functional-tests/shared/data/clu/clear_password.ref | 1
8 files changed, 1,291 insertions(+), 3 deletions(-)
diff --git a/opends/tests/functional-tests/shared/data/clu/clear_password.ref b/opends/tests/functional-tests/shared/data/clu/clear_password.ref
new file mode 100644
index 0000000..48d23cf
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/clu/clear_password.ref
@@ -0,0 +1 @@
+mypassword
diff --git a/opends/tests/functional-tests/shared/data/clu/encoded_password.ref b/opends/tests/functional-tests/shared/data/clu/encoded_password.ref
new file mode 100644
index 0000000..ac00e98
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/clu/encoded_password.ref
@@ -0,0 +1 @@
+{SSHA}S9xl7VJy0BFkDDovdixlIz6dcE2h2kOXfDZfCg==
diff --git a/opends/tests/functional-tests/shared/data/clu/make-ldif_template.ref b/opends/tests/functional-tests/shared/data/clu/make-ldif_template.ref
new file mode 100644
index 0000000..65d1ee0
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/clu/make-ldif_template.ref
@@ -0,0 +1,23 @@
+define base=dc=com
+define suffix=dc=example,[base]
+define orgunit=o=clu tests,[suffix]
+define maildomain=example.com
+define numusers=160
+
+branch: ou=make-ldif,[orgunit]
+subordinateTemplate: person:[numusers]
+
+template: person
+rdnAttr: uid
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: <first>
+sn: <last>
+employeeNumber: <sequential:0>
+cn: {givenName} {sn} {employeeNumber}
+uid: user.{employeeNumber}
+mail: {uid}@[maildomain]
+telephoneNumber: <random:telephone>
+description: This is the description for user.{employeeNumber}.
diff --git a/opends/tests/functional-tests/testcases/clu/clu.xml b/opends/tests/functional-tests/testcases/clu/clu.xml
index 6237020..184890d 100644
--- a/opends/tests/functional-tests/testcases/clu/clu.xml
+++ b/opends/tests/functional-tests/testcases/clu/clu.xml
@@ -61,7 +61,10 @@
testList.append(['.','clu_ldappasswordmodify_checkbehavior'])
testList.append(['.','clu_ldifsearch_checkbehavior'])
testList.append(['.','clu_verify-index_checkbehavior'])
- testList.append(['.','clu_rebuild-index_checkbehavior'])
+ testList.append(['.','clu_rebuild-index_checkbehavior'])
+ testList.append(['.','clu_encode-password_checkbehavior'])
+ testList.append(['.','clu_make-ldif_checkbehavior'])
+ testList.append(['.','clu_list-backends_checkbehavior'])
testList.append(['.','clu_cleanup'])
</script>
diff --git a/opends/tests/functional-tests/testcases/clu/clu_encode-password_checkbehavior.xml b/opends/tests/functional-tests/testcases/clu/clu_encode-password_checkbehavior.xml
new file mode 100644
index 0000000..26d276c
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/clu/clu_encode-password_checkbehavior.xml
@@ -0,0 +1,535 @@
+<?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="clu_encode-password_checkbehavior"/>
+
+ <function name="clu_encode-password_checkbehavior">
+
+ <sequence>
+
+ <block name="'clu_encode-password_checkbehavior'">
+
+ <sequence>
+
+ <!--- Test Suite information
+ #@TestSuiteName encode-password check behavior tests
+ #@TestSuitePurpose Test the results of the encode-password command.
+ #@TestSuiteGroup encode-password check behavior tests
+ #@TestScript clu_encode-password_checkbehavior.xml
+ -->
+
+ <script>
+ if not CurrentTestPath.has_key('group'):
+ CurrentTestPath['group'] = 'clu'
+ CurrentTestPath['suite'] = STAXCurrentBlock
+ </script>
+
+ <call function="'testSuite_Preamble'"/>
+
+ <!--- Define default value for clearFile and encodedFile -->
+ <script>
+ clearFile = '%s/clu/clear_password.ref' % logsRemoteDataDir
+ encodedFile = '%s/clu/encoded_password.ref' % logsRemoteDataDir
+ </script>
+
+ <!--- Test Case information
+ #@TestMarker encode-password check behavior tests
+ #@TestName encode-password: list available schemes
+ #@TestIssue none
+ #@TestPurpose Test encode-password with listSchemes option.
+ #@TestPreamble none
+ #@TestStep Do an encode-password with listSchemes option.
+ #@TestPostamble none
+ #@TestResult Success if encode-password returns 0.
+ -->
+ <testcase name="getTestCaseName
+ ('encode-password: list available schemes')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'encode-password: list available schemes'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'listSchemes' : 'True'
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'SSHA'
+ }
+ </call>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'MD5'
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker encode-password check behavior tests
+ #@TestName encode-password: list available
+ authPasswordSyntax schemes
+ #@TestIssue none
+ #@TestPurpose Test encode-password with listSchemes and
+ authPasswordSyntax options.
+ #@TestPreamble none
+ #@TestStep Do an encode-password with listSchemes and
+ authPasswordSyntax options.
+ #@TestPostamble none
+ #@TestResult Success if encode-password returns 0.
+ -->
+ <testcase name="getTestCaseName
+ ('encode-password: list available authPasswordSyntax schemes')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'encode-password: list available authPasswordSyntax schemes'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'listSchemes' : 'True' ,
+ 'authPwdSyntax' : 'True'
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'SHA1'
+ }
+ </call>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'MD5'
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker encode-password check behavior tests
+ #@TestName encode-password: encode clear-text pwd
+ #@TestIssue none
+ #@TestPurpose Test encode-password to encode clear-text pwd.
+ #@TestPreamble none
+ #@TestStep Do an encode-password to encode clear-text pwd
+ #@TestStep Remove schemes tag from pwd for next testcases
+ #@TestPostamble none
+ #@TestResult Success if encode-password returns 0.
+ -->
+ <testcase name="getTestCaseName
+ ('encode-password: encode clear-text pwd')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'encode-password: encode clear-text pwd'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'clearPwd' : 'mypassword' ,
+ 'storageScheme' : 'SSHA'
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ cmdResult = returnString.split(':')
+ pwd = cmdResult[1].strip().replace('{SSHA}', '')
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'Encoded Password:'
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker encode-password check behavior tests
+ #@TestName encode-password: encode clear-text pwd using
+ authPasswordSyntax
+ #@TestIssue none
+ #@TestPurpose Test encode-password to encode clear-text pwd
+ using authPasswordSyntax.
+ #@TestPreamble none
+ #@TestStep Do an encode-password to encode clear-text
+ with -a option.
+ #@TestPostamble none
+ #@TestResult Success if encode-password returns 0.
+ -->
+ <testcase name="getTestCaseName
+ ('encode-password: encode clear-text pwd using authPasswordSyntax')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'encode-password: encode clear-text pwd using \
+ authPasswordSyntax'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'clearPwd' : 'mypassword' ,
+ 'storageScheme' : 'SHA1' ,
+ 'authPwdSyntax' : 'True'
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ cmdResult = returnString.split(':')
+ pwd2 = cmdResult[1].strip().replace('"', '')
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'Encoded Password:'
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker encode-password check behavior tests
+ #@TestName encode-password: compare pwds
+ #@TestIssue none
+ #@TestPurpose Test encode-password to compare pwds.
+ #@TestPreamble none
+ #@TestStep Do an encode-password to compare pwds without
+ storageScheme option
+ #@TestStep Do an encode-password to compare good pwds with
+ storageSchema option
+ #@TestStep Do an encode-password to compare bad pws with
+ storageSchema option
+ #@TestPostamble none
+ #@TestResult Success if encode-password returns 1 for the
+ fisrt test and 0 otherwise, and if the outputs
+ are corrects.
+ -->
+ <testcase name="getTestCaseName
+ ('encode-password: compare pwd')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'encode-password: comparison error'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'clearPwd' : 'mypassword' ,
+ 'encodedPwd' : pwd ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'No password storage scheme was specified'
+ }
+ </call>
+
+ <message>
+ 'encode-password: comparison successful'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'clearPwd' : 'mypassword' ,
+ 'encodedPwd' : pwd ,
+ 'storageScheme' : 'SSHA'
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg = 'The provided clear-text and encoded passwords match'
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : msg
+ }
+ </call>
+
+ <message>
+ 'encode-password: comparison unsuccessful'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'clearPwd' : 'password' ,
+ 'encodedPwd' : pwd ,
+ 'storageScheme' : 'SSHA'
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg='The provided clear-text and encoded passwords do not match'
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : msg
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker encode-password check behavior tests
+ #@TestName encode-password: compare pwds encoded with
+ -a option
+ #@TestIssue none
+ #@TestStep Do an encode-password to compare pwds without
+ -a option and with -r option
+ #@TestStep Do an encode-password to compare good pwds with
+ -a and -r options
+ #@TestStep Do an encode-password to compare bad pws with
+ -a and -r options
+ #@TestPostamble none
+ #@TestResult Success if encode-password returns 1 for the
+ fisrt test, 6 when the comparison is successful,
+ 5 when the comparison is unsuccessful, and if the
+ outputs are corrects.
+ -->
+ <testcase name="getTestCaseName
+ ('encode-password: compare pwd with -r option')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'encode-password: comparison error'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'clearPwd' : 'mypassword' ,
+ 'encodedPwd' : pwd2 ,
+ 'useCmpRC' : 'True' ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'No password storage scheme was specified'
+ }
+ </call>
+
+ <message>
+ 'encode-password: comparison successful'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'clearPwd' : 'mypassword' ,
+ 'encodedPwd' : pwd2 ,
+ 'authPwdSyntax' : 'True' ,
+ 'useCmpRC' : 'True' ,
+ 'expectedRC' : 6
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg = 'The provided clear-text and encoded passwords match'
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : msg
+ }
+ </call>
+
+ <message>
+ 'encode-password: comparison unsuccessful'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'clearPwd' : 'password' ,
+ 'encodedPwd' : pwd2 ,
+ 'authPwdSyntax' : 'True' ,
+ 'useCmpRC' : 'True' ,
+ 'expectedRC' : 5
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg='The provided clear-text and encoded passwords do not match'
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : msg
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker encode-password check behavior tests
+ #@TestName encode-password: compare pwds using files
+ #@TestIssue none
+ #@TestPurpose Test encode-password to compare password using
+ files.
+ #@TestPreamble none
+ #@TestStep Do an encode-password to compare good pwds
+ stored in files and using -r option.
+ #@TestPostamble none
+ #@TestResult Success if encode-password returns 6 and the
+ output is correct.
+ -->
+ <testcase name="getTestCaseName
+ ('encode-password: compare pwd using file')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'encode-password: comparison successful'
+ </message>
+
+ <call function="'encodePasswordWithScript'">
+ {
+ 'clearPwdFile' : clearFile ,
+ 'encodedPwdFile' : encodedFile ,
+ 'useCmpRC' : 'True' ,
+ 'expectedRC' : 6
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg = 'The provided clear-text and encoded passwords match'
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : msg
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <call function="'testSuite_Postamble'"/>
+
+ </sequence>
+
+ </block>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/clu/clu_list-backends_checkbehavior.xml b/opends/tests/functional-tests/testcases/clu/clu_list-backends_checkbehavior.xml
new file mode 100644
index 0000000..ba53249
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/clu/clu_list-backends_checkbehavior.xml
@@ -0,0 +1,358 @@
+<?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="clu_list-backends_checkbehavior"/>
+
+ <function name="clu_list-backends_checkbehavior">
+
+ <sequence>
+
+ <block name="'clu_list-backends_checkbehavior'">
+
+ <sequence>
+
+ <!--- Test Suite information
+ #@TestSuiteName list-backends check behavior tests
+ #@TestSuitePurpose Test the results of the list-backends command.
+ #@TestSuiteGroup list-backends check behavior tests
+ #@TestScript clu_list-backends_checkbehavior.xml
+ -->
+
+ <script>
+ if not CurrentTestPath.has_key('group'):
+ CurrentTestPath['group'] = 'clu'
+ CurrentTestPath['suite'] = STAXCurrentBlock
+ </script>
+
+ <call function="'testSuite_Preamble'"/>
+
+ <!--- Test Case information
+ #@TestMarker list-backends check behavior tests
+ #@TestName list-backends: without option
+ #@TestIssue none
+ #@TestPurpose Test list-backends without option.
+ #@TestPreamble none
+ #@TestStep Do an list-backends without option.
+ #@TestPostamble none
+ #@TestResult Success if list-backends returns 0 and the
+ ouput is correct.
+ -->
+ <testcase name="getTestCaseName
+ ('list-backends: without option')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'list-backends: without option'
+ </message>
+
+ <call function="'listBackendsWithScript'">
+ {}
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'config : cn=config'
+ }
+ </call>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'userRoot : dc=com'
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker list-backends check behavior tests
+ #@TestName list-backends: backendID option
+ #@TestIssue none
+ #@TestPurpose Test list-backends with backendID option.
+ #@TestPreamble none
+ #@TestStep Do an list-backends with backendID option.
+ #@TestPostamble none
+ #@TestResult Success if list-backends returns 0 and the
+ ouput is correct.
+ -->
+ <testcase name="getTestCaseName
+ ('list-backends: backendID option')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'list-backends: backendID option'
+ </message>
+
+ <call function="'listBackendsWithScript'">
+ {
+ 'dsBackendID' : 'schema'
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'schema : cn=schema'
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker list-backends check behavior tests
+ #@TestName list-backends: baseDN option
+ #@TestIssue none
+ #@TestPurpose Test list-backends with baseDN option.
+ #@TestPreamble none
+ #@TestStep Do an list-backends with basedDN option.
+ #@TestPostamble none
+ #@TestResult Success if list-backends returns 0 and the
+ ouput is correct.
+ -->
+ <testcase name="getTestCaseName
+ ('list-backends: baseDN option')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'list-backends: baseDN option'
+ </message>
+
+ <call function="'listBackendsWithScript'">
+ {
+ 'dsBaseDN' : 'dc=com'
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg1 = 'The provided DN \'dc=com\' is a base DN'
+ msg2 = 'for backend \'userRoot\''
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : '%s %s' % (msg1, msg2)
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker list-backends check behavior tests
+ #@TestName list-backends: backendID and baseDN options
+ #@TestIssue none
+ #@TestPurpose Test list-backends with backendID and
+ baseDN options
+ #@TestPreamble none
+ #@TestStep Do an list-backends with backendID and
+ baseDN options.
+ #@TestPostamble none
+ #@TestResult Success if list-backends returns 1 and the
+ ouput is correct.
+ -->
+ <testcase name="getTestCaseName
+ ('list-backends: backendID and baseDN options')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'list-backends: backendID and baseDN options'
+ </message>
+
+ <call function="'listBackendsWithScript'">
+ {
+ 'dsBackendID' : 'userRoot' ,
+ 'dsBaseDN' : 'dc=com' ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg1 = 'You may not provide both the --backendID'
+ msg2 = 'and the --baseDN arguments'
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : '%s %s' % (msg1, msg2)
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker list-backends check behavior tests
+ #@TestName list-backends: invalid backendID
+ #@TestIssue none
+ #@TestPurpose Test list-backends with an invalid backendID
+ #@TestPreamble none
+ #@TestStep Do an list-backends with an invalid backendID
+ #@TestPostamble none
+ #@TestResult Success if list-backends returns 1 and the
+ ouput is correct.
+ -->
+ <testcase name="getTestCaseName
+ ('list-backends: invalid backendID')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'list-backends: invalid backendID'
+ </message>
+
+ <call function="'listBackendsWithScript'">
+ {
+ 'dsBackendID' : 'mybackend' ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg1 = 'There is no backend with ID \'mybackend\' in the'
+ msg2 = 'server configuration'
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : '%s %s' % (msg1, msg2)
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker list-backends check behavior tests
+ #@TestName list-backends: invalid baseDN
+ #@TestIssue 2594
+ #@TestPurpose Test list-backends with an invalid baseDN
+ #@TestPreamble none
+ #@TestStep Do an list-backends with an invalid baseDN.
+ #@TestPostamble none
+ #@TestResult Success if list-backends returns 1 and the
+ ouput is correct.
+ -->
+ <testcase name="getTestCaseName
+ ('list-backends: invalid baseDN')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'list-backends: invalid baseDN'
+ </message>
+
+ <call function="'listBackendsWithScript'">
+ {
+ 'dsBaseDN' : 'dc=mybasedn' ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg1 = 'The provided DN \'dc=mybasedn\' is not a base DN'
+ msg2 = 'for any backend configured in the Directory Server'
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : '%s %s' % (msg1, msg2)
+ }
+ </call>
+
+ <script>
+ knownIssue(2594)
+ </script>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <call function="'testSuite_Postamble'"/>
+
+ </sequence>
+
+ </block>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml b/opends/tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml
new file mode 100644
index 0000000..5a85f4e
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml
@@ -0,0 +1,367 @@
+<?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="clu_make-ldif_checkbehavior"/>
+
+ <function name="clu_make-ldif_checkbehavior">
+
+ <sequence>
+
+ <block name="'clu_make-ldif_checkbehavior'">
+
+ <sequence>
+
+ <!--- Test Suite information
+ #@TestSuiteName make-ldif check behavior tests
+ #@TestSuitePurpose Test the results of the make-ldif command.
+ #@TestSuiteGroup make-ldif check behavior tests
+ #@TestScript clu_make-ldif_checkbehavior.xml
+ -->
+
+ <script>
+ if not CurrentTestPath.has_key('group'):
+ CurrentTestPath['group'] = 'clu'
+ CurrentTestPath['suite'] = STAXCurrentBlock
+ </script>
+
+ <call function="'testSuite_Preamble'"/>
+
+ <!--- Define default value for template -->
+ <script>
+ template = '%s/clu/make-ldif_template.ref' % logsRemoteDataDir
+ </script>
+
+ <!--- Test Case information
+ #@TestMarker make-ldif check behavior tests
+ #@TestName make-ldif: generate ldif file with seed 0
+ #@TestIssue none
+ #@TestPurpose Test make-ldif with to generate ldif file
+ with seed 0
+ #@TestPreamble none
+ #@TestStep Do an make-ldif with seed of 0.
+ #@TestPostamble none
+ #@TestResult Success if make-ldif returns 0 and if the
+ output is correct.
+ -->
+ <testcase name="getTestCaseName
+ ('make-ldif: generate ldif file with seed 0')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'make-ldif: generate ldif file with seed 0'
+ </message>
+
+ <call function="'MakeLdifWithScript'">
+ {
+ 'templateFile' : template ,
+ 'ldifFile' : '%s/make-ldif_seed0_1.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'randomSeed' : 0
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg = 'LDIF processing complete. 161 entries written'
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : msg
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker make-ldif check behavior tests
+ #@TestName make-ldif: import generated data
+ #@TestIssue none
+ #@TestPurpose Check that data genereted witch make-ldif
+ are correct
+ #@TestPreamble none
+ #@TestStep Do an make-ldif with seed of 0.
+ #@TestStep Stop the server.
+ #@TestStep Import the data generated with make-ldif.
+ #@TestStep Start the server.
+ #@TestStep Search some entries using ldapsearch.
+ #@TestPostamble none
+ #@TestResult Success if ldapsearch returns the expected
+ number of entries.
+ -->
+ <testcase name="getTestCaseName
+ ('make-ldif: import generated data')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'make-ldif: generate a second ldif file with seed of 0'
+ </message>
+
+ <call function="'MakeLdifWithScript'">
+ {
+ 'templateFile' : template ,
+ 'ldifFile' : '%s/make-ldif_seed0_2.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'randomSeed' : 0
+ }
+ </call>
+
+ <message>
+ 'make-ldif: stop the server'
+ </message>
+
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <message>
+ 'make-ldif: import the data'
+ </message>
+
+ <call function="'ImportLdifWithScript'">
+ {
+ 'dsLdifFile' : '%s/make-ldif_seed0_2.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'dsBackEnd' : 'userRoot' ,
+ 'dsAppend' : 'True'
+ }
+ </call>
+
+ <call function="'checktestRC'">
+ {
+ 'returncode' : RC ,
+ 'result' : STAXResult
+ }
+ </call>
+
+ <message>
+ 'make-ldif: start the server'
+ </message>
+
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ {
+ 'noOfLoops' : 5 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <message>
+ 'make-ldif: search some entries to check that data are imported'
+ </message>
+ <call function="'ldapSearchWithScript'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'dsCountEntries' : 'True' ,
+ 'dsBaseDN' : 'ou=make-ldif,o=clu tests,dc=example,dc=com',
+ 'dsFilter' : 'objectclass=*' ,
+ 'expectedRC' : 'noCheck'
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'Total number of matching entries: 161'
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <!--- Test Case information
+ #@TestMarker make-ldif check behavior tests
+ #@TestName make-ldif: compare generated data
+ #@TestIssue none
+ #@TestPurpose Check that data genereted witch make-ldif
+ are correct
+ #@TestPreamble none
+ #@TestStep Do an make-ldif to generate a first file
+ without seed.
+ #@TestStep Do an make-ldif to generate a second file
+ without seed.
+ #@TestStep Do an make-ldif to generate a file
+ with seed of 5.
+ #@TestStep Compare files generated with seed of 0.
+ #@TestStep Compare one file generated with seed of 0 and
+ one generated without seed.
+ #@TestStep Compare files generated without seed.
+ #@TestStep Compare one file generated with seed of 0 and
+ one generated with seed of 5.
+ #@TestPostamble none
+ #@TestResult Success if ldif-diff returns 0 in each cases.
+ -->
+ <testcase name="getTestCaseName
+ ('make-ldif: compare generated data')">
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'make-ldif: generate a first ldif file without seed'
+ </message>
+
+ <call function="'MakeLdifWithScript'">
+ {
+ 'templateFile' : template ,
+ 'ldifFile' : '%s/make-ldif_noseed_1.ldif' \
+ % DIRECTORY_INSTANCE_DIR
+ }
+ </call>
+
+ <message>
+ 'make-ldif: generate a second ldif file without seed'
+ </message>
+
+ <call function="'MakeLdifWithScript'">
+ {
+ 'templateFile' : template ,
+ 'ldifFile' : '%s/make-ldif_noseed_2.ldif' \
+ % DIRECTORY_INSTANCE_DIR
+ }
+ </call>
+
+ <message>
+ 'make-ldif: generate a ldif file with seed of 5'
+ </message>
+
+ <call function="'MakeLdifWithScript'">
+ {
+ 'templateFile' : template ,
+ 'ldifFile' : '%s/make-ldif_seed5.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'randomSeed' : 5
+ }
+ </call>
+
+ <message>
+ 'make-ldif: ldifs with seed of 0 must be the same'
+ </message>
+
+ <call function="'LdifDiffWithScript'">
+ {
+ 'sourceLdif' : '%s/make-ldif_seed0_1.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'targetLdif' : '%s/make-ldif_seed0_2.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'outputLdif' : '%s/make-ldif_seed0.diff' \
+ % DIRECTORY_INSTANCE_DIR
+ }
+ </call>
+
+ <message>
+ 'make-ldif: ldifs with seed of 0 and no seed must \
+ be different'
+ </message>
+
+ <call function="'LdifDiffWithScript'">
+ {
+ 'sourceLdif' : '%s/make-ldif_seed0_1.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'targetLdif' : '%s/make-ldif_noseed_1.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'outputLdif' : '%s/make-ldif_noseed_1.diff' \
+ % DIRECTORY_INSTANCE_DIR
+ }
+ </call>
+
+ <message>
+ 'make-ldif: ldifs with no seed must be different'
+ </message>
+
+ <call function="'LdifDiffWithScript'">
+ {
+ 'sourceLdif' : '%s/make-ldif_noseed_1.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'targetLdif' : '%s/make-ldif_noseed_2.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'outputLdif' : '%s/make-ldif_noseed_2.diff' \
+ % DIRECTORY_INSTANCE_DIR
+ }
+ </call>
+
+ <message>
+ 'make-ldif: ldifs with seed of 0 and seed of 5 \
+ must be different'
+ </message>
+
+ <call function="'LdifDiffWithScript'">
+ {
+ 'sourceLdif' : '%s/make-ldif_seed0_1.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'targetLdif' : '%s/make-ldif_seed5.ldif' \
+ % DIRECTORY_INSTANCE_DIR ,
+ 'outputLdif' : '%s/make-ldif_seed5.diff' \
+ % DIRECTORY_INSTANCE_DIR
+ }
+ </call>
+
+ <call function="'testCase_Postamble'"/>
+
+ </sequence>
+
+ </testcase>
+
+ <call function="'testSuite_Postamble'"/>
+
+ </sequence>
+
+ </block>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opends/tests/shared/functions/tools.xml b/opends/tests/shared/functions/tools.xml
index b2cdfad..88ae327 100755
--- a/opends/tests/shared/functions/tools.xml
+++ b/opends/tests/shared/functions/tools.xml
@@ -72,7 +72,7 @@
<function-arg-property name="type" value="filename"/>
</function-arg-def>
- <function-arg-def name="randomSeed " type="optional">
+ <function-arg-def name="randomSeed" type="optional">
<function-arg-description>
The seed to use to initialize the random number generator
</function-arg-description>
@@ -128,7 +128,7 @@
'expectedRC': expectedRC
}
</call>
- <return>[RC, STAXResult]</return>
+ <return>STAXResult</return>
</sequence>
</function>
--
Gitblit v1.10.0