From 4cdb29a91e6cb2c6820d8474fd2fdcb6b1f69da8 Mon Sep 17 00:00:00 2001
From: gary_williams <gary_williams@localhost>
Date: Tue, 09 Dec 2008 08:39:18 +0000
Subject: [PATCH] fix tasks test suite, add verification to schema tests
---
opends/tests/staf-tests/functional-tests/testcases/schema/solaris/schema_solaris_tests.xml | 88 +++++++++++-
opends/tests/staf-tests/functional-tests/testcases/schema/solaris/schema_solaris.xml | 7
opends/tests/staf-tests/functional-tests/testcases/tasks/setup.xml | 116 +++++++++-------
opends/tests/staf-tests/functional-tests/testcases/tasks/export-ldif.xml | 43 ++++++
opends/tests/staf-tests/functional-tests/testcases/schema/rfc/schema_rfc.xml | 16 --
opends/tests/staf-tests/functional-tests/testcases/schema/schema.xml | 18 ++
opends/tests/staf-tests/functional-tests/testcases/tasks/cleanup.xml | 85 +++++++-----
7 files changed, 260 insertions(+), 113 deletions(-)
diff --git a/opends/tests/staf-tests/functional-tests/testcases/schema/rfc/schema_rfc.xml b/opends/tests/staf-tests/functional-tests/testcases/schema/rfc/schema_rfc.xml
index f229ce5..65011ec 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/schema/rfc/schema_rfc.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/schema/rfc/schema_rfc.xml
@@ -74,22 +74,6 @@
<!-- Specific to rfc tests -->
<script>
__baseDN='o=rfc tests, dc=example,%s' % server.suffix
-
- def parse_stax_result(result):
-
- if result.__class__ is org.python.core.PyList:
- _unwrapResult=result[1][0]
-
- try:
- _functionString=_unwrapResult[1]
- except AttributeError:
- _functionString='Unable to parse result.'
- elif result.__class__ is org.python.core.PyString:
- _functionString=STAXResult
- else:
- _functionString='Unable to parse result.'
-
- return _functionString
</script>
<!-- List of Test Cases -->
diff --git a/opends/tests/staf-tests/functional-tests/testcases/schema/schema.xml b/opends/tests/staf-tests/functional-tests/testcases/schema/schema.xml
index 8544e37..ae9a155 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/schema/schema.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/schema/schema.xml
@@ -65,7 +65,7 @@
suiteList.append('dynamic')
suiteList.append('solaris')
</script>
-
+
<!-- Data global to this test group -->
<!-- LDAP Server Object -->
<script>
@@ -77,6 +77,22 @@
server.dn = DIRECTORY_INSTANCE_DN
server.password = DIRECTORY_INSTANCE_PSWD
server.suffix = DIRECTORY_INSTANCE_SFX
+
+ def parse_stax_result(result):
+
+ if result.__class__ is org.python.core.PyList:
+ _unwrapResult=result[1][0]
+
+ try:
+ _functionString=_unwrapResult[1]
+ except AttributeError:
+ _functionString='Unable to parse result.'
+ elif result.__class__ is org.python.core.PyString:
+ _functionString=STAXResult
+ else:
+ _functionString='Unable to parse result.'
+
+ return _functionString
</script>
<!-- Run the test suites -->
diff --git a/opends/tests/staf-tests/functional-tests/testcases/schema/solaris/schema_solaris.xml b/opends/tests/staf-tests/functional-tests/testcases/schema/solaris/schema_solaris.xml
index da087c8..c730f1a 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/schema/solaris/schema_solaris.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/schema/solaris/schema_solaris.xml
@@ -70,6 +70,11 @@
<!-- Test Suite Setup -->
<call function="'%s_setup' % __group"/>
+
+ <!-- Specific to solaris schema tests -->
+ <script>
+ __baseDN='o=Solaris schema tests, dc=example,%s' % server.suffix
+ </script>
<!-- List of Test Cases -->
<script>
@@ -106,7 +111,7 @@
<finally>
<sequence>
<!-- Test Suite Cleanup -->
- <message>'Finally: Example Cleanup.'</message>
+ <message>'Finally: Solaris Schema Cleanup.'</message>
<call function="'%s_cleanup' % __group"/>
<call function="'testSuite_Postamble'"/>
</sequence>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/schema/solaris/schema_solaris_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/schema/solaris/schema_solaris_tests.xml
index 3e8b271..53a4fcb 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/schema/solaris/schema_solaris_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/schema/solaris/schema_solaris_tests.xml
@@ -26,7 +26,7 @@
! Copyright 2008 Sun Microsystems, Inc.
! -->
<stax>
-
+
<!-- Definition of Test Cases -->
<!--- Test Case : Schema: Add Solaris Schema Entries -->
@@ -67,14 +67,49 @@
}
</call>
- <!-- TODO: Need to verify that the added entry is working as specified -->
-
+ <call function="'runFunction'">
+ { 'functionName' : 'ldapSearchWithScript' ,
+ 'functionMessage' : 'Search for the entry just added and return rfc822mailMember.' ,
+ 'functionException' : 'LDAP.SearchException' ,
+ 'functionArguments' : { 'dsInstanceHost' : server.host ,
+ 'dsInstancePort' : server.port ,
+ 'dsInstanceDn' : server.dn ,
+ 'dsInstancePswd' : server.password ,
+ 'dsBaseDN' : __baseDN ,
+ 'dsFilter' : 'objectclass=*' ,
+ 'dsAttributes' : 'rfc822mailMember' }
+ }
+ </call>
+
+ <script>
+ _functionString=parse_stax_result(STAXResult)
+ </script>
+
+ <call function="'runFunction'">
+ { 'functionName' : 'checktestString' ,
+ 'functionMessage' : 'Check that the rfc822mailMember attribute is returned.' ,
+ 'functionException' : 'Utils.CheckStringException' ,
+ 'functionArguments' : { 'expectedString' : 'rfc822mailMember: nisMailAlias@sun.com' ,
+ 'returnString' : _functionString }
+ }
+ </call>
</sequence>
- <catch exception="'STAXException.LDAP.ModifyException'" typevar="eType" var="eInfo">
+
+ <catch exception="'STAXException.LDAP.AddException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
- '%s: LDAPModify failed. eInfo(%s)' % (eType,eInfo)
+ '%s: LDAPAdd failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
+ <catch exception="'STAXException.LDAP.SearchException'" typevar="eType" var="eInfo">
+ <message log="1" level="'fatal'">
+ '%s: LDAPSearch failed. eInfo(%s)' % (eType,eInfo)
+ </message>
+ </catch>
+ <catch exception="'STAXException.Utils.CheckStringException'" typevar="eType" var="eInfo">
+ <message log="1" level="'fatal'">
+ '%s: UtilsCheck failed. eInfo(%s)' % (eType,eInfo)
+ </message>
+ </catch>
<finally>
<call function="'testCase_Postamble'"/>
</finally>
@@ -121,12 +156,47 @@
}
</call>
- <!-- TODO: Need to verify that the added entry is working as specified -->
-
+ <call function="'runFunction'">
+ { 'functionName' : 'ldapSearchWithScript' ,
+ 'functionMessage' : 'Search for the entry just added and return nisDomain.' ,
+ 'functionException' : 'LDAP.SearchException' ,
+ 'functionArguments' : { 'dsInstanceHost' : server.host ,
+ 'dsInstancePort' : server.port ,
+ 'dsInstanceDn' : server.dn ,
+ 'dsInstancePswd' : server.password ,
+ 'dsBaseDN' : __baseDN ,
+ 'dsFilter' : 'objectclass=*' ,
+ 'dsAttributes' : 'nisDomain' }
+ }
+ </call>
+
+ <script>
+ _functionString=parse_stax_result(STAXResult)
+ </script>
+
+ <call function="'runFunction'">
+ { 'functionName' : 'checktestString' ,
+ 'functionMessage' : 'Check that the nisDomain attribute is returned.' ,
+ 'functionException' : 'Utils.CheckStringException' ,
+ 'functionArguments' : { 'expectedString' : 'nisDomain: rfc4876' ,
+ 'returnString' : _functionString }
+ }
+ </call>
</sequence>
- <catch exception="'STAXException.LDAP.ModifyException'" typevar="eType" var="eInfo">
+
+ <catch exception="'STAXException.LDAP.AddException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
- '%s: LDAPModify failed. eInfo(%s)' % (eType,eInfo)
+ '%s: LDAPAdd failed. eInfo(%s)' % (eType,eInfo)
+ </message>
+ </catch>
+ <catch exception="'STAXException.LDAP.SearchException'" typevar="eType" var="eInfo">
+ <message log="1" level="'fatal'">
+ '%s: LDAPSearch failed. eInfo(%s)' % (eType,eInfo)
+ </message>
+ </catch>
+ <catch exception="'STAXException.Utils.CheckStringException'" typevar="eType" var="eInfo">
+ <message log="1" level="'fatal'">
+ '%s: UtilsCheck failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/tasks/cleanup.xml b/opends/tests/staf-tests/functional-tests/testcases/tasks/cleanup.xml
index 896c148..6e41f25 100755
--- a/opends/tests/staf-tests/functional-tests/testcases/tasks/cleanup.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/tasks/cleanup.xml
@@ -32,41 +32,56 @@
<sequence>
<block name="'cleanup'">
<sequence>
- <block name="'Block DS Process Stop'">
- <!--- Stop DS -->
- <sequence>
- <message>
- 'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
- </message>
-
- <call function="'StopDsWithScript'">
- { 'location' : STAF_REMOTE_HOSTNAME,
- 'dsHost' : DIRECTORY_INSTANCE_HOST,
- 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
- 'dsBindDN' : DIRECTORY_INSTANCE_DN,
- 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
- </call>
- <call function="'checkRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult }
- </call>
- </sequence>
- <!--- End Block DS Process Stop -->
- </block>
- <block name="'Block Remove DS Topology'">
- <!-- Remove the topology created for the test suite -->
- <sequence>
- <message>
- 'Remove DS topology created for the Test Suite'
- </message>
- <call function="'removeTopology'"/>
- <call function="'checkRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult }
- </call>
- </sequence>
- <!-- End Block Remove DS Topology-->
- </block>
+
+ <script>
+ CurrentTestPath['suite']='cleanup_tasks'
+ </script>
+ <call function="'testSuite_Preamble'" />
+
+ <testcase name="getTestCaseName('Cleanup tasks')">
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <block name="'Block DS Process Stop'">
+ <!--- Stop DS -->
+ <sequence>
+ <message>
+ 'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
+ </message>
+
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'dsHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+ 'dsBindDN' : DIRECTORY_INSTANCE_DN,
+ 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
+ </call>
+ <call function="'checkRC'">
+ { 'returncode' : RC ,
+ 'result' : STAXResult }
+ </call>
+ </sequence>
+ <!--- End Block DS Process Stop -->
+ </block>
+ <block name="'Block Remove DS Topology'">
+ <!-- Remove the topology created for the test suite -->
+ <sequence>
+ <message>
+ 'Remove DS topology created for the Test Suite'
+ </message>
+ <call function="'removeTopology'"/>
+ <call function="'checkRC'">
+ { 'returncode' : RC ,
+ 'result' : STAXResult }
+ </call>
+ </sequence>
+ <!-- End Block Remove DS Topology-->
+ </block>
+ <call function="'testCase_Postamble'"/>
+ </sequence>
+ </testcase>
+ <call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/tasks/export-ldif.xml b/opends/tests/staf-tests/functional-tests/testcases/tasks/export-ldif.xml
index 5687958..10034ec 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/tasks/export-ldif.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/tasks/export-ldif.xml
@@ -74,6 +74,27 @@
'startTask' : '0',
'backEnd' : DIRECTORY_INSTANCE_BE}
</call>
+
+ <!-- manage-tasks -->
+ <call function="'manage-tasks'">
+ { 'location' : STAF_REMOTE_HOSTNAME ,
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+ 'dsQuiet' : ' '
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'searchStringForSubstring'">
+ { 'returnString' : returnString,
+ 'testString' : 'Completed successfully',
+ 'expectedResult' : '1' }
+ </call>
+
<message>'--- Check log files export_asynchronous ---'</message>
<call function="'listFolder'">
{ 'location' : '%s' % (STAF_REMOTE_HOSTNAME),
@@ -138,7 +159,7 @@
<call function="'searchStringForSubstring'">
{ 'returnString' : returnString,
- 'testString' : 'Export',
+ 'testString' : 'Completed successfully',
'expectedResult' : '1' }
</call>
@@ -189,6 +210,26 @@
'startTask' : '20061212000000',
'backEnd' : DIRECTORY_INSTANCE_BE}
</call>
+
+ <!-- manage-tasks -->
+ <call function="'manage-tasks'">
+ { 'location' : STAF_REMOTE_HOSTNAME ,
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+ 'dsQuiet' : ' '
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'searchStringForSubstring'">
+ { 'returnString' : returnString,
+ 'testString' : 'Completed successfully',
+ 'expectedResult' : '1' }
+ </call>
<message>'--- Check log files export_asynchronous ---'</message>
<call function="'listFolder'">
diff --git a/opends/tests/staf-tests/functional-tests/testcases/tasks/setup.xml b/opends/tests/staf-tests/functional-tests/testcases/tasks/setup.xml
index 09a6cbd..e4d005f 100755
--- a/opends/tests/staf-tests/functional-tests/testcases/tasks/setup.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/tasks/setup.xml
@@ -32,56 +32,72 @@
<sequence>
<block name="'setup'">
<sequence>
- <block name="'Block Create DS Topology'">
- <!-- Create the topology necessary to the test group/suite -->
- <sequence>
- <message>
- 'Create DS topology as described in config.py'
- </message>
- <call function="'createTopology'">
- { 'initialiseInstance' : True }
- </call>
- <call function="'checkRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult }
- </call>
- </sequence>
- <!--- End Block Create DS Topology -->
- </block>
- <block name="'Block DS Process Active'">
- <!--- Start DS -->
- <sequence>
- <message>
- 'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
- </message>
-
- <!--- Start DS -->
- <call function="'StartDsWithScript'">
- { 'location' : STAF_REMOTE_HOSTNAME }
- </call>
-
- <call function="'checkRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult }
- </call>
-
- <!--- Check that DS started -->
- <call function="'isAlive'">
- { 'noOfLoops' : 5 ,
- 'noOfMilliSeconds' : 2000 }
- </call>
-
- <call function="'ldapSearchWithScript'">
- { 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
- 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
- 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
- 'dsBaseDN' : 'dc=com' ,
- 'dsFilter' : 'objectclass=*' }
- </call>
-
- </sequence>
- <!--- End Block DS Process Active -->
- </block>
+
+ <script>
+ CurrentTestPath['suite']='setup_tasks'
+ </script>
+ <call function="'testSuite_Preamble'" />
+
+ <testcase name="getTestCaseName('Setup tasks')">
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <block name="'Block Create DS Topology'">
+ <!-- Create the topology necessary to the test group/suite -->
+ <sequence>
+ <message>
+ 'Create DS topology as described in config.py'
+ </message>
+ <call function="'createTopology'">
+ { 'initialiseInstance' : True }
+ </call>
+ <call function="'checkRC'">
+ { 'returncode' : RC ,
+ 'result' : STAXResult }
+ </call>
+ </sequence>
+ <!--- End Block Create DS Topology -->
+ </block>
+ <block name="'Block DS Process Active'">
+ <!--- Start DS -->
+ <sequence>
+ <message>
+ 'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
+ </message>
+
+ <!--- Start DS -->
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <call function="'checkRC'">
+ { 'returncode' : RC ,
+ 'result' : STAXResult }
+ </call>
+
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ { 'noOfLoops' : 5 ,
+ 'noOfMilliSeconds' : 2000 }
+ </call>
+
+ <call function="'ldapSearchWithScript'">
+ { 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'dsBaseDN' : 'dc=com' ,
+ 'dsFilter' : 'objectclass=*' }
+ </call>
+
+ </sequence>
+ <!--- End Block DS Process Active -->
+
+ </block>
+
+ <call function="'testSuite_Postamble'"/>
+ </sequence>
+ </testcase>
</sequence>
</block>
</sequence>
--
Gitblit v1.10.0