use of org.pentaho.di.trans.step.StepIOMetaInterface in project pentaho-kettle by pentaho.
the class TransExecutorMetaTest method thirdStreamIsExecutionResultFiles.
@Test
public void thirdStreamIsExecutionResultFiles() throws Exception {
StreamInterface stream = mockStream();
StepIOMetaInterface stepIo = mockStepIo(stream, 2);
TransExecutorMeta meta = new TransExecutorMeta();
meta = spy(meta);
when(meta.getStepIOMeta()).thenReturn(stepIo);
doCallRealMethod().when(meta).handleStreamSelection(any(StreamInterface.class));
meta.handleStreamSelection(stream);
assertEquals(stream.getStepMeta(), meta.getResultFilesTargetStepMeta());
}
use of org.pentaho.di.trans.step.StepIOMetaInterface in project pentaho-kettle by pentaho.
the class TransExecutorMetaTest method secondStreamIsInternalTransformationsOutput.
@Test
public void secondStreamIsInternalTransformationsOutput() throws Exception {
StreamInterface stream = mockStream();
StepIOMetaInterface stepIo = mockStepIo(stream, 1);
TransExecutorMeta meta = new TransExecutorMeta();
meta = spy(meta);
when(meta.getStepIOMeta()).thenReturn(stepIo);
doCallRealMethod().when(meta).handleStreamSelection(any(StreamInterface.class));
meta.handleStreamSelection(stream);
assertEquals(stream.getStepMeta(), meta.getOutputRowsSourceStepMeta());
}
use of org.pentaho.di.trans.step.StepIOMetaInterface in project pentaho-kettle by pentaho.
the class TransGraph method addCandidateAsHop.
private void addCandidateAsHop(int mouseX, int mouseY) {
boolean forward = startHopStep != null;
StepMeta fromStep = candidate.getFromStep();
StepMeta toStep = candidate.getToStep();
// See what the options are.
// - Does the source step has multiple stream options?
// - Does the target step have multiple input stream options?
//
List<StreamInterface> streams = new ArrayList<>();
StepIOMetaInterface fromIoMeta = fromStep.getStepMetaInterface().getStepIOMeta();
List<StreamInterface> targetStreams = fromIoMeta.getTargetStreams();
if (forward) {
streams.addAll(targetStreams);
}
StepIOMetaInterface toIoMeta = toStep.getStepMetaInterface().getStepIOMeta();
List<StreamInterface> infoStreams = toIoMeta.getInfoStreams();
if (!forward) {
streams.addAll(infoStreams);
}
if (forward) {
if (fromIoMeta.isOutputProducer() && toStep.equals(currentStep)) {
streams.add(new Stream(StreamType.OUTPUT, fromStep, BaseMessages.getString(PKG, "Spoon.Hop.MainOutputOfStep"), StreamIcon.OUTPUT, null));
}
if (fromStep.supportsErrorHandling() && toStep.equals(currentStep)) {
streams.add(new Stream(StreamType.ERROR, fromStep, BaseMessages.getString(PKG, "Spoon.Hop.ErrorHandlingOfStep"), StreamIcon.ERROR, null));
}
} else {
if (toIoMeta.isInputAcceptor() && fromStep.equals(currentStep)) {
streams.add(new Stream(StreamType.INPUT, toStep, BaseMessages.getString(PKG, "Spoon.Hop.MainInputOfStep"), StreamIcon.INPUT, null));
}
if (fromStep.supportsErrorHandling() && fromStep.equals(currentStep)) {
streams.add(new Stream(StreamType.ERROR, fromStep, BaseMessages.getString(PKG, "Spoon.Hop.ErrorHandlingOfStep"), StreamIcon.ERROR, null));
}
}
//
if (forward) {
streams.addAll(fromStep.getStepMetaInterface().getOptionalStreams());
} else {
streams.addAll(toStep.getStepMetaInterface().getOptionalStreams());
}
//
if (streams.size() > 1) {
// Show a pop-up menu with all the possible options...
//
Menu menu = new Menu(canvas);
for (final StreamInterface stream : streams) {
MenuItem item = new MenuItem(menu, SWT.NONE);
item.setText(Const.NVL(stream.getDescription(), ""));
item.setImage(getImageFor(stream));
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
addHop(stream);
}
});
}
menu.setLocation(canvas.toDisplay(mouseX, mouseY));
menu.setVisible(true);
return;
}
if (streams.size() == 1) {
addHop(streams.get(0));
} else {
return;
}
/*
*
* if (transMeta.findTransHop(candidate) == null) { spoon.newHop(transMeta, candidate); } if (startErrorHopStep) {
* addErrorHop(); } if (startTargetHopStream != null) { // Auto-configure the target in the source step... //
* startTargetHopStream.setStepMeta(candidate.getToStep());
* startTargetHopStream.setStepname(candidate.getToStep().getName()); startTargetHopStream = null; }
*/
candidate = null;
selectedSteps = null;
startHopStep = null;
endHopLocation = null;
startErrorHopStep = false;
// redraw();
}
Aggregations