/**
 * 
 */
package org.ajax4jsf.portlet;

import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;

/**
 * @author asmirnov
 *
 */
public class AbstractAjax4jsfPortletTestCase extends AbstractAjax4JsfTestCase {

    protected MockActionRequest actionRequest;
    protected MockActionResponse actionResponse;
    protected MockPortletContext portletContext;
    protected MockRenderRequest renderRequest;
    protected MockRenderResponse renderResponse;
    protected MockPortletConfig portletConfig;

    public AbstractAjax4jsfPortletTestCase(String name) {
	super(name);
    }
    
    public void setUp() throws Exception {
        super.setUp();
    	portletContext = new MockPortletContext(servletContext);
    	portletConfig = new MockPortletConfig(portletContext);
    }
    
    public void tearDown() throws Exception {
        super.tearDown();
        actionRequest = null;
        actionResponse = null;
        renderRequest = null;
        renderResponse = null;
        portletContext = null;
        portletConfig = null;
    }

    /**
     * 
     */
    protected void setupActionRequest() {
        actionRequest = new MockActionRequest(portletContext);
	actionResponse = new MockActionResponse();
	externalContext.setRequest(actionRequest);
        externalContext.setResponse(actionResponse);
    }

    /**
     * 
     */
    protected void setupRenderRequest() {
        renderRequest = new MockRenderRequest(portletContext);
	renderResponse = new MockRenderResponse();
	externalContext.setRequest(renderRequest);
        externalContext.setResponse(renderResponse);
    }

}
