Search in sources :

Example 21 with MetadataColumn

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;
}
Also used : IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 22 with MetadataColumn

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;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) ElementParameter(org.talend.designer.core.model.components.ElementParameter) Node(org.talend.designer.core.ui.editor.nodes.Node) IConnection(org.talend.core.model.process.IConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) ArrayList(java.util.ArrayList) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 23 with MetadataColumn

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;
}
Also used : IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable)

Example 24 with MetadataColumn

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;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) IConnection(org.talend.core.model.process.IConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) ArrayList(java.util.ArrayList) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 25 with MetadataColumn

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();
}
Also used : IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) Process(org.talend.designer.core.ui.editor.process.Process) Property(org.talend.core.model.properties.Property) Before(org.junit.Before)

Aggregations

MetadataColumn (org.talend.core.model.metadata.MetadataColumn)44 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)35 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)20 ArrayList (java.util.ArrayList)14 MetadataTable (org.talend.core.model.metadata.MetadataTable)13 Test (org.junit.Test)6 MetadataColumnExt (org.talend.designer.rowgenerator.ui.editor.MetadataColumnExt)6 IElementParameter (org.talend.core.model.process.IElementParameter)4 Node (org.talend.designer.core.ui.editor.nodes.Node)4 IComponent (org.talend.core.model.components.IComponent)3 IConnection (org.talend.core.model.process.IConnection)3 ChangeMetadataCommand (org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand)3 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)3 List (java.util.List)2 Schema (org.apache.avro.Schema)2 Command (org.eclipse.gef.commands.Command)2 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)2 DisposeEvent (org.eclipse.swt.events.DisposeEvent)2 DisposeListener (org.eclipse.swt.events.DisposeListener)2 Point (org.eclipse.swt.graphics.Point)2