| <?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> |
| <context name="c16" root="context16"/> |
| |
| <servlet name="app" class="org.apache.tapestry.ApplicationServlet"> |
| <init-parameter name="org.apache.tapestry.application-specification" |
| value="/org/apache/tapestry/junit/mock/c16/app.application"/> |
| </servlet> |
| |
| <request> |
| <assert-output name="Page Title"> |
| <![CDATA[ |
| <title>Private Assets</title> |
| ]]> |
| </assert-output> |
| |
| <assert-output name="Image Tag"> |
| <![CDATA[ |
| <img src="/c16/app?service=asset&sp=S%2Forg%2Fapache%2Ftapestry%2Fjunit%2Fmock%2Fc16%2Flogo.png&sp=Sf6324ac8f24f0a7f4850221b0f14c865" border="0"/> |
| ]]> |
| </assert-output> |
| </request> |
| |
| <request> |
| <parameter name="service" value="asset"/> |
| <parameter name="sp"> |
| <value>/org/apache/tapestry/junit/mock/c16/logo.png</value> |
| <value>Sf6324ac8f24f0a7f4850221b0f14c865</value> |
| </parameter> |
| |
| <assert-output-stream name="Image Content" |
| content-type="image/png" |
| path="src/org/apache/tapestry/junit/mock/c16/logo.png"/> |
| </request> |
| |
| <request> |
| <parameter name="service" value="asset"/> |
| <parameter name="sp"> |
| <value>/org/apache/tapestry/junit/mock/c16/globe.jpg</value> |
| <value>S52463f90c449b2546814d8929aa7d5cd</value> |
| </parameter> |
| |
| <assert-output-stream name="Image Content" |
| content-type="image/jpeg" |
| path="src/org/apache/tapestry/junit/mock/c16/globe.jpg"/> |
| </request> |
| |
| <!-- Request a file using a bad checksum. --> |
| |
| <request> |
| <parameter name="service" value="asset"/> |
| <parameter name="sp"> |
| <value>/org/apache/tapestry/junit/mock/c16/logo.png</value> |
| <value>Sabcdef</value> |
| </parameter> |
| |
| <assert-output name="Page Title"> |
| <![CDATA[ |
| <title>Exception</title> |
| ]]> |
| </assert-output> |
| |
| <assert-output name="Message"> |
| Checksum abcdef does not match that of resource /org/apache/tapestry/junit/mock/c16/logo.png. |
| </assert-output> |
| |
| </request> |
| |
| <!-- Request a file which does not exist. --> |
| |
| <request> |
| <parameter name="service" value="asset"/> |
| <parameter name="sp"> |
| <value>/org/apache/tapestry/junit/mock/c16/MISSING.gif</value> |
| <value>Sabcdef</value> |
| </parameter> |
| |
| <assert-output name="Page Title"> |
| <![CDATA[ |
| <title>Exception</title> |
| ]]> |
| </assert-output> |
| |
| <assert-output name="Message"> |
| Could not locate resource /org/apache/tapestry/junit/mock/c16/MISSING.gif. |
| </assert-output> |
| |
| </request> |
| |
| <!-- Request missing the sp parameter --> |
| |
| <request> |
| <parameter name="service" value="asset"/> |
| |
| <assert-output name="Page Title"> |
| <![CDATA[ |
| <title>Exception</title> |
| ]]> |
| </assert-output> |
| |
| <assert-output name="Message"> |
| Service asset requires exactly 2 service parameters. |
| </assert-output> |
| </request> |
| |
| <!-- Request missing the checksum --> |
| |
| <request> |
| <parameter name="service" value="asset"/> |
| <parameter name="sp" value="/org/apache/tapestry/junit/mock/c16/MISSING.gif"/> |
| |
| <assert-output name="Page Title"> |
| <![CDATA[ |
| <title>Exception</title> |
| ]]> |
| </assert-output> |
| |
| <assert-output name="Message"> |
| Service asset requires exactly 2 service parameters. |
| </assert-output> |
| </request> |
| |
| </mock-test> |