buildframework/helium/sf/java/quality/tests/antunit/test_ca.ant.xml
changeset 628 7c4a911dc066
child 645 b8d81fa19e7d
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : test_ca.ant.xml 
       
     5 Part of     : Helium AntLib
       
     6 
       
     7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     8 All rights reserved.
       
     9 This component and the accompanying materials are made available
       
    10 under the terms of the License "Eclipse Public License v1.0"
       
    11 which accompanies this distribution, and is available
       
    12 at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    13 
       
    14 Initial Contributors:
       
    15 Nokia Corporation - initial contribution.
       
    16 
       
    17 Contributors:
       
    18 
       
    19 Description:
       
    20 
       
    21 ============================================================================
       
    22 -->
       
    23 <project name="test-ca" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
       
    24     <description>Helium antlib Quality Compatibility Analyser related tests.</description>
       
    25 
       
    26     <taskdef name="fmpp" classname="fmpp.tools.AntTask" onerror="report"/>
       
    27 
       
    28     <taskdef resource="com/nokia/helium/quality/ant/antlib.xml" uri="http://www.nokia.com/helium" />
       
    29     <property name="ca.output.dir" location="${test.temp.dir}/output"/>
       
    30     <property name="test.data.src" location="./../data"/>
       
    31     <property name="temp.diamonds.header.xml" location="${ca.output.dir}/ca/diamonds_header.xml" />
       
    32     <property name="temp.diamonds.footer.xml" location="${ca.output.dir}/ca/diamonds_footer.xml" />
       
    33     
       
    34     <property name="diamonds.build.output.dir" location="${ca.output.dir}/ca" />
       
    35     <property name="bc.config.dir.name" location="" />
       
    36 
       
    37     <!-- is called prior to the test -->
       
    38     <target name="setUp">
       
    39         <delete dir="${ca.output.dir}/ca" failonerror="false" />
       
    40         <mkdir dir="${ca.output.dir}/ca" />
       
    41         
       
    42         <!--take the diamonds header and footer .ftl files and turn them into .xml files
       
    43         for copying as the headera nd footer parts of the output files-->
       
    44         <fmpp sourcefile="./../../../../../tools/common/templates/diamonds/diamonds_header.ftl" 
       
    45               outputfile="${temp.diamonds.header.xml}" quiet="true"/>
       
    46         <fmpp sourcefile="./../../../../../tools/common/templates/diamonds/diamonds_footer.ftl" 
       
    47               outputfile="${temp.diamonds.footer.xml}" quiet="true"/>
       
    48     </target>
       
    49 
       
    50     <!-- is called after the test, even if that caused an error -->
       
    51     <target name="tearDown">
       
    52         <delete dir="${ca.output.dir}/ca" failonerror="false" />
       
    53         <delete file="${temp.diamonds.header.xml}" failonerror="false" />
       
    54         <delete file="${temp.diamonds.footer.xml}" failonerror="false" />
       
    55     </target>
       
    56 
       
    57 
       
    58     <!--
       
    59      **************************************************************
       
    60      ** test CMT for windows
       
    61      **************************************************************
       
    62     -->
       
    63 
       
    64     <target name="test-ca-header-with-all-reqd-params-set" >
       
    65         <echo> output file is ${diamonds.build.output.dir} </echo>
       
    66         <hlm:casummary diamondsHeaderFileName="${temp.diamonds.header.xml}" diamondsFooterFileName="${temp.diamonds.footer.xml}"
       
    67                     header="true"
       
    68                     outputFile="${ca.output.dir}/ca/ca_summary_header_ok.xml"
       
    69                     inputFile="${test.data.src}/headers_report_ok.xml" />
       
    70         <au:assertLogContains text="CASummaryTask execute"/>
       
    71         <au:assertFileExists file="${ca.output.dir}\ca\ca_summary_header_ok.xml"/>
       
    72         <loadfile property="header.ok" srcfile="${ca.output.dir}/ca/ca_summary_header_ok.xml">
       
    73             <filterchain>
       
    74                 <replaceregex pattern="\\(:|\\)" replace="\1" flags="g" />
       
    75             </filterchain>
       
    76         </loadfile>
       
    77         <echo>${header.ok}</echo>
       
    78         <au:assertTrue message="type ID 13 occurs ">
       
    79             <contains string="${header.ok}" 
       
    80                 substring="value=" />
       
    81         </au:assertTrue>
       
    82     </target>
       
    83 
       
    84     <target name="test-ca-header-no-typeids" >
       
    85         <hlm:casummary diamondsHeaderFileName="${temp.diamonds.header.xml}" diamondsFooterFileName="${temp.diamonds.footer.xml}"
       
    86                     header="true"
       
    87                     outputFile="${ca.output.dir}/ca/ca_summary_header_notypeids.xml"
       
    88                     inputFile="${test.data.src}/headers_report_notypeids.xml" />
       
    89         <au:assertLogContains text="CASummaryTask execute"/>
       
    90         <au:assertFileExists file="${ca.output.dir}\ca\ca_summary_header_notypeids.xml"/>
       
    91         <loadfile property="header.notypeids" srcfile="${ca.output.dir}/ca/ca_summary_header_notypeids.xml">
       
    92             <filterchain>
       
    93                 <replaceregex pattern="\\(:|\\)" replace="\1" flags="g" />
       
    94             </filterchain>
       
    95         </loadfile>
       
    96         <echo>${header.notypeids}</echo>
       
    97         <au:assertTrue message="compatibility-headers">
       
    98             <not>
       
    99                 <contains string="${header.notypeids}" 
       
   100                     substring="summary message" />
       
   101             </not>
       
   102         </au:assertTrue>
       
   103     </target>
       
   104 
       
   105     <target name="test-ca-library-ok" >
       
   106         <hlm:casummary diamondsHeaderFileName="${temp.diamonds.header.xml}" diamondsFooterFileName="${temp.diamonds.footer.xml}"
       
   107                     header="false"
       
   108                     outputFile="${ca.output.dir}/ca/ca_summary_library_ok.xml"
       
   109                     inputFile="${test.data.src}/libraries_report_ok.xml" />
       
   110         <au:assertLogContains text="CASummaryTask execute"/>
       
   111         <au:assertFileExists file="${ca.output.dir}\ca\ca_summary_library_ok.xml"/>
       
   112         <loadfile property="libraries.ok" srcfile="${ca.output.dir}/ca/ca_summary_library_ok.xml">
       
   113             <filterchain>
       
   114                 <replaceregex pattern="\\(:|\\)" replace="\1" flags="g" />
       
   115             </filterchain>
       
   116         </loadfile>
       
   117         <echo>${libraries.ok}</echo>
       
   118         <au:assertTrue message="compatibility-libs">
       
   119             <contains string="${libraries.ok}" 
       
   120                 substring="type ID 14 occurs" />
       
   121         </au:assertTrue>
       
   122     </target>
       
   123     
       
   124     <target name="test-ca-library-fail" >
       
   125             <hlm:casummary diamondsHeaderFileName="${temp.diamonds.header.xml}" diamondsFooterFileName="${temp.diamonds.footer.xml}"
       
   126                     header="false"
       
   127                     outputFile="${ca.output.dir}/ca/ca_summary_library_fail.xml"
       
   128                     inputFile="${test.data.src}/libraries_report_fail.xml" />
       
   129         <au:assertFileDoesntExist file="${ca.output.dir}\ca\ca_summary_library_fail.xml" />
       
   130         <au:assertLogContains text="FileNotFoundException while getting the input file" />
       
   131     </target>
       
   132 
       
   133     <target name="test-ca-library-one_id" >
       
   134         <hlm:casummary diamondsHeaderFileName="${temp.diamonds.header.xml}" diamondsFooterFileName="${temp.diamonds.footer.xml}"
       
   135                     header="false"
       
   136                     outputFile="${ca.output.dir}/ca/ca_summary_library_one_id.xml"
       
   137                     inputFile="${test.data.src}/libraries_report_one_id.xml" />
       
   138         <au:assertFileExists file="${ca.output.dir}\ca\ca_summary_library_one_id.xml" />
       
   139         <loadfile property="libraries.one.id" srcfile="${ca.output.dir}/ca/ca_summary_library_one_id.xml">
       
   140             <filterchain>
       
   141                 <replaceregex pattern="\\(:|\\)" replace="\1" flags="g" />
       
   142             </filterchain>
       
   143         </loadfile>
       
   144         <echo>${libraries.one.id}</echo>
       
   145         <au:assertTrue message="compatibility-libs">
       
   146             <contains string="${libraries.one.id}" 
       
   147                 substring="type ID 7 occurs" />
       
   148         </au:assertTrue>
       
   149     </target>
       
   150 
       
   151 </project>