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