You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2008/11/01 21:05:48 UTC
svn commit: r709769 - in /james/server/trunk: build-tools/smoke.xml
phoenix-deployment/build.xml spring-deployment/build.xml
Author: rdonkin
Date: Sat Nov 1 13:05:48 2008
New Revision: 709769
URL: http://svn.apache.org/viewvc?rev=709769&view=rev
Log:
Added support for spring smoke test. Improved shell script.
Modified:
james/server/trunk/build-tools/smoke.xml
james/server/trunk/phoenix-deployment/build.xml
james/server/trunk/spring-deployment/build.xml
Modified: james/server/trunk/build-tools/smoke.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/build-tools/smoke.xml?rev=709769&r1=709768&r2=709769&view=diff
==============================================================================
--- james/server/trunk/build-tools/smoke.xml (original)
+++ james/server/trunk/build-tools/smoke.xml Sat Nov 1 13:05:48 2008
@@ -32,6 +32,10 @@
<attribute name='build-dir'/>
<attribute name='zip'/>
<attribute name='package'/>
+ <attribute name='app-path'/>
+ <attribute name='conf-path'/>
+ <attribute name='conf-file-name'/>
+ <attribute name='cmd'/>
<sequential>
<VerifySmokePrerequisites zip='@{zip}'/>
@@ -40,9 +44,13 @@
<UnpackDistribution zip='@{zip}' dir='${smoke.dir}'/>
<property name='smoke.james.dir' location='${smoke.dir}/@{package}'/>
- <ConfigureJames dir='${smoke.james.dir}'/>
- <BootJames dir='${smoke.james.dir}'/>
- <StopJames dir='${smoke.james.dir}'/>
+ <ConfigureJames
+ dir='${smoke.james.dir}'
+ app-path='@{app-path}'
+ conf-path='@{conf-path}'
+ conf-file-name='@{conf-file-name}'/>
+ <BootJames dir='${smoke.james.dir}' cmd='@{cmd}'/>
+ <StopJames dir='${smoke.james.dir}' cmd='@{cmd}'/>
</sequential>
</macrodef>
@@ -50,36 +58,41 @@
<macrodef name="ControlJames">
<attribute name='action'/>
<attribute name='dir'/>
+ <attribute name='cmd'/>
<sequential>
<chmod
perm="ugo+rx"
- file="@{dir}/bin/phoenix.sh"/>
+ file="@{dir}/bin/@{cmd}.sh"/>
<exec
- dir="@{dir}"
- executable="@{dir}/bin/phoenix.sh" >
+ dir="@{dir}/bin"
+ executable="@{dir}/bin/@{cmd}.sh"
+ failonerror='true'>
<arg line="@{action}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="StartJames">
- <attribute name='dir'/>
+ <attribute name='dir'/>
+ <attribute name='cmd'/>
<sequential>
- <ControlJames dir='@{dir}' action='start'/>
+ <ControlJames dir='@{dir}' action='start' cmd='@{cmd}'/>
</sequential>
</macrodef>
<macrodef name="StopJames">
- <attribute name='dir'/>
+ <attribute name='dir'/>
+ <attribute name='cmd'/>
<sequential>
- <ControlJames dir='@{dir}' action='stop'/>
+ <ControlJames dir='@{dir}' action='stop' cmd='@{cmd}'/>
</sequential>
</macrodef>
<macrodef name='BootJames'>
- <attribute name='dir'/>
+ <attribute name='dir'/>
+ <attribute name='cmd'/>
<sequential>
- <StartJames dir='@{dir}'/>
+ <StartJames dir='@{dir}' cmd='@{cmd}'/>
<echo>Waiting for James to boot...</echo>
<waitfor maxwait='20' maxwaitunit='second' timeoutproperty='smoke.boot.failed'>
<and>
@@ -98,14 +111,23 @@
</macrodef>
<macrodef name='ConfigureJames'>
- <attribute name='dir'/>
- <sequential>
- <unzip dest="@{dir}/apps/james" src="@{dir}/apps/james.sar"/>
- <xslt style="../build-tools/smoke.xsl"
- in='@{dir}/apps/james/SAR-INF/config.xml'
- out='@{dir}/apps/james/SAR-INF/config-smoke.xml'></xslt>
- <move file='@{dir}/apps/james/SAR-INF/config-smoke.xml'
- tofile="@{dir}/apps/james/SAR-INF/config.xml"/>
+ <attribute name='dir'/>
+ <attribute name='app-path'/>
+ <attribute name='conf-path'/>
+ <attribute name='conf-file-name'/>
+ <sequential>
+ <unzip dest="@{dir}/@{app-path}/james">
+ <fileset dir='@{dir}/@{app-path}'>
+ <include name='james.sar'/>
+ </fileset>
+ </unzip>
+ <xslt
+ style="../build-tools/smoke.xsl"
+ in='@{dir}/@{conf-path}/@{conf-file-name}'
+ out='@{dir}/@{conf-path}/config-smoke.xml'></xslt>
+ <move
+ file='@{dir}/@{conf-path}/config-smoke.xml'
+ tofile="@{dir}/@{conf-path}/@{conf-file-name}"/>
</sequential>
</macrodef>
@@ -120,8 +142,8 @@
To support smoke on Windows, a reliable method of shutting down
James from the command line is required on Windows.
</fail>
- <available file='@{zip}' property="is.packaged"/>
- <fail unless='is.packaged'>
+ <available file='@{zip}' property="is.packaged"/>
+ <fail unless='is.packaged'>
@{zip} not found. Try 'ant dist'.
</fail>
</sequential>
Modified: james/server/trunk/phoenix-deployment/build.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/build.xml?rev=709769&r1=709768&r2=709769&view=diff
==============================================================================
--- james/server/trunk/phoenix-deployment/build.xml (original)
+++ james/server/trunk/phoenix-deployment/build.xml Sat Nov 1 13:05:48 2008
@@ -1101,7 +1101,14 @@
<target name='smoke' depends='dist-properties'>
- <Smoke build-dir='${build.dir}' zip='${dist.binary.file.zip}' package='${name}-${version}'/>
+ <Smoke
+ build-dir='${build.dir}'
+ zip='${dist.binary.file.zip}'
+ package='${name}-${version}'
+ app-path='apps'
+ conf-path='apps/james/SAR-INF'
+ conf-file-name='config.xml'
+ cmd='phoenix'/>
</target>
<!--
Modified: james/server/trunk/spring-deployment/build.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/spring-deployment/build.xml?rev=709769&r1=709768&r2=709769&view=diff
==============================================================================
--- james/server/trunk/spring-deployment/build.xml (original)
+++ james/server/trunk/spring-deployment/build.xml Sat Nov 1 13:05:48 2008
@@ -20,6 +20,8 @@
-->
<project name="spring_integration" default="everything">
+ <import file="../build-tools/smoke.xml"/>
+
<property file="../include.properties"/>
<property file="../default.properties"/>
@@ -355,11 +357,79 @@
<mkdir dir="${spring-deployment.target.bin.dir}" />
<!-- create unix startup script-->
- <echo file="${spring-deployment.target.bin.dir}/run.sh" append="false">#! /bin/sh
-java -cp ${exe-classpath}:../conf org.apache.james.container.spring.Main
- </echo>
+ <echo file="${spring-deployment.target.bin.dir}/run.sh" append="false"><![CDATA[#! /bin/sh
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one #
+# or more contributor license agreements. See the NOTICE file #
+# distributed with this work for additional information #
+# regarding copyright ownership. The ASF licenses this file #
+# to you under the Apache License, Version 2.0 (the #
+# "License"); you may not use this file except in compliance #
+# with the License. You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, #
+# software distributed under the License is distributed on an #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY #
+# KIND, either express or implied. See the License for the #
+# specific language governing permissions and limitations #
+# under the License. #
+################################################################
+
+JAMES_CONSOLE=james.console
+JAMES_PID=james.pid
+JAMES_CMD="java -cp ${exe-classpath}:../conf org.apache.james.container.spring.Main"
+
+case $1 in
+ start)
+ echo 'Booting James'
+ if [ -f $JAMES_PID ]
+ then
+ if ps -p `cat $JAMES_PID ` >/dev/null 2>/dev/null
+ then
+ echo "Already Running!!"
+ exit 1
+ fi
+ fi
+
+ echo "START `date`" >> $JAMES_CONSOLE
+ nohup sh -c "exec $JAMES_CMD >>$JAMES_CONSOLE 2>&1" >/dev/null &
+ echo $! > $JAMES_PID
+ echo "James pid="`cat $JAMES_PID`
+ @@SEMI_COLON@@@@SEMI_COLON@@
+
+ restart)
+ $0 stop $*
+ sleep 5
+ $0 start $*
+ @@SEMI_COLON@@@@SEMI_COLON@@
+
+ stop)
+ PID=`cat $JAMES_PID 2>/dev/null`
+ echo "Shutting down James: $PID"
+ kill $PID 2>/dev/null
+ sleep 5
+ kill -9 $PID 2>/dev/null
+ rm -f $JAMES_PID
+ echo "STOPPED `date`" >>$JAMES_CONSOLE
+ @@SEMI_COLON@@@@SEMI_COLON@@
+
+ *)
+ echo 'Booting James'
+ if [ -f $JAMES_PID ]
+ then
+ echo "James is already running"
+ exit 1
+ fi
+ exec $JAMES_CMD
+ @@SEMI_COLON@@@@SEMI_COLON@@
+
+esac
+]]></echo>
<replace file="${spring-deployment.target.bin.dir}/run.sh" token="${spring-deployment.target.lib.dir}" value="../lib" />
<replace file="${spring-deployment.target.bin.dir}/run.sh" token=";" value=":" />
+ <replace file="${spring-deployment.target.bin.dir}/run.sh" token="@@SEMI_COLON@@" value=';'/>
<chmod file="${spring-deployment.target.bin.dir}/run.sh" perm="a+rx" />
<!-- create windows startup script-->
@@ -461,6 +531,13 @@
<target name='smoke'>
- <echo>TODO: Implementation</echo>
+ <Smoke
+ zip='${spring-deployment.dist.bin.zip}'
+ build-dir='${build.dir}'
+ package='${spring-deployment.artefact.name}'
+ app-path='conf'
+ conf-path='conf'
+ conf-file-name='james-config.xml'
+ cmd='run'/>
</target>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org