blob: 950c12955d84961fc75f2466dd2be640d574b4a4 [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.
-->
<!-- Tests IPage.validate(), PageRedirectException and PageCallback -->
<mock-test>
<context name="c19" root="context19"/>
<servlet name="app" class="org.apache.tapestry.ApplicationServlet"/>
<request>
<assert-output name="Page Title">
<![CDATA[
<title>Home</title>
]]>
</assert-output>
<assert-output name="Upload Field">
<![CDATA[
<input type="file" name="$Upload"/>
]]>
</assert-output>
</request>
<!-- The upload itself. -->
<request
content-type="multipart/form-data; boundary=---------------------------7d33212e1c03e2"
content-path="context19/upload-message.request">
<assert-output name="Page Title">
<![CDATA[
<title>Two</title>
]]>
</assert-output>
<assert-output name="Content Type">
Content Type: [text/plain]
</assert-output>
<assert-output name="Path">
Path: [context19/message.txt]
</assert-output>
<assert-output name="Name">
Name: [message.txt]
</assert-output>
<assert-output name="Size">
Size: [157]
</assert-output>
<assert-output name="In Memory">
In Memory: [true]
</assert-output>
<assert-output name="Match Confirmation">
Contents match.
</assert-output>
</request>
<request
content-type="multipart/form-data; boundary=---------------------------xyzzyx"
content-path="context19/upload-long.request">
<assert-output name="Page Title">
<![CDATA[
<title>Two</title>
]]>
</assert-output>
<assert-output name="Content Type">
Content Type: [text/html]
</assert-output>
<assert-output name="Path">
Path: [context19/long.html]
</assert-output>
<assert-output name="Name">
Name: [long.html]
</assert-output>
<assert-output name="Size">
Size: [5207]
</assert-output>
<assert-output name="In Memory">
In Memory: [false]
</assert-output>
<assert-output name="Match Confirmation">
Contents match.
</assert-output>
</request>
<request
content-type="multipart/form-data; boundary=---------------------------9d33212e1c03e3"
content-path="context19/upload-image.request">
<assert-output name="Page Title">
<![CDATA[
<title>Two</title>
]]>
</assert-output>
<assert-output name="Content Type">
Content Type: [image/x-png]
</assert-output>
<assert-output name="Path">
Path: [context19/Tapestry-Banner.png]
</assert-output>
<assert-output name="Name">
Name: [Tapestry-Banner.png]
</assert-output>
<assert-output name="Match Confirmation">
Contents match.
</assert-output>
</request>
<!-- Test a disabled Upload component. -->
<request>
<parameter name="service" value="direct/0/Home/$DirectLink"/>
<assert-output name="Page Title">
<![CDATA[
<title>Home</title>
]]>
</assert-output>
<assert-output name="Upload Field">
<![CDATA[
<input type="file" name="$Upload" disabled="disabled"/>
]]>
</assert-output>
</request>
<!-- Do the upload with the Upload component disabled. -->
<request
content-type="multipart/form-data; boundary=---------------------------7d33212e1c03e2"
content-path="context19/upload-message.request">
<assert-output name="Page Title">
<![CDATA[
<title>Three</title>
]]>
</assert-output>
</request>
<!-- Now test some stuff in multipart decoder that detects multiple values for the
same element name. -->
<request>
<parameter name="service" value="page/Four"/>
<assert-output name="Page Title">
<![CDATA[
<title>Four</title>
]]>
</assert-output>
<assert-output-matches name="Options">
<![CDATA[
<option.*?/option>
]]>
<match><![CDATA[<option value="0">Lights on</option>]]></match>
<match><![CDATA[<option value="1">Nobody Home</option>]]></match>
</assert-output-matches>
</request>
<!-- Do the form submission -->
<request
content-type="multipart/form-data; boundary=---------------------------eldorado"
content-path="context19/form-four.request">
<assert-output name="Page Title">
<![CDATA[
<title>Four</title>
]]>
</assert-output>
<assert-output-matches name="Options">
<![CDATA[
<option.*?/option>
]]>
<match><![CDATA[<option value="0" selected="selected">Lights on</option>]]></match>
<match><![CDATA[<option value="1" selected="selected">Nobody Home</option>]]></match>
</assert-output-matches>
</request>
</mock-test>