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());
}
Aggregations