Search in sources :

Example 16 with Process

use of org.talend.designer.core.ui.editor.process.Process 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 17 with Process

use of org.talend.designer.core.ui.editor.process.Process 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 18 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tesb-studio-se by Talend.

the class LocalESBRunContainerServiceTest method testCreateJavaProcessor.

/**
     * Test method for
     * {@link org.talend.designer.esb.runcontainer.core.LocalESBRunContainerService#createJavaProcessor(org.talend.core.model.process.IProcess, Property, boolean)}
     */
@Test
public void testCreateJavaProcessor() {
    IESBRunContainerService service = (IESBRunContainerService) GlobalServiceRegister.getDefault().getService(IESBRunContainerService.class);
    String[] esbComponents = { "tESBProviderRequest", "tRESTClient", "tRESTRequest", "tRESTResponse", "tESBConsumer", "tESBProviderFault", "tESBProviderRequest", "tESBProviderResponse" };
    for (String esbComponent : esbComponents) {
        Property property = PropertiesFactory.eINSTANCE.createProperty();
        property.setVersion("0.1");
        property.setId("property1");
        property.setLabel("ESBArtifact");
        ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
        processItem.setProperty(property);
        property.setItem(processItem);
        ProcessType process = TalendFileFactory.eINSTANCE.createProcessType();
        processItem.setProcess(process);
        NodeType node = TalendFileFactory.eINSTANCE.createNodeType();
        process.getNode().add(node);
        node.setComponentName(esbComponent);
        IComponent tESBComponent = ComponentsFactoryProvider.getInstance().get(esbComponent, ComponentCategory.CATEGORY_4_DI.getName());
        Process esbJob = new Process(property);
        Node tESBComponent_1 = new Node(tESBComponent, esbJob);
        esbJob.addNodeContainer(new NodeContainer(tESBComponent_1));
        Assert.assertNotNull(service.createJavaProcessor(esbJob, property, false));
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) IESBRunContainerService(org.talend.designer.runprocess.IESBRunContainerService) ProcessItem(org.talend.core.model.properties.ProcessItem) IComponent(org.talend.core.model.components.IComponent) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) Node(org.talend.designer.core.ui.editor.nodes.Node) Process(org.talend.designer.core.ui.editor.process.Process) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Example 19 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class ComponentListControllerTest method testrenameComponentUniqueName.

@Test
public void testrenameComponentUniqueName() {
    //---first
    String oldConnectionName = "joblet3_1";
    String newConnectionName = "joblet1_1_joblet2_1_joblet3_1";
    List<Node> nodesToUpdate = new ArrayList<Node>();
    IComponent component = ComponentsFactoryProvider.getInstance().get("tMysqlInput", ComponentCategory.CATEGORY_4_DI.getName());
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
    property.setVersion(VersionUtils.DEFAULT_VERSION);
    Process process = new Process(property);
    Node node = new Node(component, process);
    nodesToUpdate.add(node);
    IElementParameter param = node.getElementParameter("CONNECTION");
    param.setValue("joblet3_1_joblet4_1_joblet5_1_tMysqlConnection_1");
    ComponentListController.renameComponentUniqueName(oldConnectionName, newConnectionName, nodesToUpdate);
    assertTrue(param.getValue().equals("joblet1_1_joblet2_1_joblet3_1_joblet4_1_joblet5_1_tMysqlConnection_1"));
    //---second
    oldConnectionName = "tMysqlConnection_1";
    newConnectionName = "joblet1_1_joblet2_1_tMysqlConnection_1";
    param.setValue("tMysqlConnection_1_joblet4_1_joblet5_1_tMysqlConnection_1");
    ComponentListController.renameComponentUniqueName(oldConnectionName, newConnectionName, nodesToUpdate);
    assertTrue(param.getValue().equals("joblet1_1_joblet2_1_tMysqlConnection_1_joblet4_1_joblet5_1_tMysqlConnection_1"));
}
Also used : IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter) Process(org.talend.designer.core.ui.editor.process.Process) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Example 20 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class PostgresGenerationManagerTest method init.

