Search in sources :

Example 6 with FakePropertyImpl

use of org.talend.core.model.repository.FakePropertyImpl in project tdi-studio-se by Talend.

the class ComponentContextPropertyValueEvaluatorTest method before.

@Before
public void before() {
    //$NON-NLS-1$ //$NON-NLS-2$
    IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceInput", "DI");
    node = new Node(component, new Process(new FakePropertyImpl()));
    props = node.getComponentProperties();
    evaluator = new ComponentContextPropertyValueEvaluator(node);
}
Also used : FakePropertyImpl(org.talend.core.model.repository.FakePropertyImpl) 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) Before(org.junit.Before)

Example 7 with FakePropertyImpl

use of org.talend.core.model.repository.FakePropertyImpl in project tdi-studio-se by Talend.

the class ComponentTest method testGetElementParameterValueFromComponentProperties.

@Test
public void testGetElementParameterValueFromComponentProperties() {
    //$NON-NLS-1$ //$NON-NLS-2$
    IComponent sfComponent = ComponentsFactoryProvider.getInstance().get("tSalesforceInput", "DI");
    INode node = new Node(sfComponent, new Process(new FakePropertyImpl()));
    ComponentProperties props = node.getComponentProperties();
    Form form = props.getForm(Form.MAIN);
    IElementParameter param = new GenericElementParameter(node, node.getComponentProperties(), form, form.getWidget("condition"), //$NON-NLS-1$
    null);
    Object obj = component.getElementParameterValueFromComponentProperties(node, param);
    Assert.assertNotNull(obj);
}
Also used : INode(org.talend.core.model.process.INode) FakePropertyImpl(org.talend.core.model.repository.FakePropertyImpl) ComponentProperties(org.talend.components.api.properties.ComponentProperties) 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) IElementParameter(org.talend.core.model.process.IElementParameter) Process(org.talend.designer.core.ui.editor.process.Process) Test(org.junit.Test)

Example 8 with FakePropertyImpl

use of org.talend.core.model.repository.FakePropertyImpl 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 9 with FakePropertyImpl

use of org.talend.core.model.repository.FakePropertyImpl in project tdi-studio-se by Talend.

the class ComponentsUtilsTest method createSFTestNode.

private INode createSFTestNode() {
    //$NON-NLS-1$ //$NON-NLS-2$
    IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceConnection", "DI");
    INode node = new Node(component, new Process(new FakePropertyImpl()));
    return node;
}
Also used : INode(org.talend.core.model.process.INode) FakePropertyImpl(org.talend.core.model.repository.FakePropertyImpl) IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) Process(org.talend.designer.core.ui.editor.process.Process)

Example 10 with FakePropertyImpl

use of org.talend.core.model.repository.FakePropertyImpl in project tdi-studio-se by Talend.

the class ChangeMetadataCommandTest method testComponentSchemaPropagated.

/**
     * Test disabled since for now the propagation is done by the component itself.<br>
     * A new test need to be created with a custom component setting
     */
@Test
@Ignore
public void testComponentSchemaPropagated() {
    Node simpleInputNode = NodeTestCreator.createSimpleInputNode(process);
    //$NON-NLS-1$
    TestProperties inputProps = (TestProperties) new TestProperties("testInput").init();
    simpleInputNode.setComponentProperties(inputProps);
    simpleInputNode.getMetadataList().clear();
    IMetadataTable table = createSimpleMetadata(inputProps.schema);
    table.setTableName(simpleInputNode.getUniqueName());
    table.setLabel(simpleInputNode.getUniqueName());
    //$NON-NLS-1$
    table.setAttachedConnector("FLOW");
    simpleInputNode.getMetadataList().add(table);
    List<Object> args = new ArrayList<>();
    args.add(simpleInputNode.getUniqueName());
    //$NON-NLS-1$
    args.add("connectionName");
    // set null, the command should take the schema from the component directly
    args.add(null);
    //$NON-NLS-1$
    ConnectionCreateCommand ccc = new ConnectionCreateCommand(simpleInputNode, "FLOW", args);
    ConnectionCreateCommand.setCreatingConnection(true);
    IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceOutput", "DI");
    Node node = new Node(component, new Process(new FakePropertyImpl()));
    ccc.setTarget(node);
    ccc.execute();
    IElementParameter schemaParam = null;
    for (IElementParameter param : node.getElementParameters()) {
        if (EParameterFieldType.SCHEMA_REFERENCE.equals(param.getFieldType()) && param.getContext().equals("MAIN")) {
            schemaParam = param;
            break;
        }
    }
    assertNotNull(schemaParam);
    table = node.getMetadataList().get(0);
    String avroSchemaStr = inputProps.schema.schema.getStringValue();
    assertNotNull(avroSchemaStr);
    Schema avroSchema = new Schema.Parser().parse(avroSchemaStr);
    assertEquals(3, avroSchema.getFields().size());
    //$NON-NLS-1$
    assertNotNull(avroSchema.getField("C1"));
    //$NON-NLS-1$
    assertNotNull(avroSchema.getField("C2"));
    //$NON-NLS-1$
    assertNotNull(avroSchema.getField("C3"));
    assertEquals(avroSchema.getFields().toString(), ((Schema) schemaParam.getValue()).getFields().toString());
}
Also used : TestProperties(org.talend.designer.core.utils.TestProperties) FakePropertyImpl(org.talend.core.model.repository.FakePropertyImpl) IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) Schema(org.apache.avro.Schema) ArrayList(java.util.ArrayList) Process(org.talend.designer.core.ui.editor.process.Process) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IElementParameter(org.talend.core.model.process.IElementParameter) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

FakePropertyImpl (org.talend.core.model.repository.FakePropertyImpl)18 IComponent (org.talend.core.model.components.IComponent)15 Process (org.talend.designer.core.ui.editor.process.Process)15 Test (org.junit.Test)13 Node (org.talend.designer.core.ui.editor.nodes.Node)12 ArrayList (java.util.ArrayList)8 IElementParameter (org.talend.core.model.process.IElementParameter)8 INode (org.talend.core.model.process.INode)8 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 Schema (org.apache.avro.Schema)3 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)3 INodeConnector (org.talend.core.model.process.INodeConnector)3 GenericConnection (org.talend.repository.generic.model.genericMetadata.GenericConnection)3 File (java.io.File)2 IOException (java.io.IOException)2 List (java.util.List)2 IProject (org.eclipse.core.resources.IProject)2 IPath (org.eclipse.core.runtime.IPath)2 Path (org.eclipse.core.runtime.Path)2 Before (org.junit.Before)2