From b60e473cf6e0711814cf5ba70dd2d318fdfdb452 Mon Sep 17 00:00:00 2001
From: gary_williams <gary_williams@localhost>
Date: Tue, 25 Mar 2008 22:22:04 +0000
Subject: [PATCH] enable dsml test suite for daily tests

---
 opends/tests/functional-tests/testcases/dsml/dsml_test.xml  |  154 ++++++++++++++++++------------
 opends/tests/functional-tests/testcases/dsml/dsml_setup.xml |   90 +++++++----------
 opends/tests/shared/functions/webcontainer.xml              |   31 ++++-
 3 files changed, 157 insertions(+), 118 deletions(-)

diff --git a/opends/tests/functional-tests/testcases/dsml/dsml_setup.xml b/opends/tests/functional-tests/testcases/dsml/dsml_setup.xml
index 70dd3c5..970cb05 100755
--- a/opends/tests/functional-tests/testcases/dsml/dsml_setup.xml
+++ b/opends/tests/functional-tests/testcases/dsml/dsml_setup.xml
@@ -42,7 +42,6 @@
         CurrentTestPath['suite'] = STAXCurrentBlock
       </script>
       <call function="'testSuite_Preamble'"/>
-      <parallel>
         <sequence>
           <!--- Test Case information
               #@TestMarker          setup
@@ -146,8 +145,8 @@
               <script>
                 dsmlBaseDNs = {
                   'o=dsmlfe.com'      : ('dsmlfe.ldif', 'dsmlfe_BE'),
-                  'dc=example,dc=com'       : ('oasis.ldif', 'oasis_BE'),
-                  'o=IMC, c=US' : ('search.ldif', 'example_BE')
+                  'dc=example,dc=com' : ('oasis.ldif', 'oasis_BE'),
+                  'o=IMC, c=US'       : ('search.ldif', 'example_BE')
                 }
               </script>
               <iterate var="baseDN" in="dsmlBaseDNs.keys()">
@@ -159,49 +158,31 @@
                        DIRECTORY_INSTANCE_DIR, OPENDSNAME, dsmlBaseDNs.get(baseDN)[1],\
                        DIRECTORY_INSTANCE_DIR, OPENDSNAME)
                   </message>
+
+                  <message>
+                   'Create database backend %s.' % dsmlBaseDNs.get(baseDN)[1] 
+                  </message>
                   <script>
-                    ldapDB='%s/%s/db/%s' % \
-                             (DIRECTORY_INSTANCE_DIR,\
-                              OPENDSNAME, \
-                              dsmlBaseDNs.get(baseDN)[1])
-                    importTempDir='%s/%s/import-tmp/%s' % \
-                                    (DIRECTORY_INSTANCE_DIR, \
-                                     OPENDSNAME, \
-                                     dsmlBaseDNs.get(baseDN)[1])
+                    options=[]
+                    options.append('--backend-name %s' % dsmlBaseDNs.get(baseDN)[1])
+                    options.append('--set db-directory:%s' % dsmlBaseDNs.get(baseDN)[1])
+                    options.append('--set base-dn:"%s"' % baseDN)
+                    options.append('--set enabled:true')
+                    options.append('--set writability-mode:enabled')
+                    options.append('-t local-db')
+                    createBackendOptions=' '.join(options)
                   </script>
