2140N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
2140N/A ! The contents of this file are subject to the terms of the 2140N/A ! Common Development and Distribution License, Version 1.0 only 2140N/A ! (the "License"). You may not use this file except in compliance 2140N/A ! See the License for the specific language governing permissions 2140N/A ! and limitations under the License. 2140N/A ! When distributing Covered Code, include this CDDL HEADER in each 6982N/A ! If applicable, add the following below this CDDL HEADER, with the 6982N/A ! fields enclosed by brackets "[]" replaced with your own identifying 2140N/A ! Portions Copyright [yyyy] [name of copyright owner] 4618N/A ! Copyright 2007-2009 Sun Microsystems, Inc. 2235N/A <
defaultcall function="logging_writer"/>
2235N/A <
function name="logging_writer" scope="local">
4618N/A <
block name="STAXCurrentFunction">
2235N/A CurrentTestPath['suite']=STAXCurrentFunction
2235N/A <
call function="'testSuite_Preamble'"/>
4618N/A <
call function="'common_setup'">
4618N/A <!--- Test Suite information 4618N/A #@TestSuiteName Basic tests on logging 4618N/A #@TestSuitePurpose Check the log of information under Access or Debug files is correctly done 2235N/A <!-- #################################### --> 3174N/A #@TestMarker Basic tests on logging 3174N/A #@TestName Basic test on access log publisher 3174N/A #@TestPurpose Check informations are correclty logged under Access log files. 3174N/A #@TestPurpose the Access log publisher is configured with asynchronous mode and auto-flush 3174N/A #@TestStep Set the publisher Access Logger's properties to be an asynchronous mode 2235N/A #@TestStep Set the auto-flush to TRUE 2235N/A #@TestStep Set the append property to false 2235N/A #@TestStep Configure the Size Limit rotation policy with a Max size to 1mb 2235N/A #@TestStep Execute ldapsearch request until the log are writen in the disk 2235N/A #@TestResult The recors must be written to disk after each operation 2235N/A <!-- #################################### --> 2417N/A <
testcase name="getTestCaseName('Synchronous mode Access logger')">
2235N/A <
call function="'testCase_Preamble'"/>
2235N/A '---- Check the Synchronous mode for Access loggers -----'
2235N/A ' asynchronous:false - auto-flush:true - append:false - buffer-size:20kb '
2235N/A <
message>'------ set properties --' </
message>
2235N/A <
call function="'dsconfig'">
2235N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
2235N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
2235N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
2235N/A 'subcommand' : 'set-log-publisher-prop',
2235N/A 'objectType' : 'publisher-name',
2235N/A 'objectName' : 'File-Based Access Logger',
2235N/A 'optionsString' : '--set auto-flush:true --set append:false --set asynchronous:false --set buffer-size:20kb',
2235N/A <
call function="'dsconfig'">
2235N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
2235N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
2235N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
2235N/A 'subcommand' : 'set-log-rotation-policy-prop',
2235N/A 'objectType' : 'policy-name',
2235N/A 'objectName' : 'Size Limit Rotation Policy',
2235N/A 'optionsString' : '--set file-size-limit:1mb',
2235N/A <!-- Execute ldapsearch until logs are written to disk --> 2235N/A <!-- as auto-flush is true, the logs must be written after each operation --> 2235N/A <
loop from="1" to="5" until="RC != 0">
2235N/A <
message>'###########################'</
message>
2235N/A <
message>' LOOP %s :' % cpt </
message>
2235N/A <
message>'###########################'</
message>
2235N/A <
message>'--- Execute a Search request ---'</
message>
2235N/A <
call function="'ldapSearchWithScript'">
2235N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
2235N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
2235N/A 'dsBaseDN' : DIRECTORY_INSTANCE_SFX,
2235N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
2235N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
2235N/A 'dsFilter' : 'objectclass=*',
2235N/A <
call function="'dsconfigGet'">
2235N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
2235N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
2235N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
2235N/A 'objectName' : 'log-publisher',
2235N/A 'propertyType' : 'publisher',
2235N/A 'propertyName' : 'File-Based Access Logger',
2624N/A 'attributeName' : 'rotation-policy'
2235N/A <
message>'--- Check log files ---'</
message>
2235N/A <
call function="'listFolder'">
2235N/A { 'location' : '%s' % (DIRECTORY_INSTANCE_HOST),
2235N/A 'foldername' : '%s/%
s/
logs' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME),
2235N/A <
if expr="len(cmdResult) > 0">
2235N/A <
iterate var="result" in="cmdResult">
2235N/A 'log file status for file %s is %s ' % (logname,logsize)
2235N/A for currentLog in listName:
2235N/A currentSize=listSize[currentIndex]
2235N/A listSize[currentIndex]=logsize
2235N/A 'The new log file status is : %s : %s' % (listName,listSize)
2235N/A 'The log file status of the file "%s" has changed ' % logname
2235N/A <!-- records must be writen after each operation --> 2235N/A <!-- we should exit the loop after the first ldapsearch --> 2235N/A 'ERROR. The writer are not flushed after every log records'
2235N/A <
call function="'testFailed'"/>
2235N/A 'SUCCESS. The writer are flushed after every log records'
2235N/A <
call function="'testPassed'"/>
2534N/A <
call function="'testCase_Postamble'"/>
2235N/A <!-- #################################### --> 3174N/A #@TestMarker Basic tests on logging 3174N/A #@TestName Basic test on Debug log publisher 3174N/A #@TestPurpose Check informations are correclty logged under Debug log files. 2235N/A #@TestStep Enabled the Debug Logger 3153N/A #@TestStep Define a specific log file for debug message 2235N/A #@TestStep set the debug-log-level to All 2235N/A #@TestStep Restart the server 2235N/A #@TestStep Execute a ldapsearch request 2235N/A #@TestResult Check the debug log file has been created and contains datas 2235N/A <!-- #################################### --> 2235N/A <
testcase name="getTestCaseName('basic tests on Debug logger')">
2235N/A <
call function="'testCase_Preamble'"/>
2235N/A '---- Basic tests on Debug loggers -----'
2235N/A <
message>'------ Enabled Debug logger --' </
message>
2235N/A <
call function="'dsconfig'">
2235N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
2235N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
2235N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
2235N/A 'subcommand' : 'set-log-publisher-prop',
2235N/A 'objectType' : 'publisher-name',
2235N/A 'objectName' : 'File-Based Debug Logger',
2481N/A 'optionsString' : '--set enabled:true --set default-debug-level:warning --set log-file:
logs/
mydebug',
4153N/A <
call function="'StopDsWithScript'">
4153N/A { 'location' : STAF_REMOTE_HOSTNAME,
4153N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
3853N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
3853N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
3853N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
4153N/A <
call function="'StartDsWithScript'">
4153N/A { 'location' : STAF_REMOTE_HOSTNAME }
4153N/A <!--- Check that DS started --> 4153N/A <
call function="'isAlive'">
2235N/A <
message>'--- Check log files ---'</
message>
2235N/A <
call function="'listFolder'">
2235N/A { 'location' : '%s' % DIRECTORY_INSTANCE_HOST,
2235N/A 'foldername' : '%s/%
s/
logs' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME),
2235N/A <
if expr="len(cmdResult) == 0">
2235N/A <
message>'ERROR. The Debug logger should be created'</
message>
2235N/A <
iterate var="result" in="cmdResult">
2235N/A <
message>'ERROR. The Debug logger should contain data'</
message>
2235N/A <
call function="'testPassed'"/>
2235N/A <
call function="'testFailed'"/>
2481N/A <
message>'------ Disable Debug logger --' </
message>
2481N/A <
call function="'dsconfig'">
2481N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
2481N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
2481N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
2481N/A 'subcommand' : 'set-log-publisher-prop',
2481N/A 'objectType' : 'publisher-name',
2481N/A 'objectName' : 'File-Based Debug Logger',
2481N/A 'optionsString' : '--set enabled:false',
2534N/A <
call function="'testCase_Postamble'"/>
4618N/A <!-- Test Suite Cleanup --> 4618N/A <
message>'Finally: Global Log Writer Cleanup.'</
message>
4618N/A <
call function="'common_cleanup'" />
4618N/A <
catch exception="'STAFException'">
4618N/A <
message log="1" level="'fatal'">'Cleanup of test suite failed.'</
message>
4618N/A <
call function="'testSuite_Postamble'"/>