Skip to main content

Source code file content

Revision: 57041

Fix copyright
» Project Revision History

» Checkout URL

svn / tags / gfv3-prelude-b28a / quicklook / build.xml

Size: 17461 bytes, 1 line
<?xml version="1.0" encoding="UTF-8"?>
<!--
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

 Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.

 The contents of this file are subject to the terms of either the GNU
 General Public License Version 2 only ("GPL") or the Common Development
 and Distribution License("CDDL") (collectively, the "License").  You
 may not use this file except in compliance with the License. You can obtain
 a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
 or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
 language governing permissions and limitations under the License.

 When distributing the software, include this License Header Notice in each
 file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
 Sun designates this particular file as subject to the "Classpath" exception
 as provided by Sun in the GPL Version 2 section of the License file that
 accompanied this code.  If applicable, add the following below the License
 Header, with the fields enclosed by brackets [] replaced by your own
 identifying information: "Portions Copyrighted [year]
 [name of copyright owner]"

 Contributor(s):

 If you wish your version of this file to be governed by only the CDDL or
 only the GPL Version 2, indicate your decision by adding "[Contributor]
 elects to include this software in this distribution under the [CDDL or GPL
 Version 2] license."  If you don't indicate a single choice of license, a
 recipient has the option to distribute your version of this file under
 either the CDDL, the GPL Version 2 or to extend the choice of license to
 its licensees as provided above.  However, if you add GPL Version 2 code
 and therefore, elected the GPL Version 2 license, then the option applies
 only if the new code is made subject to such option by the copyright
 holder.
-->

