Package grails.core

Examples of grails.core.ArtefactHandler


    public void informOfClassChange(Class<?> aClass) {
        if (aClass == null || application == null) {
            return;
        }

        ArtefactHandler handler = application.getArtefactType(aClass);
        if (handler == null) {
            return;
        }

        String pluginName = handler.getPluginName();
        if (pluginName == null) {
            return;
        }

        GrailsPlugin plugin = getGrailsPlugin(pluginName);
View Full Code Here


    public void testIsTagLibClass() {
        GroovyClassLoader gcl = new GroovyClassLoader();

        Class<?> c = gcl.parseClass("class TestTagLib { }\n");

        ArtefactHandler handler = new TagLibArtefactHandler();
        assertTrue(handler.isArtefact(c));
    }
View Full Code Here

    public void testIsBootStrapClass() {
        GroovyClassLoader gcl = new GroovyClassLoader();

        Class<?> c = gcl.parseClass("class TestBootStrap { }\n");

        ArtefactHandler handler = new BootstrapArtefactHandler();
        assertTrue(handler.isArtefact(c));
    }
View Full Code Here

    public void testIsDomainClass() {

        GroovyClassLoader gcl = new GroovyClassLoader();
        Class<?> c = gcl.parseClass("class Test { Long id;Long version;}\n");

        ArtefactHandler handler = new DomainClassArtefactHandler();
        assertTrue(handler.isArtefact(c));
    }
View Full Code Here

*/
public class CodecArtefactHandlerTests extends TestCase {

    public void testIsCodecClass() {

        ArtefactHandler handler = new CodecArtefactHandler();
        GroovyClassLoader gcl = new GroovyClassLoader();

        Class<?> fullCodecClass = gcl.parseClass("class FullCodec {\n" +
                "static def encode = { str -> }\n" +
                "static def decode = { str -> }\n" +
                "}\n");
        assertTrue("class was an encoder/decoder", handler.isArtefact(fullCodecClass));

        Class<?> decodeOnlyCodecClass = gcl.parseClass("class DecodeOnlyCodec {\n" +
                "static def decode = { str -> }\n" +
                "}\n");
        assertTrue("class was a decoder", handler.isArtefact(decodeOnlyCodecClass));

        Class<?> encodeOnlyCodecClass = gcl.parseClass("class EncodeOnlyCodec {\n" +
                "static def encode = { str -> }\n" +
                "}\n");
        assertTrue("class was an encoder", handler.isArtefact(encodeOnlyCodecClass));

        Class<?> nonCodecClass = gcl.parseClass("class SomeFoo {\n" +
                "static def encode = { str -> }\n" +
                "}\n");
        assertFalse("class was not a codec", handler.isArtefact(nonCodecClass));
    }
View Full Code Here

    public void testDomainClassWithNameEndingInCodecIsNotACodec() {
        GroovyClassLoader gcl = new GroovyClassLoader();
        Class<?> c = gcl.parseClass("class MySpecialCodec { Long id;Long version;}\n");

        ArtefactHandler domainClassHandler = new DomainClassArtefactHandler();
        assertTrue(domainClassHandler.isArtefact(c));

        ArtefactHandler codecHandler = new CodecArtefactHandler();
        assertFalse(codecHandler.isArtefact(c));
    }
View Full Code Here

    public void testIsServiceClass() {
        GroovyClassLoader gcl = new GroovyClassLoader();

        Class<?> c = gcl.parseClass("class TestService { }\n");

        ArtefactHandler handler = new ServiceArtefactHandler();
        assertTrue(handler.isArtefact(c));
    }
View Full Code Here

    public void testIsControllerClass() {
        GroovyClassLoader gcl = new GroovyClassLoader();
        Class<?> c = gcl.parseClass("class TestController { }\n");

        ArtefactHandler handler = new ControllerArtefactHandler();
        assertTrue(handler.isArtefact(c));
    }
View Full Code Here

TOP

Related Classes of grails.core.ArtefactHandler

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.