From ef3b4cc06334babe2dba4b9b096790fef40d5fd3 Mon Sep 17 00:00:00 2001
From: ugaston <ugaston@localhost>
Date: Wed, 01 Apr 2009 07:55:15 +0000
Subject: [PATCH] New replication test groups for assured modes + fix knownIssue handling in verifyTrees()

---
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml                     |    2 
 opendj-sdk/opends/tests/staf-tests/shared/functions/tools.xml                                                 |    6 
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication-safe-read/replication-safe-read.xml |   92 ++++++++++++++++++
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication-safe-data/replication-safe-data.xml |   92 ++++++++++++++++++
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication_setup.xml               |  104 ++++++++++++++++++++
 5 files changed, 293 insertions(+), 3 deletions(-)

diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication-safe-data/replication-safe-data.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication-safe-data/replication-safe-data.xml
new file mode 100644
index 0000000..b8c121c
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication-safe-data/replication-safe-data.xml
@@ -0,0 +1,92 @@
+<?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, include this CDDL HEADER in each
+ ! file and include 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 2007-2008 Sun Microsystems, Inc.
+ ! -->
+<stax>
+  <defaultcall function="main_replication-safe-data"/>
+  <function name="main_replication-safe-data">
+    <function-list-args>
+      <function-required-arg name="STAXParentID"/>
+    </function-list-args>
+    <sequence>
+      <block name="'replication-safe-data'">
+        <sequence>
+          <!--- Load the job environment for the test group execution -->
+          <import machine="STAF_LOCAL_HOSTNAME"
+                  file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
+          <call function="'loadJobEnvironment'">
+               { 'parent' : STAXParentID }
+          </call>
+          <script>
+            CurrentTestPath['group']='replication-safe-data'
+          </script>
+          <call function="'testGroup_Preamble'"/>            
+
+          <!-- List of replication test suites to run -->
+          <script>
+            # Test suites common to all replication modes 
+            # (hosted by replication test group)
+            commonTestList = []
+            commonTestList.append('totalupdate')
+            commonTestList.append('binarycopy')
+            commonTestList.append('ldifimport')
+            commonTestList.append('resynchronization')
+            commonTestList.append('basic')
+            commonTestList.append('schema')
+            commonTestList.append('failover')
+            commonTestList.append('encryption')
+            commonTestList.append('changelog')
+            commonTestList.append('conflict')
+            
+            # Safe-data mode specific test suites
+            ownTestList = []
+            
+            globalAssuredReplication = 'safe-data'
+          </script>
+          
+          <iterate var="_test" in="commonTestList" >
+            <sequence>
+              <import machine="STAF_LOCAL_HOSTNAME"
+                      file="'%s/testcases/replication/%s/%s.xml' % 
+                        (TESTS_DIR,_test,_test)"/>
+              <call function="'replication_%s'% _test" />
+            </sequence>
+          </iterate>
+          <iterate var="_test" in="ownTestList" >
+            <sequence>
+              <import machine="STAF_LOCAL_HOSTNAME"
+                      file="'%s/testcases/replication-safe-data/%s/%s.xml' % 
+                        (TESTS_DIR,_test,_test)"/>
+              <call function="'replication_%s'% _test" />
+            </sequence>
+          </iterate>
+          
+          <call function="'testGroup_Postamble'"/>
+        </sequence>
+      </block>
+    </sequence>
+  </function>
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication-safe-read/replication-safe-read.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication-safe-read/replication-safe-read.xml
new file mode 100644
index 0000000..fe80b89
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication-safe-read/replication-safe-read.xml
@@ -0,0 +1,92 @@
+<?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, include this CDDL HEADER in each
+ ! file and include 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 2007-2008 Sun Microsystems, Inc.
+ ! -->
+<stax>
+  <defaultcall function="main_replication-safe-read"/>
+  <function name="main_replication-safe-read">
+    <function-list-args>
+      <function-required-arg name="STAXParentID"/>
+    </function-list-args>
+    <sequence>
+      <block name="'replication-safe-read'">
+        <sequence>
+          <!--- Load the job environment for the test group execution -->
+          <import machine="STAF_LOCAL_HOSTNAME"
+                  file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
+          <call function="'loadJobEnvironment'">
+               { 'parent' : STAXParentID }
+          </call>
+          <script>
+            CurrentTestPath['group']='replication-safe-read'
+          </script>
+          <call function="'testGroup_Preamble'"/>            
+
+          <!-- List of replication test suites to run -->
+          <script>
+            # Test suites common to all replication modes 
+            # (hosted by replication test group)
+            commonTestList = []
+            commonTestList.append('totalupdate')
+            commonTestList.append('binarycopy')
+            commonTestList.append('ldifimport')
+            commonTestList.append('resynchronization')
+            commonTestList.append('basic')
+            commonTestList.append('schema')
+            commonTestList.append('failover')
+            commonTestList.append('encryption')
+            commonTestList.append('changelog')
+            commonTestList.append('conflict')
+            
+            # Safe-read mode specific test suites
+            ownTestList = []
+            
+            globalAssuredReplication = 'safe-read'
+          </script>
+          
+          <iterate var="_test" in="commonTestList" >
+            <sequence>
+              <import machine="STAF_LOCAL_HOSTNAME"
+                      file="'%s/testcases/replication/%s/%s.xml' % 
+                        (TESTS_DIR,_test,_test)"/>
+              <call function="'replication_%s'% _test" />
+            </sequence>
+          </iterate>
+          <iterate var="_test" in="ownTestList" >
+            <sequence>
+              <import machine="STAF_LOCAL_HOSTNAME"
+                      file="'%s/testcases/replication-safe-read/%s/%s.xml' % 
+                        (TESTS_DIR,_test,_test)"/>
+              <call function="'replication_%s'% _test" />
+            </sequence>
+          </iterate>
+          
+          <call function="'testGroup_Postamble'"/>
+        </sequence>
+      </block>
+    </sequence>
+  </function>
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml
index c4f0814..c558677 100644
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml
@@ -58,6 +58,8 @@
             testList.append('encryption')
             testList.append('changelog')
             testList.append('conflict')