<project name="GlassFish-V3-QuickLook" default="default" basedir=".">
    <property file="build.properties"/>
     <property file="${basedir}/gfproject/derby.properties"/>
     <import file="${basedir}/gfproject/db-targets.xml"/>
    
    <description>Builds, tests, and runs the project V3 Quicklook</description>
    <target name="all" depends="clean">
        <record name="allrun.output" action="start"/>
	<!-- resolveArtifact artifactId="testng" property="testng.jar"/>
        <echo message="testng jar value: ${testng.jar}"/ -->
        <antcall target="start-derby"/>        
        <antcall target="start-server-felix"/>
        <antcall target="build"/>
        <antcall target="deploy"/>
        <antcall target="runtest"/>
        <antcall target="undeploy"/>
        <antcall target="stop-server"/>
        <antcall target="stop-derby"/>
	<move file="test-output" tofile="test-output-web" failonerror="false" overwrite="true"/>
        <antcall target="testng-summary"/>
        <record name="allrun.output" action="stop"/>
    </target>


    <!-- top level target for testing web distribution   -->
    <target name="all_wd" depends="clean">
        <record name="all_wd.output" action="start"/>
        <antcall target="startDerby"/>        
        <antcall target="start-server-felix"/>
        <antcall target="web_distribution"/>
        <antcall target="stop-server"/>
        <antcall target="stopDerby"/>
	<move file="test-output" tofile="test-output-wd" failonerror="false" overwrite="true"/>
        <record name="all_wd.output" action="stop"/>
    </target>

    <!-- all test suites for web distribution   -->
    <target name="web_distribution">  
        <echo message="ANT PROJECT ${ant.project.name}"/>
        <ant dir="classloader/hellojsf" target="all"/>
        <ant dir="web/helloworld" target="all"/>
        <ant dir="web/jsfastrologer" target="all"/>
        <ant dir="web/jsfinjection" target="all"/>
        <ant dir="jdbc/jdbcusertx" target="all"/>
        <ant dir="persistence/jpainjectemf" target="all"/>
        <ant dir="security/helloworld" target="all"/>
        <!--not working yet
        <ant dir="admin" target="all"/>
        <ant dir="adminconsole" target="all"/>
        -->
    </target>
        
    <!-- <import file="nbproject/build-impl.xml"/>-->
    
    <target name="copyJARS">
        <echo message="Copying testng.jar to ${ant.home}/lib"/>
        <copy todir="${ant.home}/lib" verbose="true">
            <fileset dir="${basedir}/lib">
                <include name="**/testng*.*"/>
            </fileset>
        </copy>      
    </target>
    <target name="default">
        <echo message="ANT.HOME is ${ant.home}"/>
        <antcall target="copyJARS"/>
        <echo message="ant build (Compiles and Packages testsuites)"/>
        <echo message="ant deploy (Deploys test to GlassFish server)"/>
        <echo message="ant compile-tests (Compiles TestNG test)"/>
        <echo message="ant runtest (Runs TestNG test)"/>
        <echo message="ant report (Creates TestNG Report)"/>
        <echo message="ant archive (Creates zip of testbase}"/>
        <echo message=""/>
    </target>
    
    <target name="build">  
        <record name="build.output" action="start"/>
        <echo message="ANT PROJECT ${ant.project.name}"/>
        <ant dir="amx" target="build"/>
        <ant dir="admin" target="build"/>
        <ant dir="adminconsole" target="build"/>
        <ant dir="classloader/hellojsf" target="build"/>
        <ant dir="web/helloworld" target="build"/>
        <ant dir="web/jsfastrologer" target="build"/>
        <ant dir="web/jsfinjection" target="build"/>
        <ant dir="jdbc/jdbcusertx" target="build"/>
        <ant dir="persistence/jpainjectemf" target="build"/>
        <ant dir="security/helloworld" target="build"/>
        <ant dir="security/basicauth" target="build"/>
        <!-- ant dir="web/strutsbasic" target="build"/ -->
        <!-- ant dir="persistence/servlet-jpa-app" target="build"/ -->
        <!--<ant dir="ejb30/hello" target="build"/>
        <ant dir="adminweb/basic" target="build"/>-->
        <record name="build.output" action="stop"/>
    </target>
    
    
    <target name="compile-tests">            
        <record name="compiletests.output" action="start"/>
        <ant dir="classloader/hellojsf" target="compile-tests"/>
        <ant dir="web/helloworld" target="compile-tests"/>
        <ant dir="web/jsfastrologer" target="compile-tests"/>
        <ant dir="web/jsfinjection" target="compile-tests"/>
        <ant dir="jdbc/jdbcusertx" target="compile-tests"/>
        <ant dir="persistence/jpainjectemf" target="compile-tests"/>
        <ant dir="security/helloworld" target="compile-tests"/>
        <!-- ant dir="web/strutsbasic" target="compile-tests"/ -->
        <!-- ant dir="persistence/servlet-jpa-app" target="compile-tests"/ -->
        <record name="compiletests.output" action="stop"/>
    </target>
    
    <target name="deploy">
        <record name="deploy.output" action="start"/>
        <ant dir="classloader/hellojsf" target="deploy"/>
        <ant dir="web/helloworld" target="deploy"/>
        <ant dir="web/jsfastrologer" target="deploy"/>
        <ant dir="web/jsfinjection" target="deploy"/>
        <ant dir="jdbc/jdbcusertx" target="deploy"/>
        <ant dir="persistence/jpainjectemf" target="deploy"/>
        <ant dir="security/helloworld" target="deploy"/>
        <ant dir="security/basicauth" target="deploy"/>
        <!-- ant dir="web/strutsbasic" target="deploy"/ -->
        <!-- ant dir="persistence/servlet-jpa-app" target="deploy"/ -->   
        <record name="deploy.output" action="stop"/>
    </target>
    
    <target name="undeploy">
        <record name="undeploy.output" action="start"/>
        <ant dir="classloader/hellojsf" target="undeploy"/>
        <ant dir="web/helloworld" target="undeploy"/>
        <ant dir="web/jsfastrologer" target="undeploy"/>
        <ant dir="web/jsfinjection" target="undeploy"/>
        <ant dir="jdbc/jdbcusertx" target="undeploy"/>
        <ant dir="persistence/jpainjectemf" target="undeploy"/>
        <ant dir="security/helloworld" target="undeploy"/>
        <ant dir="security/basicauth" target="undeploy"/>
        <!-- ant dir="web/strutsbasic" target="undeploy"/ -->
        <!-- ant dir="persistence/servlet-jpa-app" target="undeploy"/ -->   
        <record name="undeploy.output" action="stop"/>
    </target>

    <target name="noproject">
	    <delete includeemptydirs="true">
		<fileset dir="${basedir}">
			<include name="**/nbproject"/>
		</fileset>
	</delete>
    </target>
    
   
    <!-- Target is re-definted here as didn't want to specify ws.root property -->
    <target name="clean">
        <delete dir="${basedir}/classes"/>
	<delete verbose="true" includeemptydirs="true">
		<fileset dir="${basedir}" includes="**/classes"/>
	</delete>
        <delete dir="${basedir}/test-output-web" includeemptydirs="true"/>
        <delete dir="${basedir}/test-output-glassfish" includeemptydirs="true"/>
        <delete dir="${basedir}/dist" includeemptydirs="true"/>
	<delete includeemptydirs="true">
		<fileset dir="${basedir}">
			<include name="**/*.output"/>
			<include name="**/*.log"/>
		</fileset>
	</delete>
        <delete>
            <fileset dir="${basedir}" includes="*.zip"/>
        </delete>
        <echo message="Deleting all WAR/EAR in local testsuite directories!!!"/>
        <echo message="There should not be any WAR file checked in."/>
        <delete>
            <fileset dir="." includes="**/*.war"/>
        </delete>
    </target>
        
    
    <target name="-post-test-run">
        <loadfile property="startserver.log" srcFile="${glassfish.home}/domains/domain1/logs/server.log"/>
        <echo message="${startserver.log}"/>
    </target>
    
    <path id="path2testng">
        <pathelement location="./lib/testng-5.0-jdk15.jar"/>
    </path>
    
    <taskdef name="testng" classname="org.testng.TestNGAntTask">
        <classpath>
	    <pathelement path="${plugin_classpath}"/>
        </classpath>
    </taskdef>
    
    <!-- Target is re-definted here as didn't want to specify ws.root property -->
    <target  name="runtest" depends="compile-tests,initprops">    
        <record name="runtestng.output" action="start"/>
        <echo message="=============Starting TestNG functional tests from testng.xml ============"/>    
        <property name="hasTestNGXML" value="true"/>
        
        <mkdir dir="${test.report}"/>    
        <testng outputdir="${test.report}"
                classpathref="run.testng.classpath">
            <jvmarg value="-Djava.compiler=NONE"/>
            <jvmarg value="-Dhttp.host=${glassfish.http.host}"/>
            <jvmarg value="-Dhttp.port=${glassfish.http.port}"/>
            <sysproperty key="basedir" value="${basedir}"/>
            <!--<classfileset dir="classes/test" includes="**/SeleniumTest.class"/>-->         
            <xmlfileset dir="." includes="testng.xml"/>
            
        </testng>
        
        <record name="runtestng.output" action="stop"/>
        
        
        <!-- <antcall target="-post-test-run"/>-->
        
    </target>  
    
    <!-- Generate the TestNG report -->
    <target name="report" depends="initprops">
        <echo message="Generating report at ${test.report}"/>
        <macrodef name="gen-report">
            <attribute name="name" />
            <sequential>
                <junitreport todir="${basedir}/test-output-@{name}">
                    <fileset dir=".">
                        <include name="**/test-output-@{name}/**/*.xml"/>
                        <!--<exclude name="**/testng-failed.xml"/>-->
                    </fileset>
                    <report format="noframes" todir="${basedir}/test-output-@{name}"/>
                </junitreport>
            </sequential>
        </macrodef>
        <gen-report name="web" />
        <echo message="Test Report available at ${test.report}/index.html"/>
    </target>
    
    <!-- Generate the TestNG report -->
    <target name="reportAll" depends="initprops">        
        <echo message="Generating report at ${test.report}"/>
        <macrodef name="gen-report">
            <attribute name="name" />
            <sequential>
                <junitreport todir="${basedir}/test-output-@{name}">
                    <fileset dir=".">
                        <include name="**/test-output-@{name}/**/*.xml"/>
                        <!--<exclude name="**/testng-failed.xml"/>-->
                    </fileset>
                    <report format="noframes" todir="${basedir}/test-output-@{name}"/>
                </junitreport>
            </sequential>
        </macrodef>
        <gen-report name="web" />
        <gen-report name="glassfish" />
        <echo message="Test Report available at ${test.report}/index.html"/>
    </target>
    
    <target name="initprops">
        <property name="build.class.dir" value="${basedir}/classes/test"/>
        <property name="test.report" value="${basedir}/test-output"/>
        <mkdir dir="${test.report}"/>
        <path id="run.testng.classpath">
            <fileset dir="${glassfish.home}/modules">
               <include name="**/*.jar"/>
            </fileset>
	    <pathelement path="${plugin_classpath}"/>
            <pathelement location="${build.class.dir}"/>
        </path>
    </target>
    
    <target name="testng-summary">
	<loadfile srcfile="runtestng.output" property="testng_output">
	   <filterchain>
	      <tailfilter lines="6"/>
	   </filterchain>
	</loadfile>
        <echo message="${testng_output}"/>
    </target>

    <target name="archive" depends="initprops,clean">
        <tstamp>
            <!--<format property="TODAY_UK" pattern="d-MMMM-yyyy" locale="en,UK"/>-->
        </tstamp>
        <property name="final.src.name" value="glassfish_testng_${DSTAMP}.zip"/>
        <delete>
            <fileset dir="${basedir}" includes="*.zip"/>
        </delete>
        <delete file="{final.src.name}" failonerror="false"/>
        
        <zip zipfile="${final.src.name}" basedir=".">
            
            <exclude name="${test.report}/**"/>
            <exclude name="${build.class.dir}/**"/>
            <exclude name="**/*.log"/>
            <exclude name="**/*.output"/>
            <exclude name="**/*.war"/>
            <exclude name="**/*.class"/>
            <exclude name="**/CVS"/>
            <exclude name="**/nbproject"/>
            
        </zip>
        
    </target>

