Search in sources :

Example 56 with IProcess2

use of org.talend.core.model.process.IProcess2 in project tdi-studio-se by Talend.

the class ProcessComposite method setRunnable.

protected void setRunnable(boolean runnable) {
    // perfBtn.setEnabled(runnable);
    if (clearTracePerfBtn != null && !clearTracePerfBtn.isDisposed()) {
        IProcess2 iProcess = null;
        boolean enableClearBtn = true;
        if (processContext != null && (iProcess = processContext.getProcess()) != null) {
            if (iProcess.disableRunJobView()) {
                enableClearBtn = false;
            }
        } else {
            enableClearBtn = false;
        }
        clearTracePerfBtn.setEnabled(enableClearBtn);
    }
    setExecBtn(runnable);
    // watchBtn.setEnabled(runnable);
    if (enableLineLimitButton != null && !enableLineLimitButton.isDisposed()) {
        enableLineLimitButton.setEnabled(runnable);
    }
    if (lineLimitText != null && !lineLimitText.isDisposed()) {
        lineLimitText.setEnabled(runnable);
    }
    if (wrapButton != null && !wrapButton.isDisposed()) {
        wrapButton.setEnabled(runnable);
    }
}
Also used : IProcess2(org.talend.core.model.process.IProcess2)

Example 57 with IProcess2

use of org.talend.core.model.process.IProcess2 in project tdi-studio-se by Talend.

the class ChangeValuesFromRepositoryTest method setUp.

/**
     * DOC Administrator Comment method "setUp".
     *
     * @throws java.lang.Exception
     */
@Before
public void setUp() throws Exception {
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    IProcess2 process = new Process(property);
    IComponent sourceCom = ComponentsFactoryProvider.getInstance().get("tMysqlInput", ComponentCategory.CATEGORY_4_DI.getName());
    IComponent targetCom = ComponentsFactoryProvider.getInstance().get("tMysqlOutput", ComponentCategory.CATEGORY_4_DI.getName());
    elem = new Node(sourceCom, process);
    elem.setLabel("tMysqlInput_1");
    target = new Node(targetCom, process);
    IMetadataTable table = createSimpleMetadata();
    table.setAttachedConnector("FLOW");
    List<IMetadataTable> metadataList = new ArrayList<IMetadataTable>();
    metadataList.add(table);
    elem.setMetadataList(metadataList);
    Connection conn = new Connection(elem, target, EConnectionType.FLOW_MAIN, "FLOW", "metaName", "row1", false);
    List<Connection> connList = new ArrayList<Connection>();
    connList.add(conn);
    target.setIncomingConnections(connList);
    elem.setOutgoingConnections(connList);
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) IProcess2(org.talend.core.model.process.IProcess2) ArrayList(java.util.ArrayList) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) Process(org.talend.designer.core.ui.editor.process.Process) Property(org.talend.core.model.properties.Property) Before(org.junit.Before)

Example 58 with IProcess2

use of org.talend.core.model.process.IProcess2 in project tdi-studio-se by Talend.

the class ConnectionCreateCommandTest method executeSimpleInputToSimpleOutput1.

/**
     * simple input to simple output with no metadata and schema auto propagate.
     */
private ConnectionCreateCommand executeSimpleInputToSimpleOutput1() {
    IProcess2 process = getFakeProcess();
    Node simpleInputNode = NodeTestCreator.createSimpleInputNode(process);
    // simple tests only since it's simply using the class ConnectionManager which already have JUnits.
    List<Object> args = new ArrayList<Object>();
    args.add(simpleInputNode.getUniqueName());
    //$NON-NLS-1$
    args.add("connectionName");
    simpleInputNode.getMetadataList().clear();
    IMetadataTable table = createSimpleMetadata1();
    table.setTableName(simpleInputNode.getUniqueName());
    table.setLabel(simpleInputNode.getUniqueName());
    //$NON-NLS-1$
    table.setAttachedConnector("FLOW");
    simpleInputNode.getMetadataList().add(table);
    // 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);
    Node simpleOutputNode = NodeTestCreator.createSimpleOutputNode(process);
    ccc.setTarget(simpleOutputNode);
    ccc.execute();
    assertEquals(simpleInputNode.getOutgoingConnections().size(), 1);
    assertEquals(simpleOutputNode.getIncomingConnections().size(), 1);
    assertEquals(simpleOutputNode.getMetadataList().size(), 1);
    IMetadataTable outputMetadata = simpleOutputNode.getMetadataList().get(0);
    // metadata should have been propagated automatically
    assertMetadataIsSame(table, outputMetadata);
    IConnection connection = simpleInputNode.getOutgoingConnections().get(0);
    assertEquals(simpleOutputNode.getIncomingConnections().get(0), connection);
    assertEquals(connection.getSource(), simpleInputNode);
    assertEquals(connection.getTarget(), simpleOutputNode);
    assertEquals(connection.getMetaName(), simpleInputNode.getUniqueName());
    //$NON-NLS-1$
    assertEquals(connection.getConnectorName(), "FLOW");
    //$NON-NLS-1$
    INodeConnector inputConnector = simpleInputNode.getConnectorFromName("FLOW");
    //$NON-NLS-1$
    INodeConnector outputConnector = simpleOutputNode.getConnectorFromName("FLOW");
    assertEquals(inputConnector.getCurLinkNbOutput(), 1);
    assertEquals(outputConnector.getCurLinkNbInput(), 1);
    return ccc;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) Node(org.talend.designer.core.ui.editor.nodes.Node) IProcess2(org.talend.core.model.process.IProcess2) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection) INodeConnector(org.talend.core.model.process.INodeConnector)

