From 6a55de1a541abb6b2a5b4d2dc0f07f2d3159feae Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Fri, 02 Mar 2012 16:41:26 +0000
Subject: [PATCH] Align fractional-replication tests to replication domain

---
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/utils.xml |   32 +++++++++++++++-
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/basic.xml |   35 +++++++----------
 2 files changed, 44 insertions(+), 23 deletions(-)

diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/basic.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/basic.xml
index da355f4..750b5ec 100644
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/basic.xml
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/basic.xml
@@ -24,7 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2009-2010 Sun Microsystems, Inc.
- !      Portions Copyright 2011 ForgeRock AS.
+ !      Portions Copyright 2011-2012 ForgeRock AS.
  ! -->
 <stax>
   <defaultcall function="fractional-replication_basic"/>
@@ -100,14 +100,7 @@
                   </sequence>
                 </paralleliterate>
                 <script>
-                  repMasterDomain = '%s %s,cn=o_example,%s' % \
-                                    ("cn=Replication Domain",
-                                      domainMap[ldapPservers[0]][1],
-                                     "cn=replication,cn=monitor")
-                  repClientDomain = '%s %s,cn=o_example,%s' % \
-                                    ("cn=Replication Domain",
-                                      domainMap[ldapPservers[1]][1],
-                                     "cn=replication,cn=monitor")
+                  replDomainSuffix = 'cn=o_example,cn=replication,cn=monitor'
                 </script>
                 <message level="'debug'">'domainMap=%s' % domainMap</message>
                 <script>
@@ -174,8 +167,8 @@
         <sequence>
           <call function="'testCase_Preamble'"/>
           <call function="'replicationStatus'">
-            { "server"            : Pservers[0],
-              "replicationDomain" : repMasterDomain,
+            { "server"                  : Pservers[0],
+              "replicationDomainSuffix" : replDomainSuffix,
             }
           </call>
           <!-- set fractional-exclude on server 2 -->
@@ -198,8 +191,8 @@
           </script>
           <!-- verify we have Bad Generation ID -->
           <call function="'replicationStatus'">
-            { "server"            : Pservers[1],
-              "replicationDomain" : repClientDomain,
+            { "server"                  : Pservers[1],
+              "replicationDomainSuffix" : replDomainSuffix,
             }
           </call>
           <if expr="len(STAXResult) == 3 and STAXResult[1].find('Bad generation id') != -1">
@@ -259,8 +252,8 @@
         <sequence>
           <call function="'testCase_Preamble'"/>
           <call function="'replicationStatus'">
-            { "server"            : Pservers[0],
-              "replicationDomain" : repMasterDomain,
+            { "server"                  : Pservers[0],
+              "replicationDomainSuffix" : replDomainSuffix,
             }
           </call>
           <!-- set fractional-include on server 2 -->
@@ -281,8 +274,8 @@
           </script>
           <!-- verify we have Bad Generation ID -->
           <call function="'replicationStatus'">
-            { "server"            : Pservers[1],
-              "replicationDomain" : repClientDomain,
+            { "server"                  : Pservers[1],
+              "replicationDomainSuffix" : replDomainSuffix,
             }
           </call>
           <if expr="len(STAXResult) == 3 and STAXResult[1].find('Bad generation id') != -1">
@@ -447,8 +440,8 @@
           <call function="'testCase_Preamble'"/>
 
           <call function="'replicationStatus'">
-            { "server"            : Pservers[1],
-              "replicationDomain" : repClientDomain,
+            { "server"                  : Pservers[1],
+              "replicationDomainSuffix" : replDomainSuffix,
             }
           </call>
 
@@ -492,8 +485,8 @@
             }
           </call>
           <call function="'replicationStatus'">
-            { "server"            : Pservers[1],
-              "replicationDomain" : repClientDomain,
+            { "server"                  : Pservers[1],
+              "replicationDomainSuffix" : replDomainSuffix,
             }
           </call>
           <if expr="len(STAXResult) == 3 and STAXResult[1].find('Bad generation id') != -1">
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/utils.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/utils.xml
index 3d6e968..1e789b1 100644
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/utils.xml
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/utils.xml
@@ -24,6 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2009-2010 Sun Microsystems, Inc.
+ !      Portions Copyright 2012 ForgeRock AS.
  ! -->
 <stax>
   <function name="get-fractional-replication-attributes" scope="local">
@@ -293,10 +294,12 @@
     </function-prolog>
     <function-map-args>
       <function-required-arg name="server"/>
-      <function-required-arg name="replicationDomain"/>
+      <function-required-arg name="replicationDomainSuffix"/>
       <function-optional-arg name="expectedRC" default="0"/>
     </function-map-args>
     <sequence>
+
+      <!-- Search for the DN of the Replication Domain -->
       <call function="'ldapSearchWithScript'">
         { 'location'            : server.getHostname(),
           'dsPath'              : '%s/%s' \
@@ -305,10 +308,35 @@
           'dsInstancePort'      : server.getPort(),
           'dsInstanceDn'        : server.getRootDn(),
           'dsInstancePswd'      : server.getRootPwd(),
-          'dsBaseDN'            : replicationDomain,
+          'dsBaseDN'            : replicationDomainSuffix,
+          'dsFilter'            : 'objectclass=*',
+          'dsAttributes'        : 'status last-status-change-date',
+          'dsDontWrap'          : 'true',
+        }
+      </call>
+
+      <!-- Get the DN of the Replication Domain -->
+      <script> 
+        replicationDomainDN = replicationDomainSuffix
+        for l in STAXResult[0][1].splitlines():
+          if l.startswith('dn: cn=Replication Domain'):
+            replicationDomainDN = l.replace('dn: ','')
+      </script>
+
+      <!-- Search the Replication Domain for status last-status-change-date -->
+      <call function="'ldapSearchWithScript'">
+        { 'location'            : server.getHostname(),
+          'dsPath'              : '%s/%s' \
+                                  % (server.getDir(),OPENDSNAME),
+          'dsInstanceHost'      : server.getHostname(),
+          'dsInstancePort'      : server.getPort(),
+          'dsInstanceDn'        : server.getRootDn(),
+          'dsInstancePswd'      : server.getRootPwd(),
+          'dsBaseDN'            : replicationDomainDN,
           'dsFilter'            : 'objectclass=*',
           'dsAttributes'        : 'status last-status-change-date',
           'dsScope'             : 'base',
+          'dsDontWrap'          : 'true',
         }
       </call>
       <if expr='RC == 0'>

--
Gitblit v1.10.0