Search in sources :

Example 16 with StepNodes

use of org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes in project pentaho-metaverse by pentaho.

the class TransExecutorStepAnalyzerTest method testConnectToSubTransInputFields_noPrevFields.

@Test
public void testConnectToSubTransInputFields_noPrevFields() throws Exception {
    IMetaverseNode childTransNode = mock(IMetaverseNode.class);
    StepNodes inputs = new StepNodes();
    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, never()).linkUsedFieldToSubTrans(any(IMetaverseNode.class), any(TransMeta.class), any(IMetaverseNode.class), any(IComponentDescriptor.class));
}
Also used : IComponentDescriptor(org.pentaho.metaverse.api.IComponentDescriptor) IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) TransMeta(org.pentaho.di.trans.TransMeta) DummyTransMeta(org.pentaho.di.trans.steps.dummytrans.DummyTransMeta) StepNodes(org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes) Test(org.junit.Test)

Example 17 with StepNodes

use of org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes in project pentaho-kettle by pentaho.

the class GetXMLDataStepAnalyzerTest method testGetUsedFields.

@Test
public void testGetUsedFields() throws Exception {
    when(meta.isInFields()).thenReturn(true);
    when(meta.getXMLField()).thenReturn("xml");
    StepNodes inputs = new StepNodes();
    inputs.addNode("previousStep", "xml", node);
    inputs.addNode("previousStep", "otherField", node);
    doReturn(inputs).when(analyzer).getInputs();
    Set<StepField> usedFields = analyzer.getUsedFields(meta);
    assertEquals(1, usedFields.size());
    assertEquals("xml", usedFields.iterator().next().getFieldName());
}
Also used : StepField(org.pentaho.metaverse.api.StepField) StepNodes(org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes) Test(org.junit.Test)

Aggregations

StepNodes (org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes)17 Test (org.junit.Test)10 IMetaverseNode (org.pentaho.metaverse.api.IMetaverseNode)7 Before (org.junit.Before)6 StepField (org.pentaho.metaverse.api.StepField)5 Matchers.anyString (org.mockito.Matchers.anyString)4 TransMeta (org.pentaho.di.trans.TransMeta)4 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)4 IComponentDescriptor (org.pentaho.metaverse.api.IComponentDescriptor)4 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)2 MetaverseComponentDescriptor (org.pentaho.metaverse.api.MetaverseComponentDescriptor)2 ComponentDerivationRecord (org.pentaho.metaverse.api.analyzer.kettle.ComponentDerivationRecord)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 KettleStepException (org.pentaho.di.core.exception.KettleStepException)1 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)1 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)1 StepMeta (org.pentaho.di.trans.step.StepMeta)1 SelectMetadataChange (org.pentaho.di.trans.steps.selectvalues.SelectMetadataChange)1