<?xml version="1.0" encoding="utf-8"?>
<scenario xmlns="http://www.veremes.com/rtest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.veremes.com/rtest http://schemas.veremes.net/rtest/2.0/rtest.xsd">
	<project>Hello World !</project>
	<description>A simple test scenario to understand how rTest for FME does work</description>
	<rtestCollection>
		<rtest id="hw.t1" label="Point with positive coordinates">
			<processCollection>
				<process label="Run HelloWorld.fmw with a point in Switzerland" deletebefore="./result/dbcountry.sqlite">
					<workspace>./HelloWorld.fmw</workspace>
					<parameterCollection>
						<parameter name="xy" value="6.6 46.6"/>
						<parameter name="destSpatialiteFile" value="./result/dbcountry.sqlite"/>
					</parameterCollection>
				</process>
			</processCollection>
			<checkCollection>
				<check label="Number of features in the 'country' feature type">
					<source type="datafile" format="SPATIALITE" dataset="./result/dbcountry.sqlite" request="featuresCount()" requestparams="country"/>
					<condition comparator="eq" expectedvalue="1"/>
				</check>
				<check label="Country name in the first record">
					<source type="datafile" format="SPATIALITE" dataset="result\dbcountry.sqlite" request="attributeValue()" requestparams="country,name,1"/>
					<condition comparator="eq" expectedvalue="Switzerland"/>
				</check>
			</checkCollection>
		</rtest>
		<rtest id="hw.t2" label="Point with negative coordinates">
			<processCollection>
				<process label="Run HelloWorld.fmw with a point in Argentina">
					<workspace>./HelloWorld.fmw</workspace>
					<parameterCollection>
						<parameter name="xy" value="-60.0 -35.0"/>
						<parameter name="destSpatialiteFile" value="./result/dbcountry.sqlite"/>
					</parameterCollection>
				</process>
			</processCollection>
			<checkCollection>
				<check label="Number of features in the 'country' feature type">
					<source type="datafile" format="SPATIALITE" dataset="./result/dbcountry.sqlite" request="featuresCount()" requestparams="country"/>
					<condition comparator="eq" expectedvalue="2"/>
				</check>
				<check label="Country name in the second record">
					<source type="datafile" format="SPATIALITE" dataset="result\dbcountry.sqlite" request="attributeValue()" requestparams="country,name,2"/>
					<condition comparator="eq" expectedvalue="Argentine"/>
				</check>
			</checkCollection>
		</rtest>
		<rtest id="hw.t3" label="Point on a border">
			<processCollection>
				<process label="Run HelloWorld.fmw with a point on the French-Swiss border">
					<workspace>./HelloWorld.fmw</workspace>
					<parameterCollection>
						<parameter name="xy" value="5.966666000000032 46.209442000000095"/>
						<parameter name="destSpatialiteFile" value="./result/border.sqlite"/>
					</parameterCollection>
				</process>
			</processCollection>
			<checkCollection>
				<check label="Number of features in the 'country' feature type">
					<source type="datafile" format="SPATIALITE" dataset="./result/border.sqlite" request="featuresCount()" requestparams="country"/>
					<condition comparator="eq" expectedvalue="2"/>
				</check>
			</checkCollection>
		</rtest>
		<rtest id="hw.t4" label="Check attributes">
			<processCollection>
				<process label="Run HelloWorld.fmw with a point in Spain">
					<workspace>./HelloWorld.fmw</workspace>
					<parameterCollection>
						<parameter name="xy" value="0.0 41.0"/>
						<parameter name="destSpatialiteFile" value="./result/dbcountry.sqlite"/>
					</parameterCollection>
				</process>
			</processCollection>
			<checkCollection>
				<check label="Country name in the third record">
					<source type="datafile" format="SPATIALITE" dataset="result\dbcountry.sqlite" request="attributeValue()" requestparams="country,name,3"/>
					<condition comparator="eq" expectedvalue="Spain"/>
				</check>
				<check label="Population in the third record">
					<source type="datafile" format="SPATIALITE" dataset="result\dbcountry.sqlite" request="attributeValue()" requestparams="country,pop2005,3"/>
					<condition comparator="eq" expectedvalue="43397491"/>
				</check>
			</checkCollection>
		</rtest>
		<rtest id="hw.t5" label="Bad parameters management">
			<processCollection>
				<process label="Run HelloWorld.fmw with invalid coordinates : 1x 45" deletebefore="./result/log.log" copylogto="./result/log.log">
					<workspace>./HelloWorld.fmw</workspace>
					<expectedstatus>failure</expectedstatus>
					<parameterCollection>
						<parameter name="xy" value="1x 45"/>
						<parameter name="destSpatialiteFile" value="./result/dbcountry.sqlite"/>
					</parameterCollection>
				</process>
			</processCollection>
			<checkCollection>
				<check label="Correct error message in the log file">
					<source type="logfile" dataset="./result/log.log"/>
					<condition comparator="match" expectedvalue="|ERROR |Invalid coordinates"/>
				</check>
			</checkCollection>
		</rtest>
	</rtestCollection>
</scenario>