use of org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes in project pentaho-metaverse by pentaho.
the class TextFileOutputStepAnalyzerTest method setUp.
@Before
public void setUp() throws Exception {
when(mockNamespace.getParentNamespace()).thenReturn(mockNamespace);
descriptor = new MetaverseComponentDescriptor("test", DictionaryConst.NODE_TYPE_TRANS_STEP, mockNamespace);
analyzer = spy(new TextFileOutputStepAnalyzer());
analyzer.setDescriptor(descriptor);
analyzer.setObjectFactory(MetaverseTestUtils.getMetaverseObjectFactory());
inputs = new StepNodes();
inputs.addNode("previousStep", "first", node);
inputs.addNode("previousStep", "last", node);
inputs.addNode("previousStep", "age", node);
inputs.addNode("previousStep", "filename", node);
doReturn(inputs).when(analyzer).getInputs();
}
use of org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes in project pentaho-metaverse by pentaho.
the class TransExecutorStepAnalyzerTest method testConnectToSubTransInputFields.
@Test
public void testConnectToSubTransInputFields() throws Exception {
IMetaverseNode childTransNode = mock(IMetaverseNode.class);
IMetaverseNode outNode = mock(IMetaverseNode.class);
StepNodes inputs = new StepNodes();
inputs.addNode("previousStep", "first", outNode);
inputs.addNode("previousStep", "last", outNode);
doReturn(inputs).when(spyAnalyzer).getInputs();
doNothing().when(spyAnalyzer).linkUsedFieldToSubTrans(any(IMetaverseNode.class), any(TransMeta.class), any(IMetaverseNode.class), any(IComponentDescriptor.class));
spyAnalyzer.connectToSubTransInputFields(meta, childTransMeta, childTransNode, descriptor);
verify(spyAnalyzer, times(inputs.getFieldNames().size())).linkUsedFieldToSubTrans(any(IMetaverseNode.class), any(TransMeta.class), any(IMetaverseNode.class), any(IComponentDescriptor.class));
}
use of org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes in project pentaho-metaverse by pentaho.
the class TransExecutorStepAnalyzerTest method testConnectToSubTransOutputFields_MainOutput.
@Test
public void testConnectToSubTransOutputFields_MainOutput() throws Exception {
when(meta.getOutputRowsSourceStep()).thenReturn(null);
when(meta.getExecutorsOutputStep()).thenReturn("outputRowsStepName");
String[] outputFields = new String[] { "first", "last" };
when(meta.getOutputRowsField()).thenReturn(outputFields);
IMetaverseNode outNode = mock(IMetaverseNode.class);
StepNodes outputs = new StepNodes();
outputs.addNode("outputRowsStepName", "first", outNode);
outputs.addNode("outputRowsStepName", "last", outNode);
doReturn(outputs).when(spyAnalyzer).getOutputs();
// we'll test this in it's own test
doNothing().when(spyAnalyzer).linkResultFieldToSubTrans(any(IMetaverseNode.class), any(TransMeta.class), any(IMetaverseNode.class), any(IComponentDescriptor.class));
IMetaverseNode childTransNode = mock(IMetaverseNode.class);
spyAnalyzer.connectToSubTransOutputFields(meta, childTransMeta, childTransNode, descriptor);
verify(spyAnalyzer, times(outputFields.length)).linkResultFieldToSubTrans(any(IMetaverseNode.class), any(TransMeta.class), any(IMetaverseNode.class), any(IComponentDescriptor.class));
}
use of org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes in project pentaho-metaverse by pentaho.
the class ExcelOutputStepAnalyzerTest method setUp.
@Before
public void setUp() throws Exception {
when(mockNamespace.getParentNamespace()).thenReturn(mockNamespace);
descriptor = new MetaverseComponentDescriptor("test", DictionaryConst.NODE_TYPE_TRANS_STEP, mockNamespace);
analyzer = spy(new ExcelOutputStepAnalyzer());
analyzer.setDescriptor(descriptor);
analyzer.setObjectFactory(MetaverseTestUtils.getMetaverseObjectFactory());
inputs = new StepNodes();
inputs.addNode("previousStep", "first", node);
inputs.addNode("previousStep", "last", node);
inputs.addNode("previousStep", "age", node);
inputs.addNode("previousStep", "filename", node);
doReturn(inputs).when(analyzer).getInputs();
}
use of org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes in project pentaho-metaverse by pentaho.
the class FilterRowsStepAnalyzerTest method testGetUsedFields.
@Test
public void testGetUsedFields() throws Exception {
StepNodes inputNodes = new StepNodes();
inputNodes.addNode("input", "height", node);
inputNodes.addNode("input", "width", node);
inputNodes.addNode("input", "radius", node);
inputNodes.addNode("input", "pi", node);
inputNodes.addNode("input", "two", node);
when(analyzer.getInputs()).thenReturn(inputNodes);
Set<StepField> usedFields = analyzer.getUsedFields(meta);
assertNotNull(usedFields);
assertEquals(conditionFields.length, usedFields.size());
}
Aggregations