use of org.grails.web.util.GrailsApplicationAttributes in project grails-core by grails.
the class GrailsApplicationAttributesTests method testGetViewUri.
/*
* 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 controllerUri = '/test'\n" + "def controllerName = '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));
}
use of org.grails.web.util.GrailsApplicationAttributes in project grails-core by grails.
the class GrailsApplicationAttributesTests method testGetTemplateUri.
/*
* 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()));
}
Aggregations