james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r709739 - in /james/server/trunk: build-tools/smoke.xml build-tools/smoke.xsl build.xml phoenix-deployment/build.xml spring-deployment/build.xml stage/org.apache.james/jars/apache-james-imap-seda-test-0.1-SNAPSHOT.jar
Date Sat, 01 Nov 2008 18:12:45 GMT
Author: rdonkin
Date: Sat Nov  1 11:12:45 2008
New Revision: 709739

URL: http://svn.apache.org/viewvc?rev=709739&view=rev
Log:
Minimal smoke test implementation for phoenix. Basically just ensure that the ports on which
the standard services run are active when James boots. Fixed SAR creation issue which prevented
boot.

Added:
    james/server/trunk/build-tools/smoke.xml
    james/server/trunk/build-tools/smoke.xsl
    james/server/trunk/stage/org.apache.james/jars/apache-james-imap-seda-test-0.1-SNAPSHOT.jar
  (with props)
Modified:
    james/server/trunk/build.xml
    james/server/trunk/phoenix-deployment/build.xml
    james/server/trunk/spring-deployment/build.xml

Added: james/server/trunk/build-tools/smoke.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/build-tools/smoke.xml?rev=709739&view=auto
==============================================================================
--- james/server/trunk/build-tools/smoke.xml (added)
+++ james/server/trunk/build-tools/smoke.xml Sat Nov  1 11:12:45 2008
@@ -0,0 +1,139 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<project default="help" basedir="." name="smoke-test">
+
+	<description>
+	Contains smoke test macros. These allow basic sanity testing of the packaged distribution
+	</description>
+	
+	<target name='help'>
+		<echo>This is a library containing macros required for smoke tests.</echo>
+	</target>
+        
+    <macrodef name='Smoke'>
+        <attribute name='build-dir'/> 
+        <attribute name='zip'/>    
+        <attribute name='package'/>
+        <sequential>
+    
+            <VerifySmokePrerequisites zip='@{zip}'/>
+        
+            <property name='smoke.dir' location='@{build-dir}/smoke'/>
+            <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}'/>       
+    
+        </sequential>   
+    </macrodef> 
+    
+    <macrodef name="ControlJames">
+        <attribute name='action'/>
+        <attribute name='dir'/>   
+        <sequential>
+            <chmod 
+                perm="ugo+rx" 
+                file="@{dir}/bin/phoenix.sh"/>   
+            <exec 
+               dir="@{dir}" 
+               executable="@{dir}/bin/phoenix.sh" >
+                <arg line="@{action}"/>
+            </exec> 
+        </sequential>   
+    </macrodef>  
+ 
+    <macrodef name="StartJames">
+        <attribute name='dir'/>   
+        <sequential>
+            <ControlJames dir='@{dir}' action='start'/>
+        </sequential>   
+    </macrodef>  
+ 
+    <macrodef name="StopJames">
+        <attribute name='dir'/>   
+        <sequential>
+            <ControlJames dir='@{dir}' action='stop'/>
+        </sequential>   
+    </macrodef>    
+    
+    <macrodef name='BootJames'>
+        <attribute name='dir'/>   
+        <sequential>
+            <StartJames dir='@{dir}'/>
+            <echo>Waiting for James to boot...</echo>   
+            <waitfor maxwait='20' maxwaitunit='second' timeoutproperty='smoke.boot.failed'>
+                <and>   
+                    <socket server='localhost' port='10025'/>   
+                    <socket server='localhost' port='10110'/>
+                    <socket server='localhost' port='10043'/>
+                    <socket server='localhost' port='10119'/>   
+                    <socket server='localhost' port='10445'/>   
+                </and>   
+            </waitfor>   
+            <fail if='smoke.boot.failed'>
+Failed to boot James server. See @{dir}/temp/phoenix.console for details.   
+            </fail>   
+                <echo>James booted.</echo>      
+        </sequential>   
+    </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"/>
+        </sequential>   
+    </macrodef>   
+
+    <macrodef name='VerifySmokePrerequisites'>
+    	<attribute name='zip'/>
+        <sequential>
+            <condition property='is.windows'>
+                <os family='windows'/>   
+            </condition>   
+            <fail if='is.windows'>
+Smoke is not supported on Windows ATM.
+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'>
+@{zip} not found. Try 'ant dist'.
+            </fail>  
+        </sequential>
+    </macrodef>   
+ 
+    <macrodef name='UnpackDistribution'>
+        <attribute name='dir'/>
+        <attribute name='zip'/>   
+        <sequential>
+            <delete dir='@{dir}'/>       
+            <mkdir dir='@{dir}'/>   
+            <unzip src='@{zip}' dest='@{dir}'/>    
+        </sequential>
+    </macrodef>    
+</project>
\ No newline at end of file

