From 423529cf1574a9832f0c37155ff48c10eefdeac0 Mon Sep 17 00:00:00 2001
From: gary_williams <gary_williams@localhost>
Date: Mon, 18 Jun 2007 19:30:21 +0000
Subject: [PATCH] Issue 1796 use setup -n on windows to avoid service issues

---
 opendj-sdk/opends/tests/functional-tests/shared/functions/baselib.xml  |    2 
 opendj-sdk/opends/tests/functional-tests/shared/functions/topology.xml |   34 ++++++--
 opendj-sdk/opends/tests/functional-tests/shared/functions/dsadm.xml    |  196 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 221 insertions(+), 11 deletions(-)

diff --git a/opendj-sdk/opends/tests/functional-tests/shared/functions/baselib.xml b/opendj-sdk/opends/tests/functional-tests/shared/functions/baselib.xml
index 6435bd8..17c1d89 100755
--- a/opendj-sdk/opends/tests/functional-tests/shared/functions/baselib.xml
+++ b/opendj-sdk/opends/tests/functional-tests/shared/functions/baselib.xml
@@ -96,7 +96,7 @@
           DSInfo.ServerDict['system name']= \
             DSInfo.getServerValueFromKey('System Name',DSInfo.SystemDict)
           
-          DSInfoServersDict[dsPath]=DSInfo.ServerDict
+          DSInfoServersDict[mypath]=DSInfo.ServerDict
         </script>
       
       </else>
diff --git a/opendj-sdk/opends/tests/functional-tests/shared/functions/dsadm.xml b/opendj-sdk/opends/tests/functional-tests/shared/functions/dsadm.xml
index 518fe4a..28f46d9 100755
--- a/opendj-sdk/opends/tests/functional-tests/shared/functions/dsadm.xml
+++ b/opendj-sdk/opends/tests/functional-tests/shared/functions/dsadm.xml
@@ -27,7 +27,7 @@
  ! -->
 <stax>
   
-  <!-- This function configures DS using the configure-ds script -->
+  <!-- This function sets up DS using the setup script -->
   <function name="SetUpDsWithScript">
     <function-prolog>
       This function sets up a Directory Server using a script
@@ -81,6 +81,12 @@
         </function-arg-description>
         <function-arg-property name="type" value="filename"/>
       </function-arg-def>
+      <function-arg-def name="dsNoWindowsService" type="optional">
+        <function-arg-description>
+          Do not enable as a Windows Service
+        </function-arg-description>
+        <function-arg-property name="type" value="boolean"/>
+      </function-arg-def>            
       <function-arg-def name="dsHelp" type="optional">
         <function-arg-description>
           Help option
@@ -118,6 +124,9 @@
         
         if dsBindPwdFile:
           STAFCmdParamsList.append('-j "%s"' % dsBindPwdFile)
+
+        if dsNoWindowsService:
+          STAFCmdParamsList.append('-n')
         
         if dsHelp:
           STAFCmdParamsList.append('-H')
@@ -148,6 +157,189 @@
     </sequence>
   </function>
 
