Search in sources :

Example 1 with FramedMetaverseNode

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

the class MetaverseValidationIT method testFixedFileInputStep.

@Test
public void testFixedFileInputStep() throws Exception {
    // this is testing a specific FixedFileInputStep instance
    FixedFileInputStepNode fixedFileInputStepNode = root.getFixedFileInputStepNode();
    assertNotNull(fixedFileInputStepNode);
    Iterable<FramedMetaverseNode> inputFiles = fixedFileInputStepNode.getInputFiles();
    int countInputFiles = getIterableSize(inputFiles);
    assertEquals(1, countInputFiles);
    for (FramedMetaverseNode inputFile : inputFiles) {
        assertTrue(inputFile.getName().endsWith("Textfile input - fixed length sample data.txt"));
    }
    assertEquals("Fixed file input", fixedFileInputStepNode.getStepType());
    int countFileFieldNode = getIterableSize(fixedFileInputStepNode.getFileFieldNodesUses());
    assertEquals(0, countFileFieldNode);
    int countOutputs = getIterableSize(fixedFileInputStepNode.getOutputStreamFields());
    int fileFieldCount = 0;
    Iterable<StreamFieldNode> outFields = fixedFileInputStepNode.getOutputStreamFields();
    for (StreamFieldNode outField : outFields) {
        assertNotNull(outField.getKettleType());
        FieldNode fieldPopulatesMe = outField.getFieldPopulatesMe();
        assertNotNull(fieldPopulatesMe);
        assertEquals(DictionaryConst.NODE_TYPE_FILE_FIELD, fieldPopulatesMe.getType());
        assertEquals(fixedFileInputStepNode, fieldPopulatesMe.getStepThatInputsMe());
        fileFieldCount++;
    }
    assertEquals(countOutputs, fileFieldCount);
}
Also used : FieldNode(org.pentaho.metaverse.frames.FieldNode) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) FramedMetaverseNode(org.pentaho.metaverse.frames.FramedMetaverseNode) FixedFileInputStepNode(org.pentaho.metaverse.frames.FixedFileInputStepNode) Test(org.junit.Test)

Example 2 with FramedMetaverseNode

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

Example 3 with FramedMetaverseNode

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

the class MetaverseValidationIT method testEntity_Transformation.

@Test
public void testEntity_Transformation() throws Exception {
    FramedMetaverseNode node = root.getEntity(DictionaryConst.NODE_TYPE_TRANS);
    assertEquals(DictionaryConst.NODE_TYPE_ENTITY, node.getType());
    assertEquals(DictionaryConst.NODE_TYPE_TRANS, node.getName());
    assertEquals("Pentaho Data Integration", node.getDescription());
}
Also used : FramedMetaverseNode(org.pentaho.metaverse.frames.FramedMetaverseNode) Test(org.junit.Test)

Example 4 with FramedMetaverseNode

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

the class MetaverseValidationIT method testExcelInputStep.

@Test
public void testExcelInputStep() throws Exception {
    // this is testing a specific TextFileInputStep instance
    ExcelInputStepNode excelInputStepNode = root.getExcelInputStepNode();
    assertNotNull(excelInputStepNode);
    Iterable<FramedMetaverseNode> inputFiles = excelInputStepNode.getInputFiles();
    int countInputFiles = getIterableSize(inputFiles);
    assertEquals(1, countInputFiles);
    for (FramedMetaverseNode inputFile : inputFiles) {
        assertTrue(inputFile.getName().endsWith("SacramentoCrime.xls"));
    }
    assertEquals("Microsoft Excel Input", excelInputStepNode.getStepType());
    int countUses = getIterableSize(excelInputStepNode.getFileFieldNodesUses());
    int countInputs = getIterableSize(excelInputStepNode.getInputStreamFields());
    assertEquals(0, countUses);
    int fileFieldCount = 0;
    Iterable<StreamFieldNode> outFields = excelInputStepNode.getOutputStreamFields();
    int countOutputs = getIterableSize(outFields);
    for (StreamFieldNode outField : outFields) {
        assertNotNull(outField.getKettleType());
        FieldNode fieldPopulatesMe = outField.getFieldPopulatesMe();
        assertNotNull(fieldPopulatesMe);
        assertEquals(DictionaryConst.NODE_TYPE_FILE_FIELD, fieldPopulatesMe.getType());
        assertEquals(excelInputStepNode, fieldPopulatesMe.getStepThatInputsMe());
        fileFieldCount++;
    }
    assertEquals(countInputs, fileFieldCount);
    assertEquals(countOutputs, fileFieldCount);
}
Also used : FieldNode(org.pentaho.metaverse.frames.FieldNode) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) ExcelInputStepNode(org.pentaho.metaverse.frames.ExcelInputStepNode) FramedMetaverseNode(org.pentaho.metaverse.frames.FramedMetaverseNode) Test(org.junit.Test)

