From 8038ed3ae768fd229cf75214b0f09324f97e5b9c Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Fri, 16 Sep 2011 17:23:55 +0000
Subject: [PATCH] First drop LDAP PTA functional test cases

---
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta_setup.xml             |  209 ++++++++++++++++
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta.xml                   |   98 +++++++
 opendj-sdk/opends/tests/staf-tests/shared/ant/build.properties                              |    2 
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta_cleanup.xml           |   86 ++++++
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic.xml       |  137 ++++++++++
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic_tests.xml |  232 +++++++++++++++++
 6 files changed, 763 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic.xml
new file mode 100755
index 0000000..fbab1cf
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic.xml
@@ -0,0 +1,137 @@
+<?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/CDDLv1_0.txt
+ ! or http://forgerock.org/license/CDDLv1.0.html.
+ ! 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/CDDLv1_0.txt.  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 2011 ForgeRock AS.
+ ! -->
+<stax>
+  <defaultcall function="main_pta_basic"/>
+  <function name="main_pta_basic" scope="local">
+    <sequence>
+      <block name="'main_pta_basic'">
+        <try>
+          <sequence>
+            <script>
+              CurrentTestPath['group']='pta'        
+              CurrentTestPath['suite']='basic'
+              
+              __group=CurrentTestPath['group']
+              __groupdir='%s/testcases/%s' % (TESTS_DIR,__group)
+            </script>
+
+            <!--- Test Suite information
+            #@TestSuiteName       Basic pta suite
+            #@TestSuitePurpose    Verify basic pta
+            #@TestSuiteID         Suite
+            #@TestSuiteGroup      Basic
+            #@TestGroup           Basic
+            #@TestScript          pta.xml
+            #@TestHTMLLink        http://www.forgerock.org/
+            -->          
+            <call function="'testSuite_Preamble'"/>
+
+            <try>
+              <sequence> 
+
+                <!-- PTA setup -->
+                <import machine="STAF_LOCAL_HOSTNAME"
+                  file="'%s/testcases/pta/pta_setup.xml' % (TESTS_DIR)"/>
+                <call function="'pta_setup'">
+                  { 'topologyFile' : '%s/3server_topology.txt' % REPLICATION_CONFIG_DIR }
+                </call>
+ 
+                <!-- List of Import of Test Functions -->
+                <script>
+                  importList=[]
+                  importList.append('basic/pta_basic_tests')
+                </script>
+
+                <!-- Import the files for this test suite -->
+                <iterate var="__import" in="importList">
+                  <import machine="STAF_LOCAL_HOSTNAME"
+                    file="'%s/%s.xml' % (__groupdir,__import)"/>
+                </iterate>                                                                       
+
+                <!-- Specific to basic pta tests -->
+                                                    
+                <!-- List of Test Cases -->
+                <script>
+                  testsList=[]
+                  testsList.append('basic_pta_003')
+                </script>
+
+                <!-- Execute the Tests -->
+                <iterate var="__test" in="testsList">
+                  <sequence>
+                    <call function="'%s' % (__test)" />
+                  </sequence>
+                </iterate>                
+                                
+              </sequence>
+            <catch exception="'STAFException.TestSuite.SetupException'">
+              <sequence>
+                <message log="1" level="'fatal'">
+                  'Setup of test suite failed.'
+                </message>
+                <rethrow/>
+              </sequence>
+            </catch>
+
+            <finally>
+              <message>'Test Cases Completed.'</message>
+            </finally>
+
+            </try>
+
+          </sequence>
+          
+          <finally>
+            <sequence>
+              <!-- Test Suite Cleanup -->
+              <message>'Finally: Global PTA Cleanup.'</message>
+              <try>
+                <sequence>
+                  <import machine="STAF_LOCAL_HOSTNAME"
+                    file="'%s/testcases/pta/pta_cleanup.xml' % (TESTS_DIR)"/>
+                  <call function="'pta_cleanup'" />
+                </sequence>
+              <catch exception="'STAFException'">
+                <sequence>
+                  <message log="1" level="'fatal'">
+                    'Cleanup of test suite failed.'
+                  </message>
+                </sequence>
+              </catch>
+              <finally>
+                <call function="'testSuite_Postamble'"/>
+              </finally>
+              </try>
+            </sequence>
+          </finally>
+ 
+        </try>
+      </block>
+    </sequence>
+  </function>
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic_tests.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic_tests.xml
new file mode 100755
index 0000000..2e654f6
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic_tests.xml
@@ -0,0 +1,232 @@
+<?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/CDDLv1_0.txt
+ ! or http://forgerock.org/license/CDDLv1.0.html.
+ ! 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/CDDLv1_0.txt.  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 2011 ForgeRock AS
+ ! -->
+<stax>
+
+  <!-- Definition of Test Cases -->             
+
+  <!--- Test Cases : Basic : PTA -->
+  
+  <!--- Test Case information
+  #@TestMarker          Basic: PTA unmapped
+  #@TestName            Basic: PTA unmapped
+  #@TestID              basic_pta_001
+  #@TestPurpose         Verify user with a LDAP PTA unmapped policy can authenticated to remote server
+  #@TestPreamble
+  #@TestSteps           Configure LDAP PTA Policy
+  #@TestPostamble
+  #@TestResult          Test is successful if the result code is 0
+  -->   
+  
+  <!--- Test Case information
+  #@TestMarker          Basic: PTA mapped-bind
+  #@TestName            Basic: PTA mapped-bind
+  #@TestID              basic_pta_002
+  #@TestPurpose         Verify user with a LDAP PTA mapped-bind policy can authenticated to remote server
+  #@TestPreamble
+  #@TestSteps           Configure LDAP PTA Policy
+  #@TestPostamble
+  #@TestResult          Test is successful if the result code is 0
+  -->   
+      
+  <!--- Test Case information
+  #@TestMarker          Basic: PTA mapped-search
+  #@TestName            Basic: PTA mapped-search
+  #@TestID              basic_pta_003
+  #@TestPurpose         Verify user with a LDAP PTA mapped-search policy can authenticated to remote server
+  #@TestPreamble
+  #@TestSteps           Configure LDAP PTA Policy
+  #@TestPostamble
+  #@TestResult          Test is successful if the result code is 0
+  -->                           
+  <function name="basic_pta_003" scope="local">
+    <testcase name="getTestCaseName('PTA mapped-search')">                     
+      <sequence> 
+        <try>
+          <sequence>                
+            <call function="'testCase_Preamble'"/>
+            <message>
+               'Test Name = %s' % STAXCurrentTestcase
+            </message>
+
+            <!-- On primary server configure LDAP PTA -->
+            <script>
+              primaryHost   = primary_remote_ldap_server.getHostname()
+              primaryPort   = primary_remote_ldap_server.getPort()
+              secondaryHost = secondary_remote_ldap_server.getHostname()
+              secondaryPort = secondary_remote_ldap_server.getPort()
+
+              options=[]
+              options.append('--set primary-remote-ldap-server:%s:%s' % (primaryHost,primaryPort))
+              options.append('--set mapped-attribute:cn')
+              options.append('--set mapped-search-base-dn:dc=AD,dc=com')
+              options.append('--set mapping-policy:mapped-search')
+              options.append('--set secondary-remote-ldap-server:%s:%s' % (secondaryHost,secondaryPort))
+              options.append('--type ldap-pass-through')
+              options.append('--policy-name "LDAP PTA"')
+              dsconfigOptions=' '.join(options)
+            </script>
+
+            <call function="'dsconfig'">
+              { 'location'            : local_ldap_server.getHostname(),
+                'dsPath'              : '%s/%s' \
+                                         % (local_ldap_server.getDir(),OPENDSNAME),
+                'dsInstanceHost'      : local_ldap_server.getHostname(),
+                'dsInstanceAdminPort' : local_ldap_server.getAdminPort(),
+                'dsInstanceDn'        : local_ldap_server.getRootDn(),
+                'dsInstancePswd'      : local_ldap_server.getRootPwd(),
+                'subcommand'          : 'create-password-policy',
+                'optionsString'       : dsconfigOptions
+              }
+            </call>
+
+            <!-- Read back the "authentication policy" object -->
+            <script>
+              options=[]
+              options.append('--policy-name "LDAP PTA"')
+              dsconfigOptions=' '.join(options)
+            </script>
+
+            <call function="'dsconfig'">
+              { 'location'            : local_ldap_server.getHostname(),
+                'dsPath'              : '%s/%s' \
+                                         % (local_ldap_server.getDir(),OPENDSNAME),
+                'dsInstanceHost'      : local_ldap_server.getHostname(),
+                'dsInstanceAdminPort' : local_ldap_server.getAdminPort(),
+                'dsInstanceDn'        : local_ldap_server.getRootDn(),
+                'dsInstancePswd'      : local_ldap_server.getRootPwd(),
+                'subcommand'          : 'get-password-policy-prop',
+                'optionsString'       : dsconfigOptions
+              }
+            </call>
+
+            <!-- Add ds-pwp-password-policy-dn: 
+              cn=LDAP PTA,cn=Password Policies,cn=config 
+              to users entry -->
+            <script>
+              remotePTAuserName='uid=jvedder, ou=People, o=example'
+              remotePTAuserPSWD='befitting'
+              ldapObject=[]
+              ldapObject.append('ds-pwp-password-policy-dn: cn=LDAP PTA,cn=Password Policies,cn=config')
+           </script>
+
+            <call function="'modifyAnAttribute'">
+              { 'location'        : local_ldap_server.getHostname(),
+                'dsPath'                 : '%s/%s' \
+                                           % (local_ldap_server.getDir(),OPENDSNAME),
+                'dsInstanceHost'  : local_ldap_server.getHostname() ,
+                'dsInstancePort'  : local_ldap_server.getPort(),
+                'dsInstanceDn'    : local_ldap_server.getRootDn(),
+                'dsInstancePswd'  : local_ldap_server.getRootPwd(),
+                'DNToModify'      : remotePTAuserName ,
+                'listAttributes'  : ldapObject ,
+                'changetype'      : 'add' }
+            </call>
+
+            <!-- Search users entry as Directory Manager for operational attributes -->
+            <call function="'ldapSearchWithScript'">
+              { 'location'        : local_ldap_server.getHostname(),
+                'dsPath'                 : '%s/%s' \
+                                           % (local_ldap_server.getDir(),OPENDSNAME),
+                'dsInstanceHost'  : local_ldap_server.getHostname() ,
+                'dsInstancePort'  : local_ldap_server.getPort(),
+                'dsInstanceDn'    : local_ldap_server.getRootDn(),
+                'dsInstancePswd'  : local_ldap_server.getRootPwd(),
+                'dsBaseDN'        : remotePTAuserName ,
+                'dsFilter'        : 'objectclass=*' ,
+                'dsAttributes'    : '+'
+              }
+            </call>
+
+            <!-- Search users entry as himself -->
+            <call function="'ldapSearchWithScript'">
+              { 'location'        : local_ldap_server.getHostname(),
+                'dsPath'                 : '%s/%s' \
+                                           % (local_ldap_server.getDir(),OPENDSNAME),
+                'dsInstanceHost'  : local_ldap_server.getHostname() ,
+                'dsInstancePort'  : local_ldap_server.getPort(),
+                'dsInstanceDn'    : remotePTAuserName,
+                'dsInstancePswd'  : remotePTAuserPSWD ,
+                'dsBaseDN'        : remotePTAuserName ,
+                'dsFilter'        : 'objectclass=*'
+              }
+            </call>
+
+            <!-- Modify the users entry -->
+            <script>
+              ldapObject=[]
+              ldapObject.append('description: i am now a remote LDAP PTA user')
+           </script>
+
+            <call function="'modifyAnAttribute'">
+              { 'location'        : local_ldap_server.getHostname(),
+                'dsPath'                 : '%s/%s' \
+                                           % (local_ldap_server.getDir(),OPENDSNAME),
+                'dsInstanceHost'  : local_ldap_server.getHostname() ,
+                'dsInstancePort'  : local_ldap_server.getPort(),
+                'dsInstanceDn'    : remotePTAuserName,
+                'dsInstancePswd'  : remotePTAuserPSWD,
+                'DNToModify'      : remotePTAuserName ,
+                'listAttributes'  : ldapObject ,
+                'changetype'      : 'replace' }
+            </call>
+
+            <!-- Delete LDAP PTA (authentication) password policy attribute -->
+            <script>
+              ldapObject=[]
+              ldapObject.append('ds-pwp-password-policy-dn: cn=LDAP PTA,cn=Password Policies,cn=config')
+           </script>
+
+            <call function="'modifyAnAttribute'">
+              { 'location'        : local_ldap_server.getHostname(),
+                'dsPath'                 : '%s/%s' \
+                                           % (local_ldap_server.getDir(),OPENDSNAME),
+                'dsInstanceHost'  : local_ldap_server.getHostname() ,
+                'dsInstancePort'  : local_ldap_server.getPort(),
+                'dsInstanceDn'    : local_ldap_server.getRootDn(),
+                'dsInstancePswd'  : local_ldap_server.getRootPwd(),
+                'DNToModify'      : remotePTAuserName ,
+                'listAttributes'  : ldapObject ,
+                'changetype'      : 'delete' }
+            </call>
+                        
+          </sequence>
+  
+          <catch exception="'STAXException'" typevar="eType" var="eInfo">
+            <message log="1" level="'fatal'">
+              '%s: Test failed. eInfo(%s)' % (eType,eInfo)
+            </message>
+          </catch>
+          <finally>
+            <call function="'testCase_Postamble'"/>
+          </finally>
+        </try>
+      </sequence>
+    </testcase>
+  </function>
+   
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta.xml
new file mode 100644
index 0000000..68cf5b5
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta.xml
@@ -0,0 +1,98 @@
+<?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/CDDLv1_0.txt
+ ! or http://forgerock.org/license/CDDLv1.0.html.
+ ! 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/CDDLv1_0.txt.  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 2011 ForgeRock AS.
+ ! -->
+<stax>
+  <defaultcall function="main_pta" />
+  <function name="main_pta">
+    <function-list-args>
+      <function-required-arg name="STAXParentID"/>
+    </function-list-args>
+
+    <sequence>
+      <try>
+        <block name="'pta'">
+          <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']='pta'
+              _group=CurrentTestPath['group']
+              
+            </script>
+            <call function="'testGroup_Preamble'" />
+            <script>
+              suiteList = []
+              suiteList.append('basic')
+            </script>
+    
+            <!-- Run the test suites -->
+            <iterate  var="_suite" in="suiteList">
+              <sequence>              
+                <try>
+                  <sequence>                  
+                    <import machine="STAF_LOCAL_HOSTNAME"
+                      file="'%s/testcases/%s/%s/%s_%s.xml' % (TESTS_DIR,_group,_suite,_group,_suite)"/> 
+                    <call function="'main_%s_%s' % (_group,_suite)" />
+                  </sequence>
+                <catch exception="'STAFException.TestSuite.SetupException'">
+                  <sequence>
+                    <message log="1" level="'fatal'">'Setup of test suite %s failed.' % _suite</message>
+                  </sequence>
+                </catch>
+                <catch exception="'STAFException.TestSuite.MainException'">
+                  <sequence>
+                    <message log="1" level="'fatal'">'Main part of test suite %s failed.' % _suite</message>
+                  </sequence>
+                </catch>
+                <catch exception="'STAFException.TestSuite.CleanupException'">
+                  <sequence>
+                    <message log="1" level="'fatal'">'Cleanup of test suite %s failed.' % _suite</message>
+                  </sequence>
+                </catch>
+                </try>
+              </sequence>
+            </iterate>
+                                    
+          </sequence>
+        </block>
+        <catch exception="'STAXException.TestGroupException'">
+          <sequence>
+            <message log="1" level="'fatal'">'Execution of Test Group Failed'</message>
+          </sequence>
+        </catch>        
+        <finally>
+          <!-- Test Group postamble -->
+          <call function="'testGroup_Postamble'"/>
+        </finally>
+      </try>
+    </sequence>
+  </function>
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta_cleanup.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta_cleanup.xml
new file mode 100644
index 0000000..9bd0013
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta_cleanup.xml
@@ -0,0 +1,86 @@
+<?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/CDDLv1_0.txt
+ ! or http://forgerock.org/license/CDDLv1.0.html.
+ ! 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/CDDLv1_0.txt.  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 2011 ForgeRock AS.
+ ! -->
+<stax>
+
+  <defaultcall function="pta_cleanup"/>
+
+  <function name="pta_cleanup">
+    <function-map-args>
+      <function-arg-def name="suiteSuffix" 
+                        type="optional" 
+                        default="None">
+        <function-arg-description>
+          Test suite suffix used to copy the server logs back to the controller.
+        </function-arg-description>
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
+    </function-map-args>
+    <sequence>
+
+      <block name="'pta-cleanup'">
+
+        <testcase name="getTestCaseName('PTA Cleanup')">
+
+          <try>
+            
+            <sequence>                      
+                      
+              <!-- Stop the servers in the topology -->      
+              <call function="'stopServers'">
+                [_splitServerList]
+              </call>
+                  
+              <!-- Remove  the topology created for the test suite -->
+              <message>
+                'Remove DS topology created for the PTA Test Suite'
+              </message>          
+      
+              <call function="'removeTopology'">
+                { 'multipleInstanceTopology' : True }
+              </call>  
+    
+            </sequence>
+            
+          <finally>
+            <!-- Test Group postamble -->
+            <sequence>
+              <call function="'testCase_Postamble'"/>
+            </sequence>
+          </finally>
+            
+          </try>
+          
+        </testcase>
+
+      </block>
+    
+    </sequence>
+
+  </function>
+
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta_setup.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta_setup.xml
new file mode 100644
index 0000000..8b023b8
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/pta/pta_setup.xml
@@ -0,0 +1,209 @@
+<?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/CDDLv1_0.txt
+ ! or http://forgerock.org/license/CDDLv1.0.html.
+ ! 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/CDDLv1_0.txt.  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 2011 ForgeRock AS.
+ ! -->
+<stax>
+
+  <defaultcall function="pta_setup"/>
+
+  <function name="pta_setup">
+    <function-map-args>
+      <function-arg-def name="topologyFile" 
+                        type="optional" 
+                        default="'%s/basic_topology.txt' % REPLICATION_CONFIG_DIR">
+        <function-arg-description>
+          Pathname to file describing the topology.
+        </function-arg-description>
+        <function-arg-property name="type" value="filepath"/>
+      </function-arg-def>
+    </function-map-args>    
+    
+    <sequence>
+
+      <block name="'pta-setup'">
+
+        <testcase name="getTestCaseName('PTA Setup')">
+                  
+          <try>
+
+            <sequence>
+              
+              <call function="'testCase_Preamble'"/>
+          
+              <message>
+                 'Create DS topology as described in %s' % topologyFile
+              </message>
+                     
+              <call function="'createTopology'">
+                { 'topologyDescFile'        : topologyFile,
+                  'sharedDataFolder'        : 'pta'
+                }
+              </call>  
+    
+              <!-- Start the servers in the topology -->        
+              <call function="'startServers'">
+                [_splitServerList ]
+              </call>
+    
+              <script>
+                local_ldap            = 0
+                primary_remote_ldap   = 1
+                secondary_remote_ldap = 2
+                
+                local_ldap_server = _topologyServerList[local_ldap]
+                primary_remote_ldap_server = _topologyServerList[primary_remote_ldap]
+                secondary_remote_ldap_server = _topologyServerList[secondary_remote_ldap]
+              </script>
+    
+              <!-- On remote servers create suffixes -->
+              <paralleliterate var="server"
+                                 in="_topologyServerList"
+                                 indexvar="whoami">
+                <sequence>
+                  <if expr="whoami == local_ldap">
+                    <sequence>
+                      <message>
+                        'local-ldap-server %s:%s' % \
+                            (server.getHostname(),server.getPort())
+                      </message>
+                      <script>
+                        dataFile = 'Example.ldif'
+                        serverDataFile   = '%s/pta/%s' \
+                          % (server.getDataDir(), dataFile)
+                        serverSkipFile   = '%s/pta/skipped%s.ldif' \
+                          % (server.getTmpDir(),whoami)
+                        serverRejectFile = '%s/pta/rejects%s.ldif' \
+                          % (server.getTmpDir(),whoami)
+                      </script>
+                      <message>
+                        'Import data from %s into local-ldap-server %s:%s' \
+                        % (serverDataFile, server.getHostname(), server.getPort())
+                      </message>
+                        
+                      <!-- Import data into "local-ldap-server" -->
+                      <call function="'ImportLdifWithScript'">
+                        { 'location'            : server.getHostname(),
+                          'dsPath'              : '%s/%s' \
+                                                     % (server.getDir(),OPENDSNAME),
+                          'dsInstanceHost'      : server.getHostname(),
+                          'dsInstanceAdminPort' : server.getAdminPort(),
+                          'dsInstanceDn'        : server.getRootDn(),
+                          'dsInstancePswd'      : server.getRootPwd(),
+                          'backEnd'             : 'userRoot',
+                          'ldifFile'            : serverDataFile ,
+                          'skipFile'            : serverSkipFile ,
+                          'rejectFile'          : serverRejectFile
+                        }
+                      </call>
+                    </sequence>
+                  <else>
+                    <sequence>
+                      <message>
+                        'remote-ldap-server %s:%s' \
+                          % (server.getHostname(),server.getPort())
+                      </message>
+                      
+                      <!-- Create different backend on remote-ldap-servers -->
+                      <script>
+                        options=[]
+                        options.append('--backend-name "AD"')
+                        options.append('--set base-dn:"dc=AD,dc=com"')
+                        options.append('--set enabled:true')
+                        options.append('--set writability-mode:enabled')
+                        options.append('--type local-db')
+                        createBackendOptions=' '.join(options)
+                      </script>
+      
+                      <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'          : 'create-backend',
+                          'optionsString'       : createBackendOptions
+                        }
+                      </call>
+
+                      <script>
+                        dataFile = 'AD.ldif'
+                        serverDataFile   = '%s/pta/%s' \
+                          % (server.getDataDir(), dataFile)
+                        serverSkipFile   = '%s/pta/skipped%s.ldif' \
+                          % (server.getTmpDir(),whoami)
+                        serverRejectFile = '%s/pta/rejects%s.ldif' \
+                          % (server.getTmpDir(),whoami)
+                      </script>
+
+                      <message>
+                        'Import data from %s into remote-ldap-server %s:%s' \
+                          % (serverDataFile, server.getHostname(), server.getPort())
+                      </message>
+    
+                      <!-- Import data into "remote-ldap-servers" -->
+                      <call function="'ImportLdifWithScript'">
+                        { 'location'           : server.getHostname(),
+                          'dsPath'             : '%s/%s' \
+                                                   % (server.getDir(),OPENDSNAME),
+                          'dsInstanceHost'      : server.getHostname(),
+                          'dsInstanceAdminPort' : server.getAdminPort(),
+                          'dsInstanceDn'        : server.getRootDn(),
+                          'dsInstancePswd'      : server.getRootPwd(),
+                          'backEnd'             : 'AD',
+                          'ldifFile'            : serverDataFile,
+                          'skipFile'            : serverSkipFile ,
+                          'rejectFile'          : serverRejectFile
+                        }
+                      </call>
+    
+                    </sequence>
+                  </else>
+                  </if>
+                </sequence>
+              </paralleliterate>
+    
+            </sequence>
+              
+          <finally>
+            <!-- Test Group postamble -->
+            <sequence>
+              <call function="'testCase_Postamble'"/>
+            </sequence>
+          </finally>
+
+         </try>
+          
+        </testcase>
+ 
+      </block>
+    
+    </sequence>
+
+  </function>
+
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/shared/ant/build.properties b/opendj-sdk/opends/tests/staf-tests/shared/ant/build.properties
index 6f31232..38808a6 100644
--- a/opendj-sdk/opends/tests/staf-tests/shared/ant/build.properties
+++ b/opendj-sdk/opends/tests/staf-tests/shared/ant/build.properties
@@ -112,7 +112,7 @@
 ldclt.dir=
 temp.dir=/tmp
 test.plan.custom=
-test.plan.functional.default=aci,backends,clu,clu_secure,core,dsconfig,dsml,fractional-replication,groups,i18n,indexes,logging,monitoring,plugins,privileges,replication,schema,security,setup,snmp,tasks,virtualAttributes,replication-safe-data,replication-safe-read
+test.plan.functional.default=aci,backends,clu,clu_secure,core,dsconfig,dsml,fractional-replication,groups,i18n,indexes,logging,monitoring,plugins,privileges,pta,replication,schema,security,setup,snmp,tasks,virtualAttributes,replication-safe-data,replication-safe-read
 test.plan.stress.default=import_ldif,ldap_operation,replication
 verbose.mode=false
 

--
Gitblit v1.10.0