    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17  package org.apache.commons.fileupload;
    18
    19  import java.security.Principal;
    20  import java.util.Enumeration;
    21  import java.util.Locale;
    22  import java.util.Map;
    23
    24  import javax.portlet.PortalContext;
    25  import javax.portlet.PortletMode;
    26  import javax.portlet.PortletPreferences;
    27  import javax.portlet.PortletRequest;
    28  import javax.portlet.PortletSession;
    29  import javax.portlet.WindowState;
    30
    31  /**
    32   * A mock portlet request, useful for unit testing and offline utilities
    33   *
    34   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
    35   * @version $Id: MockPortletRequest.java 479262 2006-11-26 03:09:24Z niallp $
    36   */
    37  public class MockPortletRequest implements PortletRequest
    38  {
    39      MockPortletSession session = null;
    40
    41      public MockPortletRequest()
    42      {
    43          session = new MockPortletSession();
    44      }
    45
    46      /* (non-Javadoc)
    47       * @see javax.portlet.PortletRequest#isWindowStateAllowed(javax.portlet.WindowState)
    48       */
    49      public boolean isWindowStateAllowed(WindowState state)
    50      {
    51          // TODO Auto-generated method stub
    52          return false;
    53      }
    54      /* (non-Javadoc)
    55       * @see javax.portlet.PortletRequest#isPortletModeAllowed(javax.portlet.PortletMode)
    56       */
    57      public boolean isPortletModeAllowed(PortletMode mode)
    58      {
    59          // TODO Auto-generated method stub
    60          return false;
    61      }
    62      /* (non-Javadoc)
    63       * @see javax.portlet.PortletRequest#getPortletMode()
    64       */
    65      public PortletMode getPortletMode()
    66      {
    67          // TODO Auto-generated method stub
    68          return null;
    69      }
    70      /* (non-Javadoc)
    71       * @see javax.portlet.PortletRequest#getWindowState()
    72       */
    73      public WindowState getWindowState()
    74      {
    75          // TODO Auto-generated method stub
    76          return null;
    77      }
    78      /* (non-Javadoc)
    79       * @see javax.portlet.PortletRequest#getPreferences()
    80       */
    81      public PortletPreferences getPreferences()
    82      {
    83          // TODO Auto-generated method stub
    84          return null;
    85      }
    86      /* (non-Javadoc)
    87       * @see javax.portlet.PortletRequest#getPortletSession()
    88       */
    89      public PortletSession getPortletSession()
    90      {
    91          return session;
    92      }
    93      /* (non-Javadoc)
    94       * @see javax.portlet.PortletRequest#getPortletSession(boolean)
    95       */
    96      public PortletSession getPortletSession(boolean create)
    97      {
    98          if (session == null)
    99          {
    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 }