Package net.sf.jsptest.compiler.jsp20.mock

Examples of net.sf.jsptest.compiler.jsp20.mock.MockOptions


    ServletConfig servletConfig = new MockServletConfig(servletContext);
    MockHttpSession session = configureHttpSession(sessionAttributes);
    MockHttpServletRequest request = configureHttpServletRequest(
        httpMethod, requestAttributes, requestParameters, session);
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockJspWriter jspWriter = configureJspFactory(servletContext, request,
        session);
    initializeAndInvokeJsp(servletClass, servletConfig, request, response);
    return createExecutionResult(jspWriter.getContents());
  }
View Full Code Here


    return request;
  }

  protected MockJspWriter configureJspFactory(ServletContext httpContext,
      HttpServletRequest httpRequest, HttpSession httpSession) {
    MockJspWriter jspWriter = new MockJspWriter();
    pageContext = configurePageContext(httpContext, httpRequest,
        httpSession, jspWriter);
    JspFactory.setDefaultFactory(new MockJspFactory(pageContext));
    return jspWriter;
  }
View Full Code Here

        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setSession(httpSession);
        request.setMethod(httpMethod);
        request.setAttributes(requestAttributes);
        MockHttpServletResponse response = new MockHttpServletResponse(getRenderedResponse());
        MockJspWriter jspWriter = configureJspFactory(servletContext, request, httpSession);
        initializeAndInvokeJsp(jspClass, servletConfig, request, response);
        writeOutputToTempFile(jspWriter.getContents());
    }
View Full Code Here

            HttpServletRequest httpRequest, HttpSession httpSession) {
        pageContext = new MockPageContext();
        pageContext.setRequest(httpRequest);
        pageContext.setServletContext(httpContext);
        pageContext.setSession(httpSession);
        MockJspWriter jspWriter = new MockJspWriter();
        pageContext.setJspWriter(jspWriter);
        JspFactory.setDefaultFactory(new MockJspFactory(pageContext));
        return jspWriter;
    }
View Full Code Here

        return wrapper;
    }

    private Options createOptions(ServletContext ctx, ServletConfig cfg, JspCompilationInfo info) {
        Options options = new EmbeddedServletOptions(cfg, ctx);
        return new MockOptions(options, ctx, info);
    }
View Full Code Here

  }

  private MockPageContext configurePageContext(ServletContext httpContext,
      HttpServletRequest httpRequest, HttpSession httpSession,
      MockJspWriter jspWriter) {
    MockPageContext pageContext = new MockPageContext();
    pageContext.setRequest(httpRequest);
    pageContext.setServletContext(httpContext);
    pageContext.setSession(httpSession);
    pageContext.setJspWriter(jspWriter);
    return pageContext;
  }
View Full Code Here

        writeOutputToTempFile(jspWriter.getContents());
    }

    protected MockJspWriter configureJspFactory(ServletContext httpContext,
            HttpServletRequest httpRequest, HttpSession httpSession) {
        pageContext = new MockPageContext();
        pageContext.setRequest(httpRequest);
        pageContext.setServletContext(httpContext);
        pageContext.setSession(httpSession);
        MockJspWriter jspWriter = new MockJspWriter();
        pageContext.setJspWriter(jspWriter);
View Full Code Here

        assertTrue("Source file " + new File(info.getJspSource()).getAbsolutePath()
                + " does not exist", new File(info.getJspSource()).exists());
        PrintWriter logWriter = new PrintWriter(new StringWriter());
        URL baseUrl = new File(info.getWebRoot()).toURL();
        ServletContext sContext = new JspCServletContext(logWriter, baseUrl);
        ServletConfig sConfig = new MockServletConfig(sContext);
        Options options = createOptions(sContext, sConfig, info);
        JspRuntimeContext rtContext = new JspRuntimeContext(sContext, options);
        JspServletWrapper sWrapper = makeWrapper(sContext, options, rtContext);
        JspCompilationContext cContext = createJspCompilationContext(info, sContext, options,
                rtContext, sWrapper, new StringWriter());
View Full Code Here

  }

  public JspExecution request(String httpMethod, Map requestAttributes,
      Map sessionAttributes, Map requestParameters) {
    ServletContext servletContext = new MockServletContext();
    ServletConfig servletConfig = new MockServletConfig(servletContext);
    MockHttpSession session = configureHttpSession(sessionAttributes);
    MockHttpServletRequest request = configureHttpServletRequest(
        httpMethod, requestAttributes, requestParameters, session);
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockJspWriter jspWriter = configureJspFactory(servletContext, request,
View Full Code Here

    }

    protected void invokeServlet(String httpMethod, Class jspClass) throws InstantiationException,
            IllegalAccessException, ServletException, IOException {
        ServletContext servletContext = new MockServletContext();
        ServletConfig servletConfig = new MockServletConfig(servletContext);
        MockHttpSession httpSession = new MockHttpSession();
        httpSession.setAttributes(sessionAttributes);
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setSession(httpSession);
        request.setMethod(httpMethod);
View Full Code Here

TOP

Related Classes of net.sf.jsptest.compiler.jsp20.mock.MockOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.