use of org.talend.components.api.properties.ComponentReferenceProperties 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());
}
}
}
use of org.talend.components.api.properties.ComponentReferenceProperties 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());
}
}
}
Aggregations