use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.
the class TransExecutorStepAnalyzer method connectToSubTransInputFields.
/**
* Add links from all incoming stream fields to the fields in the sub transformation
* @param meta
* @param subTransMeta
* @param subTransNode
* @param descriptor
*/
protected void connectToSubTransInputFields(TransExecutorMeta meta, TransMeta subTransMeta, IMetaverseNode subTransNode, IComponentDescriptor descriptor) {
Set<StepField> incomingFields = getInputs().getFieldNames();
for (StepField field : incomingFields) {
IMetaverseNode inputNode = getInputs().findNode(field);
linkUsedFieldToSubTrans(inputNode, subTransMeta, subTransNode, descriptor);
}
}
use of org.pentaho.metaverse.api.StepField in project pentaho-kettle by pentaho.
the class MetaInjectAnalyzer method getUsedFields.
@Override
protected Set<StepField> getUsedFields(MetaInjectMeta meta) {
final Set<StepField> usedFields = new HashSet();
final Iterator<Map.Entry<TargetStepAttribute, SourceStepField>> fieldMappingsIter = meta.getTargetSourceMapping().entrySet().iterator();
while (fieldMappingsIter.hasNext()) {
final Map.Entry<TargetStepAttribute, SourceStepField> entry = fieldMappingsIter.next();
final SourceStepField value = entry.getValue();
final Iterator<StepField> stepFields = createStepFields(value.getField(), getInputs()).iterator();
while (stepFields.hasNext()) {
final StepField stepField = stepFields.next();
usedFields.add(stepField);
}
}
return usedFields;
}
use of org.pentaho.metaverse.api.StepField in project pentaho-kettle by pentaho.
the class JsonInputAnalyzerTest method testGetUsedFields_fileNameFromField.
@Test
public void testGetUsedFields_fileNameFromField() throws Exception {
when(meta.isAcceptingFilenames()).thenReturn(true);
when(meta.getAcceptingField()).thenReturn("filename");
Set<String> stepNames = new HashSet<>();
stepNames.add("previousStep");
Set<StepField> usedFields = analyzer.getUsedFields(meta);
assertNotNull(usedFields);
assertEquals(1, usedFields.size());
StepField used = usedFields.iterator().next();
assertEquals("previousStep", used.getStepName());
assertEquals("filename", used.getFieldName());
}
use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.
the class ConnectionExternalResourceStepAnalyzerTest method setUp.
@Before
public void setUp() throws Exception {
analyzer = spy(new ConnectionExternalResourceStepAnalyzer<BaseStepMeta>() {
@Override
protected IMetaverseNode createTableNode(IExternalResourceInfo resource) throws MetaverseAnalyzerException {
return tableNode;
}
@Override
public String getResourceInputNodeType() {
return "INPUT_TYPE";
}
@Override
public String getResourceOutputNodeType() {
return "OUTPUT_TYPE";
}
@Override
public boolean isOutput() {
return false;
}
@Override
public boolean isInput() {
return true;
}
@Override
protected Set<StepField> getUsedFields(BaseStepMeta meta) {
Set<StepField> stepFields = new HashSet<>();
stepFields.add(new StepField("prevStep", "filename"));
return stepFields;
}
@Override
public Set<Class<? extends BaseStepMeta>> getSupportedSteps() {
return null;
}
});
when(analyzer.getMetaverseBuilder()).thenReturn(builder);
analyzer.descriptor = descriptor;
when(descriptor.getContext()).thenReturn(context);
analyzer.parentTransMeta = parentTransMeta;
analyzer.parentStepMeta = parentStepMeta;
analyzer.setMetaverseObjectFactory(new MetaverseObjectFactory());
}
use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.
the class StepAnalyzerTest method testMapChange.
@Test
public void testMapChange() throws Exception {
doReturn(outputs).when(analyzer).getOutputs();
doReturn(inputs).when(analyzer).getInputs();
Operation operation = new Operation("testOperation", "testOperation");
StepField original = new StepField("previousStep", "address");
StepField changed = new StepField("nextStep", "address");
ComponentDerivationRecord cdr = new ComponentDerivationRecord(original, changed);
cdr.addOperation(operation);
ComponentDerivationRecord spyCdr = spy(cdr);
analyzer.mapChange(spyCdr);
// get operations to verify it is not null, then agains to toString it
verify(spyCdr, times(1)).getOperations();
verify(analyzer).linkChangeNodes(any(IMetaverseNode.class), any(IMetaverseNode.class));
}
Aggregations