869N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
869N/A ! The contents of this file are subject to the terms of the 869N/A ! Common Development and Distribution License, Version 1.0 only 869N/A ! (the "License"). You may not use this file except in compliance 869N/A ! You can obtain a copy of the license at 869N/A ! See the License for the specific language governing permissions 869N/A ! and limitations under the License. 869N/A ! When distributing Covered Code, include this CDDL HEADER in each 873N/A ! file and include the License file at 869N/A ! add the following below this CDDL HEADER, with the fields enclosed 869N/A ! by brackets "[]" replaced with your own identifying information: 869N/A ! Portions Copyright [yyyy] [name of copyright owner] 0N/A ! Portions Copyright 2008 Sun Microsystems, Inc. 869N/A <
function name="createWebcontainer" scope="local">
0N/A This function creates a default webcontainer instance
869N/A <
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
0N/A <
function-
arg-
description>
869N/A Location of target host
869N/A </
function-
arg-
description>
869N/A <
function-
arg-
property name="type" value="hostname"/>
869N/A <
function-
arg-
def name="wcPath" type="optional" default="'%s' % WC_DIRECTORY">
48N/A <
function-
arg-
description>
869N/A Pathname to installation root
0N/A </
function-
arg-
description>
869N/A <
function-
arg-
property name="type" value="filepath"/>
1954N/A <!-- Copy webcontainer zip archive to remote host --> 2350N/A 'Copy webcontainer %s to host %s' % (WC_ZIPNAME,location)
1954N/A <
call function="'copyFile'">
1954N/A { 'location' : STAXServiceMachine,
1954N/A 'srcfile' : '%s/%s' % (WC_ZIPPATH,WC_ZIPNAME),
0N/A 'destfile' : '%s/%s' % (wcPath,WC_ZIPNAME),
0N/A 'remotehost' : mylocation
2693N/A <!-- Unzip webcontainer into temporary folder --> 1004N/A 'Extract temporary webcontainer zip archive to %s %s.' % (location, wcPath)
1378N/A <
call function="'unZipFile'">
1503N/A 'zipfile' : '%s/%s' % (wcPath,WC_ZIPNAME),
2915N/A 'unzipdir' : '%s' % wcPath }
2624N/A <!-- chmod +x all the .sh file in tomcat bin directory --> 0N/A <
stafcmd name="'make tomcat shell scripts executable'">
2270N/A <
location>'%s' % mylocation</
location>
2270N/A <
request>' LIST DIRECTORY %s/%s-%
s/
bin EXT sh' % \
2270N/A (wcPath, WC_TYPE, WC_VERSION)</
request>
0N/A shFilesResult=" ".join(STAFResult)
868N/A <
message>'shFilesResult=%s' % shFilesResult</
message>
0N/A <
process name="'chmod +x tomcat\'s shell scripts'">
0N/A <
location>'%s' % mylocation</
location>
65N/A <
command mode="'shell'">'chmod +x %s' % shFilesResult</
command>
868N/A <
workdir>'%s/%s-%
s/
bin' % (wcPath, WC_TYPE, WC_VERSION)</
workdir>
869N/A <
stderr mode="'stdout'"/>
65N/A <!-- generate SSL certificate --> 65N/A <
location>STAXServiceMachine</
location>
65N/A <
service>'var'</
service>
65N/A <
script>stafRoot=STAFResult</
script>
65N/A <!-- Check if 'tomcatCertificate' file exists --> 65N/A <
call function="'GetEntry'">
2266N/A 'location' : STAXServiceMachine,
2624N/A <!-- 'tomcatCertificate' file does not exist so generate it --> 2266N/A <
call function="'runCommand'">
2624N/A { 'name' : 'Generate a Certificate',
2266N/A 'location' : STAXServiceMachine,
2266N/A 'arguments' : '-genkey -alias tomcat -keyalg rsa \
2266N/A -dname "cn=tomcat,O=Sun Microsystems,C=US" \
2266N/A -storepass "changeit" -keypass "changeit" \
2266N/A -storetype JKS ' % (stafRoot),
2266N/A <
call function="'copyFile'">
2266N/A { 'location' : STAXServiceMachine,
2266N/A <!-- configure webcontainer's PORTs --> 2266N/A 'Configure webcontainer ports HTTP %s / HTTPS %s' % (WC_PORT, WC_SSL_PORT)
2266N/A <
stafcmd name="'get tomcat configuration file'">
0N/A <
location>'%s' % mylocation</
location>
869N/A <
service>'fs'</
service>
0N/A (wcPath, WC_TYPE, WC_VERSION)</
request>
0N/A serverXmlInput=STAFResult
0N/A sslConnectorRegEx =
re.compile('<Service name="Catalina">')
0N/A SSL_CONNECTOR = '<Service name="Catalina">\n \
868N/A SSLEnabled="true" maxThreads="150" scheme="https" secure="true" \
0N/A clientAuth="false" sslProtocol="SSL" \
869N/A keystorePass="changeit" />' % \
0N/A (WC_SSL_PORT, wcPath, WC_TYPE, WC_VERSION)
2624N/A <
call function="'copyFile'">
2624N/A 'remotehost' : '%s' % STAF_REMOTE_HOSTNAME
2624N/A <!-- configure webcontainer's SSL environement --> 2624N/A 'Configure webcontainer SSL keystore '
2624N/A <
catch exception="'TestExceptionResultFailed'" typevar="eType" var="eInfo">
2624N/A <
message>'caught %s with %s' % (eType,eInfo)</
message>
2624N/A 'Remove temporary webcontainer zip archive from %s %s' % (location,wcPath)
2624N/A <
call function="'deleteFolder'">
2624N/A 'foldername' : '%s' % wcPath }
0N/A <
function name="deployWebApplicationWAR" scope="local">
848N/A This function deploys a Web Application War file
848N/A <
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
0N/A Location of target host
2624N/A </
function-
arg-
description>
2624N/A <
function-
arg-
property name="type" value="hostname"/>
0N/A <
function-
arg-
def name="wcPath" type="optional" default="'%s' % WC_DIRECTORY">
868N/A <
function-
arg-
description>
2624N/A Pathname to installation root
2222N/A </
function-
arg-
description>
2624N/A <
function-
arg-
property name="type" value="filepath"/>
2222N/A <
function-
arg-
def name="warFilePath" type="required" default="''">
2624N/A Web application war file path
2222N/A </
function-
arg-
description>
2624N/A <
function-
arg-
property name="type" value="filepath"/>
2222N/A <
function-
arg-
def name="destWarFileName" type="optional" default="'dsml.war'">
2624N/A Web application war destination file path
868N/A </
function-
arg-
description>
2624N/A <
function-
arg-
property name="type" value="filepath"/>
868N/A 'setup: deploy web application %s to %s/%s-%
s/
webapps/%s' % (warFilePath, wcPath, WC_TYPE, WC_VERSION, destWarFileName)
868N/A <
call function="'copyFile'">
868N/A { 'location' : STAXServiceMachine,
868N/A 'srcfile' : '%s' % warFilePath,
2624N/A 'destfile' : '%s/%s-%
s/
webapps/%s' % (wcPath, WC_TYPE, WC_VERSION, destWarFileName),
868N/A 'remotehost' : location}
2624N/A <
function name="stopWebcontainerWithScript" scope="local">
868N/A This function stops a webcontainer
868N/A <
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
868N/A </
function-
arg-
description>
868N/A <
function-
arg-
property name="type" value="hostname"/>
2624N/A <
function-
arg-
def name="wcPath" type="optional" default="'%s' % WC_DIRECTORY">
868N/A <
function-
arg-
description>
2624N/A Pathname to installation root
2624N/A </
function-
arg-
description>
868N/A <
function-
arg-
property name="type" value="filepath"/>
2624N/A STAFCmdEnv=['CATALINA_HOME=%s' % wcPath,'PATH=/bin:/
usr/
bin',\
2624N/A 'JAVA_HOME=%s' % JAVA_HOME]
1948N/A <
call function="'runCommand'">
869N/A { 'location' : location,
869N/A <
function name="startWebcontainerWithScript" scope="local">
2334N/A This function start a webcontainer
869N/A <
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
869N/A </
function-
arg-
description>
2270N/A <
function-
arg-
property name="type" value="hostname"/>
2270N/A <
function-
arg-
def name="wcPath" type="optional" default="'%s/%s-%s' % (WC_DIRECTORY, WC_TYPE, WC_VERSION)">
2270N/A Pathname to installation root
2624N/A </
function-
arg-
description>
2624N/A <
function-
arg-
property name="type" value="filepath"/>
2624N/A STAFCmdEnv=['CATALINA_HOME=%s' % wcPath,'PATH=/bin:/
usr/
bin', \
2624N/A 'JAVA_HOME=%s' % JAVA_HOME]
869N/A <!-- On Windows systems, startup command always returns 1 --> 2624N/A if is_windows_platform(location):
869N/A <
call function="'runCommand'">
869N/A { 'location' : location,
2615N/A <
function name="removeWebcontainer" scope="local">
2615N/A This function removes the webcontainer instance
2624N/A <
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
2622N/A </
function-
arg-
description>
2615N/A <
function-
arg-
property name="type" value="hostname"/>
869N/A <
function-
arg-
def name="wcPath" type="optional" default="'%s' % WC_DIRECTORY">
868N/A <
function-
arg-
description>
824N/A Pathname to installation root
824N/A </
function-
arg-
description>
824N/A <
function-
arg-
property name="type" value="filepath"/>
869N/A <!-- Remove webcontainer directory --> 869N/A 'Remove webcontainer from %s %s.' % (location,wcPath)
869N/A <
call function="'deleteFolder'">
2624N/A 'foldername' : '%s/%s-%s' % (wcPath, WC_TYPE, WC_VERSION) }
2624N/A <
catch exception="'TestExceptionResultFailed'" typevar="eType" var="eInfo">
2624N/A <
message>'caught %s with %s' % (eType,eInfo)</
message>
869N/A 'Remove temporary webcontainer zip archive from %s %s' % (location,wcPath)
869N/A <
call function="'deleteFolder'">
869N/A { 'location' : location ,
869N/A 'foldername' : '%s/%s-%s' % (wcPath, WC_TYPE, WC_VERSION) }