3361N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
3361N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
3361N/A<!--
3361N/A ! CDDL HEADER START
3361N/A !
3361N/A ! The contents of this file are subject to the terms of the
3361N/A ! Common Development and Distribution License, Version 1.0 only
3361N/A ! (the "License"). You may not use this file except in compliance
3361N/A ! with the License.
3361N/A !
3361N/A ! You can obtain a copy of the license at
3361N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
3361N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
3361N/A ! See the License for the specific language governing permissions
3361N/A ! and limitations under the License.
3361N/A !
3361N/A ! When distributing Covered Code, include this CDDL HEADER in each
3361N/A ! file and include the License file at
3361N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
3361N/A ! add the following below this CDDL HEADER, with the fields enclosed
3361N/A ! by brackets "[]" replaced with your own identifying information:
3361N/A ! Portions Copyright [yyyy] [name of copyright owner]
3361N/A !
3361N/A ! CDDL HEADER END
3361N/A !
5061N/A ! Portions Copyright 2008-2010 Sun Microsystems, Inc.
6184N/A ! Portions Copyright 2011-2013 ForgeRock AS
3361N/A! -->
3361N/A<stax>
3361N/A <defaultcall function="dsml_setup" />
3361N/A <function name="dsml_setup">
4495N/A <block name="'dsml_setup'">
3361N/A <sequence>
4495N/A
3361N/A <!--- Test Case information
3361N/A #@TestMarker setup
3379N/A #@TestName setup: prepare DSML directory server
3361N/A #@TestIssue none
3379N/A #@TestPurpose Prepare the directory server necessary to the
3361N/A test suite.
3361N/A #@TestPreamble none
3379N/A #@TestStep prepare dsml directory server instance
3361N/A #@TestPostamble none
3361N/A #@TestResult Success if returns 0.
3361N/A -->
4714N/A <testcase name="getTestCaseName('prepare DSML STAF service')">
4714N/A <sequence>
4714N/A <call function="'testCase_Preamble'"/>
4714N/A
4714N/A <call function="'createFolder'">
4714N/A {
4714N/A 'location' : STAXServiceMachine,
5105N/A 'foldername' : '%s/dsml/STAF-INF/jars' % local.temp
4714N/A }
4714N/A </call>
4714N/A
5329N/A <!--- In IPS mode, get OpenDJ.jar from remote machine-->
5061N/A <if expr="IPS_PKG == True">
5061N/A <call function="'copyFile'">
5061N/A {
5061N/A 'location' : STAF_REMOTE_HOSTNAME,
5329N/A 'srcfile' : '%s/%s/lib/OpenDJ.jar' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME),
5329N/A 'destfile' : '%s/dsml/STAF-INF/jars/OpenDJ.jar' % local.temp,
5061N/A 'remotehost' : STAXServiceMachine
5061N/A }
5061N/A </call>
5061N/A <else>
5061N/A <sequence>
5061N/A <call function="'unZipFile'">
5061N/A {
5061N/A 'location' : STAXServiceMachine,
5061N/A 'zipfile' : '%s/%s' % (ZIPPATH, ZIPNAME),
5329N/A 'file' : '%s/lib/OpenDJ.jar' % OPENDSNAME,
5105N/A 'unzipdir' : '%s/dsml' % local.temp
5061N/A }
5061N/A </call>
4714N/A
5369N/A <!-- The war file can be included in the OpenDJ archive -->
5369N/A <if expr="not PRODUCTNAME.startswith('OpenDJ')">
5105N/A <sequence>
5105N/A <call function="'unZipFile'">
5105N/A {
5105N/A 'location' : STAXServiceMachine,
5105N/A 'zipfile' : '%s/%s' % (ZIPPATH, ZIPNAME),
5105N/A 'file' : '%s/addons/DSML.war' % OPENDSNAME,
5105N/A 'unzipdir' : '%s/dsml' % local.temp
5105N/A }
5105N/A </call>
5105N/A </sequence>
5105N/A </if>
5105N/A
5061N/A <call function="'copyFile'">
5061N/A {
5061N/A 'location' : STAXServiceMachine,
5329N/A 'srcfile' : '%s/dsml/%s/lib/OpenDJ.jar' % (local.temp,OPENDSNAME),
5329N/A 'destfile' : '%s/dsml/STAF-INF/jars/OpenDJ.jar' % local.temp,
5061N/A 'remotehost' : STAXServiceMachine
5061N/A }
5061N/A </call>
5061N/A </sequence>
5061N/A </else>
5061N/A </if>
4714N/A
5369N/A <!-- The war file can be included in the OpenDJ archive -->
5105N/A <script>
5369N/A if not PRODUCTNAME.startswith('OpenDJ'):
5105N/A DSML_WARPATH = '%s/dsml/%s/addons/DSML.war' % (local.temp,OPENDSNAME)
5105N/A </script>
4714N/A <call function="'unZipFile'">
4714N/A {
4714N/A 'location' : STAXServiceMachine,
4714N/A 'zipfile' : DSML_WARPATH,
4714N/A 'directory': 'WEB-INF/classes',
5105N/A 'unzipdir' : '%s/dsml' % local.temp,
4714N/A }
4714N/A </call>
4714N/A
4714N/A <call function="'copyFolder'">
4714N/A {
4714N/A 'location' : STAXServiceMachine,
5105N/A 'srcfolder' : '%s/dsml/WEB-INF/classes' % local.temp,
5105N/A 'destfolder' : '%s/dsml/STAF-INF/classes' % local.temp,
4714N/A 'remotehost' : STAXServiceMachine
4714N/A }
4714N/A </call>
5065N/A <call function="'copyFile'">
5065N/A {
5065N/A 'location' : STAF_REMOTE_HOSTNAME,
5065N/A 'srcfile' : '%/ext/emma/lib/emma.jar' % TESTS_ROOT,
5065N/A 'destfile' : '%s/dsml/STAF-INF/jars/emma.jar' % TMPDIR,
5065N/A 'remotehost' : STAXServiceMachine
5065N/A }
5065N/A </call>
4714N/A
4714N/A <script>
4714N/A if is_windows_platform(STAXServiceMachine):
4714N/A separator=';'
4714N/A else:
4714N/A separator=':'
4714N/A
5329N/A opendsjar='%s/dsml/STAF-INF/jars/OpenDJ.jar' % local.temp
5105N/A emmajar='%s/dsml/STAF-INF/jars/emma.jar' % local.temp
5105N/A dsmlclasses='%s/dsml/STAF-INF/classes' % local.temp
4714N/A </script>
4714N/A
4714N/A <call function="'GetVar'">
4714N/A {
4714N/A 'location' : STAXServiceMachine,
4714N/A 'type' : 'system',
4714N/A 'variable' : 'STAF/Env/CLASSPATH'
4714N/A }
4714N/A </call>
4714N/A <script>
4714N/A cp=STAFResult
4714N/A </script>
4714N/A
4714N/A <call function="'compileJava'" >
4714N/A {
4714N/A 'location' : STAXServiceMachine,
4714N/A 'foldername' : '%s/src' % TESTS_DSML_DIR,
5105N/A 'destfolder' : '%s/dsml/STAF-INF/classes' % local.temp,
5065N/A 'classpath' : '%s%s%s%s%s%s%s' \
5065N/A % (opendsjar,separator,emmajar,separator,dsmlclasses,separator,cp)
4714N/A }
4714N/A </call>
4714N/A
4776N/A <call function="'copyFile'">
4776N/A {
4776N/A 'location' : STAXServiceMachine,
4776N/A 'srcfile' : '%s/resource/errorStrings.properties' % TESTS_DSML_DIR,
5105N/A 'destfile' : '%s/dsml/STAF-INF/classes/errorStrings.properties' % local.temp,
4776N/A 'remotehost' : STAXServiceMachine
4776N/A }
4776N/A </call>
4776N/A
4714N/A <call function="'createFolder'">
4714N/A {
4714N/A 'location' : location,
4714N/A 'foldername' : '%s/dsml' % local.java
4714N/A }
4714N/A </call>
4714N/A <call function="'createJar'" >
4714N/A {
4714N/A 'location' : STAXServiceMachine,
4714N/A 'jarname' : '%s/dsml/dsmlService.jar' % local.java,
4714N/A 'entrypoint' : 'STAF-INF',
5105N/A 'pathfolder' : '%s/dsml' % local.temp,
4714N/A 'manifestpath' : '%s/MANIFEST.MF' % TESTS_DSML_DIR
4714N/A }
4714N/A </call>
4714N/A
4714N/A <call function="'addSTAFJavaService'" >
4714N/A {
4714N/A 'location' : STAXServiceMachine,
4754N/A 'serviceName' : 'dsml',
4714N/A 'serviceJar' : '%s/dsml/dsmlService.jar' % local.java,
4714N/A 'J2' : '-Xms128m -Xmx512m'
4714N/A }
4714N/A </call>
4714N/A
4714N/A <call function="'testCase_Postamble'"/>
4714N/A </sequence>
4714N/A </testcase>
4714N/A
4714N/A <!--- Test Case information
4714N/A #@TestMarker setup
4714N/A #@TestName setup: prepare DSML directory server
4714N/A #@TestIssue none
4714N/A #@TestPurpose Prepare the directory server necessary to the
4714N/A test suite.
4714N/A #@TestPreamble none
4714N/A #@TestStep prepare dsml directory server instance
4714N/A #@TestPostamble none
4714N/A #@TestResult Success if returns 0.
4714N/A -->
3361N/A <testcase name="getTestCaseName('prepare DSML Directory backend')">
3361N/A <sequence>
3361N/A <call function="'testCase_Preamble'"/>
3361N/A <!-- Create the DS instance necessary to the test group/suite -->
3361N/A <message>
3361N/A 'prepare instance DS as described in config.py '
3361N/A </message>
3361N/A <call function="'prepareInstanceCreation'">
3361N/A { 'groupDataDir' : 'dsml',
4662N/A 'fileExtensions' : ['dat','res','issue'] }
3361N/A </call>
3361N/A <call function="'checktestRC'">
3361N/A {
3361N/A 'returncode' : RC ,
3361N/A 'result' : STAXResult
3361N/A }
3361N/A </call>
3361N/A
3361N/A <call function="'testCase_Postamble'"/>
3361N/A </sequence>
3361N/A </testcase>
3361N/A
3361N/A <!--- Test Case information
3361N/A #@TestMarker setup
3361N/A #@TestName setup: create DSML directory server
3361N/A #@TestIssue none
3361N/A #@TestPurpose Create the directory server necessary to the
3361N/A test suite.
3361N/A #@TestPreamble none
3361N/A #@TestStep Create Directory server as defined in config.py.
3361N/A #@TestPostamble none
3361N/A #@TestResult Success if returns 0.
3361N/A -->
3361N/A <testcase name="getTestCaseName('Create, Initialize and Start DSML Directory backend')">
3361N/A <sequence>
3361N/A <call function="'testCase_Preamble'"/>
3361N/A <message>
3361N/A 'Create DS as described in config.py '
3361N/A </message>
3361N/A <call function="'createInstance'"/>
3361N/A <call function="'checktestRC'">
3361N/A {
3361N/A 'returncode' : RC ,
3361N/A 'result' : STAXResult
3361N/A }
3361N/A </call>
3361N/A
3361N/A <message>
3361N/A 'Start DS instance'
3361N/A </message>
3361N/A <call function="'StartDsWithScript'">
3379N/A { 'location' : DIRECTORY_INSTANCE_HOST }
3361N/A </call>
3361N/A <call function="'checktestRC'">
3361N/A {
3361N/A 'returncode' : RC ,
3361N/A 'result' : STAXResult
3361N/A }
3361N/A </call>
3361N/A
3361N/A <call function="'isAlive'">
4153N/A { 'noOfLoops' : 10 ,
3361N/A 'noOfMilliSeconds' : 2000 }
3361N/A </call>
3361N/A <call function="'checkRC'">
3361N/A { 'returncode' : RC ,
3361N/A 'result' : STAXResult }
3361N/A </call>
3361N/A <call function="'testCase_Postamble'"/>
3361N/A </sequence>
3361N/A </testcase>
3361N/A
3361N/A <!--- Test Case information
3361N/A #@TestMarker setup
3361N/A #@TestName setup: import DSML directory server test data
3361N/A #@TestIssue none
3361N/A #@TestPurpose Import the directory server test data.
3361N/A #@TestPreamble none
3361N/A #@TestStep Import Directory server as defined in config.py.
3361N/A #@TestPostamble none
3361N/A #@TestResult Success if returns 0.
3361N/A -->
3361N/A <testcase name="getTestCaseName('Import DSML test data in Directory backend')">
3361N/A <sequence>
3361N/A <call function="'testCase_Preamble'"/>
3361N/A <message>
3361N/A 'Import DSML test data'
3361N/A </message>
3361N/A <script>
3361N/A dsmlBaseDNs = {
4662N/A 'o=dsmlfe.com' : ('dsmlfe.ldif', 'dsmlfe_BE', 160),
4662N/A 'dc=example,dc=com' : ('oasis.ldif', 'oasis_BE', 160),
4662N/A 'o=IMC, c=US' : ('search.ldif', 'example_BE', 1084),
3361N/A }
3361N/A </script>
3361N/A <iterate var="baseDN" in="dsmlBaseDNs.keys()">
3361N/A <sequence>
3361N/A <message>
3361N/A 'Import DSML test data [%s | %s | %s/%s/db/%s | %s/%s/import-tmp]' %\
3361N/A (baseDN,\
3361N/A dsmlBaseDNs.get(baseDN)[1],\
3361N/A DIRECTORY_INSTANCE_DIR, OPENDSNAME, dsmlBaseDNs.get(baseDN)[1],\
3361N/A DIRECTORY_INSTANCE_DIR, OPENDSNAME)
3361N/A </message>
3392N/A
3392N/A <message>
3392N/A 'Create database backend %s.' % dsmlBaseDNs.get(baseDN)[1]
3392N/A </message>
3361N/A <script>
3392N/A options=[]
3392N/A options.append('--backend-name %s' % dsmlBaseDNs.get(baseDN)[1])
3392N/A options.append('--set db-directory:%s' % dsmlBaseDNs.get(baseDN)[1])
3392N/A options.append('--set base-dn:"%s"' % baseDN)
3392N/A options.append('--set enabled:true')
3392N/A options.append('--set writability-mode:enabled')
3392N/A options.append('-t local-db')
3392N/A createBackendOptions=' '.join(options)
3361N/A </script>
3392N/A
3392N/A <call function="'dsconfig'">
3392N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
3392N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
3392N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
3392N/A 'subcommand' : 'create-backend',
3392N/A 'optionsString' : createBackendOptions
3361N/A }
3361N/A </call>
3392N/A
5064N/A <call function="'ImportLdifWithScript'">
5073N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
5064N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5073N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
5073N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
5073N/A 'ldifFile' : '%s/dsml/ldif-files/%s' % (remote.data,dsmlBaseDNs.get(baseDN)[0]),
5073N/A 'backEnd' : '%s' % dsmlBaseDNs.get(baseDN)[1]
3361N/A }
3361N/A </call>
5064N/A
4662N/A <script>
4662N/A nbEntriesExpected = dsmlBaseDNs.get(baseDN)[2]
4662N/A </script>
4662N/A <call function="'ldapSearchWithScript'">
4662N/A {
4662N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
4662N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
4662N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
4662N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
4662N/A 'dsCountEntries' : 'True' ,
4662N/A 'dsBaseDN' : baseDN,
4662N/A 'dsFilter' : 'objectclass=*' ,
5064N/A 'dsAttributes' : 'dn',
4662N/A 'expectedRC' : 'noCheck'
4662N/A }
4662N/A </call>
4662N/A
4662N/A <script>
4662N/A returnString = STAXResult[0][1]
4662N/A </script>
4662N/A
4662N/A <call function="'checktestString'">
4662N/A {
4662N/A 'returnString' : returnString ,
6184N/A 'expectedString' : 'Total number of matching entries: %s' % nbEntriesExpected
4662N/A }
4662N/A </call>
4662N/A
3361N/A <call function="'checkRC'">
3361N/A { 'returncode' : RC ,
3361N/A 'result' : STAXResult }
3361N/A </call>
3361N/A </sequence>
3361N/A </iterate>
3361N/A <call function="'checktestRC'">
3361N/A {
3361N/A 'returncode' : RC ,
3361N/A 'result' : STAXResult
3361N/A }
3361N/A </call>
3361N/A <call function="'testCase_Postamble'"/>
3361N/A </sequence>
3361N/A </testcase>
3361N/A
3361N/A <!--- Test Case information
3361N/A #@TestMarker setup
3361N/A #@TestName setup: create webcontainer
3361N/A #@TestIssue none
3361N/A #@TestPurpose Create the webcontainer necessary to the
3361N/A test suite.
3361N/A #@TestPreamble none
3361N/A #@TestStep Create webcontainer as described in config.py.
3361N/A #@TestPostamble none
3361N/A #@TestResult Success if createWebcontainer returns 0.
3361N/A -->
3361N/A <testcase name="getTestCaseName('setup: create webcontainer')">
3361N/A <sequence>
3361N/A <call function="'testCase_Preamble'"/>
3361N/A <message>
3361N/A 'setup: create webcontainer as described in config.py'
3361N/A </message>
3361N/A <call function="'createWebcontainer'" />
3361N/A <call function="'checktestRC'">
3361N/A {
3361N/A 'returncode' : RC ,
3361N/A 'result' : STAXResult
3361N/A }
3361N/A </call>
3361N/A <call function="'testCase_Postamble'"/>
3361N/A </sequence>
3361N/A </testcase>
3361N/A
3361N/A <!--- Test Case information
3361N/A #@TestMarker setup
3361N/A #@TestName setup: deploy web application WAR file
3361N/A #@TestIssue none
3361N/A #@TestPurpose Deploy web application necessary to the
3361N/A test suite.
3361N/A #@TestPreamble none
3361N/A #@TestStep Deploy web application as described in config.py.
3361N/A #@TestPostamble none
3361N/A #@TestResult Success if deployWebApplicationWAR returns 0.
3361N/A -->
3392N/A <testcase name="getTestCaseName('setup: deploy Webapplication')">
3361N/A <sequence>
3361N/A <call function="'testCase_Preamble'"/>
3361N/A <message>
3361N/A 'setup: deploy DSML gateway webapp as described in config.py'
3361N/A </message>
5105N/A
5369N/A <!-- The war file can be included in the OpenDJ archive -->
5105N/A <script>
5369N/A if not PRODUCTNAME.startswith('OpenDJ'):
5105N/A DSML_WARPATH = '%s/dsml/%s/addons/DSML.war' % (local.temp,OPENDSNAME)
5105N/A </script>
5105N/A
3361N/A <call function="'deployWebApplicationWAR'">
3379N/A { 'warFilePath' : '%s' % DSML_WARPATH }
3361N/A </call>
3361N/A <call function="'checktestRC'">
3361N/A {
3361N/A 'returncode' : RC ,
3361N/A 'result' : STAXResult
3361N/A }
3361N/A </call>
3361N/A <call function="'testCase_Postamble'"/>
3361N/A </sequence>
3361N/A </testcase>
3361N/A
3361N/A <!--- Test Case information
3361N/A #@TestMarker setup
3361N/A #@TestName setup: start web webcontainer
3361N/A #@TestIssue none
3361N/A #@TestPurpose Start the webcontainer necessary to the
3361N/A test suite.
3361N/A #@TestPreamble none
3361N/A #@TestStep start webcontainer as described in config.py.
3361N/A #@TestPostamble none
3361N/A #@TestResult Success if statWebcontainerWithScript returns 0.
3361N/A -->
3361N/A <testcase name="getTestCaseName('setup: start webcontainer')">
3361N/A <sequence>
3361N/A <call function="'testCase_Preamble'"/>
3361N/A <message>
3361N/A 'setup: start webcontainer as described in config.py'
3361N/A </message>
3379N/A <call function="'startWebcontainerWithScript'"/>
3889N/A
3361N/A <stafcmd name="'waiting for webcontainer startup'">
3361N/A <location>'%s' % location</location>
3361N/A <service>'delay'</service>
3361N/A <request>' DELAY 10000'</request>
3361N/A </stafcmd>
3361N/A <call function="'testCase_Postamble'"/>
3361N/A </sequence>
3361N/A </testcase>
3361N/A
3379N/A <!--- Test Case information
3379N/A #@TestMarker setup
3379N/A #@TestName setup: configure DSML gateway DS port param
3379N/A #@TestIssue none
3379N/A #@TestPurpose Set the gateway web.xml param pointing to DS
3379N/A #@TestPreamble none
3379N/A #@TestSteps extract web.xml out of DSML war file locally
3379N/A #@TestSteps substitute default port 389 with DIRECTORY_INSTANCE_PORT
3379N/A #@TestSteps substitute default directory host localhost with DIRECTORY_INSTANCE_HOST
3379N/A #@TestSteps overwrite the destination DSML gateway web.xml
3379N/A #@TestPostamble none
3379N/A #@TestResult Success if statWebcontainerWithScript returns 0.
3379N/A -->
3361N/A <testcase name="getTestCaseName('configure: dsml web.xml port')">
3361N/A <sequence>
3361N/A <call function="'testCase_Preamble'"/>
3392N/A <message>
3392N/A 'setup: configure DSML gateway DS port param.'
3392N/A </message>
3392N/A
3889N/A <script>
3889N/A myTmpDir='%s/%s' % (local.temp, STAF_REMOTE_HOSTNAME)
3889N/A </script>
3889N/A <message>
3889N/A 'Create folder %s on host %s' % (myTmpDir,STAXServiceMachine)
3889N/A </message>
3889N/A <call function="'createFolder'">
3889N/A { 'location' : STAXServiceMachine,
3889N/A 'foldername' : '%s' % myTmpDir
3889N/A }
3889N/A </call>
3889N/A
5369N/A <!-- The war file can be included in the OpenDJ archive -->
5105N/A <script>
5369N/A if not PRODUCTNAME.startswith('OpenDJ'):
5105N/A DSML_WARPATH = '%s/dsml/%s/addons/DSML.war' % (local.temp,OPENDSNAME)
5105N/A </script>
3392N/A <call function="'runSTAFCommand'">
3392N/A { 'name' : 'Extract DSML gateway web.xml',
3392N/A 'location' : STAXServiceMachine,
3392N/A 'service' : 'ZIP',
3392N/A 'request' : 'UNZIP',
3889N/A 'arguments' : 'ZIPFILE %s TODIRECTORY %s FILE WEB-INF/web.xml' \
3889N/A % (DSML_WARPATH, myTmpDir)
3392N/A }
3392N/A </call>
3392N/A
3361N/A <script>
3889N/A webXmlInput=open('%s/WEB-INF/web.xml' % myTmpDir,'r')
3361N/A import re
3361N/A portRegEx = re.compile('389')
3379N/A hostRegEx = re.compile('localhost')
3379N/A c0=webXmlInput.read()
3379N/A c1=portRegEx.sub(DIRECTORY_INSTANCE_PORT, c0)
3379N/A content=hostRegEx.sub(DIRECTORY_INSTANCE_HOST, c1)
3361N/A webXmlInput.close()
3889N/A webXmlOutput=open('%s/WEB-INF/web.xml.out' % myTmpDir,'w')
3361N/A webXmlOutput.write(content)
3361N/A webXmlOutput.close()
3361N/A </script>
3889N/A
3889N/A <message>
3889N/A 'Update DSML gateway web.xml file on host %s' % STAF_REMOTE_HOSTNAME
3889N/A </message>
4978N/A <script>
4978N/A # create the autodeploy webapp path
4978N/A destWebXml = None
4978N/A if WC_TYPE == 'tomcat':
4978N/A destWebXml = os.path.join(WC_DIRECTORY, 'apache-%s-%s' % (WC_TYPE, WC_VERSION), 'webapps',
4978N/A 'dsml', 'WEB-INF', 'web.xml')
5116N/A destEmmaProp = os.path.join(WC_DIRECTORY, 'apache-%s-%s' % (WC_TYPE, WC_VERSION), 'webapps',
5116N/A 'dsml', 'WEB-INF', 'classes', 'emma.properties')
4978N/A elif WC_TYPE == 'glassfish':
4978N/A destWebXml = os.path.join(WC_DIRECTORY, 'glassfishv3', 'glassfish',
4978N/A 'domains', 'domain1', 'applications',
4978N/A 'dsml', 'WEB-INF', 'web.xml')
5116N/A destEmmaProp = os.path.join(WC_DIRECTORY, 'glassfishv3', 'glassfish',
5116N/A 'domains', 'domain1', 'applications',
5116N/A 'dsml', 'WEB-INF', 'classes', 'emma.properties')
4978N/A elif WC_TYPE == 'sunwebserver':
4978N/A destWebXml = os.path.join(WC_DIRECTORY, '%s-%s' % (WC_TYPE, WC_VERSION), 'https-%s' % STAF_REMOTE_HOSTNAME,
4978N/A 'generated', STAF_REMOTE_HOSTNAME, 'dsml', 'WEB-INF', 'web.xml')
5116N/A destEmmaProp = os.path.join(WC_DIRECTORY, '%s-%s' % (WC_TYPE, WC_VERSION), 'https-%s' % STAF_REMOTE_HOSTNAME,
5116N/A 'generated', STAF_REMOTE_HOSTNAME, 'dsml', 'WEB-INF', 'classes', 'emma.properties')
4978N/A
4978N/A nbLoop = 10
4978N/A loopSleep = 1000 # 1000 millisecondes
4978N/A </script>
4978N/A <message>'checking presence of deployed dsml %s' % destWebXml</message>
4978N/A <loop from="0" to="nbLoop" while="RC == 48">
4978N/A <sequence>
4978N/A <call function="'Sleep'">
4978N/A {'sleepForMilliSeconds' : loopSleep }
4978N/A </call>
4978N/A <message>'going to sleep for 2 secondes'</message>
4978N/A <call function="'GetEntry'">
4978N/A {
4978N/A 'location' : STAF_REMOTE_HOSTNAME,
4978N/A 'entry' : destWebXml,
4978N/A 'attribute': 'TYPE'
4978N/A }
4978N/A </call>
4978N/A </sequence>
4978N/A </loop>
4978N/A <if expr="RC == 0">
4978N/A <sequence>
4978N/A <message>
4978N/A 'going to copy %s:%s/WEB-INF/web.xml.out to %s:%s' % (STAXServiceMachine,myTmpDir,STAF_REMOTE_HOSTNAME,destWebXml)
4978N/A </message>
4978N/A <call function="'copyFile'">
4978N/A { 'location' : STAXServiceMachine,
4978N/A 'remotehost' : '%s' % STAF_REMOTE_HOSTNAME,
4978N/A 'srcfile' : '%s/WEB-INF/web.xml.out' % myTmpDir,
4978N/A 'destfile' : destWebXml
4978N/A }
4978N/A </call>
4978N/A <call function="'checktestRC'">
4978N/A {
4978N/A 'returncode' : RC ,
4978N/A 'result' : STAXResult
4978N/A }
4978N/A </call>
5116N/A
5116N/A <script>
5116N/A ecPath = os.path.join(remote.temp,'coverage',CurrentTestPath['group'],'coverage_dsml.ec')
5116N/A
5116N/A coveragefh = open( '%s/emma_dsml.properties' % local.temp, 'w')
5116N/A coveragefh.write( 'coverage.out.file=%s\n' % ecPath )
5116N/A coveragefh.write( 'verbosity.level=silent\n')
5116N/A coveragefh.write( 'coverage.out.merge=true\n')
5116N/A coveragefh.close()
5116N/A </script>
5116N/A
5116N/A <message>
5116N/A 'PATH ORIG %s/emma_dsml.properties' % local.temp
5116N/A </message>
5116N/A <message>
5116N/A 'PATH DEST %s' % destEmmaProp
5116N/A </message>
5116N/A <call function="'copyFile'">
5116N/A { 'location' : STAXServiceMachine,
5116N/A 'remotehost' : '%s' % STAF_REMOTE_HOSTNAME,
5116N/A 'srcfile' : '%s/emma_dsml.properties' % local.temp,
5116N/A 'destfile' : destEmmaProp
5116N/A }
5116N/A </call>
5116N/A <call function="'checktestRC'">
5116N/A {
5116N/A 'returncode' : RC ,
5116N/A 'result' : STAXResult
5116N/A }
5116N/A </call>
5116N/A
4978N/A <call function="'stopWebcontainerWithScript'"/>
4978N/A <call function="'startWebcontainerWithScript'"/>
4978N/A </sequence>
4978N/A <else>
4978N/A <message>
4978N/A 'the target %s is not available after %sms' % (destWebXml, (nbLoop*loopSleep))
4978N/A </message>
4978N/A </else>
4978N/A </if>
3361N/A <call function="'checktestRC'">
3361N/A {
3361N/A 'returncode' : RC ,
3361N/A 'result' : STAXResult
3361N/A }
3361N/A </call>
3361N/A <call function="'testCase_Postamble'"/>
3361N/A </sequence>
3361N/A </testcase>
4495N/A
3361N/A </sequence>
3361N/A </block>
3361N/A </function>
3361N/A</stax>