All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mockrunner.mock.web.MockJspFactory Maven / Gradle / Ivy

Go to download

Mockrunner is a lightweight framework for unit testing applications in the J2EE environment. It supports servlets, filters, tag classes and Struts actions. It includes a JDBC a JMS and a JCA test framework and can be used to test EJB based applications.

The newest version!
package com.mockrunner.mock.web;

import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
//import javax.servlet.jsp.JspApplicationContext;
import javax.servlet.jsp.JspEngineInfo;
import javax.servlet.jsp.JspFactory;
import javax.servlet.jsp.PageContext;

/**
 * Mock implementation of JspFactory.
 * This implementation returns null
 * for {@link #getJspApplicationContext}. For full
 * support of JspApplicationContext use
 * {@link JasperJspFactory}.
 */
public class MockJspFactory extends JspFactory
{
    private JspEngineInfo engineInfo;
    //private JspApplicationContext applicationContext;
    private PageContext pageContext;

    public MockJspFactory()
    {
        engineInfo = new MockJspEngineInfo();
    }
    
    /**
     * Set the JspEngineInfo. Per default, 
     * {@link MockJspEngineInfo} is used.
     * @param engineInfo the JspEngineInfo
     */
    public void setEngineInfo(JspEngineInfo engineInfo)
    {
        this.engineInfo = engineInfo;
    }

    /**
     * Set the JspApplicationContext.
     * @param applicationContext the JspApplicationContext
     */
    /*public void setJspApplicationContext(JspApplicationContext applicationContext)
    {
        this.applicationContext = applicationContext;
    }*/

    /**
     * Set the PageContext.
     * @param pageContext the PageContext
     */
    public void setPageContext(PageContext pageContext)
    {
        this.pageContext = pageContext;
    }

    /**
     * Returns the PageContext.
     * @return the PageContext
     */
    public PageContext getPageContext()
    {
        return pageContext;
    }

    public JspEngineInfo getEngineInfo()
    {
        return engineInfo;
    }

    /*public JspApplicationContext getJspApplicationContext(ServletContext context)
    {
        return applicationContext;
    }*/

    public PageContext getPageContext(Servlet servlet, ServletRequest request, ServletResponse response, String errorPageURL, boolean needsSession, int buffer, boolean autoflush)
    {
        return pageContext;
    }

    public void releasePageContext(PageContext pageContext)
    {

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy