use of org.pentaho.di.trans.step.StepErrorMeta in project pentaho-kettle by pentaho.
the class SpoonTest method testCopyPasteStepsErrorHandling.
/**
* test two steps
* @see http://jira.pentaho.com/browse/PDI-689
*
* @throws KettleException
*/
@Test
public void testCopyPasteStepsErrorHandling() throws KettleException {
final TransMeta transMeta = new TransMeta();
// for check copy both step and hop
StepMeta sourceStep = new StepMeta("CsvInput", "Step1", new CsvInputMeta());
StepMeta targetStep = new StepMeta("Dummy", "Dummy Step1", new DummyTransMeta());
sourceStep.setSelected(true);
targetStep.setSelected(true);
transMeta.addStep(sourceStep);
transMeta.addStep(targetStep);
StepErrorMeta errorMeta = new StepErrorMeta(transMeta, sourceStep, targetStep);
sourceStep.setStepErrorMeta(errorMeta);
errorMeta.setSourceStep(sourceStep);
errorMeta.setTargetStep(targetStep);
final int stepsSizeBefore = transMeta.getSteps().size();
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
spoon.pasteXML(transMeta, (String) invocation.getArguments()[0], mock(Point.class));
assertTrue("Steps was not copied", stepsSizeBefore < transMeta.getSteps().size());
// selected copied step
for (StepMeta s : transMeta.getSelectedSteps()) {
if (s.getStepMetaInterface() instanceof CsvInputMeta) {
// check that stepError was copied
assertNotNull("Error hop was not copied", s.getStepErrorMeta());
}
}
return null;
}
}).when(spoon).toClipboard(anyString());
spoon.copySelected(transMeta, transMeta.getSelectedSteps(), Collections.<NotePadMeta>emptyList());
}
use of org.pentaho.di.trans.step.StepErrorMeta in project pentaho-kettle by pentaho.
the class SpoonTest method testCopyPasteOneStepWithErrorHandling.
/**
* test copy one step with error handling
* @see http://jira.pentaho.com/browse/PDI-13358
*
* @throws KettleException
*/
@Test
public void testCopyPasteOneStepWithErrorHandling() throws KettleException {
final TransMeta transMeta = new TransMeta();
StepMeta sourceStep = new StepMeta("CsvInput", "Step1", new CsvInputMeta());
StepMeta targetStep = new StepMeta("Dummy", "Dummy Step1", new DummyTransMeta());
sourceStep.setSelected(true);
transMeta.addStep(sourceStep);
transMeta.addStep(targetStep);
StepErrorMeta errorMeta = new StepErrorMeta(transMeta, sourceStep, targetStep);
sourceStep.setStepErrorMeta(errorMeta);
errorMeta.setSourceStep(sourceStep);
errorMeta.setTargetStep(targetStep);
final int stepsSizeBefore = transMeta.getSteps().size();
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
spoon.pasteXML(transMeta, (String) invocation.getArguments()[0], mock(Point.class));
assertTrue("Steps was not copied", stepsSizeBefore < transMeta.getSteps().size());
// selected copied step
for (StepMeta s : transMeta.getSelectedSteps()) {
if (s.getStepMetaInterface() instanceof CsvInputMeta) {
// check that stepError was empty, because we copy only one step from pair
assertNull("Error hop was not copied", s.getStepErrorMeta());
}
}
return null;
}
}).when(spoon).toClipboard(anyString());
spoon.copySelected(transMeta, transMeta.getSelectedSteps(), Collections.<NotePadMeta>emptyList());
}
Aggregations