use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class ChangeValuesFromRepositoryTest method testChangeValuesMultipleProperty.
@Test
public void testChangeValuesMultipleProperty() {
Property property = PropertiesFactory.eINSTANCE.createProperty();
IProcess2 process = new Process(property);
IComponent sourceCom = ComponentsFactoryProvider.getInstance().get("tMysqlInput", ComponentCategory.CATEGORY_4_DI.getName());
Node node = new Node(sourceCom, process);
node.setLabel("tMysqlInput_1");
IMetadataTable table = createSimpleMetadata();
table.setAttachedConnector("FLOW");
List<IMetadataTable> metadataList = new ArrayList<IMetadataTable>();
metadataList.add(table);
node.setMetadataList(metadataList);
ElementParameter parentParam = new ElementParameter(node);
parentParam.setCategory(EComponentCategory.BASIC);
parentParam.setName("PROPERTY2");
parentParam.setFieldType(EParameterFieldType.PROPERTY_TYPE);
ElementParameter newParam = new ElementParameter(node);
newParam.setCategory(EComponentCategory.BASIC);
newParam.setName(EParameterName.PROPERTY_TYPE.getName());
newParam.setDisplayName(EParameterName.PROPERTY_TYPE.getDisplayName());
newParam.setListItemsDisplayName(new String[] { TEXT_BUILTIN, TEXT_REPOSITORY });
newParam.setListItemsDisplayCodeName(new String[] { BUILTIN, REPOSITORY });
newParam.setListItemsValue(new String[] { BUILTIN, REPOSITORY });
newParam.setValue(BUILTIN);
newParam.setNumRow(1);
newParam.setFieldType(EParameterFieldType.TECHNICAL);
newParam.setRepositoryValue("TEST");
newParam.setShow(true);
newParam.setParentParameter(parentParam);
// listParam.add(newParam);
newParam = new ElementParameter(node);
newParam.setCategory(EComponentCategory.BASIC);
newParam.setName(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
newParam.setDisplayName(EParameterName.REPOSITORY_PROPERTY_TYPE.getDisplayName());
newParam.setListItemsDisplayName(new String[] {});
newParam.setListItemsValue(new String[] {});
newParam.setNumRow(1);
newParam.setFieldType(EParameterFieldType.TECHNICAL);
//$NON-NLS-1$
newParam.setValue("");
newParam.setShow(false);
newParam.setRequired(true);
newParam.setParentParameter(parentParam);
((List<IElementParameter>) node.getElementParameters()).add(parentParam);
IElementParameter param = node.getElementParameter("USER");
param.setRepositoryProperty("PROPERTY");
param = node.getElementParameter("PASS");
param.setRepositoryProperty("PROPERTY");
param = node.getElementParameter("HOST");
param.setRepositoryProperty("PROPERTY");
param = node.getElementParameter("PORT");
param.setRepositoryProperty("PROPERTY2");
param = node.getElementParameter("DBNAME");
param.setRepositoryProperty("PROPERTY2");
ChangeValuesFromRepository changeValuesFromRepository = new ChangeValuesFromRepository(node, connection, "PROPERTY:REPOSITORY_PROPERTY_TYPE", databaseConnItem.getProperty().getId());
changeValuesFromRepository.execute();
DatabaseConnection dbConn = (DatabaseConnection) connection;
assertEquals(databaseConnItem.getProperty().getId(), node.getPropertyValue("PROPERTY:REPOSITORY_PROPERTY_TYPE"));
assertEquals(TalendTextUtils.addQuotes(dbConn.getUsername()), node.getPropertyValue("USER"));
assertEquals(TalendTextUtils.addQuotes(dbConn.getRawPassword()), node.getPropertyValue("PASS"));
assertEquals(TalendTextUtils.addQuotes(dbConn.getServerName()), node.getPropertyValue("HOST"));
assertNotSame(TalendTextUtils.addQuotes(dbConn.getPort()), node.getPropertyValue("PORT"));
assertNotSame(TalendTextUtils.addQuotes(dbConn.getDatasourceName()), node.getPropertyValue("DBNAME"));
dbConn.setUsername("user2");
dbConn.setPort("5002");
dbConn.setDatasourceName("Test2");
changeValuesFromRepository = new ChangeValuesFromRepository(node, connection, "PROPERTY2:REPOSITORY_PROPERTY_TYPE", databaseConnItem.getProperty().getId());
changeValuesFromRepository.execute();
assertNotSame(TalendTextUtils.addQuotes(dbConn.getUsername()), node.getPropertyValue("USER"));
assertEquals(TalendTextUtils.addQuotes(dbConn.getPort()), node.getPropertyValue("PORT"));
assertEquals(TalendTextUtils.addQuotes(dbConn.getDatasourceName()), node.getPropertyValue("DBNAME"));
}
use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class ConnectionTest method setUp.
/**
* DOC Administrator Comment method "setUp".
*
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
Property property = PropertiesFactory.eINSTANCE.createProperty();
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());
source = new Node(sourceCom, process);
target = new Node(targetCom, process);
connection = new Connection(source, target, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "test", "test", "test", false);
inputTable = source.getMetadataList().get(0);
}
use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class ConnectionCreateActionTest method testValidationRuleEnableStatus.
@Test
public void testValidationRuleEnableStatus() {
IElementParameter validationParam = node.getElementParameter(EParameterName.VALIDATION_RULES.getName());
validationParam.setValue(true);
curNodeConnector = ValidationRulesUtil.createRejectConnector(node);
curNodeConnector.setDefaultConnectionType(EConnectionType.FLOW_MAIN);
connecType = curNodeConnector.getDefaultConnectionType();
ConnectionCreateAction action = new ConnectionCreateAction(null, curNodeConnector);
action.setSelectionProvider(new SelectionProvider(node));
action.update();
Assert.assertTrue(action.isEnabled());
Property property = PropertiesFactory.eINSTANCE.createProperty();
Process process = new Process(property);
process.setComponentsType(ComponentCategory.CATEGORY_4_SPARK.getName());
IComponent sourceCom = ComponentsFactoryProvider.getInstance().get("tMysqlInput", ComponentCategory.CATEGORY_4_SPARK.getName());
node = new Node(sourceCom, process);
validationParam = node.getElementParameter(EParameterName.VALIDATION_RULES.getName());
validationParam.setValue(true);
curNodeConnector = ValidationRulesUtil.createRejectConnector(node);
curNodeConnector.setDefaultConnectionType(EConnectionType.FLOW_MAIN);
connecType = curNodeConnector.getDefaultConnectionType();
action = new ConnectionCreateAction(null, curNodeConnector);
action.setSelectionProvider(new SelectionProvider(node));
action.update();
Assert.assertFalse(action.isEnabled());
}
use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class AbstractMetadataCommandTest method createFakeProcess.
protected IProcess2 createFakeProcess() {
Property property = PropertiesFactory.eINSTANCE.createProperty();
//$NON-NLS-1$
property.setId("junitId");
//$NON-NLS-1$
property.setVersion("0.1");
//$NON-NLS-1$
property.setLabel("test");
return new Process(property);
}
use of org.talend.designer.core.ui.editor.process.Process 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);
}
Aggregations