Search in sources :

Example 1 with GroovyPagesUriSupport

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"));
}
Also used : GroovyClassLoader(groovy.lang.GroovyClassLoader) GroovyPagesUriSupport(org.grails.web.pages.GroovyPagesUriSupport) GroovyObject(groovy.lang.GroovyObject)

Example 2 with GroovyPagesUriSupport

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"));
}
Also used : GroovyClassLoader(groovy.lang.GroovyClassLoader) GroovyPagesUriSupport(org.grails.web.pages.GroovyPagesUriSupport) GroovyObject(groovy.lang.GroovyObject)

Example 3 with GroovyPagesUriSupport

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"));
}
Also used : GroovyPagesUriSupport(org.grails.web.pages.GroovyPagesUriSupport)

Example 4 with GroovyPagesUriSupport

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()));
}
Also used : GroovyPagesUriSupport(org.grails.web.pages.GroovyPagesUriSupport)

Example 5 with GroovyPagesUriSupport

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"));
}
Also used : GroovyClassLoader(groovy.lang.GroovyClassLoader) GroovyPagesUriSupport(org.grails.web.pages.GroovyPagesUriSupport) GroovyObject(groovy.lang.GroovyObject)

Aggregations

GroovyPagesUriSupport (org.grails.web.pages.GroovyPagesUriSupport)7 GroovyClassLoader (groovy.lang.GroovyClassLoader)3 GroovyObject (groovy.lang.GroovyObject)3