use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.
the class SplitFieldsStepAnalyzerTest method testGetUsedFields.
@Test
public void testGetUsedFields() throws Exception {
Set<StepField> fields = new HashSet<>();
fields.add(new StepField("prev", "splitField"));
doReturn(fields).when(analyzer).createStepFields(anyString(), any(StepNodes.class));
Set<StepField> usedFields = analyzer.getUsedFields(meta);
int expectedUsedFieldCount = 1;
assertEquals(expectedUsedFieldCount, usedFields.size());
verify(analyzer, times(expectedUsedFieldCount)).createStepFields(anyString(), any(StepNodes.class));
}
use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.
the class StringsReplaceStepAnalyzerTest method testGetUsedFields.
@Test
public void testGetUsedFields() {
Set<StepField> usedFields = analyzer.getUsedFields(stringsReplaceMeta);
List<String> inFields = Arrays.asList(stringsReplaceMeta.getFieldInStream());
// This test class uses all incoming fields
for (StepField usedField : usedFields) {
assertTrue(inFields.contains(usedField.getFieldName()));
}
}
use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.
the class ValueMapperStepAnalyzerTest method testGetUsedFields.
@Test
public void testGetUsedFields() throws Exception {
Set<StepField> fields = new HashSet<>();
fields.add(new StepField("prev", "inField"));
doReturn(fields).when(analyzer).createStepFields(anyString(), any(StepNodes.class));
Set<StepField> usedFields = analyzer.getUsedFields(meta);
int expectedUsedFieldCount = 1;
assertEquals(expectedUsedFieldCount, usedFields.size());
verify(analyzer, times(expectedUsedFieldCount)).createStepFields(anyString(), any(StepNodes.class));
}
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_noOperation.
@Test
public void testMapChange_noOperation() throws Exception {
doReturn(outputs).when(analyzer).getOutputs();
doReturn(inputs).when(analyzer).getInputs();
StepField original = new StepField("previousStep", "address");
StepField changed = new StepField("nextStep", "address");
ComponentDerivationRecord cdr = new ComponentDerivationRecord(original, changed);
ComponentDerivationRecord spyCdr = spy(cdr);
analyzer.mapChange(spyCdr);
// should only be called to see if there are any operations
verify(spyCdr).getOperations();
verify(analyzer).linkChangeNodes(any(IMetaverseNode.class), any(IMetaverseNode.class));
}
Aggregations