buildframework/helium/sf/java/diamonds/tests/scenarii/build/build.xml
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 645 b8d81fa19e7d
--- a/buildframework/helium/sf/java/diamonds/tests/scenarii/build/build.xml	Wed Jun 16 16:51:40 2010 +0300
+++ b/buildframework/helium/sf/java/diamonds/tests/scenarii/build/build.xml	Fri Aug 13 14:59:05 2010 +0300
@@ -23,24 +23,26 @@
 <project name="test-diamonds" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
     <description>Helium Antlib diamonds unittests.</description>
     <property environment="env" />
-    
+    <taskdef resource="com/nokia/helium/core/ant/antlib.xml" uri="http://www.nokia.com/helium"/>
+    <taskdef name="xpathtest" classname="se.jtech.ant.xpath.XPathEvaluatorTask" onerror="ignore"/>    
+    <property name="diamonds.enabled" value="true" />
     <property name="diamonds.unitest.dir" location="${ant.file.test-diamonds}/../../../" />
     <import file="../../../../../../nokia/companyproperties.ant.xml" optional="true"/>
-    <import file="../../../../../../../extensions/nokia/external/helium-nokia-antlib/companyproperties.ant.xml" optional="true"/>
+    <import file="../../config/diamonds_config_default.ant.xml" />
     <property name="diamonds.output.dir" location="${temp.dir}/output" />
     <property name="diamonds.template.dir" location="${diamonds.unitest.dir}/data/templates" />
     <property name="build.family" value="test_new_hlm"/>
     <property name="id" value="123"/>
     <property name="name" value="${build.family}_${id}"/>
     <property name="build.system" value="ec-helium"/>
-    <property name="diamonds.listener.configuration.file" location="${diamonds.unitest.dir}/config/diamonds_config.xml.ftl" />
     <property name="compile.log.input" location="${diamonds.unitest.dir}/data/compile.log.xml" />
     <property name="codescanner.log.input" location="${diamonds.unitest.dir}/data/problemIndex.xml" />
     <property name="policy.log.input" location="${diamonds.unitest.dir}/data/policy.log.xml" />
     <property name="invalid.target.input.file" location="${diamonds.unitest.dir}/data/invalid.target.input.log.xml" />
     <property name="symsee.version" value="9.1.0" />
 
-    <property name="diamonds.host" value="diamonds.nmp.nokia.com" />
+    <import file="${diamonds.unitest.dir}/config/diamonds_config_default.ant.xml" />
+
 
     <target name="unittest" depends="unittest-diamonds" />
     
@@ -69,29 +71,6 @@
         <echo message="target without input file and just to send the data" />
     </target>
 
-    <target name="invalid-target-input-file">
-        <echo message="target with invalid input source xml file" />
-    </target>
-
-    <target name="invalid-stage-input-file">
-        <echo message="stage with invalid input source xml file" />
-    </target>
-
-    <target name="invalid-template-file">
-        <echo message="target with invalid template-file" />
-    </target>
-
-    <target name="invalid-ant-properties-input">
-        <echo message="target with invalid ant properties input" />
-    </target>
-
-    <target name="non-existing-ant-properties">
-        <echo message="target with non-existing-ant-properties" />
-    </target>
-
-    <target name="invalid-diamonds-server-properties">
-        <echo message="target with invalid-diamonds-server-properties" />
-    </target>
 
     <target name="defer-type">
         <echo message="version target for diamonds to verify sending data to diamonds" />
@@ -109,31 +88,8 @@
         <antcall target="codescanner" />
     </target>
 
-    <target name="test-invalid-target-input-file">
-        <antcall target="invalid-target-input-file" />
-    </target>
-
-    <target name="test-invalid-stage-input-file">
-        <antcall target="invalid-target-input-file" />
-        <echo message="stage with invalid input source xml file" />
-    </target>
-
-    <target name="test-invalid-template-file">
-        <antcall target="invalid-template-file" />
-    </target>
 
-    <target name="test-invalid-ant-properties-input">
-        <antcall target="invalid-ant-properties-input" />
-    </target>
 
-    <target name="test-non-existing-ant-properties">
-        <antcall target="non-existing-ant-properties" />
-    </target>
-
-    <target name="test-invalid-diamonds-server-properties">
-        <antcall target="invalid-diamonds-server-properties" />
-        <echo message="target with invalid-diamonds-server-properties" />
-    </target>
 
     <target name="test-compile-target">
         <antcall target="compile-target" />
@@ -141,6 +97,9 @@
 
     <target name="test-version">
         <antcall target="version" />
+        <au:assertTrue>
+            <isset property="diamonds.build.id"/>
+        </au:assertTrue>
     </target>
 
     <target name="test-buildid-set">