private void init(String schema, String main_table, String lookup_table) {
    List<IConnection> incomingConnections = new ArrayList<IConnection>();
    String[] mainTableEntities = new String[] { "id", "name", "classNum" };
    String[] lookupEndtities = new String[] { "id", "score" };
    incomingConnections.add(mockConnection(schema, main_table, mainTableEntities));
    incomingConnections.add(mockConnection(schema, lookup_table, lookupEndtities));
    component.setIncomingConnections(incomingConnections);
    ExternalDbMapData externalData = new ExternalDbMapData();
    List<ExternalDbMapTable> inputs = new ArrayList<ExternalDbMapTable>();
    List<ExternalDbMapTable> outputs = new ArrayList<ExternalDbMapTable>();
    // main table
    ExternalDbMapTable inputTable = new ExternalDbMapTable();
    inputTable.setTableName(schema + "." + main_table);
    List<ExternalDbMapEntry> entities = getMetadataEntities(mainTableEntities, new String[3]);
    inputTable.setMetadataTableEntries(entities);
    inputs.add(inputTable);
    // lookup table
    inputTable = new ExternalDbMapTable();
    inputTable.setTableName(schema + "." + lookup_table);
    entities = getMetadataEntities(lookupEndtities, new String[2]);
    inputTable.setMetadataTableEntries(entities);
    inputs.add(inputTable);
    // output
    ExternalDbMapTable outputTable = new ExternalDbMapTable();
    outputTable.setName("grade");
    List<ExternalDbMapEntry> conditions = new ArrayList<ExternalDbMapEntry>();
    conditions.add(new ExternalDbMapEntry(schema + "." + main_table + ".id =3"));
    outputTable.setCustomWhereConditionsEntries(conditions);
    String[] names = new String[] { "id", "name", "classNum", "score" };
    String[] expressions = new String[] { schema + "." + main_table + ".id", schema + "." + main_table + ".name", schema + "." + main_table + ".classNum", schema + "." + lookup_table + ".score" };
    outputTable.setMetadataTableEntries(getMetadataEntities(names, expressions));
    outputs.add(outputTable);
    externalData.setInputTables(inputs);
    externalData.setOutputTables(outputs);
    component.setExternalData(externalData);
    List<IMetadataTable> metadataList = new ArrayList<IMetadataTable>();
    MetadataTable metadataTable = getMetadataTable(names);
    metadataTable.setLabel("grade");
    metadataList.add(metadataTable);
    component.setMetadataList(metadataList);
    Process process = mock(Process.class);
    when(process.getContextManager()).thenReturn(new JobContextManager());
    component.setProcess(process);
}
Also used : ExternalDbMapData(org.talend.designer.dbmap.external.data.ExternalDbMapData) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection) Process(org.talend.designer.core.ui.editor.process.Process) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) ExternalDbMapTable(org.talend.designer.dbmap.external.data.ExternalDbMapTable) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) JobContextManager(org.talend.core.model.context.JobContextManager) ExternalDbMapEntry(org.talend.designer.dbmap.external.data.ExternalDbMapEntry)

Aggregations

Process (org.talend.designer.core.ui.editor.process.Process)119 Node (org.talend.designer.core.ui.editor.nodes.Node)69 INode (org.talend.core.model.process.INode)48 ArrayList (java.util.ArrayList)45 IComponent (org.talend.core.model.components.IComponent)36 IElementParameter (org.talend.core.model.process.IElementParameter)28 Test (org.junit.Test)26 List (java.util.List)25 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)25 IProcess (org.talend.core.model.process.IProcess)24 Connection (org.talend.designer.core.ui.editor.connections.Connection)24 Property (org.talend.core.model.properties.Property)23 INodeConnector (org.talend.core.model.process.INodeConnector)22 IConnection (org.talend.core.model.process.IConnection)20 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)20 FakePropertyImpl (org.talend.core.model.repository.FakePropertyImpl)15 ProcessItem (org.talend.core.model.properties.ProcessItem)12 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)11 HashMap (java.util.HashMap)10 Before (org.junit.Before)9