use of org.talend.designer.core.model.components.NodeConnector in project tdi-studio-se by Talend.
the class SimpleOutputComponent method createConnectors.
@Override
public List<? extends INodeConnector> createConnectors(INode node) {
List<NodeConnector> nodeConnectors = new ArrayList<NodeConnector>();
NodeConnector connector = createBaseConnector(node, EConnectionType.FLOW_MAIN);
connector.setMaxLinkInput(1);
connector.setMaxLinkOutput(1);
nodeConnectors.add(connector);
return nodeConnectors;
}
use of org.talend.designer.core.model.components.NodeConnector in project tdi-studio-se by Talend.
the class ConnectionCreateActionTest 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());
node = new Node(sourceCom, process);
node.setLabel("tMysqlInput_1");
curNodeConnector = new NodeConnector(node);
curNodeConnector.setDefaultConnectionType(EConnectionType.FLOW_MAIN);
connecType = curNodeConnector.getDefaultConnectionType();
Node target = new Node(targetCom, process);
IMetadataTable table = createSimpleMetadata();
table.setLabel("JOBS");
table.setTableName("JOBS");
table.setAttachedConnector("FLOW");
List<IMetadataTable> metadataList = new ArrayList<IMetadataTable>();
metadataList.add(table);
node.setMetadataList(metadataList);
Connection conn = new Connection(node, target, EConnectionType.FLOW_MAIN, "FLOW", "JOBS", "row1", false);
List<Connection> connList = new ArrayList<Connection>();
connList.add(conn);
target.setIncomingConnections(connList);
node.setOutgoingConnections(connList);
}
use of org.talend.designer.core.model.components.NodeConnector in project tdi-studio-se by Talend.
the class NodeTest method testGetNodeConnectorsShowIf2FlowConnectorWithName.
@Test
public void testGetNodeConnectorsShowIf2FlowConnectorWithName() {
Process process = new Process(new FakePropertyImpl());
IComponent sourceCom = ComponentsFactoryProvider.getInstance().get("tMysqlInput", ComponentCategory.CATEGORY_4_DI.getName());
Node node = new Node(sourceCom, process);
// create node connector for test
List<INodeConnector> listConnector = new ArrayList<>();
NodeConnector connector1 = new NodeConnector(node);
connector1.setDefaultConnectionType(EConnectionType.FLOW_MAIN);
connector1.setName("FILTER");
listConnector.add(connector1);
connector1.setShowIf("SHOW_FLOW_CONNECTOR == 'true'");
NodeConnector connector2 = new NodeConnector(node);
connector2.setDefaultConnectionType(EConnectionType.FLOW_MAIN);
connector2.setName("REJECT");
connector2.setShowIf("SHOW_FLOW_CONNECTOR == 'true'");
listConnector.add(connector2);
node.setListConnector(listConnector);
// create a test param with default value 'false'
IElementParameter param = addShowIfParam(node);
Assert.assertEquals(node.getConnectorsFromType(EConnectionType.FLOW_MAIN).size(), 0);
// make connector show if to 'true'
param.setValue(true);
Assert.assertTrue(node.getConnectorFromName("FILTER") == connector1);
Assert.assertTrue(node.getConnectorFromName("REJECT") == connector2);
Assert.assertEquals(node.getConnectorsFromType(EConnectionType.FLOW_MAIN).size(), 2);
// set CurLinkNbInput/Output should not affact other connector with same type but different name
connector1.setCurLinkNbInput(10);
connector1.setCurLinkNbOutput(100);
Assert.assertEquals(connector1.getCurLinkNbInput(), 10);
Assert.assertEquals(connector1.getCurLinkNbOutput(), 100);
Assert.assertEquals(connector2.getCurLinkNbInput(), 0);
Assert.assertEquals(connector2.getCurLinkNbOutput(), 0);
}
Aggregations