Search in sources :

Example 21 with StepErrorMeta

use of org.pentaho.di.trans.step.StepErrorMeta in project pentaho-kettle by pentaho.

the class RepositoryTestBase method createStepMeta1.

protected StepMeta createStepMeta1(final TransMeta transMeta, final DatabaseMeta dbMeta, final Condition condition) throws Exception {
    TransStepAttributeTesterTransStep step1 = new TransStepAttributeTesterTransStep();
    step1.setDatabaseMeta(dbMeta);
    step1.setCondition(condition);
    StepMeta stepMeta1 = new StepMeta(EXP_TRANS_STEP_1_NAME, step1);
    StepErrorMeta stepErrorMeta1 = new StepErrorMeta(transMeta, stepMeta1);
    stepErrorMeta1.setEnabled(EXP_TRANS_STEP_ERROR_META_1_ENABLED);
    stepErrorMeta1.setNrErrorsValuename(EXP_TRANS_STEP_ERROR_META_1_NR_ERRORS_VALUE_NAME);
    stepErrorMeta1.setErrorDescriptionsValuename(EXP_TRANS_STEP_ERROR_META_1_DESC_VALUE_NAME);
    stepErrorMeta1.setErrorFieldsValuename(EXP_TRANS_STEP_ERROR_META_1_FIELDS_VALUE_NAME);
    stepErrorMeta1.setErrorCodesValuename(EXP_TRANS_STEP_ERROR_META_1_CODES_VALUE_NAME);
    stepErrorMeta1.setMaxErrors(EXP_TRANS_STEP_ERROR_META_1_MAX_ERRORS);
    stepErrorMeta1.setMaxPercentErrors(EXP_TRANS_STEP_ERROR_META_1_MAX_PERCENT_ERRORS);
    stepErrorMeta1.setMinPercentRows(EXP_TRANS_STEP_ERROR_META_1_MIN_PERCENT_ROWS);
    stepMeta1.setStepErrorMeta(stepErrorMeta1);
    return stepMeta1;
}
Also used : StepErrorMeta(org.pentaho.di.trans.step.StepErrorMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta)

Example 22 with StepErrorMeta

use of org.pentaho.di.trans.step.StepErrorMeta in project pentaho-kettle by pentaho.

the class TransGraph method addErrorHop.

private void addErrorHop() {
    // 
    if (candidate == null || candidate.getFromStep() == null) {
        return;
    }
    StepErrorMeta errorMeta = candidate.getFromStep().getStepErrorMeta();
    if (errorMeta == null) {
        errorMeta = new StepErrorMeta(transMeta, candidate.getFromStep());
    }
    errorMeta.setEnabled(true);
    errorMeta.setTargetStep(candidate.getToStep());
    candidate.getFromStep().setStepErrorMeta(errorMeta);
}
Also used : StepErrorMeta(org.pentaho.di.trans.step.StepErrorMeta)

Example 23 with StepErrorMeta

use of org.pentaho.di.trans.step.StepErrorMeta in project pentaho-kettle by pentaho.

the class SpoonStepsDelegate method editStepErrorHandling.

public void editStepErrorHandling(TransMeta transMeta, StepMeta stepMeta) {
    if (stepMeta != null && stepMeta.supportsErrorHandling()) {
        StepErrorMeta stepErrorMeta = stepMeta.getStepErrorMeta();
        if (stepErrorMeta == null) {
            stepErrorMeta = new StepErrorMeta(transMeta, stepMeta);
        }
        List<StepMeta> targetSteps = transMeta.findNextSteps(stepMeta);
        // now edit this stepErrorMeta object:
        StepErrorMetaDialog dialog = new StepErrorMetaDialog(spoon.getShell(), stepErrorMeta, transMeta, targetSteps);
        if (dialog.open()) {
            stepMeta.setStepErrorMeta(stepErrorMeta);
            stepMeta.setChanged();
            spoon.refreshGraph();
        }
    }
}
Also used : StepErrorMeta(org.pentaho.di.trans.step.StepErrorMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) StepErrorMetaDialog(org.pentaho.di.ui.trans.step.StepErrorMetaDialog)

Example 24 with StepErrorMeta