+  <!-- This function configures DS using the configure-ds script -->
+  <function name="ConfigureDsWithScript">
+    <function-prolog>
+      This function configures a Directory Server using a script
+    </function-prolog>    
+    <function-map-args>
+      <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine">
+        <function-arg-description>
+          Location of target host
+        </function-arg-description>
+        <function-arg-property name="type" value="hostname"/>
+      </function-arg-def>
+      <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
+        <function-arg-description>
+          Pathname to installation root
+        </function-arg-description>
+        <function-arg-property name="type" value="filepath"/>
+      </function-arg-def>
+      <function-arg-def name="dsVersion" type="optional">
+        <function-arg-description>
+          Display Directory Server version information
+        </function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+      </function-arg-def>
+      <function-arg-def name="dsLdapPort" type="optional">
+        <function-arg-description>
+          Directory server LDAP port number
+        </function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+      </function-arg-def>
+      <function-arg-def name="dsLdapsPort" type="optional">
+        <function-arg-description>
+          Directory server LDAPS port number
+        </function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+      </function-arg-def>      
+      <function-arg-def name="dsEnableStartTLS" type="optional">
+        <function-arg-description>
+          Specifies whether to enable or not StartTLS
+        </function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+      </function-arg-def>   
+      <function-arg-def name="dsJmxPort" type="optional">
+        <function-arg-description>
+          Directory server JMX port number
+        </function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+      </function-arg-def>
+      <function-arg-def name="dsKeyManagerProviderDN" type="optional">
+        <function-arg-description>
+          DN of the key manager provider to use for SSL and/or StartTLS
+        </function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+      </function-arg-def>      
+      <function-arg-def name="dsTrustManagerProviderDN" type="optional">
+        <function-arg-description>
+          DN of the trust manager provider to use for SSL and/or StartTLS
+        </function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+      </function-arg-def>
+      <function-arg-def name="dsKeyManagerPath" type="optional">
+        <function-arg-description>
+          Path of the keystore to be used by the key manager provider
+        </function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+      </function-arg-def>
+      <function-arg-def name="dsCertNickName" type="optional">
+        <function-arg-description>
+          Nickname of the certificate
+        </function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+      </function-arg-def>         
+      <function-arg-def name="dsBaseDN" type="optional">
+        <function-arg-description>
+          Base DN (only single base DN supported).
+        </function-arg-description>
+        <function-arg-property name="type" value="DN"/>
+      </function-arg-def>
+      <function-arg-def name="dsRootUserDN" type="optional">
+        <function-arg-description>
+          Root User Bind DN
+        </function-arg-description>
+        <function-arg-property name="type" value="DN"/>
+      </function-arg-def> 
+      <function-arg-def name="dsRootPassword" type="optional">
+        <function-arg-description>
+          Root User Bind password
+        </function-arg-description>
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>          
+      <function-arg-def name="dsRootPasswordFile" type="optional">
+        <function-arg-description>
+          Root User password file
+        </function-arg-description>
+        <function-arg-property name="type" value="filename"/>
+      </function-arg-def>
+      <function-arg-def name="dsHelp" type="optional">
+        <function-arg-description>
+          Help option
+        </function-arg-description>
+        <function-arg-property name="help" value="option"/>
+      </function-arg-def>    
+    </function-map-args>
+    
+    <sequence>
+    
+      <!-- Build the Command -->
+      <script>
+        STAFCmdParamsList=[]
+        STAFCmdParams=''
+
+        if dsPath:
+          dsBinPath='%s/%s' % (dsPath,fileFolder) 
+          STAFCmd='%s/configure-ds%s' % (dsBinPath,fileExt)         
+
+        if dsVersion:
+          STAFCmdParamsList.append('-V %s' % dsVersion)
+                            
+        if dsLdapPort:
+          STAFCmdParamsList.append('-p %s' % dsLdapPort)
+
+        if dsLdapsPort:
+          STAFCmdParamsList.append('-P %s' % dsLdapsPort)
+          
+        if dsEnableStartTLS:
+          STAFCmdParamsList.append('-q %s' % dsEnableStartTLS)
+                  
+        if dsJmxPort:
+          STAFCmdParamsList.append('-x %s' % dsJmxPort)
+
+        if dsKeyManagerProviderDN:
+          STAFCmdParamsList.append('-k "%s"' % dsKeyManagerProviderDN)
+          
+        if dsTrustManagerProviderDN:
+          STAFCmdParamsList.append('-t "%s"' % dsTrustManagerProviderDN)
+          
+        if dsKeyManagerPath:
+          STAFCmdParamsList.append('-m "%s"' % dsKeyManagerPath)
+          
+        if dsCertNickName:
+          STAFCmdParamsList.append('-a "%s"' % dsCertNickName)
+                        
+        if dsBaseDN:
+          STAFCmdParamsList.append('-b "%s"' % dsBaseDN)
+
+        if dsRootUserDN:
+          STAFCmdParamsList.append('-D "%s"' % dsRootUserDN)
+        
+        if dsRootPassword:
+          STAFCmdParamsList.append('-w "%s"' % dsRootPassword)
+        
+        if dsRootPasswordFile:
+          STAFCmdParamsList.append('-j "%s"' % dsRootPasswordFile)
+
+        if dsHelp:
+          STAFCmdParamsList.append('-H')
+ 
+        STAFCmdParams=' '.join(STAFCmdParamsList)
+      </script>
+      
+      <message>
+        '%s %s' % (STAFCmd, STAFCmdParams)
+      </message>
+            
+      <process name="'Setup DS Script'">
+        <location>'%s' % location</location>
+        <command>'%s' % STAFCmd</command>
+        <parms>'%s' % STAFCmdParams</parms>
+        <workdir>'%s' % dsBinPath</workdir>
+        <envs>
+          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
+        </envs>
+        <console use="'same'"/>
+        <stderr mode="'stdout'"/>
+        <returnstdout/>
+      </process>
+      <call function="'checkRC'">
+        { 'returncode' : RC ,
+          'result'     : STAXResult }
+      </call>
+    </sequence>
+  </function>
+  
   <!-- This function starts DS using the start-ds script -->
   <function name="StartDsWithScript">
     <function-prolog>
@@ -2301,7 +2493,7 @@
       
       <if expr="STAXCode != 0">
         <sequence>
-          <message>
+          <message level="'error'">
             'Copy of totalupdate task failed (STAXCode=%s)' % STAXCode
           </message>
           <return>[STAXCode, STAXReason]</return>
diff --git a/opendj-sdk/opends/tests/functional-tests/shared/functions/topology.xml b/opendj-sdk/opends/tests/functional-tests/shared/functions/topology.xml
index d022c3f..0cedd08 100755
--- a/opendj-sdk/opends/tests/functional-tests/shared/functions/topology.xml
+++ b/opendj-sdk/opends/tests/functional-tests/shared/functions/topology.xml
@@ -400,20 +400,38 @@
           'unzipdir' : dsDir }
       </call>
 
+      <!-- fixMe: Windows Services are not enabled -->
+      <if expr="isWindows">
+
+        <script>
+          noWindowsService='true'
+        </script>
+             
+      <else>
+      
+        <script>
+          noWindowsService=''
+        </script>
+        
+      </else>
+      </if>
+
       <!--- Set up DS -->
       <message>
         'Set up DS on %s : %s/%s' % (dsHost,dsDir,OPENDSNAME)
       </message>
+      
       <call function="'SetUpDsWithScript'">
-        { 'location' : dsHost, 
-		  'dsPath' : '%s/%s' % (dsDir, OPENDSNAME),
-		  'dsPort'   : dsPort,
-          'dsJmxPort' : dsJmxPort,		  
-		  'dsBindDN' : dsBindDN,
-		  'dsBindPwd' : dsBindPwd,
-          'dsBaseDN' : dsBaseDN }
+        { 'location'  : dsHost, 
+          'dsPath'    : '%s/%s' % (dsDir, OPENDSNAME),
+          'dsPort'    : dsPort,
+          'dsJmxPort' : dsJmxPort,      
+          'dsBindDN'  : dsBindDN,
+          'dsBindPwd' : dsBindPwd,
+          'dsBaseDN'  : dsBaseDN,
+          'dsNoWindowsService' : noWindowsService }
       </call>
-		
+                		
       <call function="'checkRC'">
         { 'returncode' : RC ,
           'result'     : STAXResult }

--
Gitblit v1.10.0