<?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 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 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 2007-2008 Sun Microsystems, Inc.
! Portions Copyright 2012 ForgeRock AS.
! -->
<stax>
<defaultcall function="replication_cleanup"/>
<function name="replication_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-arg-def name="label"
type="optional"
default="'Replication'">
<function-arg-description>
Friendly label name
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
</function-map-args>
<sequence>
<block name="'replication-cleanup'">
<testcase name="getTestCaseName('%s Cleanup' % label)">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<!-- Stop the servers in the topology -->
<call function="'stopServers'">
[_splitServerList]
</call>
<!-- Copy the server logs to the controller machine -->
<if expr="suiteSuffix != None">
<paralleliterate var="server" in="_splitServerList" indexvar="i">
<sequence>
<script>
suffix = suiteSuffix + '_%s' % (i + 1)
serverHost = server.getHostname()
serverName = '%s:%s' % (serverHost, server.getPort())
serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
</script>
<message>
'Copy %s/logs/errors from %s to %s/errors_%s on %s' % \
(serverPath, serverName, logs.sut, suffix, STAXServiceMachine)
</message>
<call function="'copyFile'">
{
'location' : serverHost,
'srcfile' : '%s/logs/errors' % serverPath,
'destfile' : '%s/errors_%s' % (logs.sut, suffix),
'remotehost' : STAXServiceMachine
}
</call>
<message>
'Copy %s/logs/access from %s to %s/access_%s on %s' % \
(serverPath, serverName,logs.sut, suffix, STAXServiceMachine)
</message>
<call function="'copyFile'">
{
'location' : serverHost,
'srcfile' : '%s/logs/access' % serverPath,
'destfile' : '%s/access_%s' % (logs.sut, suffix),
'remotehost' : STAXServiceMachine
}
</call>
<message>
'Copy %s/logs/replication from %s to %s/replication_%s on %s' % \
(serverPath, serverName, logs.sut, suffix, STAXServiceMachine)
</message>
<call function="'copyFile'">
{
'location' : serverHost,
'srcfile' : '%s/logs/replication' % serverPath,
'destfile' : '%s/replication_%s' % (logs.sut, suffix),
'remotehost' : STAXServiceMachine
}
</call>
</sequence>
</paralleliterate>
</if>
<!-- Remove the topology created for the test suite -->
<message>
'Remove DS topology created for the Synchronization Basic Test Suite'
</message>
<call function="'removeTopology'">
{ 'multipleInstanceTopology' : True }
</call>
<call function="'checkRC'">
{ 'returncode' : RC ,
'result' : STAXResult }
</call>
<tcstatus result="'pass'"></tcstatus>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<sequence>
<message log="1" level="'fatal'">
'%s: Failed to cleanup. eInfo(%s)' % (eType,eInfo)
</message>
<throw exception="'STAFException.TestSuite.CleanupException'" />
</sequence>
</catch>
<finally>
<!-- Test Case postamble -->
<call function="'testCase_Postamble'"/>
</finally>
</try>
</testcase>
</block>
</sequence>
</function>
</stax>