@@ -148,6 +107,13 @@
         <au:assertTrue>
             <isset property="diamonds.build.id"/>
         </au:assertTrue>
+        <get src="http://${diamonds.host}:${diamonds.port}${diamonds.build.id}?fmt=xml"
+             dest="${temp.dir}/test-buildid-set_output.xml" 
+             usetimestamp="true" />
+        <xpathtest xmlfile="${temp.dir}/test-buildid-set_output.xml">
+            <namespace uri="" prefix=""/>
+            <xpath expression="/diamonds-build[schema='23']"/>
+        </xpathtest>
     </target>
 
     <target name="test-buildid-notset">
@@ -158,6 +124,9 @@
 
     <target name="test-echo-operation">
         <echo message="echo operation: test" />
+        <au:assertTrue>
+            <isset property="diamonds.build.id"/>
+        </au:assertTrue>
     </target>
 
     <target name="test-echo-operation1">
@@ -180,49 +149,65 @@
         <echo message="echo operation5: test" />
     </target>
 
-    <target name="test-depend-target" depends="test-echo-operation">
-        <echo message="test-ant-call" />
-        <antcall target="test-echo-operation" />
-        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation-time.xml" />
-    </target>
+    <target name="test-depend-target" depends="test-echo-operation" />
 
     <target name="test-ant-call">
         <echo message="test-ant-call" />
+        <delete file="${diamonds.output.dir}/diamonds_stage.xml" failonerror="false" />
         <antcall target="test-echo-operation1" />
-        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation1-time.xml" />
     </target>
 
     <target name="test-ant-call-multiple">
         <echo message="test-ant-call" />
+        <delete file="${diamonds.output.dir}/diamonds_stage.xml" failonerror="false" />
         <antcall target="test-echo-operation2" />
-        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation2-time.xml" />
         <antcall target="test-echo-operation3" />
-        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation3-time.xml" />
     </target>
 
     <target name="test-ant-call-multiple-parallel">
         <echo message="test-ant-call" />
+        <delete file="${diamonds.output.dir}/diamonds_stage.xml" failonerror="false" />
         <parallel>
             <antcall target="test-echo-operation4" />
             <antcall target="test-echo-operation5" />
         </parallel>
-        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation4-time.xml" />
-        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation5-time.xml" />
     </target>
 
     <target name="sequence-config-test-target-1">
-        <au:assertFileExists file="${diamonds.output.dir}/stage-sequence-1-time.xml" />
     </target>
 
     <target name="sequence-config-test-target-2">
-        <au:assertFileExists file="${diamonds.output.dir}/stage-sequence-2-time.xml" />
     </target>
 
+    <target name="test-verify-targets">
+        <get src="http://${diamonds.host}:${diamonds.port}${diamonds.build.id}?fmt=xml"
+             dest="${temp.dir}/test-verify-targets.xml" 
+             usetimestamp="true" />
+        <xpathtest xmlfile="${temp.dir}/test-verify-targets.xml">
+            <namespace uri="" prefix=""/>
+            <xpath expression="/diamonds-build/tools/tool[name='SymSEE']"/>
+         </xpathtest>
+     </target>
+
+    <target name="test-verify-stages">
+        <get src="http://${diamonds.host}:${diamonds.port}${diamonds.build.id}?fmt=xml"
+             dest="${temp.dir}/test-verify-stages.xml" 
+             usetimestamp="true" />
+        <xpathtest xmlfile="${temp.dir}/test-verify-stages.xml">
+            <namespace uri="" prefix=""/>
+            <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation']"/>
+            <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation1']"/>
+            <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation2']"/>
+            <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation3']"/>
+            <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation4']"/>
+            <xpath expression="/diamonds-build/stages/stage[name='test-echo-operation5']"/>
+            <xpath expression="/diamonds-build/stages/stage[name='stage-sequence-1']"/>
+            <xpath expression="/diamonds-build/stages/stage[name='stage-sequence-2']"/>
+        </xpathtest>
+    </target>        
 
     <target name="test-all" depends="test-buildid-notset, diamonds, test-buildid-set, test-defer-type, test-version,
-        test-create-bom-log,test-codescanner,test-compile-target,test-invalid-diamonds-server-properties,
-        test-non-existing-ant-properties,test-invalid-ant-properties-input,test-invalid-template-file,
-        test-invalid-target-input-file,test-invalid-stage-input-file, test-depend-target,
+        test-create-bom-log,test-codescanner,test-compile-target, test-depend-target,
         test-ant-call, test-ant-call-multiple, test-ant-call-multiple-parallel, 
-        sequence-config-test-target-1,sequence-config-test-target-2 " />
+        sequence-config-test-target-1,sequence-config-test-target-2, test-verify-stages, test-verify-targets" />
 </project>
\ No newline at end of file