+            
+            globalAssuredReplication = None
           </script>
           
           <iterate var="_test" in="testList" >
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication_setup.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication_setup.xml
index c993ef8..e574243 100644
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication_setup.xml
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication_setup.xml
@@ -128,7 +128,7 @@
             
             consumerList = _topologyServerList[1:]
               
-            domainMap = {}
+            domainMap = STAXGlobal({})
           </script>       
 
           <if expr="dataFile">
@@ -291,6 +291,108 @@
           </if>
 
 
+          <script>
+            assuredReplication = globalAssuredReplication
+          </script>
+          <if expr="assuredReplication">
+            <paralleliterate var="server" in="_topologyServerList">
+              <sequence>
+                <script>
+                  ldapServer = '%s:%s' % (server.getHostname(), 
+                                          server.getPort())
+                </script>
+                
+                <if expr="isolateLdapServers">
+                  <!-- this means the domainMap has already been filled up -->
+                  <script>
+                    domain = domainMap[ldapServer]
+                  </script>
+                  <else>
+                    <sequence>
+                      <!-- Retrieve replication-domain name -->
+                      <call function="'dsconfig'">
+                        { 'location'            : server.getHostname(),
+                          'dsPath'              : '%s/%s' \
+                                                  % (server.getDir(),OPENDSNAME),
+                          'dsInstanceHost'      : server.getHostname(),
+                          'dsInstanceAdminPort' : server.getAdminPort(),
+                          'dsInstanceDn'        : server.getRootDn(),
+                          'dsInstancePswd'      : server.getRootPwd(),
+                          'subcommand'          : 'list-replication-domains',
+                          'objectType'          : 'provider-name',
+                          'objectName'          : 'Multimaster Synchronization',
+                          'optionsString'       : '--script-friendly'
+                        }
+                      </call>
+                      <if expr='RC == 0'>
+                        <script>
+                          replicationDomains = STAXResult[0][1]
+                          for line in replicationDomains.splitlines():
+                            if line.find(synchroSuffix) != -1:
+                              domain = line
+                              domainMap[ldapServer] = domain
+                              break
+                        </script>
+                      </if>
+                    </sequence>
+                  </else>
+                </if>
+                <script>
+                  options = '--domain-name "%s" --set assured-type:%s' \
+                            % (domain, assuredReplication)
+                </script>
+                <message>
+                  'Setting replication assured-type to: %s  for server: %s \
+                  domain: %s' % (assuredReplication, ldapServer, domain)
+                </message>
+                <!-- Set assured -->
+                <call function="'dsconfig'">
+                  { 'location'            : server.getHostname(),
+                    'dsPath'              : '%s/%s' \
+                                            % (server.getDir(),OPENDSNAME),
+                    'dsInstanceHost'      : server.getHostname(),
+                    'dsInstanceAdminPort' : server.getAdminPort(),
+                    'dsInstanceDn'        : server.getRootDn(),
+                    'dsInstancePswd'      : server.getRootPwd(),
+                    'subcommand'          : 'set-replication-domain-prop',
+                    'objectType'          : 'provider-name',
+                    'objectName'          : 'Multimaster Synchronization',
+                    'optionsString'       : options
+                  }
+                </call>
+
+                <if expr="assuredReplication == 'safe-data'">
+                  <sequence>
+                    <script>
+                      assuredDataLevel = len(_topologyServerList)
+                      options = '--domain-name "%s" --set assured-sd-level:%s' \
+                                % (domain, assuredDataLevel)
+                    </script>
+                    <message>
+                      'Setting safe-data level to: %s  for server: %s \
+                      domain: %s' % (assuredDataLevel, ldapServer, domain)
+                    </message>
+                    <!-- Set assured -->
+                    <call function="'dsconfig'">
+                      { 'location'            : server.getHostname(),
+                        'dsPath'              : '%s/%s' \
+                                                % (server.getDir(),OPENDSNAME),
+                        'dsInstanceHost'      : server.getHostname(),
+                        'dsInstanceAdminPort' : server.getAdminPort(),
+                        'dsInstanceDn'        : server.getRootDn(),
+                        'dsInstancePswd'      : server.getRootPwd(),
+                        'subcommand'          : 'set-replication-domain-prop',
+                        'objectType'          : 'provider-name',
+                        'objectName'          : 'Multimaster Synchronization',
+                        'optionsString'       : options
+                      }
+                    </call>
+                  </sequence>
+                </if>
+              </sequence>
+            </paralleliterate>
+          </if>
+
           <if expr="dataFile">
             <sequence>
               <message>
