From ef0be607ebd184fcf59c5845e9d57b20bd1d3082 Mon Sep 17 00:00:00 2001
From: Sebastien Bertholet <sebastien.bertholet@forgerock.com>
Date: Wed, 14 May 2008 07:30:21 +0000
Subject: [PATCH] allow to use secure replication and to enable ssl (LDAPsport)

---
 opendj-sdk/opends/tests/system-tests/phases/parser/parser.py                       |   13 ++++--
 opendj-sdk/opends/tests/system-tests/phases/shared/functions/opendsadm.xml         |   17 +++++++-
 opendj-sdk/opends/tests/system-tests/scenario/conf.dtd                             |    3 +
 opendj-sdk/opends/tests/system-tests/phases/configuration/configuration_opends.xml |   30 +++++++++++++-
 4 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/opendj-sdk/opends/tests/system-tests/phases/configuration/configuration_opends.xml b/opendj-sdk/opends/tests/system-tests/phases/configuration/configuration_opends.xml
index 94eae9d..e9c3a9c 100755
--- a/opendj-sdk/opends/tests/system-tests/phases/configuration/configuration_opends.xml
+++ b/opendj-sdk/opends/tests/system-tests/phases/configuration/configuration_opends.xml
@@ -275,12 +275,14 @@
                       'dsInstanceDn'      : DIRECTORY_INSTANCE_DN,
                       'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD,
                       'dsReplicationPort' : instance.getREPLPort(),
+                      'dsSecureReplication' : instance.getSecureReplication(),
                       'refInstanceHost'   : instanceSource.getHost(),
                       'refInstancePort'   : instanceSource.getLDAPPort(),
                       'refInstanceDn'     : DIRECTORY_INSTANCE_DN,
                       'refInstancePswd'   : DIRECTORY_INSTANCE_PSWD,
                       'refReplicationPort': instanceSource.getREPLPort(),
                       'replicationDnList' : [suffix.getSuffixDn()],
+                      'refSecureReplication' : instanceSource.getSecureReplication(),
                       'expectedRC'        : [0,5],
                       'fileFd'            : cFileFd
                     }
@@ -349,7 +351,15 @@
           Replication port number
         </function-arg-description>
       </function-arg-def>
-        
+      
+      <function-arg-def name="dsSecureReplication" type="optional" 
+                        default="'false'">
+        <function-arg-description>
+          Use replication over ssl on first server
+        </function-arg-description>
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>  
+      
       <function-arg-def name="refInstanceHost" type="optional"
                         default="STAF_REMOTE_HOSTNAME">
         <function-arg-description>
@@ -386,7 +396,15 @@
           DN of the replicated suffix
         </function-arg-description>
       </function-arg-def>        
-        
+      
+      <function-arg-def name="refSecureReplication" type="optional" 
+                        default="'false'">
+        <function-arg-description>
+          Use replication over ssl on reference server
+        </function-arg-description>
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
+      
       <function-arg-def name="adminUID" type="optional"
                         default="DIRECTORY_INSTANCE_DN">
         <function-arg-description>
@@ -463,7 +481,13 @@
         if replicationDnList:
           for dn in replicationDnList:
             STAFCmdParamsList.append('-b "%s"' % dn)
-          
+        
+        if ( dsSecureReplication == 'true' ):
+          STAFCmdParamsList.append('--secureReplication1')  
+        
+        if ( refSecureReplication == 'true' ):
+          STAFCmdParamsList.append('--secureReplication2')  
+        
         if adminUID:
           STAFCmdParamsList.append('-I "%s"' % adminUID)
           
diff --git a/opendj-sdk/opends/tests/system-tests/phases/parser/parser.py b/opendj-sdk/opends/tests/system-tests/phases/parser/parser.py
index a80624a..87db426 100755
--- a/opendj-sdk/opends/tests/system-tests/phases/parser/parser.py
+++ b/opendj-sdk/opends/tests/system-tests/phases/parser/parser.py
@@ -338,7 +338,7 @@
   def __init__(self, iid, name, product, role, host, installDir, tarball, \
                portLDAP, portLDAPS, portJMX, portREPL, \
                sslEnabled, certificate, startTlsEnabled, \
-               tuning):
+               secureReplication,tuning):
     # from instance object
     self.iid             = iid
     self.name            = name
