| <?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="junit"/> |
| |
| <servlet name="mock" class="org.apache.tapestry.ApplicationServlet"> |
| <init-parameter |
| name="org.apache.tapestry.application-specification" |
| value="/org/apache/tapestry/junit/mock/app/Mock.application"/> |
| </servlet> |
| |
| <request> |
| |
| <parameter name="service" value="page/ServiceTest"/> |
| |
| <assert-output name="Page Title"> |
| <![CDATA[ |
| <title>ServiceTest Page</title> |
| ]]> |
| </assert-output> |
| |
| <assert-output name="ServiceLink with parameters"> |
| <![CDATA[ |
| <a href="/junit/mock?service=external/ServiceTest&sp=SSopranos&sp=20705&sp=d3.142857142857143"> |
| ]]> |
| </assert-output> |
| |
| |
| </request> |
| |
| <request> |
| <parameter name="service" value="external/ServiceTest"/> |
| <parameter name="sp"> |
| <value>SSopranos</value> |
| <value>20705</value> |
| <value>d3.142857142857143</value> |
| </parameter> |
| |
| <assert-output-matches name="Cells" subgroup="1"> |
| <![CDATA[ |
| <td>(.*?)</td> |
| ]]> |
| <match>0</match> |
| <match>java.lang.String</match> |
| <match>Sopranos</match> |
| |
| <match>1</match> |
| <match>java.lang.Integer</match> |
| <match>20705</match> |
| |
| <match>2</match> |
| <match>java.lang.Double</match> |
| <match>3.142857142857143</match> |
| |
| </assert-output-matches> |
| |
| <assert name="HttpSession created"> |
| request.session != null |
| </assert> |
| |
| </request> |
| |
| |
| <!-- OK, try some invalid versions. --> |
| |
| <request> |
| <parameter name="service" value="external"/> |
| |
| <!-- Omit the context, specifying the page. --> |
| |
| <assert-output name="Page Title"> |
| <![CDATA[ |
| <title>Exception</title> |
| ]]> |
| </assert-output> |
| |
| <assert-output name="Message"> |
| Service external requires exactly one context parameter. |
| </assert-output> |
| |
| </request> |
| |
| <!-- Specify a page which doesn't implement the IExternalPage interface. --> |
| |
| <request> |
| <parameter name="service" value="external/lib:Dumper"/> |
| |
| <assert-output name="Page Title"> |
| <![CDATA[ |
| <title>Exception</title> |
| ]]> |
| </assert-output> |
| |
| <assert-output name="Message"> |
| Page lib:Dumper does not implement the IExternalPage interface. |
| </assert-output> |
| |
| </request> |
| </mock-test> |