Package org.gradle.api.plugins

Examples of org.gradle.api.plugins.Convention


    }

    @Test
    public void canInvokeMethodDefinedByConvention() {
        Bean bean = new Bean();
        Convention convention = bean.extensibleDynamicObject.getConvention();

        assertFalse(bean.hasMethod("conventionMethod", "a", "b"));

        convention.getPlugins().put("bean", new ConventionBean());
        assertTrue(bean.hasMethod("conventionMethod", "a", "b"));
        assertThat(bean.getAsDynamicObject().invokeMethod("conventionMethod", "a", "b"), equalTo((Object) "convention:a.b"));
    }
View Full Code Here


    }

    @Test
    public void canInvokeMethodsOnJavaObjectFromGroovy() {
        Bean bean = new Bean();
        Convention convention = bean.extensibleDynamicObject.getConvention();
        convention.getPlugins().put("bean", new ConventionBean());
        new ExtensibleDynamicObjectTestHelper().assertCanCallMethods(bean);
    }
View Full Code Here

    }

    @Test
    public void canInvokeMethodsOnGroovyObjectFromGroovy() {
        GroovyBean bean = new GroovyBean();
        Convention convention = bean.extensibleDynamicObject.getConvention();
        convention.getPlugins().put("bean", new ConventionBean());
        new ExtensibleDynamicObjectTestHelper().assertCanCallMethods(bean);
    }
View Full Code Here

        // Groovy does something very strange here.
        // For some reason (probably because the class is Java), it won't employ any dynamism.
        // Even implementing invokeMethod at the Java level has no effect.

        DynamicJavaBean javaBean = new DynamicJavaBean();
        Convention convention = javaBean.extensibleDynamicObject.getConvention();
        convention.getPlugins().put("bean", new ConventionBean());
        new ExtensibleDynamicObjectTestHelper().assertCanCallMethods(javaBean);
    }
View Full Code Here

    }

    @Test
    public void conventionPropertiesAreInherited() {
        Bean bean = new Bean();
        Convention convention = bean.extensibleDynamicObject.getConvention();
        ConventionBean conventionBean = new ConventionBean();
        conventionBean.setConventionProperty("value");
        convention.getPlugins().put("convention", conventionBean);

        DynamicObject inherited = bean.getInheritable();
        assertTrue(inherited.hasProperty("conventionProperty"));
        assertThat(inherited.getProperty("conventionProperty"), equalTo((Object) "value"));
        assertThat(inherited.getProperties().get("conventionProperty"), equalTo((Object) "value"));
View Full Code Here

        Bean bean = new Bean();

        DynamicObject inherited = bean.getInheritable();
        assertFalse(inherited.hasProperty("conventionProperty"));

        Convention convention = bean.extensibleDynamicObject.getConvention();
        ConventionBean conventionBean = new ConventionBean();
        conventionBean.setConventionProperty("value");
        convention.getPlugins().put("convention", conventionBean);

        assertTrue(inherited.hasProperty("conventionProperty"));
        assertThat(inherited.getProperty("conventionProperty"), equalTo((Object) "value"));
    }
View Full Code Here

    }

    @Test
    public void conventionMethodsAreInherited() {
        Bean bean = new Bean();
        Convention convention = bean.extensibleDynamicObject.getConvention();
        convention.getPlugins().put("convention", new ConventionBean());

        DynamicObject inherited = bean.getInheritable();
        assertTrue(inherited.hasMethod("conventionMethod", "a", "b"));
        assertThat(inherited.invokeMethod("conventionMethod", "a", "b"), equalTo((Object) "convention:a.b"));
    }
View Full Code Here

    }

    @Test
    public void additionalObjectMethodsAreInherited() {
        Bean other = new Bean();
        Convention convention = other.extensibleDynamicObject.getConvention();
        convention.getPlugins().put("convention", new ConventionBean());

        Bean bean = new Bean();
        bean.extensibleDynamicObject.addObject(other.getAsDynamicObject(), ExtensibleDynamicObject.Location.BeforeConvention);

        DynamicObject inherited = bean.getInheritable();
View Full Code Here

    }

    @Test
    public void parentMethodsAreInherited() {
        Bean parent = new Bean();
        Convention convention = parent.extensibleDynamicObject.getConvention();
        convention.getPlugins().put("convention", new ConventionBean());
        Bean bean = new Bean();
        bean.setParent(parent.getAsDynamicObject());

        DynamicObject inherited = bean.getInheritable();
        assertTrue(inherited.hasMethod("conventionMethod", "a", "b"));
View Full Code Here

    }

    @Test
    public void hasPropertyDefinedByConventionObject() {
        Bean bean = new Bean();
        Convention convention = bean.extensibleDynamicObject.getConvention();

        assertFalse(bean.hasProperty("conventionProperty"));
        assertFalse(bean.hasProperty("conventionProperty"));

        convention.getPlugins().put("test", new ConventionBean());
        assertTrue(bean.hasProperty("conventionProperty"));
    }
View Full Code Here

TOP

Related Classes of org.gradle.api.plugins.Convention

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.