use of org.pentaho.di.trans.step.StepErrorMeta in project pentaho-kettle by pentaho.

the class TransGraphTest method testEnableHopGetsSelected.

@Test
public void testEnableHopGetsSelected() {
    TransGraph transGraph = mock(TransGraph.class);
    doCallRealMethod().when(transGraph).setTransMeta(any(TransMeta.class));
    doCallRealMethod().when(transGraph).setSpoon(any(Spoon.class));
    transGraph.setTransMeta(new TransMeta());
    transGraph.setSpoon(mock(Spoon.class));
    StepMeta stepMeta = mock(StepMeta.class);
    StepErrorMeta errorMeta = new StepErrorMeta(null, null);
    TransHopMeta selectedHop = new TransHopMeta();
    selectedHop.setErrorHop(true);
    selectedHop.setEnabled(false);
    selectedHop.setFromStep(stepMeta);
    when(stepMeta.getStepErrorMeta()).thenReturn(errorMeta);
    StepMeta toStep = new StepMeta();
    toStep.setName("toStep");
    selectedHop.setToStep(toStep);
    when(transGraph.getCurrentHop()).thenReturn(selectedHop);
    doCallRealMethod().when(transGraph).enableHop();
    transGraph.enableHop();
    Assert.assertTrue(errorMeta.isEnabled());
}
Also used : Spoon(org.pentaho.di.ui.spoon.Spoon) TransMeta(org.pentaho.di.trans.TransMeta) StepErrorMeta(org.pentaho.di.trans.step.StepErrorMeta) TransHopMeta(org.pentaho.di.trans.TransHopMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) Test(org.junit.Test)

Example 25 with StepErrorMeta

use of org.pentaho.di.trans.step.StepErrorMeta in project pentaho-kettle by pentaho.

the class TransGraphTest method testMouseUpHopGetsSelected.

@Test
public void testMouseUpHopGetsSelected() {
    MouseEvent event = mock(MouseEvent.class);
    int x = 0, y = 0;
    TransGraph transGraph = mock(TransGraph.class);
    StepMeta stepMeta = mock(StepMeta.class);
    StepErrorMeta errorMeta = new StepErrorMeta(null, null);
    TransHopMeta selectedHop = new TransHopMeta();
    selectedHop.setErrorHop(true);
    selectedHop.setEnabled(TRUE_RESULT);
    selectedHop.setFromStep(stepMeta);
    when(stepMeta.getStepErrorMeta()).thenReturn(errorMeta);
    when(transGraph.findHop(x, y)).thenReturn(selectedHop);
    when(transGraph.screen2real(any(Integer.class), any(Integer.class))).thenReturn(new Point(x, y));
    doCallRealMethod().when(transGraph).mouseUp(event);
    transGraph.mouseUp(event);
    Assert.assertTrue(errorMeta.isEnabled());
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) StepErrorMeta(org.pentaho.di.trans.step.StepErrorMeta) TransHopMeta(org.pentaho.di.trans.TransHopMeta) Point(org.pentaho.di.core.gui.Point) StepMeta(org.pentaho.di.trans.step.StepMeta) Point(org.pentaho.di.core.gui.Point) Test(org.junit.Test)

Aggregations

StepErrorMeta (org.pentaho.di.trans.step.StepErrorMeta)27 StepMeta (org.pentaho.di.trans.step.StepMeta)22 TransHopMeta (org.pentaho.di.trans.TransHopMeta)10 Test (org.junit.Test)8 Point (org.pentaho.di.core.gui.Point)8 TransMeta (org.pentaho.di.trans.TransMeta)8 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)7 NotePadMeta (org.pentaho.di.core.NotePadMeta)6 KettleException (org.pentaho.di.core.exception.KettleException)5 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)5 StepMetaInterface (org.pentaho.di.trans.step.StepMetaInterface)5 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)5 StepPartitioningMeta (org.pentaho.di.trans.step.StepPartitioningMeta)4 ClusterSchema (org.pentaho.di.cluster.ClusterSchema)3 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)3 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)3 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)3 StepInterface (org.pentaho.di.trans.step.StepInterface)3 ArrayList (java.util.ArrayList)2 Matchers.anyString (org.mockito.Matchers.anyString)2