Package javax.servlet

Examples of javax.servlet.GenericServlet


    @Test(expected = NoSuchContainerException.class)
    public void testSetCurrentContainerEnvironmentStringException() throws TemplateModelException {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
        HttpRequestHashModel requestModel = new HttpRequestHashModel(request, objectWrapper);
        GenericServlet servlet = createMock(GenericServlet.class);
        ServletContext servletContext = createMock(ServletContext.class);
        expect(servlet.getServletContext()).andReturn(servletContext).times(2);
        replay(servlet, objectWrapper);
        ServletContextHashModel servletContextModel = new ServletContextHashModel(servlet, objectWrapper);

        expect(model.get("Request")).andReturn(requestModel);
        expect(model.get("Application")).andReturn(servletContextModel);
View Full Code Here


    @Test
    public void testSetCurrentContainerEnvironmentTilesContainer() throws TemplateModelException {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
        HttpRequestHashModel requestModel = new HttpRequestHashModel(request, objectWrapper);
        GenericServlet servlet = createMock(GenericServlet.class);
        ServletContext servletContext = createMock(ServletContext.class);
        TilesContainer container = createMock(TilesContainer.class);
        expect(servlet.getServletContext()).andReturn(servletContext).times(2);
        replay(servlet, objectWrapper);
        ServletContextHashModel servletContextModel = new ServletContextHashModel(servlet, objectWrapper);

        expect(model.get("Request")).andReturn(requestModel);
        request.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
View Full Code Here

    @Test
    public void testGetCurrentContainer() throws TemplateModelException {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
        HttpRequestHashModel requestModel = new HttpRequestHashModel(request, objectWrapper);
        GenericServlet servlet = createMock(GenericServlet.class);
        ServletContext servletContext = createMock(ServletContext.class);
        TilesContainer container = createMock(TilesContainer.class);
        expect(servlet.getServletContext()).andReturn(servletContext).times(2);
        replay(servlet, objectWrapper);
        ServletContextHashModel servletContextModel = new ServletContextHashModel(servlet, objectWrapper);

        expect(model.get("Request")).andReturn(requestModel);
        expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(container);
View Full Code Here

     * #getServletContextHashModel(freemarker.core.Environment)}.
     * @throws TemplateModelException If something goes wrong.
     */
    @Test
    public void testGetServletContextHashModel() throws TemplateModelException {
        GenericServlet servlet = createMock(GenericServlet.class);
        ServletContext servletContext = createMock(ServletContext.class);
        ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
        expect(servlet.getServletContext()).andReturn(servletContext);
        replay(servlet, objectWrapper);
        ServletContextHashModel servletContextModel = new ServletContextHashModel(servlet, objectWrapper);

        expect(model.get("Application")).andReturn(servletContextModel);

View Full Code Here

     * @throws TemplateModelException If something goes wrong.
     */
    @Test
    public void testSetAttributePage() throws TemplateModelException {
        ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
        GenericServlet servlet = createMock(GenericServlet.class);
        TemplateModel wrappedObj = createMock(TemplateModel.class);
        Integer myObj = new Integer(DUMMY_VALUE);
        expect(objectWrapper.wrap(myObj)).andReturn(wrappedObj);
        replay(servlet, objectWrapper);

View Full Code Here

    @Test
    public void testSetAttributeRequest() throws TemplateModelException {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
        HttpRequestHashModel requestModel = new HttpRequestHashModel(request, objectWrapper);
        GenericServlet servlet = createMock(GenericServlet.class);
        TemplateModel wrappedObj = createMock(TemplateModel.class);
        Integer myObj = new Integer(DUMMY_VALUE);
        replay(servlet, objectWrapper);

        expect(model.get("Request")).andReturn(requestModel);
View Full Code Here

    public void testSetAttributeSession() throws TemplateModelException {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        HttpSession session = createMock(HttpSession.class);
        ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
        HttpRequestHashModel requestModel = new HttpRequestHashModel(request, objectWrapper);
        GenericServlet servlet = createMock(GenericServlet.class);
        TemplateModel wrappedObj = createMock(TemplateModel.class);
        Integer myObj = new Integer(DUMMY_VALUE);
        replay(servlet, objectWrapper);

        expect(model.get("Request")).andReturn(requestModel);
View Full Code Here

     */
    @Test
    public void testSetAttributeApplication() throws TemplateModelException {
        ServletContext servletContext = createMock(ServletContext.class);
        ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
        GenericServlet servlet = createMock(GenericServlet.class);
        expect(servlet.getServletContext()).andReturn(servletContext).times(2);
        TemplateModel wrappedObj = createMock(TemplateModel.class);
        Integer myObj = new Integer(DUMMY_VALUE);
        servletContext.setAttribute("myObj", myObj);
        replay(servlet, objectWrapper, servletContext);
        ServletContextHashModel servletContextModel = new ServletContextHashModel(servlet, objectWrapper);
View Full Code Here

    @Test
    public void testGetComposeStack() throws TemplateModelException {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
        HttpRequestHashModel requestModel = new HttpRequestHashModel(request, objectWrapper);
        GenericServlet servlet = createMock(GenericServlet.class);
        TemplateModel wrappedObj = createMock(TemplateModel.class);
        replay(servlet, objectWrapper);

        expect(model.get("Request")).andReturn(requestModel).times(2);
        expect(request.getAttribute(COMPOSE_STACK_ATTRIBUTE_NAME)).andReturn(null);
View Full Code Here

        Map<String, TemplateModel> params = createMock(Map.class);
        Template template = createMock(Template.class);
        TemplateHashModel rootDataModel = createMock(TemplateHashModel.class);
        Writer out = createMock(Writer.class);
        TemplateDirectiveBody body = createMock(TemplateDirectiveBody.class);
        GenericServlet servlet = createMock(GenericServlet.class);
        ObjectWrapper wrapper = createMock(ObjectWrapper.class);
        ServletContext servletContext = createMock(ServletContext.class);
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        HttpServletRequest httpServletRequest = createMock(HttpServletRequest.class);
        HttpServletResponse httpServletResponse = createMock(HttpServletResponse.class);

        expect(template.getMacros()).andReturn(new HashMap<String, Macro>());
        expect(servlet.getServletContext()).andReturn(servletContext)
                .anyTimes();
        expect(
                servletContext
                        .getAttribute(ApplicationAccess.APPLICATION_CONTEXT_ATTRIBUTE))
                .andReturn(applicationContext);
View Full Code Here

TOP

Related Classes of javax.servlet.GenericServlet

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.