buildframework/helium/sf/java/metadata/tests/antunit/test_sysdef_input.ant.xml
author wbernard
Fri, 13 Aug 2010 14:59:05 +0300
changeset 628 7c4a911dc066
child 645 b8d81fa19e7d
permissions -rw-r--r--
helium_11.0.0-e00f171ca185

<!-- 
============================================================================ 
Name        : test_sysdef_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-sysdef-input" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
    <description>Helium metadata text input unittests.</description>
    
    <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>

    <target name="test-sysdef-metadata-input-missing-file">
        <echo message="test-sysdef-metadata-input" />
        <au:expectfailure expectedMessage="file attribute is not defined.">
            <hlm:metadatarecord database="${test.temp.dir}/metadata_db">
                <hlm:sysdefmetadatainput />
            </hlm:metadatarecord>
        </au:expectfailure>
    </target>
    
    <target name="test-sysdef-metadata-input-inexisting-file">
        <echo message="test-sysdef-metadata-input" />
        <au:expectfailure>
            <hlm:metadatarecord database="${test.temp.dir}/metadata_db">
                <hlm:sysdefmetadatainput file="inexisting/inexisting_sysdef3.xml" />
            </hlm:metadatarecord>
        </au:expectfailure>
    </target>
    
    <target name="test-sysdef-metadata-input">
        <echo message="test-sysdef-metadata-input" />
        <hlm:metadatarecord database="${test.temp.dir}/metadata_db">
            <hlm:sysdefmetadatainput file="../data/sysdef/sysdef3.xml" epocroot="../" />
        </hlm:metadatarecord>
        <fmpp sourceFile="../data/sysdef/sysdef_data.ini.ftl"
                     outputfile="${test.temp.dir}/sysdef_data.ini">
            <data expandProperties="yes">
                dbPath: ${test.temp.dir}/metadata_db
                ant: antProperties()
            </data>
        </fmpp>
        <property file="${test.temp.dir}/sysdef_data.ini" />
        <echo>package.count: ${package.count}</echo>
        <echo>collection.count: ${collection.count}</echo>
        <echo>component.count: ${component.count}</echo>
        <echo>unit.count: ${unit.count}</echo>
        <au:assertTrue message="Invalid number of packages">
            <equals arg1="${package.count}" arg2="2" />
        </au:assertTrue>
        <au:assertTrue message="Invalid number of collection">
            <equals arg1="${collection.count}" arg2="2" />
        </au:assertTrue>
        <au:assertTrue message="Invalid number of components">
            <equals arg1="${component.count}" arg2="2" />
        </au:assertTrue>
        <au:assertTrue message="Invalid number of units">
            <equals arg1="${unit.count}" arg2="2" />
        </au:assertTrue>
    </target>

    <target name="test-sysdef-metadata-input-with-invalid-model">
        <echo message="test-sysdef-metadata-input" />
        <au:expectfailure>
            <hlm:metadatarecord database="${test.temp.dir}/metadata_db">
                <hlm:sysdefmetadatainput file="../data/sysdef/invalid_sysdef3.xml" epocroot="../" />
            </hlm:metadatarecord>
        </au:expectfailure>
    </target>
</project>