001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.commons.fileupload;
018    
019    import java.security.Principal;
020    import java.util.Enumeration;
021    import java.util.Locale;
022    import java.util.Map;
023    
024    import javax.portlet.PortalContext;
025    import javax.portlet.PortletMode;
026    import javax.portlet.PortletPreferences;
027    import javax.portlet.PortletRequest;
028    import javax.portlet.PortletSession;
029    import javax.portlet.WindowState;
030    
031    /**
032     * A mock portlet request, useful for unit testing and offline utilities
033     * 
034     * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
035     * @version $Id: MockPortletRequest.java 479262 2006-11-26 03:09:24Z niallp $
036     */
037    public class MockPortletRequest implements PortletRequest
038    {
039        MockPortletSession session = null;
040        
041        public MockPortletRequest()
042        {
043            session = new MockPortletSession();     
044        }
045        
046        /* (non-Javadoc)
047         * @see javax.portlet.PortletRequest#isWindowStateAllowed(javax.portlet.WindowState)
048         */
049        public boolean isWindowStateAllowed(WindowState state)
050        {
051            // TODO Auto-generated method stub
052            return false;
053        }
054        /* (non-Javadoc)
055         * @see javax.portlet.PortletRequest#isPortletModeAllowed(javax.portlet.PortletMode)
056         */
057        public boolean isPortletModeAllowed(PortletMode mode)
058        {
059            // TODO Auto-generated method stub
060            return false;
061        }
062        /* (non-Javadoc)
063         * @see javax.portlet.PortletRequest#getPortletMode()
064         */
065        public PortletMode getPortletMode()
066        {
067            // TODO Auto-generated method stub
068            return null;
069        }
070        /* (non-Javadoc)
071         * @see javax.portlet.PortletRequest#getWindowState()
072         */
073        public WindowState getWindowState()
074        {
075            // TODO Auto-generated method stub
076            return null;
077        }
078        /* (non-Javadoc)
079         * @see javax.portlet.PortletRequest#getPreferences()
080         */
081        public PortletPreferences getPreferences()
082        {
083            // TODO Auto-generated method stub
084            return null;
085        }
086        /* (non-Javadoc)
087         * @see javax.portlet.PortletRequest#getPortletSession()
088         */
089        public PortletSession getPortletSession()
090        {
091            return session;
092        }
093        /* (non-Javadoc)
094         * @see javax.portlet.PortletRequest#getPortletSession(boolean)
095         */
096        public PortletSession getPortletSession(boolean create)
097        {
098            if (session == null)
099            {
100                session = new MockPortletSession();
101            }
102            return session;
103        }
104        /* (non-Javadoc)
105         * @see javax.portlet.PortletRequest#getProperty(java.lang.String)
106         */
107        public String getProperty(String name)
108        {
109            // TODO Auto-generated method stub
110            return null;
111        }
112        /* (non-Javadoc)
113         * @see javax.portlet.PortletRequest#getProperties(java.lang.String)
114         */
115        public Enumeration getProperties(String name)
116        {
117            // TODO Auto-generated method stub
118            return null;
119        }
120        /* (non-Javadoc)
121         * @see javax.portlet.PortletRequest#getPropertyNames()
122         */
123        public Enumeration getPropertyNames()
124        {
125            // TODO Auto-generated method stub
126            return null;
127        }
128        /* (non-Javadoc)
129         * @see javax.portlet.PortletRequest#getPortalContext()
130         */
131        public PortalContext getPortalContext()
132        {
133            // TODO Auto-generated method stub
134            return null;
135        }
136        /* (non-Javadoc)
137         * @see javax.portlet.PortletRequest#getAuthType()
138         */
139        public String getAuthType()
140        {
141            // TODO Auto-generated method stub
142            return null;
143        }
144        /* (non-Javadoc)
145         * @see javax.portlet.PortletRequest#getContextPath()
146         */
147        public String getContextPath()
148        {
149            // TODO Auto-generated method stub
150            return null;
151        }
152        /* (non-Javadoc)
153         * @see javax.portlet.PortletRequest#getRemoteUser()
154         */
155        public String getRemoteUser()
156        {
157            // TODO Auto-generated method stub
158            return null;
159        }
160        /* (non-Javadoc)
161         * @see javax.portlet.PortletRequest#getUserPrincipal()
162         */
163        public Principal getUserPrincipal()
164        {
165            // TODO Auto-generated method stub
166            return null;
167        }
168        /* (non-Javadoc)
169         * @see javax.portlet.PortletRequest#isUserInRole(java.lang.String)
170         */
171        public boolean isUserInRole(String role)
172        {
173            // TODO Auto-generated method stub
174            return false;
175        }
176        /* (non-Javadoc)
177         * @see javax.portlet.PortletRequest#getAttribute(java.lang.String)
178         */
179        public Object getAttribute(String name)
180        {
181            // TODO Auto-generated method stub
182            return null;
183        }
184        /* (non-Javadoc)
185         * @see javax.portlet.PortletRequest#getAttributeNames()
186         */
187        public Enumeration getAttributeNames()
188        {
189            // TODO Auto-generated method stub
190            return null;
191        }
192        /* (non-Javadoc)
193         * @see javax.portlet.PortletRequest#getParameter(java.lang.String)
194         */
195        public String getParameter(String name)
196        {
197            // TODO Auto-generated method stub
198            return null;
199        }
200        /* (non-Javadoc)
201         * @see javax.portlet.PortletRequest#getParameterNames()
202         */
203        public Enumeration getParameterNames()
204        {
205            // TODO Auto-generated method stub
206            return null;
207        }
208        /* (non-Javadoc)
209         * @see javax.portlet.PortletRequest#getParameterValues(java.lang.String)
210         */
211        public String[] getParameterValues(String name)
212        {
213            // TODO Auto-generated method stub
214            return null;
215        }
216        /* (non-Javadoc)
217         * @see javax.portlet.PortletRequest#getParameterMap()
218         */
219        public Map getParameterMap()
220        {
221            // TODO Auto-generated method stub
222            return null;
223        }
224        /* (non-Javadoc)
225         * @see javax.portlet.PortletRequest#isSecure()
226         */
227        public boolean isSecure()
228        {
229            // TODO Auto-generated method stub
230            return false;
231        }
232        /* (non-Javadoc)
233         * @see javax.portlet.PortletRequest#setAttribute(java.lang.String, java.lang.Object)
234         */
235        public void setAttribute(String name, Object o)
236        {
237            // TODO Auto-generated method stub
238        }
239        /* (non-Javadoc)
240         * @see javax.portlet.PortletRequest#removeAttribute(java.lang.String)
241         */
242        public void removeAttribute(String name)
243        {
244            // TODO Auto-generated method stub
245        }
246        /* (non-Javadoc)
247         * @see javax.portlet.PortletRequest#getRequestedSessionId()
248         */
249        public String getRequestedSessionId()
250        {
251            // TODO Auto-generated method stub
252            return null;
253        }
254        /* (non-Javadoc)
255         * @see javax.portlet.PortletRequest#isRequestedSessionIdValid()
256         */
257        public boolean isRequestedSessionIdValid()
258        {
259            // TODO Auto-generated method stub
260            return false;
261        }
262        /* (non-Javadoc)
263         * @see javax.portlet.PortletRequest#getResponseContentType()
264         */
265        public String getResponseContentType()
266        {
267            // TODO Auto-generated method stub
268            return null;
269        }
270        /* (non-Javadoc)
271         * @see javax.portlet.PortletRequest#getResponseContentTypes()
272         */
273        public Enumeration getResponseContentTypes()
274        {
275            // TODO Auto-generated method stub
276            return null;
277        }
278        /* (non-Javadoc)
279         * @see javax.portlet.PortletRequest#getLocale()
280         */
281        public Locale getLocale()
282        {
283            // TODO Auto-generated method stub
284            return null;
285        }
286        /* (non-Javadoc)
287         * @see javax.portlet.PortletRequest#getScheme()
288         */
289        public String getScheme()
290        {
291            // TODO Auto-generated method stub
292            return null;
293        }
294        /* (non-Javadoc)
295         * @see javax.portlet.PortletRequest#getServerName()
296         */
297        public String getServerName()
298        {
299            // TODO Auto-generated method stub
300            return null;
301        }
302        /* (non-Javadoc)
303         * @see javax.portlet.PortletRequest#getServerPort()
304         */
305        public int getServerPort()
306        {
307            // TODO Auto-generated method stub
308            return 0;
309        }
310        
311        public Enumeration getLocales()
312        {
313            return null;
314        }
315        
316    }