001// Copyright 2007, 2009, 2011 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry5.internal.test; 016 017import org.apache.tapestry5.services.Request; 018import org.apache.tapestry5.test.PageTester; 019 020import java.util.Locale; 021 022/** 023 * An extended version of {@link Request} that allows the {@link PageTester} to control and override behavior, 024 * effectively simulating the portions of {@link Request} that are provided normally by a servlet container. 025 */ 026public interface TestableRequest extends Request 027{ 028 /** 029 * Clears the internal parameters map. 030 * 031 * @return the request for further configuration 032 */ 033 TestableRequest clear(); 034 035 /** 036 * Sets the path; the path should begin with a "/" character and contain everything from there to the start of query 037 * parameters (if any). 038 * 039 * @param path 040 * @return the request for further configuration 041 */ 042 TestableRequest setPath(String path); 043 044 /** 045 * Sets the locale requested by "the browser". 046 * 047 * @return the request for further configuration 048 */ 049 TestableRequest setLocale(Locale locale); 050 051 /** 052 * Loads a single parameter/value pair. This may define a new parameter, or add a value to a list of parameters. 053 * 054 * @return the request for further configuration 055 */ 056 TestableRequest loadParameter(String parameterName, String parameterValue); 057 058 /** 059 * Overrides a parameter to the specific value, regardless of how the parameter was previously set. 060 */ 061 TestableRequest overrideParameter(String parameterName, String parameterValue); 062}