use of org.pentaho.metaverse.api.IAnalysisContext in project pentaho-metaverse by pentaho.
the class ExternalResourceStepAnalyzerTest method testCreateOutputFieldNode.
@Test
public void testCreateOutputFieldNode() throws Exception {
IAnalysisContext context = mock(IAnalysisContext.class);
doReturn("thisStepName").when(analyzer).getStepName();
analyzer.rootNode = node;
when(node.getLogicalId()).thenReturn("logical id");
ValueMetaInterface vmi = new ValueMeta("name", 1);
IMetaverseNode outputFieldNode = analyzer.createOutputFieldNode(context, vmi, "targetStep", DictionaryConst.NODE_TYPE_TRANS_FIELD);
assertNotNull(outputFieldNode);
assertNotNull(outputFieldNode.getProperty(DictionaryConst.PROPERTY_KETTLE_TYPE));
assertEquals("targetStep", outputFieldNode.getProperty(DictionaryConst.PROPERTY_TARGET_STEP));
assertEquals(DictionaryConst.NODE_TYPE_TRANS_FIELD, outputFieldNode.getType());
// the input node should be added by this step
verify(builder).addNode(outputFieldNode);
}
use of org.pentaho.metaverse.api.IAnalysisContext in project pentaho-kettle by pentaho.
the class GetXMLDataStepAnalyzerTest method testCreateOutputFieldNode.
@Test
public void testCreateOutputFieldNode() throws Exception {
doReturn(builder).when(analyzer).getMetaverseBuilder();
analyzer.setBaseStepMeta(meta);
GetXMLDataField[] fields = new GetXMLDataField[2];
GetXMLDataField field1 = new GetXMLDataField("name");
GetXMLDataField field2 = new GetXMLDataField("age");
field1.setXPath("field1/xpath");
field2.setElementType(1);
field1.setResultType(1);
field2.setRepeated(true);
fields[0] = field1;
fields[1] = field2;
when(meta.getInputFields()).thenReturn(fields);
IAnalysisContext context = mock(IAnalysisContext.class);
doReturn("thisStepName").when(analyzer).getStepName();
when(node.getLogicalId()).thenReturn("logical id");
ValueMetaInterface vmi = new ValueMeta("name", 1);
IMetaverseNode outputFieldNode = analyzer.createOutputFieldNode(context, vmi, ExternalResourceStepAnalyzer.RESOURCE, DictionaryConst.NODE_TYPE_TRANS_FIELD);
assertNotNull(outputFieldNode);
assertNotNull(outputFieldNode.getProperty(DictionaryConst.PROPERTY_KETTLE_TYPE));
assertEquals(ExternalResourceStepAnalyzer.RESOURCE, outputFieldNode.getProperty(DictionaryConst.PROPERTY_TARGET_STEP));
assertEquals("field1/xpath", outputFieldNode.getProperty("xpath"));
assertNotNull(outputFieldNode.getProperty("resultType"));
assertNotNull(outputFieldNode.getProperty("element"));
assertEquals(false, outputFieldNode.getProperty("repeat"));
// the input node should be added by this step
verify(builder).addNode(outputFieldNode);
}
Aggregations