buildframework/helium/sf/java/diamonds/tests/scenarii/build/build.xml
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 645 b8d81fa19e7d
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
    21 ============================================================================
    21 ============================================================================
    22 -->
    22 -->
    23 <project name="test-diamonds" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
    23 <project name="test-diamonds" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
    24     <description>Helium Antlib diamonds unittests.</description>
    24     <description>Helium Antlib diamonds unittests.</description>
    25     <property environment="env" />
    25     <property environment="env" />
    26     
    26     <taskdef resource="com/nokia/helium/core/ant/antlib.xml" uri="http://www.nokia.com/helium"/>
       
    27     <taskdef name="xpathtest" classname="se.jtech.ant.xpath.XPathEvaluatorTask" onerror="ignore"/>    
       
    28     <property name="diamonds.enabled" value="true" />
    27     <property name="diamonds.unitest.dir" location="${ant.file.test-diamonds}/../../../" />
    29     <property name="diamonds.unitest.dir" location="${ant.file.test-diamonds}/../../../" />
    28     <import file="../../../../../../nokia/companyproperties.ant.xml" optional="true"/>
    30     <import file="../../../../../../nokia/companyproperties.ant.xml" optional="true"/>
    29     <import file="../../../../../../../extensions/nokia/external/helium-nokia-antlib/companyproperties.ant.xml" optional="true"/>
    31     <import file="../../config/diamonds_config_default.ant.xml" />
    30     <property name="diamonds.output.dir" location="${temp.dir}/output" />
    32     <property name="diamonds.output.dir" location="${temp.dir}/output" />
    31     <property name="diamonds.template.dir" location="${diamonds.unitest.dir}/data/templates" />
    33     <property name="diamonds.template.dir" location="${diamonds.unitest.dir}/data/templates" />
    32     <property name="build.family" value="test_new_hlm"/>
    34     <property name="build.family" value="test_new_hlm"/>
    33     <property name="id" value="123"/>
    35     <property name="id" value="123"/>
    34     <property name="name" value="${build.family}_${id}"/>
    36     <property name="name" value="${build.family}_${id}"/>
    35     <property name="build.system" value="ec-helium"/>
    37     <property name="build.system" value="ec-helium"/>
    36     <property name="diamonds.listener.configuration.file" location="${diamonds.unitest.dir}/config/diamonds_config.xml.ftl" />
       
    37     <property name="compile.log.input" location="${diamonds.unitest.dir}/data/compile.log.xml" />
    38     <property name="compile.log.input" location="${diamonds.unitest.dir}/data/compile.log.xml" />
    38     <property name="codescanner.log.input" location="${diamonds.unitest.dir}/data/problemIndex.xml" />
    39     <property name="codescanner.log.input" location="${diamonds.unitest.dir}/data/problemIndex.xml" />
    39     <property name="policy.log.input" location="${diamonds.unitest.dir}/data/policy.log.xml" />
    40     <property name="policy.log.input" location="${diamonds.unitest.dir}/data/policy.log.xml" />
    40     <property name="invalid.target.input.file" location="${diamonds.unitest.dir}/data/invalid.target.input.log.xml" />
    41     <property name="invalid.target.input.file" location="${diamonds.unitest.dir}/data/invalid.target.input.log.xml" />
    41     <property name="symsee.version" value="9.1.0" />
    42     <property name="symsee.version" value="9.1.0" />
    42 
    43 
    43     <property name="diamonds.host" value="diamonds.nmp.nokia.com" />
    44     <import file="${diamonds.unitest.dir}/config/diamonds_config_default.ant.xml" />
       
    45 
    44 
    46 
    45     <target name="unittest" depends="unittest-diamonds" />
    47     <target name="unittest" depends="unittest-diamonds" />
    46     
    48     
    47     <target name="unittest-diamonds" >
    49     <target name="unittest-diamonds" >
    48         <delete dir="${diamonds.output.dir}" failonerror="false"/>
    50         <delete dir="${diamonds.output.dir}" failonerror="false"/>
    67 
    69 
    68     <target name="create-bom-log">
    70     <target name="create-bom-log">
    69         <echo message="target without input file and just to send the data" />
    71         <echo message="target without input file and just to send the data" />
    70     </target>
    72     </target>
    71 
    73 
    72     <target name="invalid-target-input-file">
       
    73         <echo message="target with invalid input source xml file" />
       
    74     </target>
       
    75 
       
    76     <target name="invalid-stage-input-file">
       
    77         <echo message="stage with invalid input source xml file" />
       
    78     </target>
       
    79 
       
    80     <target name="invalid-template-file">
       
    81         <echo message="target with invalid template-file" />
       
    82     </target>
       
    83 
       
    84     <target name="invalid-ant-properties-input">
       
    85         <echo message="target with invalid ant properties input" />
       
    86     </target>
       
    87 
       
    88     <target name="non-existing-ant-properties">
       
    89         <echo message="target with non-existing-ant-properties" />
       
    90     </target>
       
    91 
       
    92     <target name="invalid-diamonds-server-properties">
       
    93         <echo message="target with invalid-diamonds-server-properties" />
       
    94     </target>
       
    95 
    74 
    96     <target name="defer-type">
    75     <target name="defer-type">
    97         <echo message="version target for diamonds to verify sending data to diamonds" />
    76         <echo message="version target for diamonds to verify sending data to diamonds" />
    98     </target>
    77     </target>
    99 
    78 
   107 
    86 
   108     <target name="test-codescanner">
    87     <target name="test-codescanner">
   109         <antcall target="codescanner" />
    88         <antcall target="codescanner" />
   110     </target>
    89     </target>
   111 
    90 
   112     <target name="test-invalid-target-input-file">
    91 
   113         <antcall target="invalid-target-input-file" />
    92 
   114     </target>
       
   115 
       
   116     <target name="test-invalid-stage-input-file">
       
   117         <antcall target="invalid-target-input-file" />
       
   118         <echo message="stage with invalid input source xml file" />
       
   119     </target>
       
   120 
       
   121     <target name="test-invalid-template-file">
       
   122         <antcall target="invalid-template-file" />
       
   123     </target>
       
   124 
       
   125     <target name="test-invalid-ant-properties-input">
       
   126         <antcall target="invalid-ant-properties-input" />
       
   127     </target>
       
   128 
       
   129     <target name="test-non-existing-ant-properties">
       
   130         <antcall target="non-existing-ant-properties" />
       
   131     </target>
       
   132 
       
   133     <target name="test-invalid-diamonds-server-properties">
       
   134         <antcall target="invalid-diamonds-server-properties" />
       
   135         <echo message="target with invalid-diamonds-server-properties" />
       
   136     </target>
       
   137 
    93 
   138     <target name="test-compile-target">
    94     <target name="test-compile-target">
   139         <antcall target="compile-target" />
    95         <antcall target="compile-target" />
   140     </target>
    96     </target>
   141 
    97 
   142     <target name="test-version">
    98     <target name="test-version">
   143         <antcall target="version" />
    99         <antcall target="version" />
       
   100         <au:assertTrue>
       
   101             <isset property="diamonds.build.id"/>
       
   102         </au:assertTrue>
   144     </target>
   103     </target>
   145 
   104 
   146     <target name="test-buildid-set">
   105     <target name="test-buildid-set">
   147         <echo>${diamonds.build.id}</echo>
   106         <echo>${diamonds.build.id}</echo>
   148         <au:assertTrue>
   107         <au:assertTrue>
   149             <isset property="diamonds.build.id"/>
   108             <isset property="diamonds.build.id"/>
   150         </au:assertTrue>
   109         </au:assertTrue>
       
   110         <get src="http://${diamonds.host}:${diamonds.port}${diamonds.build.id}?fmt=xml"
       
   111              dest="${temp.dir}/test-buildid-set_output.xml" 
       
   112              usetimestamp="true" />
       
   113         <xpathtest xmlfile="${temp.dir}/test-buildid-set_output.xml">
       
   114             <namespace uri="" prefix=""/>
       
   115             <xpath expression="/diamonds-build[schema='23']"/>
       
   116         </xpathtest>
   151     </target>
   117     </target>
   152 
   118 
   153     <target name="test-buildid-notset">
   119     <target name="test-buildid-notset">
   154         <au:assertFalse>
   120         <au:assertFalse>
   155             <isset property="diamonds.build.id"/>
   121             <isset property="diamonds.build.id"/>
   156         </au:assertFalse>
   122         </au:assertFalse>
   157     </target>
   123     </target>
   158 
   124 
   159     <target name="test-echo-operation">
   125     <target name="test-echo-operation">
   160         <echo message="echo operation: test" />
   126         <echo message="echo operation: test" />
       
   127         <au:assertTrue>
       
   128             <isset property="diamonds.build.id"/>
       
   129         </au:assertTrue>
   161     </target>
   130     </target>
   162 
   131 
   163     <target name="test-echo-operation1">
   132     <target name="test-echo-operation1">
   164         <echo message="echo operation1: test" />
   133         <echo message="echo operation1: test" />
   165     </target>
   134     </target>
   178 
   147 
   179     <target name="test-echo-operation5">
   148     <target name="test-echo-operation5">
   180         <echo message="echo operation5: test" />
   149         <echo message="echo operation5: test" />
   181     </target>
   150     </target>
   182 
   151 
   183     <target name="test-depend-target" depends="test-echo-operation">
   152     <target name="test-depend-target" depends="test-echo-operation" />
   184         <echo message="test-ant-call" />
       
   185         <antcall target="test-echo-operation" />
       
   186         <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation-time.xml" />
       
   187     </target>
       
   188 
   153 
   189     <target name="test-ant-call">
   154     <target name="test-ant-call">
   190         <echo message="test-ant-call" />
   155         <echo message="test-ant-call" />
       
   156         <delete file="${diamonds.output.dir}/diamonds_stage.xml" failonerror="false" />
   191         <antcall target="test-echo-operation1" />
   157         <antcall target="test-echo-operation1" />
   192         <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation1-time.xml" />
       
   193     </target>
   158     </target>
   194 
   159 
   195     <target name="test-ant-call-multiple">
   160     <target name="test-ant-call-multiple">
   196         <echo message="test-ant-call" />
   161         <echo message="test-ant-call" />
       
   162         <delete file="${diamonds.output.dir}/diamonds_stage.xml" failonerror="false" />
   197         <antcall target="test-echo-operation2" />
   163         <antcall target="test-echo-operation2" />
   198         <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation2-time.xml" />
       
   199         <antcall target="test-echo-operation3" />
   164         <antcall target="test-echo-operation3" />
   200         <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation3-time.xml" />
       
   201     </target>
   165     </target>
   202 
   166 
   203     <target name="test-ant-call-multiple-parallel">
   167     <target name="test-ant-call-multiple-parallel">
   204         <echo message="test-ant-call" />
   168         <echo message="test-ant-call" />
       
   169         <delete file="${diamonds.output.dir}/diamonds_stage.xml" failonerror="false" />
   205         <parallel>
   170         <parallel>
   206             <antcall target="test-echo-operation4" />
   171             <antcall target="test-echo-operation4" />
   207             <antcall target="test-echo-operation5" />
   172             <antcall target="test-echo-operation5" />
   208         </parallel>
   173         </parallel>
   209         <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation4-time.xml" />
       
   210         <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation5-time.xml" />
       
   211     </target>
   174     </target>
   212 
   175 
   213     <target name="sequence-config-test-target-1">
   176     <target name="sequence-config-test-target-1">
   214         <au:assertFileExists file="${diamonds.output.dir}/stage-sequence-1-time.xml" />
       
   215     </target>
   177     </target>
   216 
   178 
   217     <target name="sequence-config-test-target-2">
   179     <target name="sequence-config-test-target-2">
   218         <au:assertFileExists file="${diamonds.output.dir}/stage-sequence-2-time.xml" />
   180     </target>
   219     </target>
   181 
   220 
   182     <target name="test-verify-targets">
       
   183         <get src="http://${diamonds.host}:${diamonds.port}${diamonds.build.id}?fmt=xml"
       
   184              dest="${temp.dir}/test-verify-targets.xml" 
       
   185              usetimestamp="true" />
       
   186         <xpathtest xmlfile="${temp.dir}/test-verify-targets.xml">
       
   187             <namespace uri="" prefix=""/>
       
   188             <xpath expression="/diamonds-build/tools/tool[name='SymSEE']"/>
       
   189          </xpathtest>
       
   190      </target>
       
   191 
       
   192     <target name="test-verify-stages">
       
   193         <get src="http://${diamonds.host}:${diamonds.port}${diamonds.build.id}?fmt=xml"
       
   194              dest="${temp.dir}/test-verify-stages.xml" 
       
   195              usetimestamp="true" />
       
   196         <xpathtest xmlfile="${temp.dir}/test-verify-stages.xml">
       
   197             <namespace uri="" prefix=""/>
       
   198             <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation']"/>
       
   199             <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation1']"/>
       
   200             <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation2']"/>
       
   201             <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation3']"/>
       
   202             <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation4']"/>
       
   203             <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation5']"/>
       
   204             <xpath expression="/diamonds-build/stages/stage[name='stage-sequence-1']"/>
       
   205             <xpath expression="/diamonds-build/stages/stage[name='stage-sequence-2']"/>
       
   206         </xpathtest>
       
   207     </target>        
   221 
   208 
   222     <target name="test-all" depends="test-buildid-notset, diamonds, test-buildid-set, test-defer-type, test-version,
   209     <target name="test-all" depends="test-buildid-notset, diamonds, test-buildid-set, test-defer-type, test-version,
   223         test-create-bom-log,test-codescanner,test-compile-target,test-invalid-diamonds-server-properties,
   210         test-create-bom-log,test-codescanner,test-compile-target, test-depend-target,
   224         test-non-existing-ant-properties,test-invalid-ant-properties-input,test-invalid-template-file,
       
   225         test-invalid-target-input-file,test-invalid-stage-input-file, test-depend-target,
       
   226         test-ant-call, test-ant-call-multiple, test-ant-call-multiple-parallel, 
   211         test-ant-call, test-ant-call-multiple, test-ant-call-multiple-parallel, 
   227         sequence-config-test-target-1,sequence-config-test-target-2 " />
   212         sequence-config-test-target-1,sequence-config-test-target-2, test-verify-stages, test-verify-targets" />
   228 </project>
   213 </project>