Search in sources :

Example 1 with DatabaseTableNode

use of org.pentaho.metaverse.frames.DatabaseTableNode in project pentaho-metaverse by pentaho.

the class MetaverseValidationIT method testTableOutputStepNode.

@Test
public void testTableOutputStepNode() throws Exception {
    // this tests a specific step in a specific transform
    TableOutputStepNode node = root.getTableOutputStepNode();
    // check the table that it writes to
    TableOutputMeta meta = (TableOutputMeta) getStepMeta(node);
    String tableName = meta.getTableName();
    String schema = meta.getSchemaName();
    boolean truncateTable = meta.truncateTable();
    DatabaseTableNode databaseTableNode = node.getDatabaseTable();
    assertEquals(tableName, databaseTableNode.getName());
    assertEquals(schema, node.getSchema());
    assertEquals(truncateTable, node.isTruncateTable());
    Iterable<StreamFieldNode> inputs = node.getInputStreamFields();
    Iterable<StreamFieldNode> outputs = node.getOutputStreamFields();
    assertEquals(getIterableSize(inputs) + meta.getFieldDatabase().length, getIterableSize(outputs));
    for (StreamFieldNode input : inputs) {
        assertEquals(input.getName(), input.getFieldPopulatedByMe().getName());
    }
    DatasourceNode datasource = node.getDatasource(meta.getDatabaseMeta().getName());
    assertEquals(meta.getDatabaseMeta().getHostname(), datasource.getHost());
    assertEquals(meta.getDatabaseMeta().getDatabasePortNumberString(), datasource.getPort());
    assertEquals(meta.getDatabaseMeta().getUsername(), datasource.getUserName());
    assertEquals(meta.getDatabaseMeta().getDatabaseName(), datasource.getDatabaseName());
    assertEquals(DictionaryConst.NODE_TYPE_DATASOURCE, datasource.getType());
    assertEquals(meta.getTableName(), databaseTableNode.getName());
    assertEquals(DictionaryConst.NODE_TYPE_DATA_TABLE, databaseTableNode.getType());
}
Also used : MongoDbDatasourceNode(org.pentaho.metaverse.frames.MongoDbDatasourceNode) DatasourceNode(org.pentaho.metaverse.frames.DatasourceNode) DatabaseTableNode(org.pentaho.metaverse.frames.DatabaseTableNode) TableOutputMeta(org.pentaho.di.trans.steps.tableoutput.TableOutputMeta) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) TableOutputStepNode(org.pentaho.metaverse.frames.TableOutputStepNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 TableOutputMeta (org.pentaho.di.trans.steps.tableoutput.TableOutputMeta)1 DatabaseTableNode (org.pentaho.metaverse.frames.DatabaseTableNode)1 DatasourceNode (org.pentaho.metaverse.frames.DatasourceNode)1 MongoDbDatasourceNode (org.pentaho.metaverse.frames.MongoDbDatasourceNode)1 StreamFieldNode (org.pentaho.metaverse.frames.StreamFieldNode)1 TableOutputStepNode (org.pentaho.metaverse.frames.TableOutputStepNode)1