summaryrefslogtreecommitdiffstats
path: root/uitest/vaadin-server.xml
blob: 226965c642cad220709947948ea7ac759f56ac6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?xml version="1.0"?>
<project xmlns:antcontrib="antlib:net.sf.antcontrib"
    xmlns:ivy="antlib:org.apache.ivy.ant"
    name="vaadin-server" 
	default="deploy-and-start" basedir=".">
    
	 <!-- Import common targets  -->
	<import file="../build/common.xml" />

	<target name="check-params">
		<fail unless="output-dir" message="The 'output-dir' (usually build/result/vaadin-xxx) should be given to test script." />
		<fail unless="package.name" message="The 'package.name' property must be defined." />
		<fail unless="package.filename" message="The 'package.filename' property must be defined." />
		<fail unless="testing.testarea" message="The 'testing.testarea' property must be defined." />
		<property name="webroot" value="${testing.testarea}/${package.name}/WebContent" />		
	</target>
	
    <target name="prepare-testing-area" depends="check-params">
        <echo> Package name: ${package.name}</echo>
        <echo> Package filename: ${package.filename}</echo>
        <echo> Testing area: ${testing.testarea}</echo>    
        <echo> test-output-dir: ${test-output-dir}</echo>

        <delete dir="${testing.testarea}/${package.name}" />
        <mkdir dir="${testing.testarea}/${package.name}/WebContent" />
        <echo>Extracting Vaadin package ${package.filename} to testing area ${testing.testarea}</echo>
        <unzip src="${package.filename}" dest="${testing.testarea}/${package.name}/WebContent" />   
    </target>

    <target name="deploy-and-start" depends="init-deps, prepare-testing-area">
    	<property name="webroot" value="${testing.testarea}/${package.name}/WebContent"></property>
    	
    	<ivy:resolve file="ivy.xml"/>
    	<ivy:cachepath pathid="server" conf="build" />
        <java classname="com.vaadin.launcher.DemoLauncher" fork="yes" dir="${testing.testarea}/${package.name}" resultproperty="server.start.result">
            <arg value="--nogui=1" />
            <classpath>
            	<path location="${webroot}/WEB-INF/classes" />
            	<fileset dir="${webroot}/WEB-INF/lib/" includes="*.jar" />                            
                <path refid="server" />
            </classpath>
            <jvmarg value="-Demma.coverage.out.file=${testing.testarea}/${package.name}/war.ec"/>
            <jvmarg value="-Djava.awt.headless=true"/>
        	<jvmarg value="-ea" />
        </java>
    </target>
    
    <target name="wait-for-startup">
        <echo>Waiting for Servlet Container to start up.</echo>
        <waitfor maxwait="60" maxwaitunit="second" checkevery="5" checkeveryunit="second" timeoutproperty="server.start.failed">
            <http url="http://localhost:8888"/>
        </waitfor>
        <fail if="server.start.failed" message="Server startup failed" />
    </target>
   
</project>