站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.6 API 英文版文档

AbstractTestPortlet - JBOSS Portal 2.6 API 英文版文档


org.jboss.portal.test.framework.portlet.components
Class AbstractTestPortlet

java.lang.Object
  extended byorg.jboss.portal.test.framework.portlet.components.AbstractTestPortlet
All Implemented Interfaces:
Portlet
Direct Known Subclasses:
ExceptionsDuringRequestHandlingControllerPortlet, PortletExceptionDuringRequestHandlingPortlet, RuntimeExceptionDuringRequestHandlingPortlet, UnavailableExceptionDuringProcessActionPortlet, UnavailableExceptionDuringRenderPortlet

public abstract class AbstractTestPortlet
extends java.lang.Object
implements Portlet

Version:
$Revision: 5493 $
Author:
Julien Viet, Boleslaw Dawidowicz

Field Summary
private  PortletConfig config
          To keep PortletConfig for some tests*
private  java.lang.String testCaseId
          The test id.
 
Constructor Summary
AbstractTestPortlet()
          Construct a test portlet with a test id computed with the method getTestId(Class).
AbstractTestPortlet(java.lang.String testCaseId)
          Construct a test portlet with the specified id.
 
Method Summary
protected  java.lang.String createCaseTestId(java.lang.Class clazz)
          Get the test id from the class name.
 void destroy()
          Called by the portlet container to indicate to a portlet that the portlet is being taken out of service.
protected  void doProcessAction(ActionRequest req, ActionResponse resp)
           
protected  void doRender(RenderRequest req, RenderResponse resp)
           
 PortletConfig getPortletConfig()
          Returns the PortletConfig object of this portlet.
 PortletContext getPortletContext()
          Returns the PortletContext of the portlet application the portlet is in.
 void init(PortletConfig config)
          Called by the portlet container to indicate to a portlet that the portlet is being placed into service.
static void marshall(Result result)
           
 void processAction(ActionRequest req, ActionResponse resp)
          Called by the portlet container to allow the portlet to process an action request.
 void render(RenderRequest req, RenderResponse resp)
          Called by the portlet container to allow the portlet to generate the content of the response based on its current state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

testCaseId

private final java.lang.String testCaseId
The test id.


config

private PortletConfig config
To keep PortletConfig for some tests*

Constructor Detail

AbstractTestPortlet

public AbstractTestPortlet()
Construct a test portlet with a test id computed with the method getTestId(Class).


AbstractTestPortlet

public AbstractTestPortlet(java.lang.String testCaseId)
Construct a test portlet with the specified id.

Parameters:
testCaseId -
Method Detail

init

public void init(PortletConfig config)
          throws PortletException
Description copied from interface: Portlet
Called by the portlet container to indicate to a portlet that the portlet is being placed into service.

The portlet container calls the init method exactly once after instantiating the portlet. The init method must complete successfully before the portlet can receive any requests.

The portlet container cannot place the portlet into service if the init method

  1. Throws a PortletException
  2. Does not return within a time period defined by the portlet container.

Specified by:
init in interface Portlet
Parameters:
config - a PortletConfig object containing the portlet's configuration and initialization parameters
Throws:
PortletException - if an exception has occurred that interferes with the portlet's normal operation.

getPortletConfig

public PortletConfig getPortletConfig()
Returns the PortletConfig object of this portlet.

Returns:
the PortletConfig object of this portlet

getPortletContext

public PortletContext getPortletContext()
Returns the PortletContext of the portlet application the portlet is in.

Returns:
the portlet application context

processAction

public final void processAction(ActionRequest req,
                                ActionResponse resp)
                         throws PortletException,
                                PortletSecurityException,
                                java.io.IOException
Description copied from interface: Portlet
Called by the portlet container to allow the portlet to process an action request. This method is called if the client request was originated by a URL created (by the portlet) with the RenderResponse.createActionURL() method.

Typically, in response to an action request, a portlet updates state based on the information sent in the action request parameters. In an action the portlet may:

  • issue a redirect
  • change its window state
  • change its portlet mode
  • modify its persistent state
  • set render parameters

A client request triggered by an action URL translates into one action request and many render requests, one per portlet in the portal page. The action processing must be finished before the render requests can be issued.

Specified by:
processAction in interface Portlet
Parameters:
req - the action request
resp - the action response
Throws:
PortletException - if the portlet has problems fulfilling the request
java.io.IOException - if the streaming causes an I/O problem
PortletSecurityException - if the portlet cannot fullfill this request because of security reasons

render

public final void render(RenderRequest req,
                         RenderResponse resp)
                  throws PortletException,
                         PortletSecurityException,
                         java.io.IOException
Description copied from interface: Portlet
Called by the portlet container to allow the portlet to generate the content of the response based on its current state.

Specified by:
render in interface Portlet
Parameters:
req - the render request
resp - the render response
Throws:
PortletSecurityException - if the portlet cannot fullfill this request because of security reasons
PortletException - if the portlet has problems fulfilling the rendering request
java.io.IOException - if the streaming causes an I/O problem

destroy

public void destroy()
Description copied from interface: Portlet
Called by the portlet container to indicate to a portlet that the portlet is being taken out of service.

Before the portlet container calls the destroy method, it should allow any threads that are currently processing requests within the portlet object to complete execution. To avoid waiting forever, the portlet container can optionally wait for a predefined time before destroying the portlet object.

This method enables the portlet to do the following:

  • clean up any resources that it holds (for example, memory, file handles, threads)
  • make sure that any persistent state is synchronized with the portlet current state in memory.

Specified by:
destroy in interface Portlet

doProcessAction

protected void doProcessAction(ActionRequest req,
                               ActionResponse resp)
                        throws PortletException,
                               PortletSecurityException,
                               java.io.IOException
Throws:
PortletException
PortletSecurityException
java.io.IOException

doRender

protected void doRender(RenderRequest req,
                        RenderResponse resp)
                 throws PortletException,
                        PortletSecurityException,
                        java.io.IOException
Throws:
PortletException
PortletSecurityException
java.io.IOException

createCaseTestId

protected java.lang.String createCaseTestId(java.lang.Class clazz)
Get the test id from the class name. It can be overriden.


marshall

public static void marshall(Result result)