diff --git a/opendj-sdk/opends/tests/staf-tests/shared/functions/tools.xml b/opendj-sdk/opends/tests/staf-tests/shared/functions/tools.xml
index a65b41b..4582a93 100755
--- a/opendj-sdk/opends/tests/staf-tests/shared/functions/tools.xml
+++ b/opendj-sdk/opends/tests/staf-tests/shared/functions/tools.xml
@@ -546,6 +546,7 @@
     <sequence>
       <script>
         myRC = 0
+        myKnownIssue = knownIssue
         failedServers = []
         failingServerList = ''
         referenceServerPath = '%s/%s' % (referenceServer.getDir(), OPENDSNAME)
@@ -637,7 +638,7 @@
         { 'returncode' : myRC,
           'result'     : failingServerList,
           'expected'   : 0,
-          'issue'      : knownIssue
+          'issue'      : myKnownIssue
         }
       </call>
       <return>[myRC, failedServers]</return>
@@ -700,6 +701,7 @@
     <sequence>
       <script>
         myRC = 0
+        myKnownIssue = knownIssue
         failedServers = []
         failingServerList = ''
         referenceServerPath = '%s/%s' % (referenceServer.getDir(), OPENDSNAME)
@@ -758,7 +760,7 @@
         { 'returncode' : myRC,
           'result'     : failingServerList ,
           'expected'   : 0,
-          'issue'      : knownIssue
+          'issue'      : myKnownIssue
         }
       </call>
       <return>[myRC, failedServers]</return>

--
Gitblit v1.10.0