buildframework/helium/sf/java/metadata/tests/antunit/test_ant_input.ant.xml
author lorewang
Wed, 01 Dec 2010 16:05:36 +0800
changeset 715 e0739b8406dd
parent 628 7c4a911dc066
permissions -rw-r--r--
Specify extenal tool with path

<!-- 
============================================================================ 
Name        : test_ant_input.ant.xml 
Part of     : Helium

Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved.
This component and the accompanying materials are made available
under the terms of the License "Eclipse Public License v1.0"
which accompanies this distribution, and is available
at the URL "http://www.eclipse.org/legal/epl-v10.html".

Initial Contributors:
Nokia Corporation - initial contribution.

Contributors:

Description:

============================================================================
-->
<project name="test-ant-input" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
    <description>Helium metadata Ant input unittests.</description>
    
    <dirname property="project.dir" file="${ant.file.test-metadata-regex}" />
    <taskdef resource="com/nokia/helium/metadata/ant/antlib.xml" uri="http://www.nokia.com/helium" />
    <taskdef name="fmpp" classname="fmpp.tools.AntTask" onerror="report"/>
    
    <target name="setUp">
        <echo>---=====================================---</echo>
        <mkdir dir="${test.temp.dir}" />
        <delete dir="${test.temp.dir}" />
        <mkdir dir="${test.temp.dir}" />
    </target>
    
    <target name="tearDown">
        <delete dir="${test.temp.dir}" />
        <echo>---=====================================---</echo>
    </target>

    <hlm:metadatafilterset id="error.filterset">
        <hlm:metadatafilter severity="error" regex="^ERROR: .*" description="Simple error pattern"/>
        <hlm:metadatafilter severity="warning" regex="^WARNING: .*" description="Simple warning pattern"/>
    </hlm:metadatafilterset>

    
    <target name="test-ant-log-metadata-input">
        <echo message="Ant log metadata input validation" />
        <mkdir dir="${test.temp.dir}"/>

        <hlm:metadatarecord database="${test.temp.dir}/metadata_db">
            <hlm:antmetadatainput>
                <fileset file="${project.dir}/../data/ant/package_ant_build.log" />
                <metadatafilterset refid="error.filterset" />
            </hlm:antmetadatainput>
        </hlm:metadatarecord>

        <fmpp sourceFile="${project.dir}/../data/ant/result.ini.ftl"
                     outputfile="${test.temp.dir}/result.ini">
            <data expandProperties="yes">
                dbPath: ${test.temp.dir}/metadata_db
                ant: antProperties()
            </data>
        </fmpp>
        <property file="${test.temp.dir}/result.ini" />
        <echo>number.of.logs: ${number.of.logs}</echo>
        <echo>number.of.components: ${number.of.components}</echo>
        <echo>number.of.errors: ${number.of.errors}</echo>
        <au:assertTrue message="Invalid number of logs">
            <equals arg1="${number.of.logs}" arg2="1" />
        </au:assertTrue>
        <au:assertTrue message="Invalid number of components">
            <equals arg1="${number.of.components}" arg2="16" />
        </au:assertTrue>
        <au:assertTrue message="Invalid number of errors">
            <equals arg1="${number.of.errors}" arg2="1" />
        </au:assertTrue>
        
    </target>
        
</project>