org.apache.myfaces.test.mock
Class MockPortletContext

java.lang.Object
  extended by org.apache.myfaces.test.mock.MockPortletContext
All Implemented Interfaces:
javax.portlet.PortletContext

public class MockPortletContext
extends Object
implements javax.portlet.PortletContext

Mock implementation of PortletContext.

$Id: MockPortletContext.java 990408 2010-08-28 18:59:21Z lu4242 $

Since:
1.0.0

Constructor Summary
MockPortletContext()
           
 
Method Summary
 void addInitParameter(String name, String value)
          Add a context initialization parameter to the set of parameters recognized by this instance.
 void addMimeType(String extension, String contentType)
          Add a new MIME type mapping to the set of mappings recognized by this instance.
 Object getAttribute(String name)
          
 Enumeration getAttributeNames()
          
 String getInitParameter(String name)
          
 Enumeration getInitParameterNames()
          
 int getMajorVersion()
          
 String getMimeType(String path)
          
 int getMinorVersion()
           
 javax.portlet.PortletRequestDispatcher getNamedDispatcher(String arg0)
           
 String getPortletContextName()
          
 String getRealPath(String path)
          
 javax.portlet.PortletRequestDispatcher getRequestDispatcher(String arg0)
          
 URL getResource(String path)
          
 InputStream getResourceAsStream(String path)
          
 Set getResourcePaths(String path)
          
 String getServerInfo()
          
 void log(String message)
          
 void log(String message, Throwable exception)
          
 void removeAttribute(String name)
          
 void setAttribute(String name, Object value)
          
 void setDocumentRoot(File documentRoot)
          Set the document root for getRealPath() resolution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockPortletContext

public MockPortletContext()
Method Detail

addInitParameter

public void addInitParameter(String name,
                             String value)

Add a context initialization parameter to the set of parameters recognized by this instance.

Parameters:
name - Parameter name
value - Parameter value

addMimeType

public void addMimeType(String extension,
                        String contentType)

Add a new MIME type mapping to the set of mappings recognized by this instance.

Parameters:
extension - Extension to check for (without the period)
contentType - Corresponding content type

setDocumentRoot

public void setDocumentRoot(File documentRoot)

Set the document root for getRealPath() resolution. This parameter MUST represent a directory.

Parameters:
documentRoot - The new base directory

getAttribute

public Object getAttribute(String name)

Specified by:
getAttribute in interface javax.portlet.PortletContext

getAttributeNames

public Enumeration getAttributeNames()

Specified by:
getAttributeNames in interface javax.portlet.PortletContext

getInitParameter

public String getInitParameter(String name)

Specified by:
getInitParameter in interface javax.portlet.PortletContext

getInitParameterNames

public Enumeration getInitParameterNames()

Specified by:
getInitParameterNames in interface javax.portlet.PortletContext

getMajorVersion

public int getMajorVersion()

Specified by:
getMajorVersion in interface javax.portlet.PortletContext

getMimeType

public String getMimeType(String path)

Specified by:
getMimeType in interface javax.portlet.PortletContext

getMinorVersion

public int getMinorVersion()
Specified by:
getMinorVersion in interface javax.portlet.PortletContext

getNamedDispatcher

public javax.portlet.PortletRequestDispatcher getNamedDispatcher(String arg0)
Specified by:
getNamedDispatcher in interface javax.portlet.PortletContext

getPortletContextName

public String getPortletContextName()

Specified by:
getPortletContextName in interface javax.portlet.PortletContext

getRealPath

public String getRealPath(String path)

Specified by:
getRealPath in interface javax.portlet.PortletContext

getRequestDispatcher

public javax.portlet.PortletRequestDispatcher getRequestDispatcher(String arg0)

Specified by:
getRequestDispatcher in interface javax.portlet.PortletContext

getResource

public URL getResource(String path)
                throws MalformedURLException

Specified by:
getResource in interface javax.portlet.PortletContext
Throws:
MalformedURLException

getResourceAsStream

public InputStream getResourceAsStream(String path)

Specified by:
getResourceAsStream in interface javax.portlet.PortletContext

getResourcePaths

public Set getResourcePaths(String path)

Specified by:
getResourcePaths in interface javax.portlet.PortletContext

getServerInfo

public String getServerInfo()

Specified by:
getServerInfo in interface javax.portlet.PortletContext

log

public void log(String message)

Specified by:
log in interface javax.portlet.PortletContext

log

public void log(String message,
                Throwable exception)

Specified by:
log in interface javax.portlet.PortletContext

removeAttribute

public void removeAttribute(String name)

Specified by:
removeAttribute in interface javax.portlet.PortletContext

setAttribute

public void setAttribute(String name,
                         Object value)

Specified by:
setAttribute in interface javax.portlet.PortletContext


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.