Example 59 with IProcess2

use of org.talend.core.model.process.IProcess2 in project tdi-studio-se by Talend.

the class JobSettingsManagerTest method testCreateExtraContextLoadNodes.

/**
     * Test method for
     * {@link org.talend.designer.core.model.process.jobsettings.JobSettingsManager#createExtraContextLoadNodes(org.talend.core.model.process.IProcess)}
     * .
     */
@Test
public void testCreateExtraContextLoadNodes() {
    // junit for TUP-3972
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    IProcess2 process = new Process(property);
    process.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD.getName()).setValue(true);
    process.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName()).setValue("the test file");
    process.getElementParameter("FROM_FILE_FLAG_IMPLICIT_CONTEXT").setValue(true);
    final List<DataNode> createContextLoadNodes = JobSettingsManager.createExtraContextLoadNodes(process);
    assertNotEquals(createContextLoadNodes.size(), 0);
    final DataNode dataNode = createContextLoadNodes.get(0);
    final IMetadataTable metadataTable = dataNode.getMetadataList().get(0);
    for (IMetadataColumn column : metadataTable.getListColumns()) {
        assertNotNull(column.getDefault());
        assertNotNull(JavaTypesManager.getDefaultValueFromJavaType(column.getTalendType(), column.getDefault()));
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) DataNode(org.talend.designer.core.model.process.DataNode) IProcess2(org.talend.core.model.process.IProcess2) Process(org.talend.designer.core.ui.editor.process.Process) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Example 60 with IProcess2

use of org.talend.core.model.process.IProcess2 in project tdi-studio-se by Talend.

the class ConnectionCreateCommandTest method testCanExecute.

/**
     * Test method for {@link org.talend.designer.core.ui.editor.cmd.ConnectionCreateCommand#canExecute()}.
     */
@Test
public void testCanExecute() {
    IProcess2 process = getFakeProcess();
    Node simpleInputNode = NodeTestCreator.createSimpleInputNode(process);
    // simple tests only since it's simply using the class ConnectionManager which already have JUnits.
    List<Object> args = new ArrayList<Object>();
    //$NON-NLS-1$
    args.add("metaName");
    //$NON-NLS-1$
    args.add("connectionName");
    args.add(mock(IMetadataTable.class));
    //$NON-NLS-1$
    ConnectionCreateCommand ccc = new ConnectionCreateCommand(simpleInputNode, "FLOW", args);
    ccc.setTarget(NodeTestCreator.createSimpleOutputNode(process));
    assertTrue(ccc.canExecute());
    ccc.setTarget(NodeTestCreator.createSimpleInputNode(process));
    assertFalse(ccc.canExecute());
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) Node(org.talend.designer.core.ui.editor.nodes.Node) IProcess2(org.talend.core.model.process.IProcess2) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

IProcess2 (org.talend.core.model.process.IProcess2)115 INode (org.talend.core.model.process.INode)31 Node (org.talend.designer.core.ui.editor.nodes.Node)31 ArrayList (java.util.ArrayList)30 ProcessItem (org.talend.core.model.properties.ProcessItem)30 Item (org.talend.core.model.properties.Item)28 IProcess (org.talend.core.model.process.IProcess)24 PersistenceException (org.talend.commons.exception.PersistenceException)22 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)21 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)19 List (java.util.List)17 IElementParameter (org.talend.core.model.process.IElementParameter)15 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)14 Property (org.talend.core.model.properties.Property)14 CoreException (org.eclipse.core.runtime.CoreException)12 IConnection (org.talend.core.model.process.IConnection)11 HashSet (java.util.HashSet)10 IEditorReference (org.eclipse.ui.IEditorReference)10 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)10 InvocationTargetException (java.lang.reflect.InvocationTargetException)7