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;
}
}
}
}
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());
}
}
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();
}
}
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;
}
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();
}
Aggregations