Added: james/server/trunk/build-tools/smoke.xsl
URL: http://svn.apache.org/viewvc/james/server/trunk/build-tools/smoke.xsl?rev=709739&view=auto
==============================================================================
--- james/server/trunk/build-tools/smoke.xsl (added)
+++ james/server/trunk/build-tools/smoke.xsl Sat Nov  1 11:12:45 2008
@@ -0,0 +1,49 @@
+<?xml version ='1.0'?>
+<xsl:stylesheet version="1.1"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	<xsl:strip-space elements = "*" />
+	<xsl:output method = "xml" indent='yes'/>
+<!-- 
+	Basically copy everything  
+--> 
+	<xsl:template match="@*|node()">
+	  <xsl:copy>
+	    <xsl:apply-templates select="@*|node()"/>
+	  </xsl:copy>
+	</xsl:template>
+<!-- 
+	But: 
+-->
+<!-- 
+	Ignore comments 
+-->
+	<xsl:template match="comment()"/>
+<!--
+	Use high ports  
+-->
+	<xsl:template match="config/smtpserver/port">
+		<xsl:element name='port'>
+			<xsl:text>10025</xsl:text>
+	    </xsl:element>
+	</xsl:template>
+	<xsl:template match="config/pop3server/port">
+		<xsl:element name='port'>
+			<xsl:text>10110</xsl:text>
+	    </xsl:element>
+	</xsl:template>
+	<xsl:template match="config/imapserver/port">
+		<xsl:element name='port'>
+			<xsl:text>10043</xsl:text>
+	    </xsl:element>
+	</xsl:template>
+	<xsl:template match="config/nntpserver/port">
+		<xsl:element name='port'>
+			<xsl:text>10119</xsl:text>
+	    </xsl:element>
+	</xsl:template>
+		<xsl:template match="config/remotemanager/port">
+		<xsl:element name='port'>
+			<xsl:text>10445</xsl:text>
+	    </xsl:element>
+	</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Modified: james/server/trunk/build.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/build.xml?rev=709739&r1=709738&r2=709739&view=diff
==============================================================================
--- james/server/trunk/build.xml (original)
+++ james/server/trunk/build.xml Sat Nov  1 11:12:45 2008
@@ -129,6 +129,13 @@
         <foralldo do='eclipse'/>
     </target> 
 
+    <target
+        name='smoke'
+        description='Smoke tests deployment'>
+        <echo>Smoke testing deployments</echo>
+        <fordeploymentsdo do='smoke'/>
+    </target>
+
     <target 
         name='lite'
         description='Builds modules and performs lightweight deployment'>

Modified: james/server/trunk/phoenix-deployment/build.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/build.xml?rev=709739&r1=709738&r2=709739&view=diff
==============================================================================
--- james/server/trunk/phoenix-deployment/build.xml (original)
+++ james/server/trunk/phoenix-deployment/build.xml Sat Nov  1 11:12:45 2008
@@ -34,6 +34,8 @@
     <property file="check-targets.properties"/>
     <property file="../include.properties"/>
     <property file="../default.properties"/>
+ 
+    <import file="../build-tools/smoke.xml"/>   
 
     <!--
     ===================================================================
@@ -592,6 +594,9 @@
               <include name="${jars-prefix}*-library-${version}.jar" />
               <include name="${jars-prefix}*-function-${version}.jar" />
             </lib>
