Search in sources :

Example 31 with INodeConnector

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

the class ConnectionCreateCommandTest method redoSimpleInputToSimpleOutput2.

/**
     * DOC nrousseau Comment method "redoSimpleInputToSimpleOutput1".
     */
private void redoSimpleInputToSimpleOutput2() {
    ConnectionCreateCommand ccc = undoSimpleInputToSimpleOutput2();
    ccc.redo();
    //$NON-NLS-1$
    INodeConnector inputConnector = ccc.source.getConnectorFromName("FLOW");
    //$NON-NLS-1$
    INodeConnector outputConnector = ccc.target.getConnectorFromName("FLOW");
    assertEquals(inputConnector.getCurLinkNbOutput(), 1);
    assertEquals(outputConnector.getCurLinkNbInput(), 1);
}
Also used : INodeConnector(org.talend.core.model.process.INodeConnector)

Example 32 with INodeConnector

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

the class ConnectionCreateCommandTest method undoSimpleInputToSimpleOutput3.

/**
     * DOC nrousseau Comment method "undoSimpleInputToSimpleOutput1".
     */
private ConnectionCreateCommand undoSimpleInputToSimpleOutput3() {
    ConnectionCreateCommand ccc = executeSimpleInputToSimpleOutput3();
    ccc.undo();
    assertEquals(ccc.source.getOutgoingConnections().size(), 0);
    assertEquals(ccc.target.getOutgoingConnections().size(), 0);
    //$NON-NLS-1$
    INodeConnector inputConnector = ccc.source.getConnectorFromName("FLOW");
    //$NON-NLS-1$
    INodeConnector outputConnector = ccc.target.getConnectorFromName("FLOW");
    assertEquals(inputConnector.getCurLinkNbOutput(), 0);
    assertEquals(outputConnector.getCurLinkNbInput(), 0);
    return ccc;
}
Also used : INodeConnector(org.talend.core.model.process.INodeConnector)

Example 33 with INodeConnector

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

the class ConnectionCreateCommandTest method undoSimpleInputToSimpleOutput2.

/**
     * DOC nrousseau Comment method "undoSimpleInputToSimpleOutput1".
     */
private ConnectionCreateCommand undoSimpleInputToSimpleOutput2() {
    ConnectionCreateCommand ccc = executeSimpleInputToSimpleOutput2();
    ccc.undo();
    assertEquals(ccc.source.getOutgoingConnections().size(), 0);
    assertEquals(ccc.target.getOutgoingConnections().size(), 0);
    //$NON-NLS-1$
    INodeConnector inputConnector = ccc.source.getConnectorFromName("FLOW");
    //$NON-NLS-1$
    INodeConnector outputConnector = ccc.target.getConnectorFromName("FLOW");
    assertEquals(inputConnector.getCurLinkNbOutput(), 0);
    assertEquals(outputConnector.getCurLinkNbInput(), 0);
    return ccc;
}
Also used : INodeConnector(org.talend.core.model.process.INodeConnector)

Example 34 with INodeConnector

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

the class ConnectionCreateCommandTest method executeSimpleInputToSimpleOutput3.

/**
     * simple input to simple output with no metadata and without schema auto propagate.
     */
private ConnectionCreateCommand executeSimpleInputToSimpleOutput3() {
    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.createSimpleOutputNodeNoPropagate(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);
    // no propagation
    assertEquals(outputMetadata.getListColumns().size(), 0);
    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 35 with INodeConnector

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

the class ConnectionCreateCommandTest method redoSimpleInputToSimpleOutput1.

/**
     * DOC nrousseau Comment method "redoSimpleInputToSimpleOutput1".
     */
private void redoSimpleInputToSimpleOutput1() {
    ConnectionCreateCommand ccc = undoSimpleInputToSimpleOutput1();
    ccc.redo();
    //$NON-NLS-1$
    INodeConnector inputConnector = ccc.source.getConnectorFromName("FLOW");
    //$NON-NLS-1$
    INodeConnector outputConnector = ccc.target.getConnectorFromName("FLOW");
    assertEquals(inputConnector.getCurLinkNbOutput(), 1);
    assertEquals(outputConnector.getCurLinkNbInput(), 1);
}
Also used : INodeConnector(org.talend.core.model.process.INodeConnector)

Aggregations

INodeConnector (org.talend.core.model.process.INodeConnector)76 ArrayList (java.util.ArrayList)37 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)31 INode (org.talend.core.model.process.INode)31 Node (org.talend.designer.core.ui.editor.nodes.Node)31 IConnection (org.talend.core.model.process.IConnection)27 IElementParameter (org.talend.core.model.process.IElementParameter)22 Process (org.talend.designer.core.ui.editor.process.Process)21 List (java.util.List)20 Connection (org.talend.designer.core.ui.editor.connections.Connection)17 IJobletProviderService (org.talend.core.ui.IJobletProviderService)14 HashMap (java.util.HashMap)11 NodeConnector (org.talend.designer.core.model.components.NodeConnector)11 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)9 EConnectionType (org.talend.core.model.process.EConnectionType)9 Map (java.util.Map)8 IExternalNode (org.talend.core.model.process.IExternalNode)7 IProcess (org.talend.core.model.process.IProcess)7 RepositoryNode (org.talend.repository.model.RepositoryNode)7 Point (org.eclipse.draw2d.geometry.Point)6