ovidiu      02/05/19 12:27:03

  Added:       src/test/anteater all-tests.xml calc.xml
  Log:
  Added the continuations based control flow layer from scratchpad/schecoon/.
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/test/anteater/all-tests.xml
  
  Index: all-tests.xml
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  
  <!--
  
    Automatically detects all the Anteater tests in the current
    directory and runs them.
  
    Author: Ovidiu Predescu "[EMAIL PROTECTED]"
    Date: April 4, 2002
  
    Description:
  
    To write a new Anteater test, just create a new Ant XML file and
    define a target whose name is the same as the filename, except for
    the .xml suffix. Then go in the top level directory of Schecoon and
    type:
  
    ./build.sh test
  
    The newly added test file will be picked up and executed
    auto-magically.
  
    -->
  
  <project name="all-tests" default="all">
  
    <taskdef resource="META-INF/Anteater.tasks"/>
    <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  
    <property name="schecoon" value="http://${host}:${port}/${base}"/>
  
    <target name="all">
      <foreach target="runtest" param="name">
        <fileset dir=".">
          <include name="*.xml"/>
          <exclude name="all-tests.xml"/>
        </fileset>
      </foreach>
    </target>
  
    <target name="runtest">
     <basename property="target" file="${name}" suffix=".xml"/>
     <echo message="running test ${target} in dir ${basedir}"/>
     <ant antfile="${target}.xml" dir="${basedir}" target="${target}" 
inheritAll="yes"/>
    </target>
  
  </project>
  
  
  
  1.1                  xml-cocoon2/src/test/anteater/calc.xml
  
  Index: calc.xml
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  
  <project name="calc-test" default="calc">
  
    <!-- 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="${schecoon}/examples/calc"/>
  
      <http description="Test the 'calc' JavaScript implementation">
        <httpRequest href="${calc}/">
          <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}/kont/${cont2}">
          <parameter name="b" value="2"/>
          <match>
            <xpath select="html/body//form/@action" assign="cont3"/>
          </match>
        </httpRequest>
        <httpRequest href="${calc}/kont/${cont3}">
          <parameter name="operator" value="plus"/>
          <match>
            <xpath select="html/body//form/p[contains(text(),'Result')]/b"
                 value="3.0"
                 assign="result"/>
          </match>
        </httpRequest>
        <echo>result = ${result}</echo>
      </http>
  
      <http description="Simulate going back in the browser">
        <httpRequest href="${calc}/kont/${cont2}">
          <parameter name="b" value="4"/>
          <match>
            <xpath select="html/body//form/@action" assign="cont4"/>
          </match>
        </httpRequest>
        <httpRequest href="${calc}/kont/${cont4}">
          <parameter name="operator" value="minus"/>
          <match>
            <xpath select="html/body//form/p[contains(text(),'Result')]/b"
                 value="-3.0"
                 assign="result"/>
          </match>
        </httpRequest>
        <echo>result = ${result}</echo>
      </http>
  
      <http description="Simulate going back again in the browser">
        <httpRequest href="${calc}/kont/${cont4}">
          <parameter name="operator" value="divide"/>
          <match>
            <xpath select="html/body//form/p[contains(text(),'Result')]/b"
                 value="0.25"
                 assign="result"/>
          </match>
        </httpRequest>
        <echo>result = ${result}</echo>
      </http>
  
    </target>
  
  </project>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to