@@ -356,6 +356,7 @@
     self.sslEnabled      = sslEnabled
     self.certificate     = certificate
     self.startTlsEnabled = startTlsEnabled
+    self.secureReplication = secureReplication
     self.tuning          = tuning
     
   def getLDAPSPort(self):
@@ -381,7 +382,10 @@
     
   def getIsStartTlsEnabled(self):
     return self.startTlsEnabled
-    
+  
+  def getSecureReplication(self):
+    return self.secureReplication
+  
   def getTuning(self):
     return self.tuning
 
@@ -657,6 +661,7 @@
   cSslEnabled      = 'false'
   cCertificate     = NOT_DEFINED
   cStartTlsEnabled = 'false'
+  cSecureReplication  = 'false'
   cIsJava          = 'false'
   cXms             = NOT_DEFINED
   cXmx             = NOT_DEFINED
@@ -724,7 +729,7 @@
         cSslEnabled      = _getAttributeNode(thisSubChild,'sslEnabled')
         cCertificate     = _getAttributeNode(thisSubChild,'certificate')
         cStartTlsEnabled = _getAttributeNode(thisSubChild,'startTlsEnabled')
-        
+        cSecureReplication = _getAttributeNode(thisSubChild,'secureReplication')
       
       elif (thisSubChild.getNodeType() == Node.ELEMENT_NODE and
           thisSubChild.getNodeName() == 'tuning'):
@@ -801,7 +806,7 @@
                              opendsZip,\
                              cPortLDAP,cPortLDAPS,cPortJMX,cPortREPL,\
                              cSslEnabled,cCertificate,cStartTlsEnabled,\
-                             cOpendsTuning)]
+                             cSecureReplication,cOpendsTuning)]
 
 
 
diff --git a/opendj-sdk/opends/tests/system-tests/phases/shared/functions/opendsadm.xml b/opendj-sdk/opends/tests/system-tests/phases/shared/functions/opendsadm.xml
index ca0f4a0..1acdacd 100755
--- a/opendj-sdk/opends/tests/system-tests/phases/shared/functions/opendsadm.xml
+++ b/opendj-sdk/opends/tests/system-tests/phases/shared/functions/opendsadm.xml
@@ -967,8 +967,15 @@
         STAFCmd='%s/dsreplication' % (dsBinPath)
         
         STAFCmdParamsList.append('status -n')
+        STAFCmdParamsList.append('--trustAll')
         STAFCmdParamsList.append('-h %s' % instance.getHost())
-        STAFCmdParamsList.append('-p %s' % instance.getLDAPPort())
+        if ( instance.getIsSslEnabled() == 'true' ):
+          port = instance.getLDAPSPort()
+          STAFCmdParamsList.append('--useSSL')
+        else:
+          port = instance.getLDAPPort()
+          
+        STAFCmdParamsList.append('-p %s' % port )
         STAFCmdParamsList.append('-b %s' % suffix.getSuffixDn())
         STAFCmdParamsList.append('-I "%s"' % adminDN)
         STAFCmdParamsList.append('-w "%s"' % adminPwd)
@@ -1021,8 +1028,14 @@
           <iterate in="instances" var="instance">
             <sequence>
               <script>
+                
+                if ( instance.getIsSslEnabled() == 'true' ):
+                  port = instance.getLDAPPort()
+                else:
+                  port = instance.getLDAPSPort()
+                  
                 serverName = '%s:%s' % \
-                             (instance.getHost(),instance.getLDAPPort())
+                             (instance.getHost(),port)
                 nbEntries = NOT_DEFINED
                 
                 for e in cmdOutput:
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/conf.dtd b/opendj-sdk/opends/tests/system-tests/scenario/conf.dtd
index 98f5a61..c9ac14a 100755
--- a/opendj-sdk/opends/tests/system-tests/scenario/conf.dtd
+++ b/opendj-sdk/opends/tests/system-tests/scenario/conf.dtd
@@ -56,7 +56,8 @@
   <!ATTLIST security
         sslEnabled ( true | false ) "false"
         certificate ( generateSelfSigned ) "generateSelfSigned"
-        startTlsEnabled ( true | false ) "false">
+        startTlsEnabled ( true | false ) "false"
+        secureReplication ( true | false ) "false" >
   <!ELEMENT tuning (java?,databaseCachePercentage?,replicationPurgeDelay?)>
     <!ELEMENT java EMPTY>
     <!ATTLIST java

--
Gitblit v1.10.0