From 0e02964d4df506f9337c34f743e3d6c685633aa6 Mon Sep 17 00:00:00 2001
From: ugaston <ugaston@localhost>
Date: Mon, 11 Aug 2008 15:56:31 +0000
Subject: [PATCH] Replication Conflict Test Suite

---
 opends/tests/shared/functions/dsconfig.xml |  181 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 181 insertions(+), 0 deletions(-)

diff --git a/opends/tests/shared/functions/dsconfig.xml b/opends/tests/shared/functions/dsconfig.xml
index 48a3dcf..2652289 100755
--- a/opends/tests/shared/functions/dsconfig.xml
+++ b/opends/tests/shared/functions/dsconfig.xml
@@ -2264,4 +2264,185 @@
     </sequence>
   </function>
 
+
+
+  <function name="disconnectReplicationServers">
+    <function-prolog>
+      This function breaks the connection among a group of replication servers
+      by resetting the replication-server attribute in the replication server of
+      a given list of servers.
+    </function-prolog>
+    <function-list-args>
+      <function-arg-def name="location"
+                        type="optional"
+                        default="STAF_REMOTE_HOSTNAME">
+        <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="serverList" type="required">
+        <function-arg-description>
+          List of the servers whose replication servers are to be disconnected.
+        </function-arg-description>
+        <function-arg-property name="type" value="Server-list"/>
+      </function-arg-def>
+              
+      <function-arg-def name="expectedRC" type="optional" default="0">
+        <function-arg-description>
+          Expected return code value. Default value is 0.
+          Wildcard 'noCheck' to not check the RC
+        </function-arg-description>
+        <function-arg-property name="type" value="string" />
+      </function-arg-def>
+    </function-list-args>
+    <sequence>
+                
+      <paralleliterate var="server" in="serverList">
+        <sequence>
+          <script>
+            ldapServer = '%s:%s' % (server.getHostname(), 
+                                    server.getPort())
+            replicationServer = server.getChangelogServer()
+            replServer = '%s:%s' % (server.getHostname(),
+                                    replicationServer.getPort())
+          </script>
+          <message>
+            'Disconnecting \nreplication server: %s \nin server: %s' \
+            % (replServer, ldapServer)
+          </message>
+          <!-- Remove peer RS from replicated domain -->
+          <call function="'dsconfig'">
+            { 'location'       : server.getHostname(),
+              'dsPath'         : '%s/%s' % (server.getDir(),OPENDSNAME),
+              'dsInstanceHost' : server.getHostname(),
+              'dsInstancePort' : server.getPort(),
+              'dsInstanceDn'   : server.getRootDn(),
+              'dsInstancePswd' : server.getRootPwd(),
+              'subcommand'     : 'set-replication-server-prop',
+              'objectType'     : 'provider-name',
+              'objectName'     : 'Multimaster Synchronization',
+              'optionsString'  : '--reset replication-server',
+              'expectedRC'     : expectedRC
+            }
+          </call>
+        </sequence>
+      </paralleliterate>
+
+      <return>
+        STAXResult
+      </return>
+      
+    </sequence>
+  </function>
+    
+    
+    
+  <function name="reconnectReplicationServers">
+    <function-prolog>
+      This function re-establishes the connection among a group of replication
+      servers by setting the replication-server attribute in the replication
+      server of a server with the replication servers of a given list of servers
+    </function-prolog>
+    <function-list-args>
+      <function-arg-def name="location"
+                        type="optional"
+                        default="STAF_REMOTE_HOSTNAME">
+        <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="serverList" type="required">
+        <function-arg-description>
+          List of the servers whose replication servers are to be reconnected.
+        </function-arg-description>
+        <function-arg-property name="type" value="Server-list"/>
+      </function-arg-def>
+              
+      <function-arg-def name="expectedRC" type="optional" default="0">
+        <function-arg-description>
+          Expected return code value. Default value is 0.
+          Wildcard 'noCheck' to not check the RC
+        </function-arg-description>
+        <function-arg-property name="type" value="string" />
+      </function-arg-def>
+    </function-list-args>
+    <sequence>
+        
+      <script>
+        optionList = []
+        replServerList = []
+        mainServer = serverList[0]
+      </script>
+                
+      <iterate var="server" in="serverList">
+        <sequence>
+          <script>
+            ldapServer = '%s:%s' % (server.getHostname(), 
+                                    server.getPort())
+            replicationServer = server.getChangelogServer()
+            replServer = '%s:%s' % (server.getHostname(),
+                                    replicationServer.getPort())
+            optionList.append('--set replication-server:%s' % replServer)
+            replServerList.append(replServer)
+          </script>
+        </sequence>
+      </iterate>
+  
+      <script>
+        optionString = ' '.join(optionList)
+        replServers = ' '.join(replServerList)
+      </script>
+        
+      <message>
+        'Reconnecting \nreplication servers: %s \nin server: %s:%s' \
+        % (replServers, mainServer.getHostname(),
+           mainServer.getPort())
+      </message>
+      <!-- Remove peer RS from replicated domain -->
+      <call function="'dsconfig'">
+        { 'location'       : mainServer.getHostname(),
+          'dsPath'         : '%s/%s' \
+                             % (mainServer.getDir(),OPENDSNAME),
+          'dsInstanceHost' : mainServer.getHostname(),
+          'dsInstancePort' : mainServer.getPort(),
+          'dsInstanceDn'   : mainServer.getRootDn(),
+          'dsInstancePswd' : mainServer.getRootPwd(),
+          'subcommand'     : 'set-replication-server-prop',
+          'objectType'     : 'provider-name',
+          'objectName'     : 'Multimaster Synchronization',
+          'optionsString'  : optionString,
+          'expectedRC'     : expectedRC
+        }
+      </call>
+  
+      <return>
+        STAXResult
+      </return>
+      
+    </sequence>
+  </function>
+    
+    
 </stax>

--
Gitblit v1.10.0