From df2dc46ec03512f5d2b3fe6f26b8b4021775eefa Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Mon, 11 Feb 2013 17:00:06 +0000
Subject: [PATCH] CR-1272 Fix for setup tests

---
 opends/tests/staf-tests/functional-tests/testcases/setup/_pre.xml     |   17 -----
 opends/tests/staf-tests/functional-tests/testcases/setup/security.xml |   15 +++--
 opends/tests/staf-tests/functional-tests/testcases/setup/setup.xml    |   12 +++
 opends/tests/staf-tests/functional-tests/testcases/setup/ports.xml    |  124 ++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 142 insertions(+), 26 deletions(-)

diff --git a/opends/tests/staf-tests/functional-tests/testcases/setup/_pre.xml b/opends/tests/staf-tests/functional-tests/testcases/setup/_pre.xml
index 9640c36..8f83fa2 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/setup/_pre.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/setup/_pre.xml
@@ -24,6 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2008 Sun Microsystems, Inc.
+ !      Portions Copyright 2013 ForgeRock AS
  ! -->
 <stax>
   
@@ -86,22 +87,6 @@
           </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="'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',
diff --git a/opends/tests/staf-tests/functional-tests/testcases/setup/ports.xml b/opends/tests/staf-tests/functional-tests/testcases/setup/ports.xml
index 570faf3..a1e6303 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/setup/ports.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/setup/ports.xml
@@ -24,6 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2008 Sun Microsystems, Inc.
+ !      Portions Copyright 2013 ForgeRock AS
  ! -->
 <stax>
   
@@ -225,6 +226,45 @@
           <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>
             c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
             p = []
@@ -269,6 +309,45 @@
           <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>
             c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
             p = []
@@ -321,7 +400,7 @@
           <message>'Ports: '</message>
           
           <!-- 1. Setup options: baseDN baseDN sampleData -->
-          <message>'Prepare Open DS ZIP (in %s)' % PORTS_I1_ROOT</message>
+          <message>'Prepare Open DS ZIP (in %s)' % PORTS_I2_ROOT</message>
 
           <call function="'runSTAFCommand'">
             { 'name'      :  'Create directory to contain I2',
@@ -371,7 +450,7 @@
               'name'      : 'Setup command for I2 (port conflict but nocheck)',
               'command'   : c,
               'arguments' : p,
-              'path'      : PORTS_I1_ROOT,
+              'path'      : PORTS_I2_ROOT,
               'expectedRC': 0,
               'outputFile': '%s/ports-setup-confl-nocheck-i2.txt' % OUT_GROUP,
             }
@@ -410,7 +489,7 @@
               'name'      : 'Uninstall I2',
               'command'   : c,
               'arguments' : p,
-              'path'      : PORTS_I1_ROOT,
+              'path'      : PORTS_I2_ROOT,
               'expectedRC': 0,
               'outputFile': '%s/ports-uninstall-conflict-i2.txt' % OUT_GROUP,
             }
@@ -440,6 +519,45 @@
           <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
diff --git a/opends/tests/staf-tests/functional-tests/testcases/setup/security.xml b/opends/tests/staf-tests/functional-tests/testcases/setup/security.xml
index 82af9d6..e53bb3c 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/setup/security.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/setup/security.xml
@@ -24,6 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2008-2009 Sun Microsystems, Inc.
+ !      Portions Copyright 2013 ForgeRock AS
  ! -->
 <stax>
   
@@ -72,7 +73,7 @@
       <call function="'getFreePort'">
         {
           'host'  : STAF_REMOTE_HOSTNAME,
-          'port'  : 8524,
+          'port'  : 8554,
         }
       </call>
       <script>SEC_I1_ADMIN_PORT = STAXResult</script>
@@ -104,7 +105,7 @@
       <call function="'getFreePort'">
         {
           'host'  : STAF_REMOTE_HOSTNAME,
-          'port'  : 8624,
+          'port'  : 8654,
         }
       </call>
       <script>SEC_I2_ADMIN_PORT = STAXResult</script>
@@ -213,7 +214,8 @@
           <script>
             c = '%s/setup%s' % (SEC_I1_ROOT, fileExt)
             p = []
-            p.append('--cli --no-prompt --ldapPort %s' % (SEC_I1_PORT))
+            p.append('--cli --hostname %s' % (STAF_REMOTE_HOSTNAME))
+            p.append('--no-prompt --ldapPort %s' % (SEC_I1_PORT))
             p.append('--ldapsPort %s' % SEC_I1_SPORT)
             p.append('--adminConnectorPort %s' % SEC_I1_ADMIN_PORT)  
             p.append('--rootUserDN "%s"' % DM_DN)
@@ -351,7 +353,8 @@
           <script>
             c = '%s/setup%s' % (SEC_I2_ROOT, fileExt)
             p = []
-            p.append('--cli --no-prompt --ldapPort %s' % (SEC_I2_PORT))
+            p.append('--cli --hostname %s' % (STAF_REMOTE_HOSTNAME))
+            p.append('--no-prompt --ldapPort %s' % (SEC_I2_PORT))
             p.append('--ldapsPort %s' % SEC_I2_SPORT)
             p.append('--adminConnectorPort %s' % SEC_I2_ADMIN_PORT)  
             p.append('--rootUserDN "%s"' % DM_DN)
@@ -870,9 +873,9 @@
           <script>
             c = '%s/uninstall%s' % (SEC_I1_ROOT, fileExt)
             p = []
-            p.append('--cli --no-prompt')
+            p.append('--cli --referencedHostName %s' % STAF_REMOTE_HOSTNAME)
             p.append('--adminUID admin --bindPassword %s' % DM_PW)
-            p.append('--remove-all')
+            p.append('--remove-all --no-prompt')
             p.append('--trustStorePath %s' % MY_KEYSTORE)
             p.append('--trustStorePassword secret12')
             p = ' '.join(p)
diff --git a/opends/tests/staf-tests/functional-tests/testcases/setup/setup.xml b/opends/tests/staf-tests/functional-tests/testcases/setup/setup.xml
index 92e62b0..854d11a 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/setup/setup.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/setup/setup.xml
@@ -24,7 +24,8 @@
  ! CDDL HEADER END
  !
  !      Copyright 2008 Sun Microsystems, Inc.
-! -->
+ !      Portions Copyright 2013 ForgeRock AS
+ ! -->
 <stax>
   
   <defaultcall function="main_setup"/>
@@ -64,6 +65,15 @@
             }
           </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>
+
           <script>
             testList = []
             testList.append(['.','_pre'])

--
Gitblit v1.10.0