Search in sources :

Example 1 with MongoDbMeta

use of org.pentaho.di.trans.steps.mongodb.MongoDbMeta in project pentaho-metaverse by pentaho.

the class MetaverseValidationIT method testMongoDbInput.

@Test
public void testMongoDbInput() throws Exception {
    MongoDbInputStepNode node = root.getMongoDbInputStepNode();
    assertNotNull(node);
    MongoDbMeta meta = (MongoDbMeta) getStepMeta(node);
    assertEquals(meta.getCollection(), node.getCollection().getName());
    assertEquals(meta.getDbName(), node.getDatasource(meta.getDbName()).getName());
    Iterable<StreamFieldNode> inputs = node.getInputStreamFields();
    Iterable<StreamFieldNode> outputs = node.getOutputStreamFields();
    assertEquals(getIterableSize(inputs), getIterableSize(outputs));
    for (StreamFieldNode output : outputs) {
        assertEquals(output.getName(), output.getFieldPopulatesMe().getName());
    }
    MongoConnectionNode datasource = node.getDatasource(meta.getDbName());
    assertEquals(meta.getHostnames(), datasource.getHost());
    assertEquals(meta.getPort(), datasource.getPort());
    assertEquals(meta.getAuthenticationUser(), datasource.getUserName());
    assertEquals(meta.getDbName(), datasource.getDatabaseName());
    assertEquals(DictionaryConst.NODE_TYPE_MONGODB_CONNECTION, datasource.getType());
    FramedMetaverseNode collection = node.getCollection();
    assertEquals(meta.getCollection(), collection.getName());
    assertEquals(DictionaryConst.NODE_TYPE_MONGODB_COLLECTION, collection.getType());
}
Also used : MongoDbInputStepNode(org.pentaho.metaverse.frames.MongoDbInputStepNode) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) FramedMetaverseNode(org.pentaho.metaverse.frames.FramedMetaverseNode) MongoDbMeta(org.pentaho.di.trans.steps.mongodb.MongoDbMeta) MongoConnectionNode(org.pentaho.metaverse.frames.MongoConnectionNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 MongoDbMeta (org.pentaho.di.trans.steps.mongodb.MongoDbMeta)1 FramedMetaverseNode (org.pentaho.metaverse.frames.FramedMetaverseNode)1 MongoConnectionNode (org.pentaho.metaverse.frames.MongoConnectionNode)1 MongoDbInputStepNode (org.pentaho.metaverse.frames.MongoDbInputStepNode)1 StreamFieldNode (org.pentaho.metaverse.frames.StreamFieldNode)1