Package org.grails.web.servlet

Examples of org.grails.web.servlet.DefaultGrailsApplicationAttributes


    /*
     * Test method for 'org.grails.web.servlet.DefaultGrailsApplicationAttributes.getTemplateUri(String, ServletRequest)'
     */
    public void testGetTemplateUri() {
         GrailsApplicationAttributes attrs = new DefaultGrailsApplicationAttributes(new MockServletContext());

         assertEquals("/_test.gsp",attrs.getTemplateUri("/test", new MockHttpServletRequest()));
         assertEquals("/shared/_test.gsp",attrs.getTemplateUri("/shared/test", new MockHttpServletRequest()));
    }
View Full Code Here


    /*
     * Test method for 'org.grails.web.servlet.DefaultGrailsApplicationAttributes.getViewUri(String, ServletRequest)'
     */
    public void testGetViewUri() throws Exception {
        GrailsApplicationAttributes attrs = new DefaultGrailsApplicationAttributes(new MockServletContext());
        GroovyClassLoader gcl = new GroovyClassLoader();
        Class<?> controllerClass = gcl.parseClass("class TestController {\n" +
                "def "+ControllerDynamicMethods.CONTROLLER_URI_PROPERTY+" = '/test'\n" +
                "def "+ControllerDynamicMethods.CONTROLLER_NAME_PROPERTY+" = 'test'\n" +
                "}");

        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controllerClass.newInstance());

        assertEquals("/WEB-INF/grails-app/views/test/aView.gsp",attrs.getViewUri("aView", request));
        assertEquals("/WEB-INF/grails-app/views/shared.gsp",attrs.getViewUri("/shared", request));
    }
View Full Code Here

        GrailsClass[] taglibs = app.getArtefacts(TagLibArtefactHandler.TYPE);
        for (int i = 0; i < taglibs.length; i++) {
            context.registerMockBean(taglibs[i].getFullName(), taglibs[i].newInstance());
        }
        return new DefaultGrailsApplicationAttributes(servletContext);
    }
View Full Code Here

TOP

Related Classes of org.grails.web.servlet.DefaultGrailsApplicationAttributes

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.