use of org.talend.core.model.process.INodeConnector in project tesb-studio-se by Talend.
the class CamelDesignerCoreService method getTargetConnectionType.
@Override
public EConnectionType getTargetConnectionType(INode node) {
INodeConnector connector = node.getConnectorFromType(EConnectionType.ROUTE);
if (connector.getMaxLinkOutput() > 0) {
return EConnectionType.ROUTE;
}
connector = node.getConnectorFromType(EConnectionType.ROUTE_ENDBLOCK);
if (connector.getMaxLinkOutput() > 0) {
return EConnectionType.ROUTE_ENDBLOCK;
}
return EConnectionType.ROUTE;
}
use of org.talend.core.model.process.INodeConnector 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.core.model.process.INodeConnector in project tdi-studio-se by Talend.
the class ConnectionCreateActionTest method testGetConnectors.
/**
* Test method for {@link org.talend.designer.core.ui.action.ConnectionCreateAction#getConnectors()}.
*/
@Test
public void testGetConnectors() {
List<INodeConnector> list = new ArrayList<INodeConnector>();
List<INodeConnector> nodeConnectorList = new ArrayList<INodeConnector>(node.getConnectorsFromType(EConnectionType.FLOW_MAIN));
int connecSize = nodeConnectorList.size();
List<INodeConnector> toRemove = new ArrayList<INodeConnector>();
for (INodeConnector connector : nodeConnectorList) {
if ((connector.getMaxLinkOutput() != -1) && (connector.getCurLinkNbOutput() >= connector.getMaxLinkOutput())) {
toRemove.add(connector);
} else {
if (PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
if (service != null) {
if (service.isJobletComponent(node) && !service.isBuiltTriggerConnector(node, connector)) {
toRemove.add(connector);
}
List<? extends IConnection> outgoingConnections = node.getOutgoingConnections();
if (service.isTriggerInputNode(node) && outgoingConnections != null && outgoingConnections.size() >= 1) {
toRemove.add(connector);
}
}
}
}
}
nodeConnectorList.removeAll(toRemove);
assertEquals(nodeConnectorList.size(), connecSize - toRemove.size());
}
use of org.talend.core.model.process.INodeConnector in project tdi-studio-se by Talend.
the class ConnectionCreateCommandTest method redoSimpleInputToSimpleOutput3.
/**
* DOC nrousseau Comment method "redoSimpleInputToSimpleOutput1".
*/
private void redoSimpleInputToSimpleOutput3() {
ConnectionCreateCommand ccc = undoSimpleInputToSimpleOutput3();
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);
}
use of org.talend.core.model.process.INodeConnector in project tdi-studio-se by Talend.
the class ConnectionCreateCommandTest method executeSimpleInputToSimpleOutput2.
/**
* simple input to simple output with metadata already existing and schema auto propagate.
*/
private ConnectionCreateCommand executeSimpleInputToSimpleOutput2() {
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 table1 = createSimpleMetadata1();
table1.setTableName(simpleInputNode.getUniqueName());
table1.setLabel(simpleInputNode.getUniqueName());
//$NON-NLS-1$
table1.setAttachedConnector("FLOW");
simpleInputNode.getMetadataList().add(table1);
// 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);
simpleOutputNode.getMetadataList().clear();
IMetadataTable table2 = createSimpleMetadata2();
table2.setTableName(simpleOutputNode.getUniqueName());
table2.setLabel(simpleOutputNode.getUniqueName());
//$NON-NLS-1$
table2.setAttachedConnector("FLOW");
simpleOutputNode.getMetadataList().add(table2);
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(table1, 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;
}
Aggregations