Search in sources :

Example 1 with BaseStep

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

the class Mapping method lookupStatusStepNumbers.

private void lookupStatusStepNumbers() {
    MappingData mappingData = getData();
    if (mappingData.getMappingTrans() != null) {
        List<StepMetaDataCombi> steps = mappingData.getMappingTrans().getSteps();
        for (int i = 0; i < steps.size(); i++) {
            StepMetaDataCombi sid = steps.get(i);
            BaseStep rt = (BaseStep) sid.step;
            if (rt.getStepname().equals(getData().mappingTransMeta.getTransLogTable().getStepnameRead())) {
                mappingData.linesReadStepNr = i;
            }
            if (rt.getStepname().equals(getData().mappingTransMeta.getTransLogTable().getStepnameInput())) {
                mappingData.linesInputStepNr = i;
            }
            if (rt.getStepname().equals(getData().mappingTransMeta.getTransLogTable().getStepnameWritten())) {
                mappingData.linesWrittenStepNr = i;
            }
            if (rt.getStepname().equals(getData().mappingTransMeta.getTransLogTable().getStepnameOutput())) {
                mappingData.linesOutputStepNr = i;
            }
            if (rt.getStepname().equals(getData().mappingTransMeta.getTransLogTable().getStepnameUpdated())) {
                mappingData.linesUpdatedStepNr = i;
            }
            if (rt.getStepname().equals(getData().mappingTransMeta.getTransLogTable().getStepnameRejected())) {
                mappingData.linesRejectedStepNr = i;
            }
        }
    }
}
Also used : BaseStep(org.pentaho.di.trans.step.BaseStep) StepMetaDataCombi(org.pentaho.di.trans.step.StepMetaDataCombi)

Example 2 with BaseStep

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

the class IngresVectorwiseTest method testWaitForFinish.

@Test
public void testWaitForFinish() {
    try {
        int r = rows.size();
        BaseStep step = doOutput(wrongRows, "2");
        assertEquals(r - 1, step.getLinesOutput());
        assertEquals(r, step.getLinesRead());
        assertEquals(r, step.getLinesWritten());
        assertEquals(1, step.getLinesRejected());
        assertEquals(0, step.getErrors());
    } catch (KettleException e) {
        fail(e.getMessage());
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) BaseStep(org.pentaho.di.trans.step.BaseStep) Test(org.junit.Test)

Example 3 with BaseStep

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

the class IngresVectorwiseTest method testGuiSuccess.

@Test
public void testGuiSuccess() {
    try {
        int r = rows.size();
        BaseStep step = doOutput(rows, "0");
        ((IngresVectorwiseLoader) step).vwLoadMonitorThread.join();
        assertEquals(r, step.getLinesOutput());
        assertEquals(r, step.getLinesRead());
        assertEquals(r, step.getLinesWritten());
        assertEquals(0, step.getLinesRejected());
        assertEquals(0, step.getErrors());
    } catch (KettleException e) {
        fail(e.getMessage());
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) BaseStep(org.pentaho.di.trans.step.BaseStep) Test(org.junit.Test)

Example 4 with BaseStep

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

the class CheckSumTest method executeHexTest.

/**
 * Create, execute, and return the row listener attached to the output step with complete results from the execution.
 *
 * @param checkSumType
 *          Type of checksum to use (the array index of {@link CheckSumMeta#checksumtypeCodes})
 * @param compatibilityMode
 *          Use compatibility mode for CheckSum
 * @param input
 *          String to calculate checksum for
 * @param meta
 *          meta to be used
 * @return RowListener with results.
 */
private MockRowListener executeHexTest(int checkSumType, boolean compatibilityMode, Object input, ValueMetaInterface meta, boolean oldChecksumBehaviour) throws Exception {
    Trans trans = buildHexadecimalChecksumTrans(checkSumType, compatibilityMode, oldChecksumBehaviour);
    trans.prepareExecution(null);
    StepInterface output = trans.getRunThread("Output", 0);
    MockRowListener listener = new MockRowListener();
    output.addRowListener(listener);
    RowProducer rp = trans.addRowProducer("CheckSum", 0);
    RowMeta inputRowMeta = createStringRowMeta(meta);
    ((BaseStep) trans.getRunThread("CheckSum", 0)).setInputRowMeta(inputRowMeta);
    trans.startThreads();
    rp.putRow(inputRowMeta, new Object[] { input });
    rp.finished();
    trans.waitUntilFinished();
    trans.stopAll();
    trans.cleanup();
    return listener;
}
Also used : StepInterface(org.pentaho.di.trans.step.StepInterface) RowProducer(org.pentaho.di.trans.RowProducer) BaseStep(org.pentaho.di.trans.step.BaseStep) RowMeta(org.pentaho.di.core.row.RowMeta) Trans(org.pentaho.di.trans.Trans)

Example 5 with BaseStep

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

the class BaseStepConcurrencyTest method testRowListeners.

/**
 * Row listeners collection modifiers are exposed out of BaseStep class,
 * whereas the collection traversal is happening on every row being processed.
 *
 * We should be sure that modification of the collection will not throw a concurrent modification exception.
 */
@Test
public void testRowListeners() throws Exception {
    int modifiersAmount = 100;
    int traversersAmount = 100;
    StepMeta stepMeta = mock(StepMeta.class);
    TransMeta transMeta = mock(TransMeta.class);
    when(stepMeta.getName()).thenReturn(STEP_META);
    when(transMeta.findStep(STEP_META)).thenReturn(stepMeta);
    when(stepMeta.getTargetStepPartitioningMeta()).thenReturn(mock(StepPartitioningMeta.class));
    baseStep = new BaseStep(stepMeta, null, 0, transMeta, mock(Trans.class));
    AtomicBoolean condition = new AtomicBoolean(true);
    List<RowListenersModifier> rowListenersModifiers = new ArrayList<>();
    for (int i = 0; i < modifiersAmount; i++) {
        rowListenersModifiers.add(new RowListenersModifier(condition));
    }
    List<RowListenersTraverser> rowListenersTraversers = new ArrayList<>();
    for (int i = 0; i < traversersAmount; i++) {
        rowListenersTraversers.add(new RowListenersTraverser(condition));
    }
    ConcurrencyTestRunner<?, ?> runner = new ConcurrencyTestRunner<Object, Object>(rowListenersModifiers, rowListenersTraversers, condition);
    runner.runConcurrentTest();
    runner.checkNoExceptionRaised();
}
Also used : BaseStep(org.pentaho.di.trans.step.BaseStep) TransMeta(org.pentaho.di.trans.TransMeta) ArrayList(java.util.ArrayList) StepPartitioningMeta(org.pentaho.di.trans.step.StepPartitioningMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Test(org.junit.Test)

Aggregations

BaseStep (org.pentaho.di.trans.step.BaseStep)10 Test (org.junit.Test)7 KettleException (org.pentaho.di.core.exception.KettleException)5 StepMeta (org.pentaho.di.trans.step.StepMeta)4 StepInterface (org.pentaho.di.trans.step.StepInterface)3 ArrayList (java.util.ArrayList)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 Trans (org.pentaho.di.trans.Trans)2 TransMeta (org.pentaho.di.trans.TransMeta)2 StepMetaDataCombi (org.pentaho.di.trans.step.StepMetaDataCombi)2 StepPartitioningMeta (org.pentaho.di.trans.step.StepPartitioningMeta)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)1 KettleFileException (org.pentaho.di.core.exception.KettleFileException)1 KettleTransException (org.pentaho.di.core.exception.KettleTransException)1 KettleValueException (org.pentaho.di.core.exception.KettleValueException)1 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)1