Search in sources :

Example 1 with CodegenPropInfo

use of org.talend.designer.core.generic.model.Component.CodegenPropInfo in project tdi-studio-se by Talend.

the class ComponentTest method testGetCodegenPropInfosWithoutReferenceObject.

@Test
public void testGetCodegenPropInfosWithoutReferenceObject() {
    //$NON-NLS-1$
    ComponentProperties props = (ComponentProperties) new TestProperties("test").init();
    List<CodegenPropInfo> propInfos = component.getCodegenPropInfos(props);
    for (CodegenPropInfo propInfo : propInfos) {
        Properties properties = propInfo.props;
        if (properties instanceof ComponentReferenceProperties) {
            ComponentReferenceProperties crp = (ComponentReferenceProperties) properties;
            assertEquals(Boolean.TRUE, crp.componentInstanceId.getTaggedValue(IGenericConstants.ADD_QUOTES));
            assertEquals(Boolean.TRUE, crp.referenceDefinitionName.getTaggedValue(IGenericConstants.ADD_QUOTES));
            //please see ComponentRefController class, the reference will be set when some ui action happen, so expect the value is null as no any ui action here
            assertNull(crp.getReference());
        }
    }
}
Also used : TestProperties(org.talend.designer.core.generic.utils.TestProperties) ComponentProperties(org.talend.components.api.properties.ComponentProperties) CodegenPropInfo(org.talend.designer.core.generic.model.Component.CodegenPropInfo) ComponentProperties(org.talend.components.api.properties.ComponentProperties) ComponentReferenceProperties(org.talend.components.api.properties.ComponentReferenceProperties) TestProperties(org.talend.designer.core.generic.utils.TestProperties) Properties(org.talend.daikon.properties.Properties) TestReferencedProperties(org.talend.designer.core.generic.utils.TestReferencedProperties) ComponentReferenceProperties(org.talend.components.api.properties.ComponentReferenceProperties) Test(org.junit.Test)

Example 2 with CodegenPropInfo

use of org.talend.designer.core.generic.model.Component.CodegenPropInfo in project tdi-studio-se by Talend.

the class ComponentTest method testGetCodegenPropInfosWithReferencePropertiesObject.

@Test
public void testGetCodegenPropInfosWithReferencePropertiesObject() {
    //$NON-NLS-1$
    TestProperties props = (TestProperties) new TestProperties("test").init();
    props.referencePros.setReference(new TestReferencedProperties("reference").init());
    List<CodegenPropInfo> propInfos = component.getCodegenPropInfos(props);
    for (CodegenPropInfo propInfo : propInfos) {
        Properties properties = propInfo.props;
        if (properties instanceof ComponentReferenceProperties) {
            ComponentReferenceProperties crp = (ComponentReferenceProperties) properties;
            assertEquals(Boolean.TRUE, crp.componentInstanceId.getTaggedValue(IGenericConstants.ADD_QUOTES));
            assertEquals(Boolean.TRUE, crp.referenceDefinitionName.getTaggedValue(IGenericConstants.ADD_QUOTES));
            assertNotNull(crp.getReference());
        }
    }
}
Also used : TestProperties(org.talend.designer.core.generic.utils.TestProperties) CodegenPropInfo(org.talend.designer.core.generic.model.Component.CodegenPropInfo) ComponentProperties(org.talend.components.api.properties.ComponentProperties) ComponentReferenceProperties(org.talend.components.api.properties.ComponentReferenceProperties) TestProperties(org.talend.designer.core.generic.utils.TestProperties) Properties(org.talend.daikon.properties.Properties) TestReferencedProperties(org.talend.designer.core.generic.utils.TestReferencedProperties) TestReferencedProperties(org.talend.designer.core.generic.utils.TestReferencedProperties) ComponentReferenceProperties(org.talend.components.api.properties.ComponentReferenceProperties) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ComponentProperties (org.talend.components.api.properties.ComponentProperties)2 ComponentReferenceProperties (org.talend.components.api.properties.ComponentReferenceProperties)2 Properties (org.talend.daikon.properties.Properties)2 CodegenPropInfo (org.talend.designer.core.generic.model.Component.CodegenPropInfo)2 TestProperties (org.talend.designer.core.generic.utils.TestProperties)2 TestReferencedProperties (org.talend.designer.core.generic.utils.TestReferencedProperties)2