Search in sources :

Example 1 with TestProperties

use of org.talend.designer.core.generic.utils.TestProperties in project tdi-studio-se by Talend.

the class GenericNodeConnectorTest method testGetComponentProperties.

@Test
public void testGetComponentProperties() {
    //$NON-NLS-1$
    TestProperties testProps2 = (TestProperties) new TestProperties("test2").init();
    GenericNodeConnector connector = new GenericNodeConnector(testNode, false);
    connector.setComponentProperties(testProps2);
    assertEquals(testNode.getComponentProperties(), connector.getComponentProperties());
    connector = new GenericNodeConnector(null, false);
    connector.setComponentProperties(testProps2);
    assertEquals(testProps2, connector.getComponentProperties());
}
Also used : TestProperties(org.talend.designer.core.generic.utils.TestProperties) Test(org.junit.Test)

Example 2 with TestProperties

use of org.talend.designer.core.generic.utils.TestProperties in project tdi-studio-se by Talend.

the class GenericElementParameterTest method before.

@Before
public void before() {
    ComponentService componentService = ComponentsUtils.getComponentService();
    //$NON-NLS-1$
    TestProperties props = (TestProperties) new TestProperties("test").init();
    Form form = props.getForm(Form.MAIN);
    //$NON-NLS-1$ //$NON-NLS-2$
    IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceConnection", "DI");
    INode node = new Node(component, new Process(new FakePropertyImpl()));
    parameter = new GenericElementParameter(node, props, form, form.getWidget(props.userId), componentService);
}
Also used : TestProperties(org.talend.designer.core.generic.utils.TestProperties) INode(org.talend.core.model.process.INode) FakePropertyImpl(org.talend.core.model.repository.FakePropertyImpl) Form(org.talend.daikon.properties.presentation.Form) IComponent(org.talend.core.model.components.IComponent) INode(org.talend.core.model.process.INode) Node(org.talend.designer.core.ui.editor.nodes.Node) Process(org.talend.designer.core.ui.editor.process.Process) ComponentService(org.talend.components.api.service.ComponentService) Before(org.junit.Before)

Example 3 with TestProperties

use of org.talend.designer.core.generic.utils.TestProperties in project tdi-studio-se by Talend.

the class GenericNodeConnectorTest method before.

@Before
public void before() {
    process = new Process(createProperty());
    testNode = new Node(testComponent, process);
    //$NON-NLS-1$
    TestProperties testProps = (TestProperties) new TestProperties("test").init();
    testNode.setComponentProperties(testProps);
}
Also used : TestProperties(org.talend.designer.core.generic.utils.TestProperties) INode(org.talend.core.model.process.INode) Node(org.talend.designer.core.ui.editor.nodes.Node) Process(org.talend.designer.core.ui.editor.process.Process) Before(org.junit.Before)

Example 4 with TestProperties

use of org.talend.designer.core.generic.utils.TestProperties 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 5 with TestProperties

use of org.talend.designer.core.generic.utils.TestProperties 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

TestProperties (org.talend.designer.core.generic.utils.TestProperties)5 Test (org.junit.Test)3 Before (org.junit.Before)2 ComponentProperties (org.talend.components.api.properties.ComponentProperties)2 ComponentReferenceProperties (org.talend.components.api.properties.ComponentReferenceProperties)2 INode (org.talend.core.model.process.INode)2 Properties (org.talend.daikon.properties.Properties)2 CodegenPropInfo (org.talend.designer.core.generic.model.Component.CodegenPropInfo)2 TestReferencedProperties (org.talend.designer.core.generic.utils.TestReferencedProperties)2 Node (org.talend.designer.core.ui.editor.nodes.Node)2 Process (org.talend.designer.core.ui.editor.process.Process)2 ComponentService (org.talend.components.api.service.ComponentService)1 IComponent (org.talend.core.model.components.IComponent)1 FakePropertyImpl (org.talend.core.model.repository.FakePropertyImpl)1 Form (org.talend.daikon.properties.presentation.Form)1