Package org.gradle.api.internal.plugins

Examples of org.gradle.api.internal.plugins.DefaultConvention


    }

    @Test
    public void canInvokeMethodsOnJavaSubClassOfGroovyObjectFromGroovy() {
        DynamicBean bean = new DynamicBean();
        Convention convention = new DefaultConvention();
        bean.setConvention(convention);
        convention.getPlugins().put("bean", new ConventionBean());
        DynamicObjectHelperTestHelper.assertCanCallMethods(bean);
    }
View Full Code Here


    }

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

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

        Bean bean = new Bean();

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

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

        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 = new DefaultConvention();
        convention.getPlugins().put("convention", new ConventionBean());
        bean.setConvention(convention);

        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 = new DefaultConvention();
        convention.getPlugins().put("convention", new ConventionBean());
        other.setConvention(convention);

        Bean bean = new Bean();
        bean.helper.addObject(other, DynamicObjectHelper.Location.BeforeConvention);
View Full Code Here

    }

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

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

    TestTask testTask;

    @Before public void setUp() {
        testTask = HelperUtil.createTask(TestTask.class);
        conventionAware = new ConventionAwareHelper(testTask, new DefaultConvention());
    }
View Full Code Here

    @Test
    public void doesNotOverrideMethodsFromDynamicObjectAwareInterface() throws Exception {
        DynamicObjectAwareBean bean = generator.generate(DynamicObjectAwareBean.class).newInstance();
        assertThat(bean.getConvention(), sameInstance(bean.conv));
        Convention newConvention = new DefaultConvention();
        bean.setConvention(newConvention);
        assertThat(bean.getConvention(), sameInstance(newConvention));
        assertThat(bean.getAsDynamicObject(), sameInstance((DynamicObject) newConvention));
    }
View Full Code Here

        Bean bean = generator.generate(Bean.class).newInstance();
        IConventionAware conventionAware = (IConventionAware) bean;
        DynamicObjectAware dynamicObjectAware = (DynamicObjectAware) bean;
        assertThat(dynamicObjectAware.getConvention(), sameInstance(conventionAware.getConventionMapping().getConvention()));

        Convention newConvention = new DefaultConvention();
        dynamicObjectAware.setConvention(newConvention);
        assertThat(dynamicObjectAware.getConvention(), sameInstance(newConvention));
        assertThat(conventionAware.getConventionMapping().getConvention(), sameInstance(newConvention));
    }
View Full Code Here

        void add(MethodVisitor visitor) throws Exception;
    }

    public static class MixInDynamicObject extends DynamicObjectHelper {
        public MixInDynamicObject(Object delegateObject, DynamicObject dynamicObject) {
            super(wrap(delegateObject, dynamicObject), new DefaultConvention());
        }
View Full Code Here

TOP

Related Classes of org.gradle.api.internal.plugins.DefaultConvention

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.