use of org.grails.web.pages.GroovyPagesUriSupport in project grails-core by grails.
the class GroovyPagesUriSupportTests method testGetTemplateURIForController.
public void testGetTemplateURIForController() throws IllegalAccessException, InstantiationException {
GroovyObject controller = (GroovyObject) new GroovyClassLoader().parseClass("class FooController { }").newInstance();
GroovyPagesUriSupport uriSupport = new GroovyPagesUriSupport();
assertEquals("/foo/_bar.gsp", uriSupport.getTemplateURI(controller, "bar"));
assertEquals("/bar/_foo.gsp", uriSupport.getTemplateURI(controller, "/bar/foo"));
assertEquals("/foo/bar/_foo.gsp", uriSupport.getTemplateURI(controller, "bar/foo"));
}
use of org.grails.web.pages.GroovyPagesUriSupport in project grails-core by grails.
the class GroovyPagesUriSupportTests method testGetViewURIForController.
public void testGetViewURIForController() throws IllegalAccessException, InstantiationException {
GroovyObject controller = (GroovyObject) new GroovyClassLoader().parseClass("class FooController { }").newInstance();
GroovyPagesUriSupport uriSupport = new GroovyPagesUriSupport();
assertEquals("/foo/bar.gsp", uriSupport.getViewURI(controller, "bar"));
assertEquals("/bar.gsp", uriSupport.getViewURI(controller, "../bar"));
assertEquals("/bar/foo.gsp", uriSupport.getViewURI(controller, "/bar/foo"));
assertEquals("/foo/bar/foo.gsp", uriSupport.getViewURI(controller, "bar/foo"));
}
use of org.grails.web.pages.GroovyPagesUriSupport in project grails-core by grails.
the class GroovyPagesUriSupportTests method testGetTemplateURI.
public void testGetTemplateURI() {
GroovyPagesUriSupport uriSupport = new GroovyPagesUriSupport();
assertEquals("/foo/_bar.gsp", uriSupport.getTemplateURI("foo", "bar"));
assertEquals("/_bar.gsp", uriSupport.getTemplateURI("foo", "../bar"));
assertEquals("/bar/_foo.gsp", uriSupport.getTemplateURI("foo", "/bar/foo"));
assertEquals("/foo/bar/_foo.gsp", uriSupport.getTemplateURI("foo", "bar/foo"));
}
use of org.grails.web.pages.GroovyPagesUriSupport in project grails-core by grails.
the class GroovyPagesUriSupportTests method testGetLogicalControllerNameWithNonController.
public void testGetLogicalControllerNameWithNonController() {
GroovyPagesUriSupport uriSupport = new DefaultGroovyPagesUriService();
assertNull(uriSupport.getLogicalControllerName(new FooInterceptor()));
}
use of org.grails.web.pages.GroovyPagesUriSupport in project grails-core by grails.
the class GroovyPagesUriSupportTests method testNoSuffixGetViewURIForController.
public void testNoSuffixGetViewURIForController() throws IllegalAccessException, InstantiationException {
GroovyObject controller = (GroovyObject) new GroovyClassLoader().parseClass("class FooController { }").newInstance();
GroovyPagesUriSupport uriSupport = new GroovyPagesUriSupport();
assertEquals("/foo/bar", uriSupport.getNoSuffixViewURI(controller, "bar"));
assertEquals("/bar/foo", uriSupport.getNoSuffixViewURI(controller, "/bar/foo"));
assertEquals("/foo/bar/foo", uriSupport.getNoSuffixViewURI(controller, "bar/foo"));
}
Aggregations