Search in sources :

Example 1 with DatasourceNode

use of org.pentaho.metaverse.frames.DatasourceNode 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)

Example 2 with DatasourceNode

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

the class MetaverseValidationIT method testDatasources.

@Test
public void testDatasources() throws Exception {
    int countDatasources = getIterableSize(root.getDatasourceNodes());
    for (DatasourceNode ds : root.getDatasourceNodes()) {
        // make sure at least one step uses the connection
        int countUsedSteps = getIterableSize(ds.getTransformationStepNodes());
        assertTrue(countUsedSteps > 0);
        assertEquals(DictionaryConst.NODE_TYPE_DATASOURCE, ds.getEntity().getName());
        assertNotNull(ds.getName());
        assertNotNull(ds.getDatabaseName());
        assertNotNull(ds.getPort());
        assertNotNull(ds.getAccessType());
        assertNotNull(ds.getAccessTypeDesc());
    }
    assertTrue(countDatasources > 0);
}
Also used : MongoDbDatasourceNode(org.pentaho.metaverse.frames.MongoDbDatasourceNode) DatasourceNode(org.pentaho.metaverse.frames.DatasourceNode) Test(org.junit.Test)

Example 3 with DatasourceNode

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

the class MetaverseValidationIT method testSampleDataConnection.

@Test
public void testSampleDataConnection() throws Exception {
    DatasourceNode sampleData = root.getDatasourceNode("Sampledata");
    assertEquals("Sampledata", sampleData.getName());
    assertEquals("-1", sampleData.getPort());
    assertEquals("Native", sampleData.getAccessTypeDesc());
    assertEquals("sampledata", sampleData.getDatabaseName());
    assertEquals("sa", sampleData.getUserName());
}
Also used : MongoDbDatasourceNode(org.pentaho.metaverse.frames.MongoDbDatasourceNode) DatasourceNode(org.pentaho.metaverse.frames.DatasourceNode) Test(org.junit.Test)

Aggregations

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