| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| Copyright 1999-2004 The Apache Software Foundation |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <project name="calc-test" default="calc"> |
| |
| <group id="default"> |
| <property name="usetidy" value="true"/> |
| </group> |
| |
| <!-- Simulate the behavior of a user that opens a browser, starts |
| the calculator example, and goes back in the processing several |
| times. --> |
| <target name="calc"> |
| <property name="calc" value="${anteater.env.cocoon}/samples/flow/jxcalc/"/> |
| |
| <httpRequest href="${calc}/" |
| description="Test the 'calc' JavaScript implementation"> |
| <match> |
| <xpath select="html/body//form/@action" assign="cont1"/> |
| </match> |
| </httpRequest> |
| <httpRequest href="${calc}/${cont1}"> |
| <parameter name="a" value="1"/> |
| <match> |
| <xpath select="html/body//form/@action" assign="cont2"/> |
| </match> |
| </httpRequest> |
| <httpRequest href="${calc}/${cont2}"> |
| <parameter name="b" value="2"/> |
| <match> |
| <xpath select="html/body//form/@action" assign="cont3"/> |
| </match> |
| </httpRequest> |
| <httpRequest href="${calc}/${cont3}"> |
| <parameter name="operator" value="plus"/> |
| <match> |
| <xpath select="html/body//form/p[contains(text(),'Result')]/strong" |
| value="3.0" |
| assign="result"/> |
| </match> |
| </httpRequest> |
| <echo>result = ${result}</echo> |
| |
| <httpRequest href="${calc}/${cont2}" |
| description="Simulate going back in the browser"> |
| <parameter name="b" value="4"/> |
| <match> |
| <xpath select="html/body//form/@action" assign="cont4"/> |
| </match> |
| </httpRequest> |
| <httpRequest href="${calc}/${cont4}"> |
| <parameter name="operator" value="minus"/> |
| <match> |
| <xpath select="html/body//form/p[contains(text(),'Result')]/strong" |
| value="-3.0" |
| assign="result"/> |
| </match> |
| </httpRequest> |
| <echo>result = ${result}</echo> |
| |
| <httpRequest href="${calc}/${cont4}" |
| description="Simulate going back again in the browser"> |
| <parameter name="operator" value="divide"/> |
| <match> |
| <xpath select="html/body//form/p[contains(text(),'Result')]/strong" |
| value="0.25" |
| assign="result"/> |
| </match> |
| </httpRequest> |
| <echo>result = ${result}</echo> |
| </target> |
| </project> |