<target name="setOSConditions">
  <condition property="isUnix">
    <os family="unix"/>
  </condition>
  <condition property="isWindows">
    <os family="windows" />
  </condition>
</target>

<target name="start-server-hk2" depends="setOSConditions" if="v3">
   
    <echo>+-----------------------------+</echo>
    <echo>|                             |</echo>
    <echo>| S T A R T I N G   GLASSFISH |</echo>
    <echo>|       in HK2 mode           |</echo>
    <echo>|                             |</echo>
    <echo>+-----------------------------+</echo>
    
    <antcall target="start-server-hk2-unix"/>
    <antcall target="start-server-hk2-windows"/>
</target>

<target name="start-server-hk2-windows" if="isWindows">
    <exec executable="cmd" spawn="true">	
        <env key="GlassFish_Platform" value="HK2"/>
        <arg value="/c"/>
        <arg value="${glassfish.home}\bin\asadmin.bat"/>
        <arg value="start-domain"/>
    </exec>
</target>
    
<target name="start-server-hk2-unix" if="isUnix">
    <exec executable="${glassfish.home}/bin/asadmin">        
        <env key="GlassFish_Platform" value="HK2"/>
        <arg value="start-domain"/>
    </exec>
</target>

<target name="start-server-felix" depends="setOSConditions" if="v3">
  
    <echo>+-----------------------------+</echo>
    <echo>|                             |</echo>
    <echo>| S T A R T I N G   GLASSFISH |</echo>
    <echo>|       in Felix mode         |</echo>
    <echo>|                             |</echo>
    <echo>+-----------------------------+</echo>
   
    <antcall target="start-server-felix-unix"/>
    <antcall target="start-server-felix-windows"/>
    <!-- GF takes longer than usual while starting Felix. Until we fix the
         startup issue, let's introduce a delay.
    <echo message="Sleeping for 20 seconds while the server is starting"/>
    <sleep seconds="20"/>
    -->
</target>

<target name="start-server-felix-windows" if="isWindows">
    <exec executable="cmd" spawn="true">
        <env key="GlassFish_Platform" value="Felix"/>
        <arg value="/c"/>
        <arg value="${glassfish.home}\bin\asadmin.bat"/>
        <arg value="start-domain"/>
    </exec>
</target>

<target name="start-server-felix-unix" if="isUnix">
    <exec executable="${glassfish.home}/bin/asadmin">
        <env key="GlassFish_Platform" value="Felix"/>
        <arg value="start-domain"/>
    </exec>
</target>

<target name="stop-server" depends="setOSConditions">
    <echo message="stopping server"/>
    <antcall target="stop-server-unix"/>
    <antcall target="stop-server-windows"/>
</target>
    
<target name="stop-server-windows" if="isWindows">
     <exec executable="cmd">	
         <arg value="/c"/>
         <arg value="${glassfish.home}\bin\asadmin.bat"/>
         <arg value="stop-domain"/>
     </exec>
</target>
         
<target name="stop-server-unix" if="isUnix">
     <exec executable="${glassfish.home}/bin/asadmin">        
        <arg value="stop-domain"/>
    </exec>
</target>

</project>
 
 
Close
loading
Please Confirm
Close