blob: 871013aba9efd780d100e73ee8bf232690b1abbf [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->
<!--
Copyright 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.
-->
<mock-test>
<!-- Accidentally named this once context upper-case, and it's a pain to fix
it because of how NT handles case and filenames. -->
<context name="c9" root="Context9"/>
<servlet name="app" class="org.apache.tapestry.ApplicationServlet"/>
<request>
<assert-output name="Page Title">
<![CDATA[
<title>Home</title>
]]>
</assert-output>
<assert-output name="Initial Value">
Initial value: []
</assert-output>
<assert-output name="Final Value">
Final value: [boy]
</assert-output>
<assert-output-matches name="List Items" subgroup="1">
<![CDATA[
<li>(.*?)</li>
]]>
<match>Gromit</match>
<match>is</match>
<match>a</match>
<match>good</match>
<match>boy</match>
</assert-output-matches>
<assert-regexp name="Page Class">
<![CDATA[
Page class: \[org\.apache\.tapestry\.html\.BasePage\$(.*?)\]
]]>
</assert-regexp>
</request>
<request>
<assert-output name="Page Title">
<![CDATA[
<title>Home</title>
]]>
</assert-output>
<assert-output name="Initial Value">
Initial value: []
</assert-output>
<assert-output name="Final Value">
Final value: [boy]
</assert-output>
<assert-output-matches name="List Items" subgroup="1">
<![CDATA[
<li>(.*?)</li>
]]>
<match>Gromit</match>
<match>is</match>
<match>a</match>
<match>good</match>
<match>boy</match>
</assert-output-matches>
</request>
<request>
<parameter name="service" value="page/Two"/>
<assert-output name="Page Title">
<![CDATA[
<title>Two</title>
]]>
</assert-output>
<assert-output name="Initial Value">
Initial value: [15]
</assert-output>
<assert-output name="Final Value">
Final value: [8]
</assert-output>
<assert-output-matches name="List Items" subgroup="1">
<![CDATA[
<li>(.*?)</li>
]]>
<match>2</match>
<match>4</match>
<match>6</match>
<match>8</match>
</assert-output-matches>
</request>
<request>
<parameter name="service" value="page/Two"/>
<assert-output name="Page Title">
<![CDATA[
<title>Two</title>
]]>
</assert-output>
<assert-output name="Initial Value">
Initial value: [15]
</assert-output>
<assert-output name="Final Value">
Final value: [8]
</assert-output>
</request>
<request>
<parameter name="service" value="page/Three"/>
<assert-output name="Page Title">
<![CDATA[
<title>Three</title>
]]>
</assert-output>
<assert-output name="Initial Value">
Initial value: [Tapestry]
</assert-output>
<assert-output name="Final Value">
Final value: [Taxi]
</assert-output>
<assert-output-matches name="List Items" subgroup="1">
<![CDATA[
<li>(.*?)</li>
]]>
<match>Crazy</match>
<match>Taxi</match>
</assert-output-matches>
<assert-regexp name="Page Class">
<![CDATA[
Page class: \[org\.apache\.tapestry\.junit\.mock\.c9\.Three\$(.*?)\]
]]>
</assert-regexp>
</request>
<request>
<parameter name="service" value="page/Three"/>
<assert-output name="Page Title">
<![CDATA[
<title>Three</title>
]]>
</assert-output>
<assert-output name="Initial Value">
Initial value: [Tapestry]
</assert-output>
<assert-output name="Final Value">
Final value: [Taxi]
</assert-output>
</request>
<!-- Page Four includes an non-abstract accessor for the property, so it will
cause an exception. -->
<request>
<parameter name="service" value="page/Four"/>
<assert-output name="Page Title">
<![CDATA[
<title>Exception</title>
]]>
</assert-output>
<assert-output name="Exception Message">
Unable to enhance class org.apache.tapestry.junit.mock.c9.Four because it implements a non-abstract write method for property 'word'.
</assert-output>
</request>
<request>
<parameter name="service" value="page/Five"/>
<assert-output name="Page Title">
<![CDATA[
<title>Exception</title>
]]>
</assert-output>
<assert-output name="Exception Message">
Unable to enhance class org.apache.tapestry.junit.mock.c9.Five because it implements a non-abstract read method for property 'word'.
</assert-output>
</request>
<!-- This test is about making sure the property type in the specification matches
the actual property type (if the class declares abstract accessor methods). -->
<request>
<parameter name="service" value="page/Six"/>
<assert-output name="Page Title">
<![CDATA[
<title>Exception</title>
]]>
</assert-output>
<assert-output name="Exception Message">
Unable to enhance class org.apache.tapestry.junit.mock.c9.Six because it contains property 'value' of type int, not the expected type long.
</assert-output>
</request>
<request>
<parameter name="service" value="page/Seven"/>
<assert-output name="Page Title">
<![CDATA[
<title>Seven</title>
]]>
</assert-output>
<assert-output-matches name="Values" subgroup="1">
<![CDATA[
value: \[(.*?)\]
]]>
<match>true</match>
<match>65</match>
<match>Z</match>
<match>97</match>
<match>100</match>
<match>32000000</match>
<match>-22.7</match>
<match>3.2</match>
<match>Magic</match>
</assert-output-matches>
<assert-output name="Link">
<![CDATA[
/c9/app?service=direct/0/Seven/$DirectLink
]]>
</assert-output>
</request>
<!-- Trigger the link and check for the changes in the page, and in persistent storage. -->
<request>
<parameter name="service" value="direct/0/Seven/$DirectLink"/>
<assert-output name="Page Title">
<![CDATA[
<title>Seven</title>
]]>
</assert-output>
<assert-output-matches name="Values" subgroup="1">
<![CDATA[
value: \[(.*?)\]
]]>
<match>false</match>
<match>81</match>
<match>f</match>
<match>21</match>
<match>3097</match>
<match>132000001</match>
<match>-202.2</match>
<match>9.87</match>
<match>Marker</match>
</assert-output-matches>
<assert-output name="Link">
<![CDATA[
/c9/app?service=direct/1/Seven/$DirectLink
]]>
</assert-output>
<assert name="Persistent booleanValue">
request.session.getAttribute("app/Seven/booleanValue") == false
</assert>
<assert name="Persistent byteValue">
request.session.getAttribute("app/Seven/byteValue") == 81
</assert>
<assert name="Persistent charValue">
request.session.getAttribute("app/Seven/charValue") == 'f'
</assert>
<assert name="Persistent shortValue">
request.session.getAttribute("app/Seven/shortValue") == 21
</assert>
<assert name="Persistent intValue">
request.session.getAttribute("app/Seven/intValue") == 3097
</assert>
<assert name="Persistent longValue">
request.session.getAttribute("app/Seven/longValue") == 132000001
</assert>
<assert name="Persistent floatValue">
request.session.getAttribute("app/Seven/floatValue") == -202.2f
</assert>
<assert name="Persistent doubleValue">
request.session.getAttribute("app/Seven/doubleValue") == 9.87
</assert>
<assert name="Persistent stringValue">
request.session.getAttribute("app/Seven/stringValue") == "Marker"
</assert>
</request>
<!-- Test an abstract page that includes an abstract method that
isn't implemented. -->
<request>
<parameter name="service" value="page/Eight"/>
<assert-output name="Title">
<![CDATA[
<title>Exception</title
]]>
</assert-output>
<assert-output name="Message">
Method 'public abstract long org.apache.tapestry.junit.mock.c9.Eight.setEnhancedProperty(long)' (declared in class org.apache.tapestry.junit.mock.c9.Eight) has no implementation in class org.apache.tapestry.junit.mock.c9.Eight (or enhanced subclass org.apache.tapestry.junit.mock.c9.Eight$
</assert-output>
</request>
<request>
<parameter name="service" value="page/Nine"/>
<assert-output name="Title">
<![CDATA[
<title>Exception</title
]]>
</assert-output>
<assert-output name="Message">
Method 'public abstract void org.apache.tapestry.junit.mock.c9.Nine.pageDetached(org.apache.tapestry.event.PageEvent)' (declared in class org.apache.tapestry.junit.mock.c9.Nine) has no implementation in class org.apache.tapestry.junit.mock.c9.Nine (or enhanced subclass org.apache.tapestry.junit.mock.c9.Nine$
</assert-output>
</request>
<request>
<parameter name="service" value="page/Ten"/>
<assert-output name="Title">
<![CDATA[
<title>Ten</title>
]]>
</assert-output>
<assert-output name="Long Value">
Long value: [123456]
</assert-output>
</request>
<request>
<parameter name="service" value="page/Eleven"/>
<assert-output name="Title">
<![CDATA[
<title>Eleven</title>
]]>
</assert-output>
<assert-output name="Two">
en_US is the US locale
</assert-output>
<assert-output name="Three">
de_DE is the Germany locale
</assert-output>
<assert-output name="Five">
it_IT is the Italy locale
</assert-output>
</request>
<request>
<parameter name="service" value="page/Twelve"/>
<assert-output name="Title">
<![CDATA[
<title>Twelve</title>
]]>
</assert-output>
<assert-output name="Two">
Variable initial value = 0
</assert-output>
<assert-output name="Two">
Constant initial value = 5
</assert-output>
</request>
<request>
<parameter name="service" value="page/Twelve"/>
<assert-output name="Title">
<![CDATA[
<title>Twelve</title>
]]>
</assert-output>
<assert-output name="Two">
Variable initial value = 1
</assert-output>
<assert-output name="Two">
Constant initial value = 5
</assert-output>
</request>
</mock-test>