Example 5 with FramedMetaverseNode

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

the class MetaverseValidationIT method testHttpClientStep.

@Test
public void testHttpClientStep() throws Exception {
    HttpClientStepNode node = root.getHttpClientStepNode();
    assertNotNull(node);
    Iterable<FramedMetaverseNode> inputUrls = node.getInputUrls();
    int countInputUrls = getIterableSize(inputUrls);
    assertEquals(1, countInputUrls);
    assertEquals("HTTP Client", node.getStepType());
    HTTPMeta stepMeta = (HTTPMeta) getStepMeta(node);
    for (FramedMetaverseNode inputUrl : inputUrls) {
        assertEquals(stepMeta.getUrl(), inputUrl.getName());
    }
    // check the param  field is "used"
    Iterable<StreamFieldNode> streamFieldNodesUses = node.getStreamFieldNodesUses();
    assertEquals(2, getIterableSize(streamFieldNodesUses));
    Iterable<StreamFieldNode> outputs = node.getOutputStreamFields();
    assertEquals(5, getIterableSize(outputs));
    Iterable<StreamFieldNode> inputs = node.getInputStreamFields();
    assertEquals(3, getIterableSize(inputs));
    for (StreamFieldNode in : inputs) {
        assertNotNull(in.getFieldNodesDerivedFromMe());
        assertEquals(in.getName(), in.getFieldNodesDerivedFromMe().iterator().next().getName());
    }
}
Also used : StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) FramedMetaverseNode(org.pentaho.metaverse.frames.FramedMetaverseNode) HttpClientStepNode(org.pentaho.metaverse.frames.HttpClientStepNode) HTTPMeta(org.pentaho.di.trans.steps.http.HTTPMeta) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)16 FramedMetaverseNode (org.pentaho.metaverse.frames.FramedMetaverseNode)16 StreamFieldNode (org.pentaho.metaverse.frames.StreamFieldNode)14 FieldNode (org.pentaho.metaverse.frames.FieldNode)4 HashSet (java.util.HashSet)3 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)3 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)3 TransMeta (org.pentaho.di.trans.TransMeta)3 HTTPMeta (org.pentaho.di.trans.steps.http.HTTPMeta)2 RestMeta (org.pentaho.di.trans.steps.rest.RestMeta)2 TextFileOutputMeta (org.pentaho.di.trans.steps.textfileoutput.TextFileOutputMeta)2 CsvFileInputStepNode (org.pentaho.metaverse.frames.CsvFileInputStepNode)2 FixedFileInputStepNode (org.pentaho.metaverse.frames.FixedFileInputStepNode)2 HttpClientStepNode (org.pentaho.metaverse.frames.HttpClientStepNode)2 HttpPostStepNode (org.pentaho.metaverse.frames.HttpPostStepNode)2 RestClientStepNode (org.pentaho.metaverse.frames.RestClientStepNode)2 TextFileOutputStepNode (org.pentaho.metaverse.frames.TextFileOutputStepNode)2 ExcelField (org.pentaho.di.trans.steps.exceloutput.ExcelField)1 ExcelOutputMeta (org.pentaho.di.trans.steps.exceloutput.ExcelOutputMeta)1 HTTPPOSTMeta (org.pentaho.di.trans.steps.httppost.HTTPPOSTMeta)1