-                  <stafcmd name="'create import temp directory'">
-                    <location>'%s' % DIRECTORY_INSTANCE_HOST</location>
-                    <service>'fs'</service>
-                    <request>' CREATE DIRECTORY %s' % (importTempDir)</request>
-                  </stafcmd>
-                  <call function="'checkRC'">
-                    { 'returncode' : RC ,
-                      'result'     : STAXResult }
-                  </call>
-                  <stafcmd name="'create database directory'">
-                    <location>'%s' % DIRECTORY_INSTANCE_HOST</location>
-                    <service>'fs'</service>
-                    <request>' CREATE DIRECTORY %s' % (ldapDB)</request>
-                  </stafcmd>
-                  <call function="'checkRC'">
-                    { 'returncode' : RC ,
-                      'result'     : STAXResult }
-                  </call>
-                  <call function="'CreateBackendWithScript'">
-                    {
-                    'dsBaseDN' : '%s' % baseDN,
-                    'dsBackendID' : '%s' % dsmlBaseDNs.get(baseDN)[1],
-                    'dsLdapDB' : '%s' % ldapDB,
-                    'dsImportTempDir' : '%s' % importTempDir,
-                    'dsInstancePort' : '%s' % DIRECTORY_INSTANCE_PORT,
-                    'dsInstanceDn' : '%s' % DIRECTORY_INSTANCE_DN,
-                    'dsInstancePswd' : '%s' % DIRECTORY_INSTANCE_PSWD
+
+                  <call function="'dsconfig'">
+                    { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+                      'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
+                      'dsInstanceDn'   : DIRECTORY_INSTANCE_DN,
+                      'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+                      'subcommand'     : 'create-backend',
+                      'optionsString'  : createBackendOptions
                     }
                   </call>
-                  <call function="'checkRC'">
-                    { 'returncode' : RC ,
-                      'result'     : STAXResult }
-                  </call>
+
                   <call function="'importLdifTask'">
                     { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
                       'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
@@ -269,7 +250,7 @@
               #@TestPostamble       none
               #@TestResult          Success if deployWebApplicationWAR returns 0.
           -->
-          <testcase name="getTestCaseName('setup: deploy Webapplication %s' % DSML_WARPATH)">
+          <testcase name="getTestCaseName('setup: deploy Webapplication')">
             <sequence>
               <call function="'testCase_Preamble'"/>
               <message>
@@ -337,11 +318,19 @@
           <testcase name="getTestCaseName('configure: dsml web.xml port')">
             <sequence>
               <call function="'testCase_Preamble'"/>
-              <stafcmd name="'extract DSML gateway web.xml'">
-                <location>STAXServiceMachine</location>
-                <service>'zip'</service>
-                <request>'UNZIP ZIPFILE %s TODIRECTORY %s FILE WEB-INF/web.xml' % (DSML_WARPATH, TMPDIR)</request>
-              </stafcmd>
+              <message>
+                'setup: configure DSML gateway DS port param.'
+              </message>
+
+              <call function="'runSTAFCommand'">
+                { 'name'      :  'Extract DSML gateway web.xml',
+                  'location'  :  STAXServiceMachine,
+                  'service'   :  'ZIP',
+                  'request'   :  'UNZIP',
+                  'arguments' :  'ZIPFILE %s TODIRECTORY %s FILE WEB-INF/web.xml' % (DSML_WARPATH, TMPDIR)
+                }
+              </call>
+
               <script>
                 webXmlInput=open('%s/WEB-INF/web.xml' % TMPDIR,'r')
                 import re
@@ -357,9 +346,9 @@
               </script>
               <call function="'copyFile'">
                 { 'location' : STAXServiceMachine,
-                  'remotehost' : '%s' % location,
+                  'remotehost' : '%s' % STAF_REMOTE_HOSTNAME,
                   'srcfile' : '%s/WEB-INF/web.xml.out' % TMPDIR,
-                  'destfile' : '%s/%s-%s/webapps/dsml/WEB-INF/web.xml' % (TMPDIR,WC_TYPE,WC_VERSION)
+                  'destfile' : '%s/%s-%s/webapps/dsml/WEB-INF/web.xml' % (WC_DIRECTORY,WC_TYPE,WC_VERSION)
                  }
               </call>
               <call function="'checktestRC'">
@@ -372,7 +361,6 @@
             </sequence>
           </testcase>
         </sequence>
-      </parallel>
       <call function="'testSuite_Postamble'"/>
       </sequence>
     </block>
diff --git a/opends/tests/functional-tests/testcases/dsml/dsml_test.xml b/opends/tests/functional-tests/testcases/dsml/dsml_test.xml
index 7b1519f..67bf9c3 100755
--- a/opends/tests/functional-tests/testcases/dsml/dsml_test.xml
+++ b/opends/tests/functional-tests/testcases/dsml/dsml_test.xml
@@ -60,13 +60,18 @@
           -->
           <testcase name="getTestCaseName('dsml suites')">
             <sequence>
-              <message>'TESTS_DIR=%s / TESTS_DATA_DIR=%s' % (TESTS_DIR,TESTS_DATA_DIR)</message>
-              <stafcmd name="'STAF Command: list DSML suites families'">
-                <location>'%s' % location</location>
-                <service>'fs'</service>
-                <request>' LIST DIRECTORY %s/dsml/suites SORTBYNAME TYPE d' % \
-                 (TESTS_DATA_DIR)</request>
-              </stafcmd>
+
+              <message>'List DSML suites families'</message>
+
+              <call function="'runSTAFCommand'">
+                { 'name'      :  'list DSML suites families',
+                  'location'  :  STAXServiceMachine,
+                  'service'   :  'FS',
+                  'request'   :  'LIST DIRECTORY',
+                  'arguments' :  '%s/dsml/suites SORTBYNAME TYPE d' % TESTS_DATA_DIR
+                }
+              </call>
+
               <if expr="RC != 0">
                 <sequence>
                   <message>
@@ -79,6 +84,9 @@
               <script>
                 cmdRC=RC
                 familyList=STAFResult
+                # The subversion folder could be present, if so remove it
+                if familyList.count != 0:
+                  familyList.remove('.svn')
                 import re
                 import base64
                 runFileRE = re.compile( 'dat$')
@@ -93,27 +101,36 @@
               <message>'DSML familyList = %s' % familyList</message>
               <iterate var="family" in="familyList">
                 <sequence>
-                  <message>'DSML family %s ' % (family)</message>
-                  <stafcmd name="'STAF Command: list DSML suite %s input' % (family)">
-                    <location>'%s' % location</location>
-                    <service>'fs'</service>
-                    <request>' LIST DIRECTORY %s/dsml/suites/%s/data \
-                      SORTBYNAME EXT dat TYPE f' % (TESTS_DATA_DIR,family)
-                    </request>
-                  </stafcmd>
+                  <message>'DSML family %s ' % family</message>
+
+                  <call function="'runSTAFCommand'">
+                    { 'name'      :  'List DSML suite %s input' % family,
+                      'location'  :  STAXServiceMachine,
+                      'service'   :  'FS',
+                      'request'   :  'LIST DIRECTORY',
+                      'arguments' :  '%s/dsml/suites/%s/data \
+                                      SORTBYNAME EXT dat TYPE f' % (TESTS_DATA_DIR,family)
+                    }
+                  </call>
+
                   <script>
                     familyInput = STAFResult
                   </script>
-                  <stafcmd name="'STAF Command: list DSML suite %s expected results' % (family)">
-                    <location>'%s' % location</location>
-                    <service>'fs'</service>
-                    <request>' LIST DIRECTORY %s/dsml/suites/%s/data \
-                      SORTBYNAME EXT res TYPE f' % (TESTS_DATA_DIR,family)
-                    </request>
-                  </stafcmd>
+
+                  <call function="'runSTAFCommand'">
+                    { 'name'      :  'List DSML suite %s expected results' % family,
+                      'location'  :  STAXServiceMachine,
+                      'service'   :  'FS',
+                      'request'   :  'LIST DIRECTORY',
+                      'arguments' :  '%s/dsml/suites/%s/data \
+                                      SORTBYNAME EXT res TYPE f' % (TESTS_DATA_DIR,family)
+                    }
+                  </call>
+
                   <script>
                     familyExpected = STAFResult
                   </script>
+
                   <iterate var="test" in="familyInput">
                     <testcase name="getTestCaseName('%s-%s' % (family,test))">
                       <sequence>
@@ -131,11 +148,16 @@
                           else:
                             url = urls['noSSL']
                         </script>
-                        <stafcmd name="'STAF Command: list DSML suite %s file %s' % (family,test)">
-                          <location>'%s' % location</location>
-                          <service>'fs'</service>
-                          <request>'GET FILE %s' % requestFilePath</request>
-                        </stafcmd>
+
+                        <call function="'runSTAFCommand'">
+                          { 'name'      :  'List DSML suite %s file %s' % (family,test),
+                            'location'  :  STAXServiceMachine,
+                            'service'   :  'FS',
+                            'request'   :  'GET FILE',
+                            'arguments' :  requestFilePath
+                          }
+                        </call>
+
                         <script>
                           from com.ibm.staf import STAFUtil
                           BODYSeparator = '\n\n'
@@ -162,14 +184,17 @@
                             
                           SOAPBody = STAFUtil.wrapData(STAFResult[BODYStart+len(BODYSeparator):])
                         </script>
-                        <stafcmd name="'submit SOAPBody '">
-                          <location>'local'</location>
-                          <service>'http'</service>
-                          <request>
-                            'REQUEST METHOD POST URL %s FOLLOWREDIRECT %s CONTENT %s RETURNHEADERS ' % \
-                            (url, SOAPHeaders, SOAPBody)
-                          </request>
-                        </stafcmd>
+
+                        <call function="'runSTAFCommand'">
+                          { 'name'      :  'Submit SOAPBody',
+                            'location'  :  STAXServiceMachine,
+                            'service'   :  'HTTP',
+                            'request'   :  'REQUEST METHOD POST',
+                            'arguments' :  'URL %s FOLLOWREDIRECT %s CONTENT %s RETURNHEADERS ' \
+                                            % (url, SOAPHeaders, SOAPBody)
+                          }
+                        </call>
+
                         <call function="'checktestRC'">
                           {
                           'returncode' : RC ,
@@ -192,13 +217,16 @@
                               f.close()
                             </script>
                             <message>'Comparing result %s and expected result %s' %  (runFilePath, expectedFilePath)</message>
-                            <stafcmd name="'compared SOAPResult with expected'">
-                              <location>'%s' % location</location>
-                              <service>'dsml'</service>
-                              <request>
-                                'COMPARE FILE %s EXP_FILE %s' %(runFilePath, expectedFilePath)
-                              </request>
-                            </stafcmd>
+
+                            <call function="'runSTAFCommand'">
+                              { 'name'      :  'Compare SOAPResult with expected result',
+                                'location'  :  STAXServiceMachine,
+                                'service'   :  'DSML',
+                                'request'   :  'COMPARE FILE',
+                                'arguments' :  '%s EXP_FILE %s' %(runFilePath, expectedFilePath)
+                              }
+                            </call>
+
                             <call function="'checktestRC'">
                               {
                               'returncode' : RC ,
@@ -217,17 +245,20 @@
                         </if>
                         <if expr="dsmlSvcLoaded == False">
                           <sequence>
-                            <stafcmd name="'load DSML service'">
-                            <location>'%s' % location</location>
-                            <service>'service'</service>
-                            <request>
-                              'ADD SERVICE DSML LIBRARY JSTAF \
-                                 EXECUTE %s/ext/staf/dsmlService.jar \
-                                 OPTION JVMNAME=dsmlJVM  \
-                                 OPTION J2=-Xmx512m' % \
-                                 TESTS_ROOT
-                            </request>
-                            </stafcmd> 
+
+                            <call function="'runSTAFCommand'">
+                              { 'name'      :  'Load DSML service',
+                                'location'  :  STAXServiceMachine,
+                                'service'   :  'SERVICE',
+                                'request'   :  'ADD SERVICE',
+                                'arguments' :  'DSML LIBRARY JSTAF \
+                                                EXECUTE %s/ext/staf/dsmlService.jar \
+                                                OPTION JVMNAME=dsmlJVM  \
+                                                OPTION J2=-Xmx512m' % \
+                                                TESTS_ROOT
+                              }
+                            </call>
+                            
                             <script>
                               dsmlSvcLoaded = True
                             </script>
@@ -242,13 +273,16 @@
               </iterate>
               <if expr="dsmlSvcLoaded == True">
                 <sequence>
-                  <stafcmd name="'unload DSML service'">
-                    <location>'%s' % location</location>
-                    <service>'service'</service>
-                    <request>
-                      'REMOVE SERVICE DSML'
-                    </request>
-                  </stafcmd>
+
+                  <call function="'runSTAFCommand'">
+                    { 'name'      :  'Unload DSML service',
+                      'location'  :  STAXServiceMachine,
+                      'service'   :  'SERVICE',
+                      'request'   :  'REMOVE SERVICE',
+                      'arguments' :  'DSML'
+                    }
+                  </call>
+
                   <script>
                     dsmlSvcLoaded = True
                   </script>
diff --git a/opends/tests/shared/functions/webcontainer.xml b/opends/tests/shared/functions/webcontainer.xml
index 7cccff4..0550eed 100755
--- a/opends/tests/shared/functions/webcontainer.xml
+++ b/opends/tests/shared/functions/webcontainer.xml
@@ -50,19 +50,36 @@
     <try>
       
       <sequence>
+
+        <script>
+          mylocation=location
+        </script>
         
+        <!-- Copy webcontainer zip archive to remote host -->
+        <message>
+          'Copy webcontainer %s to host %s' % (WC_ZIPNAME,location)
+        </message>
+        <call function="'copyFile'">
+          { 'location'   : STAXServiceMachine,
+            'srcfile'    : '%s/%s' % (WC_ZIPPATH,WC_ZIPNAME),
+            'destfile'   : '%s/%s' % (wcPath,WC_ZIPNAME),
+            'remotehost' : mylocation
+          }
+        </call>
+                      
         <!-- Unzip webcontainer into temporary folder -->
         <message>
           'Extract temporary webcontainer zip archive to %s %s.' % (location, wcPath)
         </message>
         <call function="'unZipFile'">
-          { 'location' : location, 
-          'zipfile'  : '%s/%s' % (WC_ZIPPATH,WC_ZIPNAME), 
-          'unzipdir' : '%s' % wcPath }
+          { 'location' : mylocation, 
+            'zipfile'  : '%s/%s' % (wcPath,WC_ZIPNAME), 
+            'unzipdir' : '%s' % wcPath }
         </call>
+
         <!-- chmod +x all the .sh file in tomcat bin directory -->
         <stafcmd name="'create import temp directory'">
-          <location>'%s' % location</location>
+          <location>'%s' % mylocation</location>
           <service>'fs'</service>
           <request>' LIST DIRECTORY %s/%s-%s/bin EXT sh' % \
                    (wcPath, WC_TYPE, WC_VERSION)</request>
@@ -73,7 +90,7 @@
         </script>
         <message>'shFilesResult=%s' % shFilesResult</message>
         <process name="'chmod +x tomcat\'s shell scripts'">
-          <location>'%s' % location</location>
+          <location>'%s' % mylocation</location>
           <command mode="'shell'">'chmod +x %s' % shFilesResult</command>
           <parms/>
           <workdir>'%s/%s-%s/bin' % (wcPath, WC_TYPE, WC_VERSION)</workdir>
@@ -88,7 +105,7 @@
           'Configure webcontainer ports HTTP %s / HTTPS %s' % (WC_PORT, WC_SSL_PORT)
         </message>
         <stafcmd name="'get tomcat configuration file'">
-          <location>'%s' % location</location>
+          <location>'%s' % mylocation</location>
           <service>'fs'</service>
           <request>' GET FILE %s/%s-%s/conf/server.xml ' % \
                    (wcPath, WC_TYPE, WC_VERSION)</request>
@@ -217,7 +234,7 @@
         if wcPath:
           wcBinPath='%s/bin' % wcPath
           STAFCmd='%s/shutdown.sh' % wcBinPath
-          STAFCmdEnv=['CATALINA_HOME=%s' % wcPath,'PATH=/bin:/usr/bin'\
+          STAFCmdEnv=['CATALINA_HOME=%s' % wcPath,'PATH=/bin:/usr/bin',\
                       'JAVA_HOME=%s' % JAVA_HOME]
       </script>
       

--
Gitblit v1.10.0