use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.
the class StepAnalyzerTest method testIsPassthrough_noOutputs.
@Test
public void testIsPassthrough_noOutputs() throws Exception {
doReturn(null).when(analyzer).getOutputs();
StepField testField = new StepField("previousStep2", "occupation");
assertFalse(analyzer.isPassthrough(testField));
}
use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.
the class StepAnalyzerTest method setUp.
@Before
public void setUp() throws Exception {
StepAnalyzer stepAnalyzer = new StepAnalyzer() {
@Override
protected Set<StepField> getUsedFields(BaseStepMeta meta) {
return null;
}
@Override
protected void customAnalyze(BaseStepMeta meta, IMetaverseNode rootNode) throws MetaverseAnalyzerException {
}
@Override
public Set<Class<? extends BaseStepMeta>> getSupportedSteps() {
return null;
}
};
analyzer = spy(stepAnalyzer);
analyzer.rootNode = rootNode;
analyzer.baseStepMeta = baseStepMeta;
analyzer.descriptor = descriptor;
analyzer.parentTransMeta = parentTransMeta;
analyzer.parentStepMeta = parentStepMeta;
usedFields = new HashSet<>();
inputs = new StepNodes();
inputs.addNode("prevStep", "name", fieldNode);
inputs.addNode("prevStep", "address", fieldNode);
inputs.addNode("prevStep", "email", fieldNode);
inputs.addNode("prevStep", "birthday", fieldNode);
inputs.addNode("prevStep2", "employeeNumber", fieldNode);
inputs.addNode("prevStep2", "occupation", fieldNode);
outputs = new StepNodes();
outputs.addNode("nextStep", "full name", fieldNode);
outputs.addNode("nextStep", "address", fieldNode);
outputs.addNode("nextStep", "email", fieldNode);
outputs.addNode("nextStep", "date of birth", fieldNode);
outputs.addNode("nextStep", "ID", fieldNode);
outputs.addNode("nextStep", "occupation", fieldNode);
doReturn(builder).when(analyzer).getMetaverseBuilder();
MetaverseObjectFactory factory = new MetaverseObjectFactory();
doReturn(factory).when(analyzer).getMetaverseObjectFactory();
when(descriptor.getContext()).thenReturn(context);
when(parentStepMeta.getName()).thenReturn("STEP NAME");
}
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));
}
use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.
the class StepAnalyzerTest method testIsPassthrough_false.
@Test
public void testIsPassthrough_false() throws Exception {
doReturn(outputs).when(analyzer).getOutputs();
StepField testField = new StepField("previousStep2", "employeeNumber");
assertFalse(analyzer.isPassthrough(testField));
}
use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.
the class StepAnalyzerTest method testProcessUsedFields.
@Test
public void testProcessUsedFields() throws Exception {
StepField name = new StepField("prevStep", "name");
StepField address = new StepField("prevStep", "birthday");
StepField empNum = new StepField("prevStep2", "employeeNumber");
usedFields.add(name);
usedFields.add(address);
usedFields.add(empNum);
doReturn(inputs).when(analyzer).getInputs();
analyzer.processUsedFields(usedFields);
verify(builder, times(usedFields.size())).addLink(rootNode, DictionaryConst.LINK_USES, fieldNode);
}
Aggregations