+            <lib dir='${lib.dir}/${path.lib.james}'>   
+                <include name='apache-james-imap*.jar'/>    
+            </lib>   
             <zipfileset dir="${conf.dir}" fullpath="conf/sqlResources.xml">
                 <include name="sqlResources.xml"/>
             </zipfileset>
@@ -646,16 +651,24 @@
                                   binary distributions
     ===================================================================
     -->
-
-    <target name="dist-bin-phoenix-warn" depends="dist-bin-common, prepare-master-dist"
unless="phoenix.bin.present">
+    <target name='dist-properties'>
+        <property name="dist.binary.dir" value="${dist.dir}/downloads/bin"/>   
+        <property
+            name='dist.binary.file.tgz'
+            value='${dist.binary.dir}/${name}-binary-${version}.tar.gz'/>   
+        <property
+            name='dist.binary.file.zip'
+            value='${dist.binary.dir}/${name}-binary-${version}.zip'/>   
+    </target>   
+    
+    <target name="dist-bin-phoenix-warn" 
+            depends="dist-bin-common, prepare-master-dist, dist-properties" 
+            unless="phoenix.bin.present">
         <echo message ="The Phoenix distribution is not present - the James w/Phoenix
binary distribution will not be built."/>
     </target>
 
     <target name="dist-bin-phoenix" depends="dist-bin-common" if="phoenix.bin.present">
         <echo message ="Building binary w/Phoenix distributions"/>
-        <property
-            name='dist.binary.file.zip'
-            value='${dist.binary.dir}/${name}-binary-${version}.zip'/>
         <zip zipfile="${dist.binary.file.zip}">
             <fileset dir="dist">
                 <include name="${name}-${version}/**"/>
@@ -667,9 +680,6 @@
             </fileset>
         </zip>
         <copy todir='${dir.master.dist}/bin' file='${dist.binary.file.zip}'/>
-        <property
-            name='dist.binary.file.tgz'
-            value='${dist.binary.dir}/${name}-binary-${version}.tar.gz'/>
         <tar longfile="gnu" tarfile="${dist.binary.dir}/${name}-binary-${version}.tar">
             <tarfileset dir="dist" username="${name}" group="${name}">
                 <include name="${name}-${version}/**"/>
@@ -688,9 +698,8 @@
 
     <!-- removed xdocs from depends list -->
     <!-- target name="dist-bin-common" depends="dist-lite,javadocs" -->
-    <target name="dist-bin-common" depends="dist-lite">
+    <target name="dist-bin-common" depends="dist-lite, dist-properties">
         <echo message ="Building binary distributions"/>
-        <property name="dist.binary.dir" value="${dist.dir}/downloads/bin"/>
         <mkdir dir="${dist.binary.dir}"/>
         <!-- Sar only-->
         <copy file="${dist.dir}/apps/${sar-name}.sar" todir="${dist.binary.dir}"/>
@@ -1089,7 +1098,12 @@
             </classpath>
         </echoxml>
     </target>
-
+ 
+    
+    <target name='smoke' depends='dist-properties'>
+        <Smoke build-dir='${build.dir}' zip='${dist.binary.file.zip}' package='${name}-${version}'/>
  
+    </target>   
+    
     <!--
     ===================================================================
                                    Help on usage

Modified: james/server/trunk/spring-deployment/build.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/spring-deployment/build.xml?rev=709739&r1=709738&r2=709739&view=diff
==============================================================================
--- james/server/trunk/spring-deployment/build.xml (original)
+++ james/server/trunk/spring-deployment/build.xml Sat Nov  1 11:12:45 2008
@@ -459,4 +459,8 @@
 		</GenerateEclipseProject>
 	</target>
 
+ 
+    <target name='smoke'>
+        <echo>TODO: Implementation</echo>
+    </target>   
 </project>

Added: james/server/trunk/stage/org.apache.james/jars/apache-james-imap-seda-test-0.1-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/james/server/trunk/stage/org.apache.james/jars/apache-james-imap-seda-test-0.1-SNAPSHOT.jar?rev=709739&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/server/trunk/stage/org.apache.james/jars/apache-james-imap-seda-test-0.1-SNAPSHOT.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message