use of org.talend.core.model.metadata.MetadataColumn in project tdi-studio-se by Talend.
the class OracleGenerationManagerTest method createColumn.
private IMetadataColumn createColumn(String label) {
IMetadataColumn column = new MetadataColumn();
// will be error, strange
// when(column.getLabel()).thenReturn(label);
column.setLabel(label);
column.setOriginalDbColumnName(label);
return column;
}
use of org.talend.core.model.metadata.MetadataColumn in project tdi-studio-se by Talend.
the class PostgresGenerationManagerTest method mockConnection.
private IConnection mockConnection(String schemaName, String tableName, String[] columns) {
Connection connection = mock(Connection.class);
Node node = mock(Node.class);
ElementParameter param = new ElementParameter(node);
param.setName("ELT_SCHEMA_NAME");
param.setValue(schemaName);
when(node.getElementParameter("ELT_SCHEMA_NAME")).thenReturn(param);
param = new ElementParameter(node);
param.setName("ELT_TABLE_NAME");
param.setValue(tableName);
when(node.getElementParameter("ELT_TABLE_NAME")).thenReturn(param);
when(connection.getName()).thenReturn(schemaName + "." + tableName);
when(connection.getSource()).thenReturn(node);
IMetadataTable table = new MetadataTable();
table.setLabel(tableName);
table.setTableName(tableName);
List<IMetadataColumn> listColumns = new ArrayList<IMetadataColumn>();
for (String columnName : columns) {
IMetadataColumn column = new MetadataColumn();
column.setLabel(columnName);
column.setOriginalDbColumnName(columnName);
listColumns.add(column);
}
table.setListColumns(listColumns);
when(connection.getMetadataTable()).thenReturn(table);
return connection;
}
use of org.talend.core.model.metadata.MetadataColumn in project tdi-studio-se by Talend.
the class PostgresGenerationManagerTest method getMetadataTable.
private MetadataTable getMetadataTable(String[] entitiesName) {
MetadataTable table = new MetadataTable();
for (String element : entitiesName) {
MetadataColumn column = new MetadataColumn();
column.setLabel(element);
table.getListColumns().add(column);
}
return table;
}
use of org.talend.core.model.metadata.MetadataColumn in project tdi-studio-se by Talend.
the class DbGenerationManagerTest method createConnection.
private IConnection createConnection(String schemaName, String tableName, String label, String[] columns) {
Connection connection = mock(Connection.class);
when(connection.getName()).thenReturn(tableName);
IMetadataTable metadataTable = new MetadataTable();
metadataTable.setLabel(tableName);
metadataTable.setTableName(tableName);
List<IMetadataColumn> listColumns = new ArrayList<IMetadataColumn>();
for (String columnName : columns) {
IMetadataColumn column = new MetadataColumn();
column.setLabel(label);
column.setOriginalDbColumnName(columnName);
listColumns.add(column);
}
metadataTable.setListColumns(listColumns);
when(connection.getMetadataTable()).thenReturn(metadataTable);
return connection;
}
use of org.talend.core.model.metadata.MetadataColumn in project tdi-studio-se by Talend.
the class ColumnListControllerTest method before.
@Before
public void before() {
instance = mock(ColumnListController.class);
IComponent component = ComponentsFactoryProvider.getInstance().get("tRowGenerator", "DI");
Property property = PropertiesFactory.eINSTANCE.createProperty();
Process process = new Process(property);
node = new Node(component, process);
table = node.getMetadataList().get(0);
column = new MetadataColumn();
}
Aggregations