Search in sources :

Example 1 with BaseTransform

use of org.apache.hop.pipeline.transform.BaseTransform in project hop by apache.

the class CheckSumTest method executeHexTest.

/**
 * Create, execute, and return the row listener attached to the output transform with complete
 * results from the execution.
 *
 * @param checkSumType Type of checksum to use
 * @param input String to calculate checksum for
 * @param meta meta to be used
 * @return IRowListener with results.
 */
private MockRowListener executeHexTest(CheckSumMeta.CheckSumType checkSumType, Object input, IValueMeta meta) throws Exception {
    Pipeline pipeline = buildHexadecimalChecksumPipeline(checkSumType);
    pipeline.prepareExecution();
    ITransform output = pipeline.getRunThread("Output", 0);
    MockRowListener listener = new MockRowListener();
    output.addRowListener(listener);
    RowProducer rp = pipeline.addRowProducer("CheckSum", 0);
    RowMeta inputRowMeta = createStringRowMeta(meta);
    ((BaseTransform) pipeline.getRunThread("CheckSum", 0)).setInputRowMeta(inputRowMeta);
    pipeline.startThreads();
    rp.putRow(inputRowMeta, new Object[] { input });
    rp.finished();
    pipeline.waitUntilFinished();
    pipeline.stopAll();
    pipeline.cleanup();
    return listener;
}
Also used : ITransform(org.apache.hop.pipeline.transform.ITransform) RowProducer(org.apache.hop.pipeline.RowProducer) RowMeta(org.apache.hop.core.row.RowMeta) IRowMeta(org.apache.hop.core.row.IRowMeta) BaseTransform(org.apache.hop.pipeline.transform.BaseTransform) Pipeline(org.apache.hop.pipeline.Pipeline)

Aggregations

IRowMeta (org.apache.hop.core.row.IRowMeta)1 RowMeta (org.apache.hop.core.row.RowMeta)1 Pipeline (org.apache.hop.pipeline.Pipeline)1 RowProducer (org.apache.hop.pipeline.RowProducer)1 BaseTransform (org.apache.hop.pipeline.transform.BaseTransform)1 ITransform (org.apache.hop.pipeline.transform.ITransform)1